1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-13 14:40:22 +00:00

Find remaining hardcoded gzip bits and change to bzip2 bits.

Mark with XXX so someone that cares about being able to handle either
bziped or gziped packages knows where the remaining nits are.
This commit is contained in:
David E. O'Brien 2002-08-25 01:00:16 +00:00
parent fff6062ab6
commit 1ab94a83c2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=102383
3 changed files with 15 additions and 9 deletions

View File

@ -151,8 +151,10 @@ main(int argc, char **argv)
errx(1, "package name too long");
remotepkg = temppackageroot;
if (!((ptr = strrchr(remotepkg, '.')) && ptr[1] == 't' &&
ptr[2] == 'g' && ptr[3] == 'z' && !ptr[4]))
if (strlcat(remotepkg, ".tgz", sizeof(temppackageroot))
(ptr[2] == 'b' || ptr[2] == 'g') && ptr[3] == 'z' &&
!ptr[4]))
/* XXX: need to handle .tgz also */
if (strlcat(remotepkg, ".tbz", sizeof(temppackageroot))
>= sizeof(temppackageroot))
errx(1, "package name too long");
}

View File

@ -97,7 +97,7 @@ pkg_do(char *pkg)
}
/* Nope - do it now */
else {
/* Is it an ftp://foo.bar.baz/file.tgz specification? */
/* Is it an ftp://foo.bar.baz/file.t[bg]z specification? */
if (isURL(pkg)) {
if (!(Home = fileGetURL(NULL, pkg))) {
warnx("unable to fetch '%s' by URL", pkg);
@ -267,7 +267,8 @@ pkg_do(char *pkg)
if (!Fake) {
if (!isURL(pkg) && !getenv("PKG_ADD_BASE")) {
snprintf(path, FILENAME_MAX, "%s/%s.tgz", getenv("_TOP"), p->name);
/* XXX: need to handle .tgz also */
snprintf(path, FILENAME_MAX, "%s/%s.tbz", getenv("_TOP"), p->name);
if (fexists(path))
cp = path;
else

View File

@ -176,7 +176,8 @@ fileGetURL(const char *base, const char *spec)
*(cp + 1) = '\0';
strcat(cp, "All/");
strcat(cp, spec);
strcat(cp, ".tgz");
/* XXX: need to handle .tgz also */
strcat(cp, ".tbz");
}
else
return NULL;
@ -188,7 +189,8 @@ fileGetURL(const char *base, const char *spec)
*/
strcpy(fname, hint);
strcat(fname, spec);
strcat(fname, ".tgz");
/* XXX: need to handle .tgz also */
strcat(fname, ".tbz");
}
}
else
@ -222,7 +224,8 @@ fileGetURL(const char *base, const char *spec)
dup2(pfd[0], 0);
for (fd = getdtablesize() - 1; fd >= 3; --fd)
close(fd);
execl("/usr/bin/tar", "tar", Verbose ? "-xzpvf" : "-xzpf", "-",
/* XXX: need to handle .tgz also */
execl("/usr/bin/tar", "tar", Verbose ? "-xjvf" : "-xzf", "-",
(char *)0);
_exit(2);
}
@ -252,7 +255,7 @@ fileFindByPath(const char *base, const char *fname)
{
static char tmp[FILENAME_MAX];
char *cp;
const char *suffixes[] = {".tgz", ".tar", ".tbz", NULL};
const char *suffixes[] = {".tbz", ".tgz", ".tar", NULL};
int i;
if (fexists(fname) && isfile(fname)) {
@ -457,7 +460,7 @@ unpack(const char *pkg, const char *flist)
strcpy(suff, cp + 1);
if (strchr(suff, 'z') || strchr(suff, 'Z')) {
if (strchr(suff, 'b'))
strcpy(args, "-y");
strcpy(args, "-j");
else
strcpy(args, "-z");
}