Lots of misc tweaks, support for arbitrary separators in pkg_info, more

intelligent name handling in pkg_create.  Most of these files are changed
because of rcsid's being different in my cvs tree and freefall's (foo).
This commit is contained in:
Jordan K. Hubbard 1993-09-03 23:01:17 +00:00
parent 1dc20d5093
commit a9c42a2388
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=379
28 changed files with 101 additions and 40 deletions

View file

@ -1,6 +1,6 @@
PROG= pkg_add
CFLAGS+= -I${.CURDIR}/../lib
CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
LDADD+= -L${.CURDIR}/../lib -linstall
SRCS= main.c perform.c futil.c extract.c

View file

@ -1,4 +1,4 @@
/* $Id: add.h,v 1.3 1993/08/24 09:23:13 jkh Exp $ */
/* $Id: add.h,v 1.4 1993/09/04 05:06:25 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: extract.c,v 1.4 1993/08/24 09:23:14 jkh Exp $";
static const char *rcsid = "$Id: extract.c,v 1.5 1993/09/04 05:06:26 jkh Exp $";
#endif
/*

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: futil.c,v 1.3 1993/08/26 08:12:25 jkh Exp $";
static const char *rcsid = "$Id: futil.c,v 1.4 1993/09/04 05:06:27 jkh Exp $";
#endif
/*

View file

@ -1,5 +1,5 @@
#ifndef lint
static char *rcsid = "$Id: main.c,v 1.5 1993/08/26 08:46:54 jkh Exp $";
static char *rcsid = "$Id: main.c,v 1.6 1993/09/04 05:06:28 jkh Exp $";
#endif
/*

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: perform.c,v 1.7 1993/08/26 08:46:55 jkh Exp $";
static const char *rcsid = "$Id: perform.c,v 1.8 1993/09/04 05:06:29 jkh Exp $";
#endif
/*

View file

@ -1,6 +1,6 @@
PROG= pkg_create
CFLAGS+= -I${.CURDIR}/../lib
CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
LDADD+= -L${.CURDIR}/../lib -linstall
SRCS= main.c perform.c pl.c

View file

@ -1,4 +1,4 @@
/* $Id: create.h,v 1.3 1993/08/24 09:23:32 jkh Exp $ */
/* $Id: create.h,v 1.4 1993/09/04 05:06:32 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: main.c,v 1.3 1993/08/20 08:52:39 jkh Exp $";
static const char *rcsid = "$Id: main.c,v 1.4 1993/09/04 05:06:33 jkh Exp $";
#endif
/*

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: perform.c,v 1.4 1993/08/26 08:12:52 jkh Exp $";
static const char *rcsid = "$Id: perform.c,v 1.5 1993/09/04 05:06:33 jkh Exp $";
#endif
/*
@ -62,14 +62,19 @@ pkg_perform(char **pkgs)
else
suffix = "tgz";
/* Register the package name (base part) */
add_plist(&plist, PLIST_NAME, pkg);
if (Prefix)
add_plist(&plist, PLIST_CWD, Prefix);
/* Slurp in the packing list */
read_plist(&plist, pkg_in);
/*
* Run down the list and see if we've named it, if not stick in a name
* at the top.
*/
if (!in_plist(&plist, PLIST_NAME))
add_plist_top(&plist, PLIST_NAME, pkg);
/* Make a directory to stomp around in */
home = make_playpen();
signal(SIGINT, cleanup);

View file

@ -121,6 +121,9 @@ in the packing list. Briefly described, these sequences are:
Sets the internal directory pointer to point to
.I directory.
All subsequent filenames will be assumed relative to this directory.
Note:
.BI @cd
is also an alias for this command.
.TP
.BI "@exec\ " command
Execute

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: pl.c,v 1.4 1993/08/26 08:12:53 jkh Exp $";
static const char *rcsid = "$Id: pl.c,v 1.5 1993/09/04 05:06:34 jkh Exp $";
#endif
/*

View file

@ -1,6 +1,6 @@
PROG= pkg_delete
CFLAGS+= -I${.CURDIR}/../lib
CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
LDADD+= -L${.CURDIR}/../lib -linstall
SRCS= main.c perform.c

View file

@ -1,5 +1,5 @@
#ifndef lint
static char *rcsid = "$Id: main.c,v 1.4 1993/08/26 08:47:02 jkh Exp $";
static char *rcsid = "$Id: main.c,v 1.5 1993/09/04 05:06:38 jkh Exp $";
#endif
/*

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: perform.c,v 1.1 1993/08/20 08:53:36 jkh Exp $";
static const char *rcsid = "$Id: perform.c,v 1.2 1993/09/04 05:06:39 jkh Exp $";
#endif
/*

View file

@ -1,6 +1,6 @@
PROG= pkg_info
CFLAGS+= -I${.CURDIR}/../lib
CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
LDADD+= -L${.CURDIR}/../lib -linstall
SRCS= main.c perform.c show.c

View file

@ -1,4 +1,4 @@
/* $Id: info.h,v 1.3 1993/08/26 08:47:04 jkh Exp $ */
/* $Id: info.h,v 1.4 1993/09/04 05:06:40 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@ -34,6 +34,7 @@
extern int Flags;
extern Boolean AllInstalled;
extern char *InfoPrefix;
extern void show_file(char *, char *);
extern void show_plist(char *, Package *, plist_t);

View file

@ -1,5 +1,5 @@
#ifndef lint
static char *rcsid = "$Header: /usr1/cvs/jkh/pkg_install/info/main.c,v 1.4 1993/08/26 08:47:05 jkh Exp $";
static char *rcsid = "$Header: /usr1/cvs/jkh/pkg_install/info/main.c,v 1.5 1993/09/04 05:06:41 jkh Exp $";
#endif
/*
@ -26,10 +26,11 @@ static char *rcsid = "$Header: /usr1/cvs/jkh/pkg_install/info/main.c,v 1.4 1993/
#include "lib.h"
#include "info.h"
static char Options[] = "acdfikrpIvh";
static char Options[] = "acdfikrpIvhl:";
int Flags = 0;
Boolean AllInstalled = FALSE;
char *InfoPrefix = "";
int
main(int argc, char **argv)
@ -84,6 +85,10 @@ main(int argc, char **argv)
Flags |= SHOW_REQUIRE;
break;
case 'l':
InfoPrefix = optarg;
break;
case 'h':
case '?':
default:
@ -132,6 +137,7 @@ usage(const char *name, const char *fmt, ...)
fprintf(stderr, "-k show deinstall script\n");
fprintf(stderr, "-r show requirements script\n");
fprintf(stderr, "-p show prefix\n");
fprintf(stderr, "-l <str> Prefix each info catagory with <str>\n");
fprintf(stderr, "-v show all information\n");
fprintf(stderr, "\n[no args = -c -d]\n");
exit(1);

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: perform.c,v 1.3 1993/08/26 08:47:06 jkh Exp $";
static const char *rcsid = "$Id: perform.c,v 1.4 1993/09/04 05:06:43 jkh Exp $";
#endif
/*
@ -117,19 +117,19 @@ pkg_do(char *pkg)
}
else {
/* Start showing the package contents */
printf(" Information for %s:\n\n", pkg);
printf("%sInformation for %s:\n\n", InfoPrefix, pkg);
if (Flags & SHOW_COMMENT)
show_file(" Comment:\n", COMMENT_FNAME);
show_file("Comment:\n", COMMENT_FNAME);
if (Flags & SHOW_DESC)
show_file(" Description:\n", DESC_FNAME);
show_file("Description:\n", DESC_FNAME);
if (Flags & SHOW_PLIST)
show_plist(" Packing list:\n", &plist, (plist_t)-1);
show_plist("Packing list:\n", &plist, (plist_t)-1);
if ((Flags & SHOW_INSTALL) && fexists(INSTALL_FNAME))
show_file(" Install script:\n", INSTALL_FNAME);
show_file("Install script:\n", INSTALL_FNAME);
if ((Flags & SHOW_DEINSTALL) && fexists(DEINSTALL_FNAME))
show_file(" De-Install script:\n", DEINSTALL_FNAME);
show_file("De-Install script:\n", DEINSTALL_FNAME);
if (Flags & SHOW_PREFIX)
show_plist(" Prefix(s):\n", &plist, PLIST_CWD);
show_plist("Prefix(s):\n", &plist, PLIST_CWD);
putchar('\014');
}
free_plist(&plist);

View file

@ -62,6 +62,15 @@ Show the de-install script (if any) for each package.
.TP
.B \-r
Show the requirements script (if any) for each package.
.TP
.BI "\-l\ " str
Prefix each catagory of information shown with
.I str.
This is primarily of use to front-end programs who want to request a
lot of different information fields at once for a package, but don't
necessary want the output intermingled in such a way that they can't
organize it. This lets you add a special token to the start of
each field.
.PP
.SH "TECHNICAL DETAILS"
Package info is either extracted from files supplied on the

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: show.c,v 1.3 1993/08/26 08:47:07 jkh Exp $";
static const char *rcsid = "$Id: show.c,v 1.4 1993/09/04 05:06:44 jkh Exp $";
#endif
/*
@ -32,7 +32,7 @@ show_file(char *title, char *fname)
char line[1024];
int n;
printf(title);
printf("%s%s", InfoPrefix, title);
fp = fopen(fname, "r");
if (!fp) {
whinge("show_file: Can't open '%s' for reading.", fname);
@ -51,7 +51,7 @@ show_plist(char *title, Package *plist, plist_t type)
PackingList p;
Boolean ign = FALSE;
printf(title);
printf("%s%s", InfoPrefix, title);
p = plist->head;
while (p) {
if (p->type != type && type != -1) {

View file

@ -1,5 +1,6 @@
LIB= install
SRCS= file.c msg.c plist.c str.c exec.c global.c pen.c
CFLAGS+= ${DEBUG}
NOPROFILE= yes
install:

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: exec.c,v 1.3 1993/08/24 09:24:04 jkh Exp $";
static const char *rcsid = "$Id: exec.c,v 1.4 1993/09/04 05:06:47 jkh Exp $";
#endif
/*

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: file.c,v 1.5 1993/08/26 08:13:48 jkh Exp $";
static const char *rcsid = "$Id: file.c,v 1.6 1993/09/04 05:06:48 jkh Exp $";
#endif
/*

View file

@ -1,4 +1,4 @@
/* $Id: lib.h,v 1.4 1993/08/24 09:24:07 jkh Exp $ */
/* $Id: lib.h,v 1.5 1993/09/04 05:06:49 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@ -123,10 +123,12 @@ Boolean y_or_n(Boolean, const char *, ...);
/* Packing list */
PackingList new_plist_entry(void);
PackingList last_plist(Package *);
Boolean in_plist(Package *, plist_t);
void free_plist(Package *);
void mark_plist(Package *);
void csum_plist_entry(char *, PackingList);
void add_plist(Package *, int, char *);
void add_plist(Package *, plist_t, char *);
void add_plist_top(Package *, plist_t, char *);
void write_plist(Package *, FILE *);
void read_plist(Package *, FILE *);
int plist_cmd(char *, char **);

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: msg.c,v 1.2 1993/08/16 14:20:18 jkh Exp $";
static const char *rcsid = "$Id: msg.c,v 1.3 1993/09/04 05:06:50 jkh Exp $";
#endif
/*

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: pen.c,v 1.1 1993/08/24 09:24:08 jkh Exp $";
static const char *rcsid = "$Id: pen.c,v 1.2 1993/09/04 05:06:51 jkh Exp $";
#endif
/*

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: plist.c,v 1.5 1993/08/26 08:13:49 jkh Exp $";
static const char *rcsid = "$Id: plist.c,v 1.6 1993/09/04 05:06:52 jkh Exp $";
#endif
/*
@ -26,7 +26,7 @@ static const char *rcsid = "$Id: plist.c,v 1.5 1993/08/26 08:13:49 jkh Exp $";
/* Add an item to a packing list */
void
add_plist(Package *p, int type, char *arg)
add_plist(Package *p, plist_t type, char *arg)
{
PackingList tmp;
@ -43,6 +43,24 @@ add_plist(Package *p, int type, char *arg)
}
}
void
add_plist_top(Package *p, plist_t type, char *arg)
{
PackingList tmp;
tmp = new_plist_entry();
tmp->name = copy_string(arg);
tmp->type = type;
if (!p->head)
p->head = p->tail = tmp;
else {
tmp->next = p->head;
p->head->prev = tmp;
p->head = tmp;
}
}
/* Return the last (most recent) entry in a packing list */
PackingList
last_plist(Package *p)
@ -62,6 +80,20 @@ mark_plist(Package *pkg)
}
}
/* Return whether or not there is an item of 'type' in the list */
Boolean
in_plist(Package *pkg, plist_t type)
{
PackingList p = pkg->head;
while (p) {
if (p->type == type)
return TRUE;
p = p->next;
}
return FALSE;
}
/* Allocate a new packing list entry */
PackingList
new_plist_entry(void)
@ -116,6 +148,8 @@ plist_cmd(char *s, char **arg)
*arg = sp;
if (!strcmp(cmd, "cwd"))
return PLIST_CWD;
else if (!strcmp(cmd, "cd"))
return PLIST_CWD;
else if (!strcmp(cmd, "exec"))
return PLIST_CMD;
else if (!strcmp(cmd, "mode"))
@ -226,7 +260,7 @@ delete_package(Boolean ign_err, Package *pkg)
if (p->type == PLIST_CWD) {
Where = p->name;
if (Verbose)
printf("Delete: (CWD to %s)\n", Where);
printf("(CWD to %s)\n", Where);
}
else if (p->type == PLIST_IGNORE)
p = p->next;