Add -I argument to pkg_create so that the real prefix can be specified

for the @src and @cwd PLIST directives.

Bump version number.
This commit is contained in:
agc 2001-05-21 09:17:28 +00:00
parent cdc294674b
commit 95a52b2709
8 changed files with 55 additions and 39 deletions

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.58 2001/03/28 12:46:01 hubertf Exp $ */
/* $NetBSD: perform.c,v 1.59 2001/05/21 09:17:28 agc Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
__RCSID("$NetBSD: perform.c,v 1.58 2001/03/28 12:46:01 hubertf Exp $");
__RCSID("$NetBSD: perform.c,v 1.59 2001/05/21 09:17:28 agc Exp $");
#endif
#endif
@ -294,7 +294,7 @@ pkg_do(char *pkg)
/* If we're running in MASTER mode, just output the plist and return */
if (AddMode == MASTER) {
printf("%s\n", where_playpen());
write_plist(&Plist, stdout);
write_plist(&Plist, stdout, NULL);
return 0;
}
}
@ -669,7 +669,7 @@ pkg_do(char *pkg)
contents);
goto success; /* can't log, but still keep pkg */
}
write_plist(&Plist, cfile);
write_plist(&Plist, cfile, NULL);
fclose(cfile);
move_file(".", DESC_FNAME, LogDir);
move_file(".", COMMENT_FNAME, LogDir);

View File

@ -1,4 +1,4 @@
/* $NetBSD: create.h,v 1.15 2001/05/18 13:21:38 agc Exp $ */
/* $NetBSD: create.h,v 1.16 2001/05/21 09:17:30 agc Exp $ */
/* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */
@ -42,6 +42,7 @@ extern char *BuildInfo;
extern char *SizePkg;
extern char *SizeAll;
extern char *SrcDir;
extern char *realprefix;
extern char PlayPen[];
extern size_t PlayPenSize;
extern int Dereference;

View File

@ -1,11 +1,11 @@
/* $NetBSD: main.c,v 1.18 2001/05/18 13:21:38 agc Exp $ */
/* $NetBSD: main.c,v 1.19 2001/05/21 09:17:30 agc Exp $ */
#include <sys/cdefs.h>
#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.18 2001/05/18 13:21:38 agc Exp $");
__RCSID("$NetBSD: main.c,v 1.19 2001/05/21 09:17:30 agc Exp $");
#endif
#endif
@ -24,7 +24,7 @@ __RCSID("$NetBSD: main.c,v 1.18 2001/05/18 13:21:38 agc Exp $");
#include "lib.h"
#include "create.h"
static char Options[] = "ORhlVvFf:p:P:C:c:d:i:k:L:r:t:X:D:m:s:S:b:B:U";
static char Options[] = "ORhlVvFf:p:P:C:c:d:i:k:L:r:t:X:D:m:s:S:b:B:UI:";
char *Prefix = NULL;
char *Comment = NULL;
@ -43,6 +43,7 @@ char *BuildInfo = NULL;
char *SizePkg = NULL;
char *SizeAll = NULL;
char *SrcDir = NULL;
char *realprefix = NULL;
char PlayPen[FILENAME_MAX];
size_t PlayPenSize = sizeof(PlayPen);
int update_pkgdb = 1;
@ -60,6 +61,7 @@ usage(void)
" [-i iscript] [-k dscript] [-r rscript] [-t template]",
" [-X excludefile] [-D displayfile] [-m mtreefile]",
" [-b build-version-file] [-B build-info-file]",
" [-I realprefix]",
" -c comment -d description -f packlist pkg-name");
exit(1);
}
@ -77,6 +79,10 @@ main(int argc, char **argv)
Verbose = TRUE;
break;
case 'I':
realprefix = optarg;
break;
case 'O':
PlistOnly = 1;
break;

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.25 2001/03/04 18:16:42 hubertf Exp $ */
/* $NetBSD: perform.c,v 1.26 2001/05/21 09:17:30 agc Exp $ */
#include <sys/cdefs.h>
#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.25 2001/03/04 18:16:42 hubertf Exp $");
__RCSID("$NetBSD: perform.c,v 1.26 2001/05/21 09:17:30 agc Exp $");
#endif
#endif
@ -297,7 +297,7 @@ pkg_perform(lpkg_head_t *pkgs)
*/
if (PlistOnly) {
check_list(home, &plist, basename_of(pkg));
write_plist(&plist, stdout);
write_plist(&plist, stdout, realprefix);
exit(0);
}
@ -374,7 +374,7 @@ pkg_perform(lpkg_head_t *pkgs)
cleanup(0);
errx(2, "can't open file %s for writing", CONTENTS_FNAME);
}
write_plist(&plist, fp);
write_plist(&plist, fp, realprefix);
if (fclose(fp)) {
cleanup(0);
errx(2, "error while closing %s", CONTENTS_FNAME);

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pkg_create.1,v 1.28 2001/05/18 13:21:38 agc Exp $
.\" $NetBSD: pkg_create.1,v 1.29 2001/05/21 09:17:31 agc Exp $
.\"
.\" FreeBSD install - a package for the installation and maintainance
.\" of non-core utilities.
@ -58,6 +58,9 @@
.Op Fl i Ar iscript
.Ek
.Bk -words
.Op Fl I Ar realprefix
.Ek
.Bk -words
.Op Fl k Ar dscript
.Ek
.Bk -words
@ -161,6 +164,9 @@ is a
.It Fl h
Force tar to follow symbolic links, so that the files they point to
are dumped, rather than the links themselves.
.It Fl I Ar realprefix
Provide the real prefix, as opposed to the staging prefix, for use in
staged installations of packages.
.It Fl i Ar iscript
Set
.Ar iscript

View File

@ -1,4 +1,4 @@
/* $NetBSD: lib.h,v 1.34 2001/04/28 20:55:34 hubertf Exp $ */
/* $NetBSD: lib.h,v 1.35 2001/05/21 09:17:31 agc Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@ -230,7 +230,7 @@ void csum_plist_entry(char *, plist_t *);
void add_plist(package_t *, pl_ent_t, char *);
void add_plist_top(package_t *, pl_ent_t, char *);
void delete_plist(package_t *pkg, Boolean all, pl_ent_t type, char *name);
void write_plist(package_t *, FILE *);
void write_plist(package_t *, FILE *, char *);
void read_plist(package_t *, FILE *);
int plist_cmd(char *, char **);
int delete_package(Boolean, Boolean, package_t *);

View File

@ -1,11 +1,11 @@
/* $NetBSD: plist.c,v 1.28 2001/04/17 10:33:35 hubertf Exp $ */
/* $NetBSD: plist.c,v 1.29 2001/05/21 09:17:31 agc Exp $ */
#include <sys/cdefs.h>
#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.28 2001/04/17 10:33:35 hubertf Exp $");
__RCSID("$NetBSD: plist.c,v 1.29 2001/05/21 09:17:31 agc Exp $");
#endif
#endif
@ -39,29 +39,30 @@ typedef struct cmd_t {
char *c_s; /* string to recognise */
pl_ent_t c_type; /* type of command */
int c_argc; /* # of arguments */
int c_subst; /* can substitute real prefix */
} 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},
{"mode", PLIST_CHMOD, 1},
{"owner", PLIST_CHOWN, 1},
{"group", PLIST_CHGRP, 1},
{"comment", PLIST_COMMENT, 1},
{"ignore", PLIST_IGNORE, 0},
{"ignore_inst", PLIST_IGNORE_INST, 0},
{"name", PLIST_NAME, 1},
{"display", PLIST_DISPLAY, 1},
{"pkgdep", PLIST_PKGDEP, 1},
{"pkgcfl", PLIST_PKGCFL, 1},
{"mtree", PLIST_MTREE, 1},
{"dirrm", PLIST_DIR_RM, 1},
{"option", PLIST_OPTION, 1},
{NULL, FAIL, 0}
{"cwd", PLIST_CWD, 1, 1},
{"src", PLIST_SRC, 1, 1},
{"cd", PLIST_CWD, 1, 0},
{"exec", PLIST_CMD, 1, 0},
{"unexec", PLIST_UNEXEC, 1, 0},
{"mode", PLIST_CHMOD, 1, 0},
{"owner", PLIST_CHOWN, 1, 0},
{"group", PLIST_CHGRP, 1, 0},
{"comment", PLIST_COMMENT, 1, 0},
{"ignore", PLIST_IGNORE, 0, 0},
{"ignore_inst", PLIST_IGNORE_INST, 0, 0},
{"name", PLIST_NAME, 1, 0},
{"display", PLIST_DISPLAY, 1, 0},
{"pkgdep", PLIST_PKGDEP, 1, 0},
{"pkgcfl", PLIST_PKGCFL, 1, 0},
{"mtree", PLIST_MTREE, 1, 0},
{"dirrm", PLIST_DIR_RM, 1, 0},
{"option", PLIST_OPTION, 1, 0},
{NULL, FAIL, 0, 0}
};
/*
@ -288,7 +289,7 @@ read_plist(package_t *pkg, FILE * fp)
* Write a packing list to a file, converting commands to ASCII equivs
*/
void
write_plist(package_t *pkg, FILE * fp)
write_plist(package_t *pkg, FILE * fp, char *realprefix)
{
plist_t *p;
cmd_t *cmdp;
@ -305,6 +306,8 @@ write_plist(package_t *pkg, FILE * fp)
warnx("Unknown PLIST command type %d (%s)", p->type, p->name);
} else if (cmdp->c_argc == 0) {
(void) fprintf(fp, "%c%s\n", CMD_CHAR, cmdp->c_s);
} else if (cmdp->c_subst && realprefix) {
(void) fprintf(fp, "%c%s %s\n", CMD_CHAR, cmdp->c_s, realprefix);
} else {
(void) fprintf(fp, "%c%s %s\n", CMD_CHAR, cmdp->c_s,
(p->name) ? p->name : "");

View File

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.5 2001/05/18 13:21:39 agc Exp $ */
/* $NetBSD: version.h,v 1.6 2001/05/21 09:17:31 agc Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@ -33,6 +33,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
#define PKGTOOLS_VERSION "20010518"
#define PKGTOOLS_VERSION "20010519"
#endif /* _INST_LIB_VERSION_H_ */