Modify pkg_create to recognise Build Information and Version files, when

creating packages, and modify pkg_add to copy the files when a binary
package is added. This preserves the fine-grained version information in
a binary package, and also the options with which the binary package was
built.
This commit is contained in:
agc 1998-10-26 17:39:20 +00:00
parent ede30e2813
commit 3fdf3a6fae
5 changed files with 168 additions and 116 deletions

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.26 1998/10/12 12:03:25 agc Exp $ */ /* $NetBSD: perform.c,v 1.27 1998/10/26 17:39:20 agc Exp $ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp"; static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else #else
__RCSID("$NetBSD: perform.c,v 1.26 1998/10/12 12:03:25 agc Exp $"); __RCSID("$NetBSD: perform.c,v 1.27 1998/10/26 17:39:20 agc Exp $");
#endif #endif
#endif #endif
@ -488,6 +488,8 @@ pkg_do(char *pkg)
fclose(cfile); fclose(cfile);
move_file(".", DESC_FNAME, LogDir); move_file(".", DESC_FNAME, LogDir);
move_file(".", COMMENT_FNAME, LogDir); move_file(".", COMMENT_FNAME, LogDir);
move_file(".", BUILD_VERSION_FNAME, LogDir);
move_file(".", BUILD_INFO_FNAME, LogDir);
if (fexists(DISPLAY_FNAME)) if (fexists(DISPLAY_FNAME))
move_file(".", DISPLAY_FNAME, LogDir); move_file(".", DISPLAY_FNAME, LogDir);

View File

@ -1,4 +1,4 @@
/* $NetBSD: create.h,v 1.8 1998/10/12 12:03:25 agc Exp $ */ /* $NetBSD: create.h,v 1.9 1998/10/26 17:39:22 agc Exp $ */
/* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */ /* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */
@ -38,6 +38,8 @@ extern char *ExcludeFrom;
extern char *Mtree; extern char *Mtree;
extern char *Pkgdeps; extern char *Pkgdeps;
extern char *Pkgcfl; extern char *Pkgcfl;
extern char *BuildVersion;
extern char *BuildInfo;
extern char PlayPen[]; extern char PlayPen[];
extern size_t PlayPenSize; extern size_t PlayPenSize;
extern int Dereference; extern int Dereference;

View File

@ -1,11 +1,11 @@
/* $NetBSD: main.c,v 1.10 1998/10/13 10:05:38 agc Exp $ */ /* $NetBSD: main.c,v 1.11 1998/10/26 17:39:22 agc Exp $ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static const char *rcsid = "from FreeBSD Id: main.c,v 1.17 1997/10/08 07:46:23 charnier Exp"; static const char *rcsid = "from FreeBSD Id: main.c,v 1.17 1997/10/08 07:46:23 charnier Exp";
#else #else
__RCSID("$NetBSD: main.c,v 1.10 1998/10/13 10:05:38 agc Exp $"); __RCSID("$NetBSD: main.c,v 1.11 1998/10/26 17:39:22 agc Exp $");
#endif #endif
#endif #endif
@ -24,7 +24,7 @@ __RCSID("$NetBSD: main.c,v 1.10 1998/10/13 10:05:38 agc Exp $");
#include "lib.h" #include "lib.h"
#include "create.h" #include "create.h"
static char Options[] = "ORhlvf:p:P:C:c:d:i:k:r:t:X:D:m:s:"; static char Options[] = "ORhlvf:p:P:C:c:d:i:k:r:t:X:D:m:s:b:B:";
char *Prefix = NULL; char *Prefix = NULL;
char *Comment = NULL; char *Comment = NULL;
@ -39,6 +39,8 @@ char *ExcludeFrom = NULL;
char *Mtree = NULL; char *Mtree = NULL;
char *Pkgdeps = NULL; char *Pkgdeps = NULL;
char *Pkgcfl = NULL; char *Pkgcfl = NULL;
char *BuildVersion = NULL;
char *BuildInfo = NULL;
char PlayPen[FILENAME_MAX]; char PlayPen[FILENAME_MAX];
size_t PlayPenSize = sizeof(PlayPen); size_t PlayPenSize = sizeof(PlayPen);
int Dereference = 0; int Dereference = 0;
@ -49,10 +51,11 @@ int ReorderDirs = 0;
static void static void
usage(void) usage(void)
{ {
fprintf(stderr, "%s\n%s\n%s\n%s\n", fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
"usage: pkg_create [-ORhlv] [-P dpkgs] [-C cpkgs] [-p prefix] [-f contents]", "usage: pkg_create [-ORhlv] [-P dpkgs] [-C cpkgs] [-p prefix] [-f contents]",
" [-i iscript] [-k dscript] [-r rscript] [-t template]", " [-i iscript] [-k dscript] [-r rscript] [-t template]",
" [-X excludefile] [-D displayfile] [-m mtreefile]", " [-X excludefile] [-D displayfile] [-m mtreefile]",
" [-b build-version-file] [-B build-info-file]",
" -c comment -d description -f packlist pkg-name"); " -c comment -d description -f packlist pkg-name");
exit(1); exit(1);
} }
@ -142,6 +145,14 @@ main(int argc, char **argv)
Pkgcfl = optarg; Pkgcfl = optarg;
break; break;
case 'b':
BuildVersion = optarg;
break;
case 'B':
BuildInfo = optarg;
break;
case '?': case '?':
default: default:
usage(); usage();

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.13 1998/10/12 12:03:25 agc Exp $ */ /* $NetBSD: perform.c,v 1.14 1998/10/26 17:39:23 agc Exp $ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.38 1997/10/13 15:03:51 jkh Exp"; static const char *rcsid = "from FreeBSD Id: perform.c,v 1.38 1997/10/13 15:03:51 jkh Exp";
#else #else
__RCSID("$NetBSD: perform.c,v 1.13 1998/10/12 12:03:25 agc Exp $"); __RCSID("$NetBSD: perform.c,v 1.14 1998/10/26 17:39:23 agc Exp $");
#endif #endif
#endif #endif
@ -106,16 +106,27 @@ make_dist(char *home, char *pkg, char *suffix, package_t *plist)
fprintf(totar, "%s\n", COMMENT_FNAME); fprintf(totar, "%s\n", COMMENT_FNAME);
fprintf(totar, "%s\n", DESC_FNAME); fprintf(totar, "%s\n", DESC_FNAME);
if (Install) if (Install) {
fprintf(totar, "%s\n", INSTALL_FNAME); fprintf(totar, "%s\n", INSTALL_FNAME);
if (DeInstall) }
if (DeInstall) {
fprintf(totar, "%s\n", DEINSTALL_FNAME); fprintf(totar, "%s\n", DEINSTALL_FNAME);
if (Require) }
if (Require) {
fprintf(totar, "%s\n", REQUIRE_FNAME); fprintf(totar, "%s\n", REQUIRE_FNAME);
if (Display) }
if (Display) {
fprintf(totar, "%s\n", DISPLAY_FNAME); fprintf(totar, "%s\n", DISPLAY_FNAME);
if (Mtree) }
if (Mtree) {
fprintf(totar, "%s\n", MTREE_FNAME); fprintf(totar, "%s\n", MTREE_FNAME);
}
if (BuildVersion) {
(void) fprintf(totar, "%s\n", BUILD_VERSION_FNAME);
}
if (BuildInfo) {
(void) fprintf(totar, "%s\n", BUILD_INFO_FNAME);
}
for (p = plist->head; p; p = p->next) { for (p = plist->head; p; p = p->next) {
if (p->type == PLIST_FILE) if (p->type == PLIST_FILE)
@ -260,8 +271,9 @@ pkg_perform(char **pkgs)
* Run down the list and see if we've named it, if not stick in a name * Run down the list and see if we've named it, if not stick in a name
* at the top. * at the top.
*/ */
if (find_plist(&plist, PLIST_NAME) == NULL) if (find_plist(&plist, PLIST_NAME) == NULL) {
add_plist_top(&plist, PLIST_NAME, basename_of(pkg)); add_plist_top(&plist, PLIST_NAME, basename_of(pkg));
}
/* /*
* We're just here for to dump out a revised plist for the FreeBSD ports * We're just here for to dump out a revised plist for the FreeBSD ports
@ -321,6 +333,16 @@ pkg_perform(char **pkgs)
add_plist(&plist, PLIST_FILE, MTREE_FNAME); add_plist(&plist, PLIST_FILE, MTREE_FNAME);
add_plist(&plist, PLIST_MTREE, MTREE_FNAME); add_plist(&plist, PLIST_MTREE, MTREE_FNAME);
} }
if (BuildVersion) {
copy_file(home, BuildVersion, BUILD_VERSION_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, BUILD_VERSION_FNAME);
}
if (BuildInfo) {
copy_file(home, BuildInfo, BUILD_INFO_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, BUILD_INFO_FNAME);
}
/* Finally, write out the packing list */ /* Finally, write out the packing list */
fp = fopen(CONTENTS_FNAME, "w"); fp = fopen(CONTENTS_FNAME, "w");

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pkg_create.1,v 1.11 1998/10/12 12:03:25 agc Exp $ .\" $NetBSD: pkg_create.1,v 1.12 1998/10/26 17:39:23 agc Exp $
.\" .\"
.\" FreeBSD install - a package for the installation and maintainance .\" FreeBSD install - a package for the installation and maintainance
.\" of non-core utilities. .\" of non-core utilities.
@ -33,17 +33,19 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl ORhvl .Op Fl ORhvl
.Op Fl P Ar dpkgs .Op Fl B Ar build-info-file
.Op Fl C Ar cpkgs .Op Fl C Ar cpkgs
.Op Fl p Ar prefix .Op Fl D Ar displayfile
.Op Fl P Ar dpkgs
.Op Fl X Ar excludefile
.Op Fl b Ar build-version-file
.Op Fl f Ar contents .Op Fl f Ar contents
.Op Fl i Ar iscript .Op Fl i Ar iscript
.Op Fl k Ar dscript .Op Fl k Ar dscript
.Op Fl m Ar mtreefile
.Op Fl p Ar prefix
.Op Fl r Ar rscript .Op Fl r Ar rscript
.Op Fl t Ar template .Op Fl t Ar template
.Op Fl X Ar excludefile
.Op Fl D Ar displayfile
.Op Fl m Ar mtreefile
.Fl c Ar comment .Fl c Ar comment
.Fl d Ar description .Fl d Ar description
.Fl f Ar packlist .Fl f Ar packlist
@ -61,16 +63,68 @@ description of the input syntax is included in this document.
.Sh OPTIONS .Sh OPTIONS
The following command line options are supported: The following command line options are supported:
.Bl -tag -width indent .Bl -tag -width indent
.It Fl f Ar packinglist .It Fl B Ar build-info-file
Fetch ``packing list'' for package from the file Install the file
.Ar packinglist .Ar build-info-file
or so that users of binary packages can see what
.Cm stdin .Xr make 1
if definitions
.Ar packinglist were used to control the build when creating the
is a binary package. This allows various build definitions
.Cm - to be retained in a binary package and viewed wherever it is installed,
(dash). using
.Xr pkginfo 1 .
.It Fl C Ar cpkgs
Set the initial package conflict list to
.Ar cpkgs .
This is assumed to be a whitespace separated list of package names
and is meant as a convenient shorthand for specifying multiple
.Cm @pkgcfl
directives in the packing list (see PACKING LIST DETAILS section below).
.It Fl D Ar displayfile
Display the file (using
.Xr more 1 )
after installing the package. Useful for things like
legal notices on almost-free software, etc.
.It Fl O
Go into a `packing list Only' mode.
This is used to do `fake pkg_add' operations when a package is installed.
In such cases, it is necessary to know what the final, adjusted packing
list will look like.
.It Fl P Ar dpkgs
Set the initial package dependency list to
.Ar dpkgs .
This is assumed to be a whitespace separated list of package names
and is meant as a convenient shorthand for specifying multiple
.Cm @pkgdep
directives in the packing list (see PACKING LIST DETAILS section below).
.It Fl R
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 X Ar excludefile
Pass
.Ar excludefile
as a
.Fl exclude-from
argument to
.Cm tar
when creating final package. See
.Cm tar
man page (or run
.Cm tar
with
.Fl -help
flag) for further information on using this flag.
.It Fl b Ar build-version-file
Install the file
.Ar build-version-file
so that users of binary packages can see what versions of
the files used to control the build were used when creating the
binary package. This allows some fine-grained version control information
to be retained in a binary package and viewed wherever it is installed,
using
.Xr pkg_info 1 .
.It Fl c Ar [-]desc .It Fl c Ar [-]desc
Fetch package ``one line description'' from file Fetch package ``one line description'' from file
.Ar desc .Ar desc
@ -85,20 +139,31 @@ Fetch long description for package from file
or, if preceded by or, if preceded by
.Cm - , .Cm - ,
the argument itself. the argument itself.
.It Fl O .It Fl f Ar packinglist
Go into a `packing list Only' mode. Fetch ``packing list'' for package from the file
This is used to do `fake pkg_add' operations when a package is installed. .Ar packinglist
In such cases, it is necessary to know what the final, adjusted packing or
list will look like. .Cm stdin
.It Fl R if
Re-order any directories in the pkg/PLIST file into reverse alphabetic .Ar packinglist
order, so that child directories will automatically be removed before is a
parent directories. .Cm -
.It Fl v (dash).
Turn on verbose output.
.It Fl h .It Fl h
Force tar to follow symbolic links, so that the files they point to Force tar to follow symbolic links, so that the files they point to
are dumped, rather than the links themselves. are dumped, rather than the links themselves.
.It Fl i Ar iscript
Set
.Ar iscript
to be the install procedure for the package. This can be any
executable program (or shell script). It will be invoked automatically
when the package is later installed.
.It Fl k Ar dscript
Set
.Ar dscript
to be the de-install procedure for the package. This can be any
executable program (or shell script). It will be invoked automatically
when the package is later (if ever) de-installed.
.It Fl l .It Fl l
Check that any symbolic links which are to be placed in the package are Check that any symbolic links which are to be placed in the package are
relative to the current prefix. This means using relative to the current prefix. This means using
@ -107,37 +172,29 @@ and
.Xr symlink 2 .Xr symlink 2
to remove and re-link to remove and re-link
any symbolic links which are targetted at full path names. any symbolic links which are targetted at full path names.
.It Fl i Ar iscript .It Fl m Ar mtreefile
Set Run
.Ar iscript .Xr mtree 8
to be the install procedure for the package. This can be any with input from mtreefile before the package is installed.
executable program (or shell script). It will be invoked automatically Mtree is invoked as
when the package is later installed. .Cm mtree
.It Fl P Ar dpkgs .Fl u
Set the initial package dependency list to .Fl f
.Ar dpkgs . .Ar mtreefile
This is assumed to be a whitespace separated list of package names .Fl d
and is meant as a convenient shorthand for specifying multiple .Fl e
.Cm @pkgdep .Fl p
directives in the packing list (see PACKING LIST DETAILS section below). .Pa prefix ,
.It Fl C Ar cpkgs where
Set the initial package conflict list to .Pa prefix
.Ar cpkgs . is the name of the first directory named by a
This is assumed to be a whitespace separated list of package names .Cm @cwd
and is meant as a convenient shorthand for specifying multiple directive.
.Cm @pkgcfl
directives in the packing list (see PACKING LIST DETAILS section below).
.It Fl p Ar prefix .It Fl p Ar prefix
Set Set
.Ar prefix .Ar prefix
as the initial directory ``base'' to start from in selecting files for as the initial directory ``base'' to start from in selecting files for
the package. the package.
.It Fl k Ar dscript
Set
.Ar dscript
to be the de-install procedure for the package. This can be any
executable program (or shell script). It will be invoked automatically
when the package is later (if ever) de-installed.
.It Fl r Ar rscript .It Fl r Ar rscript
Set Set
.Ar rscript .Ar rscript
@ -158,44 +215,9 @@ space in your
directory is limited. Be sure to leave some number of `X' characters directory is limited. Be sure to leave some number of `X' characters
for for
.Xr mktemp 3 .Xr mktemp 3
to fill in with a unique ID. to fill in with a unique ID.
.It Fl X Ar excludefile .It Fl v
Pass Turn on verbose output.
.Ar excludefile
as a
.Fl exclude-from
argument to
.Cm tar
when creating final package. See
.Cm tar
man page (or run
.Cm tar
with
.Fl -help
flag) for further information on using this flag.
.It Fl D Ar displayfile
Display the file (using
.Xr more 1 )
after installing the package. Useful for things like
legal notices on almost-free software, etc.
.It Fl m Ar mtreefile
Run
.Xr mtree 8
with input from mtreefile before the package is installed.
Mtree is invoked as
.Cm mtree
.Fl u
.Fl f
.Ar mtreefile
.Fl d
.Fl e
.Fl p
.Pa prefix ,
where
.Pa prefix
is the name of the first directory named by a
.Cm @cwd
directive.
.El .El
.Pp .Pp
.Sh PACKING LIST DETAILS .Sh PACKING LIST DETAILS
@ -369,15 +391,10 @@ package is deinstalled. Multiple
.Cm @pkgdep .Cm @pkgdep
directives may be used if the package depends on multiple other packages. directives may be used if the package depends on multiple other packages.
.It Cm @pkgcfl Ar pkgcflname .It Cm @pkgcfl Ar pkgcflname
Declare a conflict to the Declare a conflict with the
.Ar pkgcflname .Ar pkgcflname
package. The package, as the two packages contain references to the same files,
.Ar pkgcflname and so cannot co-exist on the same system.
package must
.Cm not
be installed if
.Ar pkgname
package gets installed cause they install the same files and thus conflict.
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr pkg_add 1 , .Xr pkg_add 1 ,
@ -406,5 +423,3 @@ extracted. They additionally must not end up being split between
invocations due to exec argument-space limitations (this depends on the invocations due to exec argument-space limitations (this depends on the
value returned by value returned by
.Fn sysconf _SC_ARG_MAX ) . .Fn sysconf _SC_ARG_MAX ) .
.Pp
Sure to be others.