summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-04-09 15:05:01 +0000
committerjkh <jkh@FreeBSD.org>1995-04-09 15:05:01 +0000
commite8ff66af03039a32b2bdf2f4bba9843809a54cd2 (patch)
treef273cc944338bcf02c0c1057a024d5fdbf75658e
parentdbdb475f26b4d6f6d822f6bc625b0a9fc81e4b4c (diff)
downloadFreeBSD-src-e8ff66af03039a32b2bdf2f4bba9843809a54cd2.zip
FreeBSD-src-e8ff66af03039a32b2bdf2f4bba9843809a54cd2.tar.gz
Add true support for dependency lists.
1. pkg_create now has a -P argument for specifying dependencies on the command line. 2. pkg_add will honor dependencies and chain-load them automatically if it finds the required package(s) in the same directory as the package that is being loaded. For best results, install packages from a directory containing all the packages you'll possibly need (like /usr/ports/packages/all). 2 remaining flaws: 1. pkg_add looks in one place (where you were when you loaded the primary pkg) for depended packages. If you can come up with a search path scheme that's not a total hack - be my guest! 2. Recursive dependency expansion can result in the name of a dep being listed more than once. This doesn't bother pkg_add since it checks for package existance with pkg_info and will skip already-loaded packages. I don't know how/if pkg_delete handles this yet, however. I need to look into it.
-rw-r--r--usr.sbin/pkg_install/add/add.h3
-rw-r--r--usr.sbin/pkg_install/add/main.c3
-rw-r--r--usr.sbin/pkg_install/add/perform.c29
-rw-r--r--usr.sbin/pkg_install/create/create.h3
-rw-r--r--usr.sbin/pkg_install/create/main.c10
-rw-r--r--usr.sbin/pkg_install/create/perform.c10
-rw-r--r--usr.sbin/pkg_install/create/pkg_create.111
7 files changed, 55 insertions, 14 deletions
diff --git a/usr.sbin/pkg_install/add/add.h b/usr.sbin/pkg_install/add/add.h
index 5bbaa2e..fe9b5fa 100644
--- a/usr.sbin/pkg_install/add/add.h
+++ b/usr.sbin/pkg_install/add/add.h
@@ -1,4 +1,4 @@
-/* $Id: add.h,v 1.3 1993/09/05 04:53:47 jkh Exp $ */
+/* $Id: add.h,v 1.4 1994/12/06 00:51:31 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@@ -36,6 +36,7 @@ extern char *Directory;
extern char *PkgName;
extern char *PlayPen;
extern add_mode_t AddMode;
+extern char *Home;
int make_hierarchy(char *);
void extract_plist(char *, Package *);
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index 341b700..e8b053b 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char *rcsid = "$Id: main.c,v 1.4 1993/09/14 19:53:01 jkh Exp $";
+static char *rcsid = "$Id: main.c,v 1.5 1994/12/06 00:51:33 jkh Exp $";
#endif
/*
@@ -39,6 +39,7 @@ char *Group = NULL;
char *PkgName = NULL;
char *Directory = NULL;
char *PlayPen = NULL;
+char *Home = NULL;
add_mode_t AddMode = NORMAL;
int
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c
index f5f5f07..da64fae 100644
--- a/usr.sbin/pkg_install/add/perform.c
+++ b/usr.sbin/pkg_install/add/perform.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char *rcsid = "$Id: perform.c,v 1.12 1994/11/17 10:53:21 jkh Exp $";
+static const char *rcsid = "$Id: perform.c,v 1.13 1994/12/06 00:51:34 jkh Exp $";
#endif
/*
@@ -100,7 +100,7 @@ pkg_do(char *pkg)
return 1;
}
sb.st_size *= 4;
- (void)make_playpen(PlayPen, sb.st_size);
+ Home = make_playpen(PlayPen, sb.st_size);
if (unpack(pkg_fullname, NULL))
return 1;
@@ -142,13 +142,28 @@ pkg_do(char *pkg)
for (p = Plist.head; p ; p = p->next) {
if (p->type != PLIST_PKGDEP)
continue;
- if (Verbose)
- printf("Checking dependency on package list `%s'\n", p->name);
if (!Fake && vsystem("pkg_info -e %s", p->name)) {
- whinge("Package `%s' depends on missing package `%s'%s.", PkgName,
+ char tmp[120];
+
+ sprintf(tmp, "%s/%s.tgz", Home, p->name);
+ if (fexists(tmp)) {
+ if (Verbose)
+ printf("Package `%s' depends on `%s': Trying to load it.\n", PkgName, p->name);
+ if (vsystem("pkg_add %s", tmp)) {
+ whinge("Autoload of dependency package `%s' failed!%s",
+ p->name, Force ? " (proceeding anyway)" : "");
+ if (!Force)
+ code++;
+ }
+ else if (Verbose)
+ printf("Dependency `%s' loaded successfully.\n", p->name);
+ }
+ else {
+ whinge("Package `%s' depends on missing package `%s'%s.", PkgName,
p->name, Force ? " (proceeding anyway)" : "");
- if (!Force)
- code++;
+ if (!Force)
+ code++;
+ }
}
}
if (code != 0)
diff --git a/usr.sbin/pkg_install/create/create.h b/usr.sbin/pkg_install/create/create.h
index e0ee4cc..e64cf29 100644
--- a/usr.sbin/pkg_install/create/create.h
+++ b/usr.sbin/pkg_install/create/create.h
@@ -1,4 +1,4 @@
-/* $Id: create.h,v 1.5 1994/05/19 18:27:38 alm Exp $ */
+/* $Id: create.h,v 1.6 1994/12/06 00:51:35 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@@ -34,6 +34,7 @@ extern char *Require;
extern char *PlayPen;
extern char *ExcludeFrom;
extern char *Mtree;
+extern char *Pkgdeps;
extern int Dereference;
void check_list(char *, Package *);
diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c
index 623d7d1..e3058dd 100644
--- a/usr.sbin/pkg_install/create/main.c
+++ b/usr.sbin/pkg_install/create/main.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char *rcsid = "$Id: main.c,v 1.7 1994/05/19 18:27:40 alm Exp $";
+static const char *rcsid = "$Id: main.c,v 1.8 1994/12/06 00:51:36 jkh Exp $";
#endif
/*
@@ -16,7 +16,7 @@ static const char *rcsid = "$Id: main.c,v 1.7 1994/05/19 18:27:40 alm Exp $";
#include "lib.h"
#include "create.h"
-static char Options[] = "YNhvf:p:c:d:i:k:r:t:X:D:m:";
+static char Options[] = "YNhvf:p:P:c:d:i:k:r:t:X:D:m:";
char *Prefix = NULL;
char *Comment = NULL;
@@ -29,6 +29,7 @@ char *Require = NULL;
char *PlayPen = NULL;
char *ExcludeFrom = NULL;
char *Mtree = NULL;
+char *Pkgdeps = NULL;
int Dereference = 0;
int
@@ -101,6 +102,10 @@ main(int argc, char **argv)
Mtree = optarg;
break;
+ case 'P':
+ Pkgdeps = optarg;
+ break;
+
case '?':
default:
usage(prog_name, NULL);
@@ -153,6 +158,7 @@ usage(const char *name, const char *fmt, ...)
fprintf(stderr, "-k script de-install script\n");
fprintf(stderr, "-D file install notice\n");
fprintf(stderr, "-m file mtree spec for directories\n");
+ fprintf(stderr, "-P pkgs set package dependency list to pkgs\n");
fprintf(stderr, "-p prefix install prefix will be arg\n");
fprintf(stderr, "-r script pre/post requirements script\n");
fprintf(stderr, "-t temp use temp as template for mktemp()\n");
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index 6d15ef8..fb72a51 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char *rcsid = "$Id: perform.c,v 1.13 1994/11/17 10:54:11 jkh Exp $";
+static const char *rcsid = "$Id: perform.c,v 1.14 1994/12/06 00:51:37 jkh Exp $";
#endif
/*
@@ -62,6 +62,14 @@ pkg_perform(char **pkgs)
else
suffix = "tgz";
+ /* Stick the dependencies, if any, at the top */
+ while (Pkgdeps) {
+ cp = strsep(&Pkgdeps, " \t\n");
+ if (*cp) {
+ add_plist(&plist, PLIST_PKGDEP, cp);
+ }
+ }
+
/* Slurp in the packing list */
read_plist(&plist, pkg_in);
diff --git a/usr.sbin/pkg_install/create/pkg_create.1 b/usr.sbin/pkg_install/create/pkg_create.1
index c2fc2bb..e5424a9 100644
--- a/usr.sbin/pkg_install/create/pkg_create.1
+++ b/usr.sbin/pkg_install/create/pkg_create.1
@@ -15,7 +15,7 @@
.\"
.\"
.\" @(#)pkg_create.8
-.\" $Id: pkg_create.1,v 1.11 1995/01/05 10:22:51 jkh Exp $
+.\" $Id: pkg_create.1,v 1.12 1995/01/05 10:37:09 jkh Exp $
.\" hacked up by John Kohl for NetBSD--fixed a few bugs, extended keywords,
.\" added dependency tracking, etc.
.\"
@@ -28,6 +28,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl YNhv
+.Op Fl P Ar pkgs
.Op Fl p Ar prefix
.Op Fl f Ar contents
.Op Fl i Ar iscript
@@ -99,6 +100,14 @@ 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.
.Em "Optional."
+.It Fl P Ar pkgs
+Sets the initial package dependency list to
+.Ar pkgs.
+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).
+.Em "Optional."
.It Fl p Ar prefix
Sets
.Ar prefix
OpenPOWER on IntegriCloud