Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jan 2009 13:10:06 +0000 (UTC)
From:      Florent Thoumie <flz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r186773 - in stable/7/usr.sbin/pkg_install: . create lib
Message-ID:  <200901051310.n05DA6UQ097067@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: flz
Date: Mon Jan  5 13:10:06 2009
New Revision: 186773
URL: http://svn.freebsd.org/changeset/base/186773

Log:
  Synchronize pkg_install with HEAD (20080708):
  
      r180361: actually enable '-n' for pkg_create(1)
      r181376: use humanize_number to report pen-sizes

Modified:
  stable/7/usr.sbin/pkg_install/   (props changed)
  stable/7/usr.sbin/pkg_install/Makefile.inc
  stable/7/usr.sbin/pkg_install/create/main.c
  stable/7/usr.sbin/pkg_install/lib/lib.h
  stable/7/usr.sbin/pkg_install/lib/pen.c

Modified: stable/7/usr.sbin/pkg_install/Makefile.inc
==============================================================================
--- stable/7/usr.sbin/pkg_install/Makefile.inc	Mon Jan  5 13:06:03 2009	(r186772)
+++ stable/7/usr.sbin/pkg_install/Makefile.inc	Mon Jan  5 13:10:06 2009	(r186773)
@@ -4,6 +4,9 @@
 
 LIBINSTALL=	${.OBJDIR}/../lib/libinstall.a
 
+DPADD+=		${LIBUTIL}
+LDADD+=		-lutil
+
 .if ${MK_OPENSSL} != "no" && \
     defined(LDADD) && ${LDADD:M-lfetch} != ""
 DPADD+=		${LIBSSL} ${LIBCRYPTO}

Modified: stable/7/usr.sbin/pkg_install/create/main.c
==============================================================================
--- stable/7/usr.sbin/pkg_install/create/main.c	Mon Jan  5 13:06:03 2009	(r186772)
+++ stable/7/usr.sbin/pkg_install/create/main.c	Mon Jan  5 13:10:06 2009	(r186773)
@@ -208,6 +208,10 @@ main(int argc, char **argv)
 	    Recursive = TRUE;
 	    break;
 
+	case 'n':
+	    Regenerate = FALSE;
+	    break;
+
 	case 0:
 	    if (Help)
 		usage();

Modified: stable/7/usr.sbin/pkg_install/lib/lib.h
==============================================================================
--- stable/7/usr.sbin/pkg_install/lib/lib.h	Mon Jan  5 13:06:03 2009	(r186772)
+++ stable/7/usr.sbin/pkg_install/lib/lib.h	Mon Jan  5 13:10:06 2009	(r186773)
@@ -105,7 +105,7 @@
  * Version of the package tools - increase only when some
  * functionality used by bsd.port.mk is changed, added or removed
  */
-#define PKG_INSTALL_VERSION	20080612
+#define PKG_INSTALL_VERSION	20080708
 
 #define PKG_WRAPCONF_FNAME	"/var/db/pkg_install.conf"
 #define main(argc, argv)	real_main(argc, argv)

Modified: stable/7/usr.sbin/pkg_install/lib/pen.c
==============================================================================
--- stable/7/usr.sbin/pkg_install/lib/pen.c	Mon Jan  5 13:06:03 2009	(r186772)
+++ stable/7/usr.sbin/pkg_install/lib/pen.c	Mon Jan  5 13:10:06 2009	(r186773)
@@ -23,6 +23,7 @@ __FBSDID("$FreeBSD$");
 
 #include "lib.h"
 #include <err.h>
+#include <libutil.h>
 #include <libgen.h>
 #include <sys/signal.h>
 #include <sys/param.h>
@@ -44,6 +45,7 @@ find_play_pen(char *pen, off_t sz)
 {
     char *cp;
     struct stat sb;
+    char humbuf[6];
 
     if (pen[0] && isdir(dirname(pen)) == TRUE && (min_free(dirname(pen)) >= sz))
 	return pen;
@@ -59,10 +61,12 @@ find_play_pen(char *pen, off_t sz)
 	strcpy(pen, "/usr/tmp/instmp.XXXXXX");
     else {
 	cleanup(0);
+	humanize_number(humbuf, sizeof humbuf, sz, "", HN_AUTOSCALE,
+	    HN_NOSPACE);
 	errx(2,
 "%s: can't find enough temporary space to extract the files, please set your\n"
-"PKG_TMPDIR environment variable to a location with at least %ld bytes\n"
-"free", __func__, (long)sz);
+"PKG_TMPDIR environment variable to a location with at least %s bytes\n"
+"free", __func__, humbuf);
 	return NULL;
     }
     return pen;
@@ -98,6 +102,8 @@ popPen(char *pen)
 char *
 make_playpen(char *pen, off_t sz)
 {
+    char humbuf1[6], humbuf2[6];
+
     if (!find_play_pen(pen, sz))
 	return NULL;
 
@@ -111,8 +117,13 @@ make_playpen(char *pen, off_t sz)
     }
 
     if (Verbose) {
-	if (sz)
-	    fprintf(stderr, "Requested space: %d bytes, free space: %lld bytes in %s\n", (int)sz, (long long)min_free(pen), pen);
+	if (sz) {
+	    humanize_number(humbuf1, sizeof humbuf1, sz, "", HN_AUTOSCALE,
+	        HN_NOSPACE);
+	    humanize_number(humbuf2, sizeof humbuf2, min_free(pen),
+	        "", HN_AUTOSCALE, HN_NOSPACE);
+	    fprintf(stderr, "Requested space: %s bytes, free space: %s bytes in %s\n", humbuf1, humbuf2, pen);
+	}
     }
 
     if (min_free(pen) < sz) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901051310.n05DA6UQ097067>