diff --git a/usr.sbin/pkg_install/admin/main.c b/usr.sbin/pkg_install/admin/main.c index df203567c255..d3552b266fd2 100644 --- a/usr.sbin/pkg_install/admin/main.c +++ b/usr.sbin/pkg_install/admin/main.c @@ -1,8 +1,8 @@ -/* $NetBSD: main.c,v 1.8 1999/09/13 00:32:14 hubertf Exp $ */ +/* $NetBSD: main.c,v 1.9 1999/11/29 19:48:44 hubertf Exp $ */ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.8 1999/09/13 00:32:14 hubertf Exp $"); +__RCSID("$NetBSD: main.c,v 1.9 1999/11/29 19:48:44 hubertf Exp $"); #endif /* @@ -117,9 +117,6 @@ check1pkg(const char *pkgdir) dirp = dir; } break; - case PLIST_SRC: - warnx("@src is deprecated - please send-pr for %s!\n", PkgName); - break; case PLIST_IGNORE: p = p->next; break; @@ -228,9 +225,6 @@ rebuild(void) dirp = dir; } break; - case PLIST_SRC: - warnx("@src is deprecated - please send-pr for %s!\n", PkgName); - break; case PLIST_IGNORE: p = p->next; break; diff --git a/usr.sbin/pkg_install/create/create.h b/usr.sbin/pkg_install/create/create.h index b0690ef461bc..c9cfe862a93f 100644 --- a/usr.sbin/pkg_install/create/create.h +++ b/usr.sbin/pkg_install/create/create.h @@ -1,4 +1,4 @@ -/* $NetBSD: create.h,v 1.12 1999/08/24 00:48:38 hubertf Exp $ */ +/* $NetBSD: create.h,v 1.13 1999/11/29 19:48:45 hubertf Exp $ */ /* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */ @@ -33,13 +33,14 @@ extern char *Install; extern char *DeInstall; extern char *Contents; extern char *Require; -extern char *SrcDir; extern char *ExcludeFrom; extern char *Mtree; extern char *Pkgdeps; extern char *Pkgcfl; extern char *BuildVersion; extern char *BuildInfo; +extern char *SizePkg; +extern char *SizeAll; extern char PlayPen[]; extern size_t PlayPenSize; extern int Dereference; diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c index 1d75aea2f839..06803f0d6ff5 100644 --- a/usr.sbin/pkg_install/create/main.c +++ b/usr.sbin/pkg_install/create/main.c @@ -1,11 +1,11 @@ -/* $NetBSD: main.c,v 1.14 1999/08/24 00:48:38 hubertf Exp $ */ +/* $NetBSD: main.c,v 1.15 1999/11/29 19:48:45 hubertf Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: main.c,v 1.17 1997/10/08 07:46:23 charnier Exp"; #else -__RCSID("$NetBSD: main.c,v 1.14 1999/08/24 00:48:38 hubertf Exp $"); +__RCSID("$NetBSD: main.c,v 1.15 1999/11/29 19:48:45 hubertf Exp $"); #endif #endif @@ -24,12 +24,11 @@ __RCSID("$NetBSD: main.c,v 1.14 1999/08/24 00:48:38 hubertf Exp $"); #include "lib.h" #include "create.h" -static char Options[] = "ORhlvFf:p:P:C:c:d:i:k:r:t:X:D:m:s:b:B:"; +static char Options[] = "ORhlvFf:p:P:C:c:d:i:k:r:t:X:D:m:s:S:b:B:"; char *Prefix = NULL; char *Comment = NULL; char *Desc = NULL; -char *SrcDir = NULL; char *Display = NULL; char *Install = NULL; char *DeInstall = NULL; @@ -41,6 +40,8 @@ char *Pkgdeps = NULL; char *Pkgcfl = NULL; char *BuildVersion = NULL; char *BuildInfo = NULL; +char *SizePkg = NULL; +char *SizeAll = NULL; char PlayPen[FILENAME_MAX]; size_t PlayPenSize = sizeof(PlayPen); int Dereference = 0; @@ -87,7 +88,11 @@ main(int argc, char **argv) break; case 's': - SrcDir = optarg; + SizePkg = optarg; + break; + + case 'S': + SizeAll = optarg; break; case 'f': diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index 62d4ff6d3ac2..f8d4e11f821a 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -1,11 +1,11 @@ -/* $NetBSD: perform.c,v 1.19 1999/08/24 00:48:38 hubertf Exp $ */ +/* $NetBSD: perform.c,v 1.20 1999/11/29 19:48:45 hubertf Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.38 1997/10/13 15:03:51 jkh Exp"; #else -__RCSID("$NetBSD: perform.c,v 1.19 1999/08/24 00:48:38 hubertf Exp $"); +__RCSID("$NetBSD: perform.c,v 1.20 1999/11/29 19:48:45 hubertf Exp $"); #endif #endif @@ -127,11 +127,17 @@ make_dist(char *home, char *pkg, char *suffix, package_t *plist) if (BuildInfo) { (void) fprintf(totar, "%s\n", BUILD_INFO_FNAME); } + if (SizePkg) { + (void) fprintf(totar, "%s\n", SIZE_PKG_FNAME); + } + if (SizeAll) { + (void) fprintf(totar, "%s\n", SIZE_ALL_FNAME); + } for (p = plist->head; p; p = p->next) { if (p->type == PLIST_FILE) fprintf(totar, "%s\n", p->name); - else if (p->type == PLIST_CWD || p->type == PLIST_SRC) + else if (p->type == PLIST_CWD) fprintf(totar, "-C\n%s\n", p->name); else if (p->type == PLIST_IGNORE) p = p->next; @@ -257,13 +263,6 @@ pkg_perform(lpkg_head_t *pkgs) printf(".\n"); } - /* If a SrcDir override is set, add it now */ - if (SrcDir) { - if (Verbose && !PlistOnly) - printf("Using SrcDir value of %s\n", SrcDir); - add_plist(&plist, PLIST_SRC, SrcDir); - } - /* Slurp in the packing list */ read_plist(&plist, pkg_in); @@ -346,6 +345,16 @@ pkg_perform(lpkg_head_t *pkgs) add_plist(&plist, PLIST_IGNORE, NULL); add_plist(&plist, PLIST_FILE, BUILD_INFO_FNAME); } + if (SizePkg) { + copy_file(home, SizePkg, SIZE_PKG_FNAME); + add_plist(&plist, PLIST_IGNORE, NULL); + add_plist(&plist, PLIST_FILE, SIZE_PKG_FNAME); + } + if (SizeAll) { + copy_file(home, SizeAll, SIZE_ALL_FNAME); + add_plist(&plist, PLIST_IGNORE, NULL); + add_plist(&plist, PLIST_FILE, SIZE_ALL_FNAME); + } /* Finally, write out the packing list */ fp = fopen(CONTENTS_FNAME, "w"); diff --git a/usr.sbin/pkg_install/create/pkg_create.1 b/usr.sbin/pkg_install/create/pkg_create.1 index 5c55dde380f3..9d28a6066182 100644 --- a/usr.sbin/pkg_install/create/pkg_create.1 +++ b/usr.sbin/pkg_install/create/pkg_create.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_create.1,v 1.18 1999/07/28 10:07:05 tron Exp $ +.\" $NetBSD: pkg_create.1,v 1.19 1999/11/29 19:48:45 hubertf Exp $ .\" .\" FreeBSD install - a package for the installation and maintainance .\" of non-core utilities. @@ -70,6 +70,12 @@ .Op Fl r Ar rscript .Ek .Bk -words +.Op Fl s Ar size-pkg-file +.Ek +.Bk -words +.Op Fl S Ar size-all-file +.Ek +.Bk -words .Op Fl t Ar template .Ek .Bk -words @@ -105,7 +111,7 @@ were used to control the build when creating the binary package. This allows various build definitions to be retained in a binary package and viewed wherever it is installed, using -.Xr pkginfo 1 . +.Xr pkg_info 1 . .It Fl C Ar cpkgs Set the initial package conflict list to .Ar cpkgs . @@ -132,11 +138,18 @@ directives in the packing list (see PACKING LIST DETAILS section below). Re-order any directories in the pkg/PLIST file into reverse alphabetic order, so that child directories will automatically be removed before parent directories. +.It Fl S Ar size-all-file +Store the given file for later querying with the +.Xr pkg_info 1 +.Ar -S +flag. The file is expected to contain the the size (in bytes) of all files of +this package plus any required packages added up and stored as a +ASCII string, terminated by a newline. .It Fl X Ar excludefile Pass .Ar excludefile as a -.Fl exclude-from +.Fl -exclude-from argument to .Cm tar when creating final package. See @@ -232,6 +245,12 @@ to be the ``requirements'' procedure for the package. This can be any executable program (or shell script). It will be invoked automatically at installation/deinstallation time to determine whether or not installation/deinstallation should proceed. +.It Fl s Ar size-pkg-file +Store the given file for later querying with the +.Xr pkg_info 1 +.Ar -s +flag. The file is expected to contain the the size (in bytes) of all files of +this package added up and stored as a ASCII string, terminated by a newline. .It Fl t Ar template Use .Ar template @@ -269,12 +288,6 @@ All subsequent filenames will be assumed relative to this directory. Note: .Cm @cd is also an alias for this command. -.It Cm @src Ar directory -Set the internal directory pointer for _creation only_ to -.Ar directory . -That is to say that it overrides -.Cm @cwd -for package creation but not extraction. .It Cm @exec Ar command Execute .Ar command @@ -446,7 +459,7 @@ refined it for .Nx .It "Hubert Feyrer" .Nx -wildcard dependency processing, pkgdb, etc. +wildcard dependency processing, pkgdb, pkg size recording etc. .El .Sh BUGS Hard links between files in a distribution must be bracketed by diff --git a/usr.sbin/pkg_install/create/pl.c b/usr.sbin/pkg_install/create/pl.c index 365fb075cc0d..b981dacb979f 100644 --- a/usr.sbin/pkg_install/create/pl.c +++ b/usr.sbin/pkg_install/create/pl.c @@ -1,11 +1,11 @@ -/* $NetBSD: pl.c,v 1.16 1999/08/24 00:48:38 hubertf Exp $ */ +/* $NetBSD: pl.c,v 1.17 1999/11/29 19:48:45 hubertf Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp"; #else -__RCSID("$NetBSD: pl.c,v 1.16 1999/08/24 00:48:38 hubertf Exp $"); +__RCSID("$NetBSD: pl.c,v 1.17 1999/11/29 19:48:45 hubertf Exp $"); #endif #endif @@ -133,9 +133,6 @@ check_list(char *home, package_t *pkg, const char *PkgName) case PLIST_IGNORE: p = p->next; break; - case PLIST_SRC: - srcdir = p->name; - break; case PLIST_DIR_RM: dirc++; break; diff --git a/usr.sbin/pkg_install/info/info.h b/usr.sbin/pkg_install/info/info.h index 32ff17cccc84..12a036a7547a 100644 --- a/usr.sbin/pkg_install/info/info.h +++ b/usr.sbin/pkg_install/info/info.h @@ -1,4 +1,4 @@ -/* $NetBSD: info.h,v 1.11 1999/08/24 00:48:39 hubertf Exp $ */ +/* $NetBSD: info.h,v 1.12 1999/11/29 19:48:46 hubertf Exp $ */ /* from FreeBSD Id: info.h,v 1.10 1997/02/22 16:09:40 peter Exp */ @@ -33,21 +33,23 @@ #define MAXNAMESIZE 20 #endif -#define SHOW_COMMENT 0x0001 -#define SHOW_DESC 0x0002 -#define SHOW_PLIST 0x0004 -#define SHOW_INSTALL 0x0008 -#define SHOW_DEINSTALL 0x0010 -#define SHOW_REQUIRE 0x0020 -#define SHOW_PREFIX 0x0040 -#define SHOW_INDEX 0x0080 -#define SHOW_FILES 0x0100 -#define SHOW_DISPLAY 0x0200 -#define SHOW_REQBY 0x0400 -#define SHOW_MTREE 0x0800 -#define SHOW_BUILD_VERSION 0x1000 -#define SHOW_BUILD_INFO 0x2000 -#define SHOW_DEPENDS 0x4000 +#define SHOW_COMMENT 0x00001 +#define SHOW_DESC 0x00002 +#define SHOW_PLIST 0x00004 +#define SHOW_INSTALL 0x00008 +#define SHOW_DEINSTALL 0x00010 +#define SHOW_REQUIRE 0x00020 +#define SHOW_PREFIX 0x00040 +#define SHOW_INDEX 0x00080 +#define SHOW_FILES 0x00100 +#define SHOW_DISPLAY 0x00200 +#define SHOW_REQBY 0x00400 +#define SHOW_MTREE 0x00800 +#define SHOW_BUILD_VERSION 0x01000 +#define SHOW_BUILD_INFO 0x02000 +#define SHOW_DEPENDS 0x04000 +#define SHOW_PKG_SIZE 0x08000 +#define SHOW_ALL_SIZE 0x10000 extern int Flags; extern Boolean AllInstalled; diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c index 9a507a9d7c22..4021ae7a020b 100644 --- a/usr.sbin/pkg_install/info/main.c +++ b/usr.sbin/pkg_install/info/main.c @@ -1,11 +1,11 @@ -/* $NetBSD: main.c,v 1.18 1999/08/24 00:48:39 hubertf Exp $ */ +/* $NetBSD: main.c,v 1.19 1999/11/29 19:48:46 hubertf Exp $ */ #include #ifndef lint #if 0 static char *rcsid = "from FreeBSD Id: main.c,v 1.14 1997/10/08 07:47:26 charnier Exp"; #else -__RCSID("$NetBSD: main.c,v 1.18 1999/08/24 00:48:39 hubertf Exp $"); +__RCSID("$NetBSD: main.c,v 1.19 1999/11/29 19:48:46 hubertf Exp $"); #endif #endif @@ -38,7 +38,7 @@ __RCSID("$NetBSD: main.c,v 1.18 1999/08/24 00:48:39 hubertf Exp $"); #include "lib.h" #include "info.h" -static char Options[] = "aBbcDde:fFIikLl:mpqRrvh"; +static char Options[] = "aBbcDde:fFhIikLl:mpqRrsSv"; int Flags = 0; Boolean AllInstalled = FALSE; @@ -156,12 +156,20 @@ main(int argc, char **argv) Flags |= SHOW_REQUIRE; break; + case 's': + Flags |= SHOW_PKG_SIZE; + break; + + case 'S': + Flags |= SHOW_ALL_SIZE; + break; + case 'v': Verbose = TRUE; /* Reasonable definition of 'everything' */ Flags = SHOW_COMMENT | SHOW_DESC | SHOW_PLIST | SHOW_INSTALL | SHOW_DEINSTALL | SHOW_REQUIRE | SHOW_DISPLAY | SHOW_MTREE | - SHOW_REQBY | SHOW_DEPENDS; + SHOW_REQBY | SHOW_DEPENDS | SHOW_PKG_SIZE | SHOW_ALL_SIZE; break; case 'h': diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c index 7a5a74c66ce6..247b32d615db 100644 --- a/usr.sbin/pkg_install/info/perform.c +++ b/usr.sbin/pkg_install/info/perform.c @@ -1,11 +1,11 @@ -/* $NetBSD: perform.c,v 1.28 1999/08/24 00:48:39 hubertf Exp $ */ +/* $NetBSD: perform.c,v 1.29 1999/11/29 19:48:46 hubertf Exp $ */ #include #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.28 1999/08/24 00:48:39 hubertf Exp $"); +__RCSID("$NetBSD: perform.c,v 1.29 1999/11/29 19:48:46 hubertf Exp $"); #endif #endif @@ -199,6 +199,12 @@ pkg_do(char *pkg) if ((Flags & SHOW_BUILD_INFO) && fexists(BUILD_INFO_FNAME)) { show_file("Build information:\n", BUILD_INFO_FNAME); } + if ((Flags & SHOW_PKG_SIZE) && fexists(SIZE_PKG_FNAME)) { + show_file("Size of this package in bytes: ", SIZE_PKG_FNAME); + } + if ((Flags & SHOW_ALL_SIZE) && fexists(SIZE_ALL_FNAME)) { + show_file("Size in bytes including required pkgs: ", SIZE_ALL_FNAME); + } if (!Quiet) { puts(InfoPrefix); } diff --git a/usr.sbin/pkg_install/info/pkg_info.1 b/usr.sbin/pkg_install/info/pkg_info.1 index ab10d0783e07..31d29d14b7eb 100644 --- a/usr.sbin/pkg_install/info/pkg_info.1 +++ b/usr.sbin/pkg_install/info/pkg_info.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_info.1,v 1.18 1999/08/19 19:37:22 hubertf Exp $ +.\" $NetBSD: pkg_info.1,v 1.19 1999/11/29 19:48:46 hubertf Exp $ .\" .\" FreeBSD install - a package for the installation and maintainance .\" of non-core utilities. @@ -25,7 +25,7 @@ .Nd a utility for displaying information on software packages .Sh SYNOPSIS .Nm "" -.Op Fl BbcDdFfIikLmpqRrvh +.Op Fl BbcDdFfhIikLmpqRrSsv .Bk -words .Op Fl e Ar package .Ek @@ -145,6 +145,12 @@ raw info (basically, assume a non-human reading). Show which packages are required by each package. .It Fl r Show the requirements script (if any) for each package. +.It Fl S +Show the size of this package and all the packages it requires, +in bytes. +.It Fl s +Show the size of this package in bytes. The size is calculated by +adding up the size of each file of the package. .It Fl v Turn on verbose output. .El @@ -223,5 +229,6 @@ refined it for .Nx .It "Hubert Feyrer" .Nx -wildcard dependency processing, pkgdb, depends displaying, etc. +wildcard dependency processing, pkgdb, depends displaying, +pkg size display etc. .El diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index 267d1a933aa4..5890c165d91a 100644 --- a/usr.sbin/pkg_install/info/show.c +++ b/usr.sbin/pkg_install/info/show.c @@ -1,11 +1,11 @@ -/* $NetBSD: show.c,v 1.16 1999/08/24 00:48:39 hubertf Exp $ */ +/* $NetBSD: show.c,v 1.17 1999/11/29 19:48:47 hubertf Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp"; #else -__RCSID("$NetBSD: show.c,v 1.16 1999/08/24 00:48:39 hubertf Exp $"); +__RCSID("$NetBSD: show.c,v 1.17 1999/11/29 19:48:47 hubertf Exp $"); #endif #endif @@ -84,7 +84,6 @@ static show_t showv[] = { {PLIST_IGNORE, NULL, NULL}, {PLIST_NAME, "@name %s", "\tPackage name: %s"}, {PLIST_UNEXEC, "@unexec %s", "\tUNEXEC '%s'"}, - {PLIST_SRC, "@src: %s", "\tSRC to: %s"}, {PLIST_DISPLAY, "@display %s", "\tInstall message file: %s"}, {PLIST_PKGDEP, "@pkgdep %s", "\tPackage depends on: %s"}, {PLIST_MTREE, "@mtree %s", "\tPackage mtree file: %s"}, @@ -183,7 +182,6 @@ show_plist(char *title, package_t *plist, pl_ent_t type) break; case PLIST_CWD: case PLIST_CMD: - case PLIST_SRC: case PLIST_UNEXEC: case PLIST_COMMENT: case PLIST_NAME: diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 7bb1139e5ac8..2bafe86e6f71 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -1,4 +1,4 @@ -/* $NetBSD: lib.h,v 1.26 1999/09/09 01:31:44 hubertf Exp $ */ +/* $NetBSD: lib.h,v 1.27 1999/11/29 19:48:47 hubertf Exp $ */ /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */ @@ -83,6 +83,8 @@ #define MTREE_FNAME "+MTREE_DIRS" #define BUILD_VERSION_FNAME "+BUILD_VERSION" #define BUILD_INFO_FNAME "+BUILD_INFO" +#define SIZE_PKG_FNAME "+SIZE_PKG" +#define SIZE_ALL_FNAME "+SIZE_ALL" #define CMD_CHAR '@' /* prefix for extended PLIST cmd */ @@ -109,14 +111,13 @@ typedef enum pl_ent_t { PLIST_IGNORE, /* 7 */ PLIST_NAME, /* 8 */ PLIST_UNEXEC, /* 9 */ - PLIST_SRC, /* 10 */ - PLIST_DISPLAY, /* 11 */ - PLIST_PKGDEP, /* 12 */ - PLIST_MTREE, /* 13 */ - PLIST_DIR_RM, /* 14 */ - PLIST_IGNORE_INST, /* 15 */ - PLIST_OPTION, /* 16 */ - PLIST_PKGCFL /* 17 */ + PLIST_DISPLAY, /* 10 */ + PLIST_PKGDEP, /* 11 */ + PLIST_MTREE, /* 12 */ + PLIST_DIR_RM, /* 13 */ + PLIST_IGNORE_INST, /* 14 */ + PLIST_OPTION, /* 15 */ + PLIST_PKGCFL /* 16 */ } pl_ent_t; /* Types */ diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c index 2603809c3d1d..b5bd13987797 100644 --- a/usr.sbin/pkg_install/lib/plist.c +++ b/usr.sbin/pkg_install/lib/plist.c @@ -1,11 +1,11 @@ -/* $NetBSD: plist.c,v 1.22 1999/08/24 00:48:40 hubertf Exp $ */ +/* $NetBSD: plist.c,v 1.23 1999/11/29 19:48:48 hubertf Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp"; #else -__RCSID("$NetBSD: plist.c,v 1.22 1999/08/24 00:48:40 hubertf Exp $"); +__RCSID("$NetBSD: plist.c,v 1.23 1999/11/29 19:48:48 hubertf Exp $"); #endif #endif @@ -44,7 +44,6 @@ typedef struct cmd_t { /* Commands to recognise */ static cmd_t cmdv[] = { {"cwd", PLIST_CWD, 1}, - {"src", PLIST_SRC, 1}, {"cd", PLIST_CWD, 1}, {"exec", PLIST_CMD, 1}, {"unexec", PLIST_UNEXEC, 1},