Fix pkg_info when specifying a remote package.
MFC after: 1 week
This commit is contained in:
parent
2e4b86adc7
commit
60968ceaff
@ -236,7 +236,7 @@ main(int argc, char **argv)
|
||||
* Don't try to apply heuristics if arguments are regexs or if
|
||||
* the argument refers to an existing file.
|
||||
*/
|
||||
if (MatchType != MATCH_REGEX && MatchType != MATCH_EREGEX && !isfile(*argv))
|
||||
if (MatchType != MATCH_REGEX && MatchType != MATCH_EREGEX && !isfile(*argv) && !isURL(*argv))
|
||||
while ((pkgs_split = strrchr(*argv, (int)'/')) != NULL) {
|
||||
*pkgs_split++ = '\0';
|
||||
/*
|
||||
|
@ -101,8 +101,11 @@ pkg_do(char *pkg)
|
||||
|
||||
if (isURL(pkg)) {
|
||||
if ((cp = fileGetURL(NULL, pkg, KeepPackage)) != NULL) {
|
||||
strcpy(fname, cp);
|
||||
if (!getcwd(fname, FILENAME_MAX))
|
||||
upchuck("getcwd");
|
||||
isTMP = TRUE;
|
||||
} else {
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
else if (fexists(pkg) && isfile(pkg)) {
|
||||
@ -123,22 +126,24 @@ pkg_do(char *pkg)
|
||||
strncpy(fname, cp, FILENAME_MAX);
|
||||
}
|
||||
if (cp) {
|
||||
/*
|
||||
* Apply a crude heuristic to see how much space the package will
|
||||
* take up once it's unpacked. I've noticed that most packages
|
||||
* compress an average of 75%, but we're only unpacking the + files so
|
||||
* be very optimistic.
|
||||
*/
|
||||
if (stat(fname, &sb) == FAIL) {
|
||||
warnx("can't stat package file '%s'", fname);
|
||||
code = 1;
|
||||
goto bail;
|
||||
}
|
||||
Home = make_playpen(PlayPen, sb.st_size / 2);
|
||||
if (unpack(fname, "'+*'")) {
|
||||
warnx("error during unpacking, no info for '%s' available", pkg);
|
||||
code = 1;
|
||||
goto bail;
|
||||
if (!isURL(pkg)) {
|
||||
/*
|
||||
* Apply a crude heuristic to see how much space the package will
|
||||
* take up once it's unpacked. I've noticed that most packages
|
||||
* compress an average of 75%, but we're only unpacking the + files so
|
||||
* be very optimistic.
|
||||
*/
|
||||
if (stat(fname, &sb) == FAIL) {
|
||||
warnx("can't stat package file '%s'", fname);
|
||||
code = 1;
|
||||
goto bail;
|
||||
}
|
||||
Home = make_playpen(PlayPen, sb.st_size / 2);
|
||||
if (unpack(fname, "'+*'")) {
|
||||
warnx("error during unpacking, no info for '%s' available", pkg);
|
||||
code = 1;
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* It's not an uninstalled package, try and find it among the installed */
|
||||
|
Loading…
Reference in New Issue
Block a user