diff options
author | kris <kris@FreeBSD.org> | 2003-04-17 09:56:05 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2003-04-17 09:56:05 +0000 |
commit | 7ec422366401f961c808e40fd6b4c95c955ea58f (patch) | |
tree | 8cc602fa2181b3251a7557cd50f7b5898169f909 /usr.sbin/pkg_install/create | |
parent | 52a551e4c5e52ca9df95a65b82e6e31e39f27648 (diff) | |
download | FreeBSD-src-7ec422366401f961c808e40fd6b4c95c955ea58f.zip FreeBSD-src-7ec422366401f961c808e40fd6b4c95c955ea58f.tar.gz |
* Add explicit conflict-checking to the package tools. Packages can
register a list of other packages with which they conflict (via the
-C option to pkg_create), and they will refuse to install (unless -f is
specified) if one of the listed packages is already present.
* Update documentation for the new feature as well as fleshing out some
existing documentation.
* Bump PKG_INSTALL_VERSION so this feature can be tested for.
Submitted by: Sergey Matveychuk <sem@ciam.ru>
PR: bin/47145
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/pkg_install/create')
-rw-r--r-- | usr.sbin/pkg_install/create/create.h | 1 | ||||
-rw-r--r-- | usr.sbin/pkg_install/create/main.c | 17 | ||||
-rw-r--r-- | usr.sbin/pkg_install/create/perform.c | 16 | ||||
-rw-r--r-- | usr.sbin/pkg_install/create/pkg_create.1 | 13 |
4 files changed, 41 insertions, 6 deletions
diff --git a/usr.sbin/pkg_install/create/create.h b/usr.sbin/pkg_install/create/create.h index e7a18b9..0e806fb 100644 --- a/usr.sbin/pkg_install/create/create.h +++ b/usr.sbin/pkg_install/create/create.h @@ -37,6 +37,7 @@ extern char *SrcDir; extern char *ExcludeFrom; extern char *Mtree; extern char *Pkgdeps; +extern char *Conflicts; extern char *Origin; extern char *InstalledPkg; extern char PlayPen[]; diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c index f309853..82da981 100644 --- a/usr.sbin/pkg_install/create/main.c +++ b/usr.sbin/pkg_install/create/main.c @@ -16,7 +16,7 @@ __FBSDID("$FreeBSD$"); #include "lib.h" #include "create.h" -static char Options[] = "YNOhjvyzf:p:P:c:d:i:I:k:K:r:t:X:D:m:s:o:b:"; +static char Options[] = "YNOhjvyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:o:b:"; char *Prefix = NULL; char *Comment = NULL; @@ -32,6 +32,7 @@ char *Require = NULL; char *ExcludeFrom = NULL; char *Mtree = NULL; char *Pkgdeps = NULL; +char *Conflicts = NULL; char *Origin = NULL; char *InstalledPkg = NULL; char PlayPen[FILENAME_MAX]; @@ -78,6 +79,10 @@ main(int argc, char **argv) Contents = optarg; break; + case 'C': + Conflicts = optarg; + break; + case 'c': Comment = optarg; break; @@ -195,11 +200,11 @@ static void usage() { fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n", -"usage: pkg_create [-YNOhvy] [-P pkgs] [-p prefix] [-f contents] [-i iscript]", -" [-I piscript] [-k dscript] [-K pdscript] [-r rscript] ", -" [-t template] [-X excludefile] [-D displayfile] ", -" [-m mtreefile] [-o origin] -c comment -d description ", -" -f packlist pkg-filename", +"usage: pkg_create [-YNOhvy] [-P pkgs] [-C conflicts] [-p prefix] [-f contents] ", +" [-i iscript] [-I piscript] [-k dscript] [-K pdscript] ", +" [-r rscript] [-t template] [-X excludefile] ", +" [-D displayfile] [-m mtreefile] [-o origin] ", +" -c comment -d description -f packlist pkg-filename", " pkg_create [-YNhvy] -b pkg-name [pkg-filename]"); exit(1); } diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index 859cc3e..db6847f 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -145,6 +145,22 @@ pkg_perform(char **pkgs) printf(".\n"); } + /* Put the conflicts directly after the dependencies, if any */ + if (Conflicts) { + if (Verbose && !PlistOnly) + printf("Registering conflicts:"); + while (Conflicts) { + cp = strsep(&Conflicts, " \t\n"); + if (*cp) { + add_plist(&plist, PLIST_CONFLICTS, cp); + if (Verbose && !PlistOnly) + printf(" %s", cp); + } + } + if (Verbose && !PlistOnly) + printf(".\n"); + } + /* If a SrcDir override is set, add it now */ if (SrcDir) { if (Verbose && !PlistOnly) diff --git a/usr.sbin/pkg_install/create/pkg_create.1 b/usr.sbin/pkg_install/create/pkg_create.1 index 9edd183..08aae7b 100644 --- a/usr.sbin/pkg_install/create/pkg_create.1 +++ b/usr.sbin/pkg_install/create/pkg_create.1 @@ -32,6 +32,7 @@ .Sh SYNOPSIS .Nm .Op Fl YNOhjvyz +.Op Fl C Ar conflicts .Op Fl P Ar pkgs .Op Fl p Ar prefix .Op Fl f Ar contents @@ -142,6 +143,13 @@ executable program (or shell script). It will be invoked automatically when the package is later installed. It will be passed the package's name as the first argument. +.It Fl C Ar conflicts +Set the initial package conflict list to +.Ar conflicts . +This is assumed to be a whitespace separated list of package names +and is meant as a convenient shorthand for specifying multiple +.Cm @conflicts +directives in the packing list (see PACKING LIST DETAILS section below). .It Fl P Ar pkgs Set the initial package dependency list to .Ar pkgs . @@ -482,6 +490,11 @@ installed, and this package must be deinstalled before the package is deinstalled. Multiple .Cm @pkgdep directives may be used if the package depends on multiple other packages. +.It Cm @conflicts Ar pkgcflname +Declare a conflict with the +.Ar pkgcflname +package, as the two packages contain references to the same files, +and so cannot co-exist on the same system. .El .Sh ENVIRONMENT The environment variable |