Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.sbin/pkg_install/info Pull up revision 1.34 (reques...



details:   https://anonhg.NetBSD.org/src/rev/9d9b72b3ca83
branches:  netbsd-1-5
changeset: 490368:9d9b72b3ca83
user:      he <he%NetBSD.org@localhost>
date:      Fri Dec 15 04:06:53 2000 +0000

description:
Pull up revision 1.34 (requested by hubertf):
  Accept ``.tbz'' as an alternative suffix; compress with bzip2 if
  a .tbz suffix is given.  Fix pkg_info to work via ftp, either
  via URL on command line or from PKG_PATH environment variable.

diffstat:

 usr.sbin/pkg_install/info/perform.c |  55 +++++++++++++++++++++++-------------
 1 files changed, 35 insertions(+), 20 deletions(-)

diffs (86 lines):

diff -r eb5a3cbb1e07 -r 9d9b72b3ca83 usr.sbin/pkg_install/info/perform.c
--- a/usr.sbin/pkg_install/info/perform.c       Fri Dec 15 04:06:32 2000 +0000
+++ b/usr.sbin/pkg_install/info/perform.c       Fri Dec 15 04:06:53 2000 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.31.4.1 2000/10/18 03:20:02 tv Exp $      */
+/*     $NetBSD: perform.c,v 1.31.4.2 2000/12/15 04:06:53 he Exp $      */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.31.4.1 2000/10/18 03:20:02 tv Exp $");
+__RCSID("$NetBSD: perform.c,v 1.31.4.2 2000/12/15 04:06:53 he Exp $");
 #endif
 #endif
 
@@ -67,12 +67,14 @@
                        }
                        len = strlen(fname);
                        (void) snprintf(&fname[len], sizeof(fname) - len, "/%s", pkg);
-               } else
+               } else {
                        strcpy(fname, pkg);
+               }
                cp = fname;
        } else {
-               if ((cp = fileFindByPath(NULL, pkg)) != NULL)
+               if ((cp = fileFindByPath(NULL, pkg)) != NULL) {
                        strncpy(fname, cp, FILENAME_MAX);
+               }
        }
 
        if (cp) {
@@ -80,22 +82,35 @@
                        /* file is already unpacked by fileGetURL() */
                        strcpy(PlayPen, cp);
                } else {
-                       /*
-                        * 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, PlayPenSize, sb.st_size / 2);
-                       if (unpack(fname, "+*")) {
-                               warnx("error during unpacking, no info for '%s' available", pkg);
-                               code = 1;
-                               goto bail;
+                       if (IS_URL(cp)) {
+                               /* only a package name was given, and it was expanded to a
+                                * full URL by fileFindByPath. Now extract...
+                                */
+                               char *cp2;
+
+                               if ((cp2 = fileGetURL(NULL, cp)) != NULL) {
+                                       strcpy(fname, cp2);
+                                       isTMP = TRUE;
+                               }
+                               strcpy(PlayPen, cp2);
+                       } else {
+                               /*
+                                * 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, PlayPenSize, sb.st_size / 2);
+                               if (unpack(fname, "+*")) {
+                                       warnx("error during unpacking, no info for '%s' available", pkg);
+                                       code = 1;
+                                       goto bail;
+                               }
                        }
                }
        } else {



Home | Main Index | Thread Index | Old Index