Add support for CONFLICTS entry, implement -C switch for pkg_create
and document that new feature.
This commit is contained in:
parent
486c074973
commit
dd2f801595
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: perform.c,v 1.10 1998/05/06 15:05:29 agc Exp $ */
|
||||
/* $NetBSD: perform.c,v 1.11 1998/06/05 11:22:19 frueauf 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.10 1998/05/06 15:05:29 agc Exp $");
|
||||
__RCSID("$NetBSD: perform.c,v 1.11 1998/06/05 11:22:19 frueauf Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -234,6 +234,18 @@ pkg_do(char *pkg)
|
|||
goto success; /* close enough for government work */
|
||||
}
|
||||
|
||||
/* See if there are conflicting packages installed */
|
||||
for (p = Plist.head; p ; p = p->next) {
|
||||
if (p->type != PLIST_PKGCFL)
|
||||
continue;
|
||||
if (Verbose)
|
||||
printf("Package `%s' conflicts with `%s'.\n", PkgName, p->name);
|
||||
if (!vsystem("/usr/sbin/pkg_info -e %s", p->name)) {
|
||||
warnx("Conflicting package `%s' installed, please use pkg_delete(1)\n\t first to remove it!\n", p->name);
|
||||
++code;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now check the packing list for dependencies */
|
||||
for (p = Plist.head; p ; p = p->next) {
|
||||
if (p->type != PLIST_PKGDEP)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: pkg_add.1,v 1.7 1998/05/28 02:30:39 jeremy Exp $
|
||||
.\" $NetBSD: pkg_add.1,v 1.8 1998/06/05 11:22:20 frueauf Exp $
|
||||
.\"
|
||||
.\" FreeBSD install - a package for the installation and maintainance
|
||||
.\" of non-core utilities.
|
||||
|
@ -208,6 +208,13 @@ A check is made to determine if the package is already recorded as installed.
|
|||
If it is,
|
||||
installation is terminated.
|
||||
.It
|
||||
A check is made to determine if the package conflicts (from
|
||||
.Cm @pkgcfl
|
||||
directives, see
|
||||
.Xr pkg_create 1 )
|
||||
with an already recorded as installed package. If it is,
|
||||
installation is terminated.
|
||||
.It
|
||||
All package dependencies (from
|
||||
.Cm @pkgdep
|
||||
directives, see
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: create.h,v 1.4 1997/10/16 00:50:28 hubertf Exp $ */
|
||||
/* $NetBSD: create.h,v 1.5 1998/06/05 11:22:20 frueauf Exp $ */
|
||||
|
||||
/* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */
|
||||
|
||||
|
@ -37,6 +37,7 @@ extern char *SrcDir;
|
|||
extern char *ExcludeFrom;
|
||||
extern char *Mtree;
|
||||
extern char *Pkgdeps;
|
||||
extern char *Pkgcfl;
|
||||
extern char PlayPen[];
|
||||
extern int Dereference;
|
||||
extern int PlistOnly;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: main.c,v 1.5 1997/10/17 14:53:50 lukem Exp $ */
|
||||
/* $NetBSD: main.c,v 1.6 1998/06/05 11:22:20 frueauf 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.5 1997/10/17 14:53:50 lukem Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.6 1998/06/05 11:22:20 frueauf Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -24,10 +24,10 @@ __RCSID("$NetBSD: main.c,v 1.5 1997/10/17 14:53:50 lukem Exp $");
|
|||
#include "lib.h"
|
||||
#include "create.h"
|
||||
|
||||
static char Options[] = "YNOhvf:p:P:c:d:i:k:r:t:X:D:m:s:";
|
||||
static char Options[] = "YNOhvf:p:P:C:c:d:i:k:r:t:X:D:m:s:";
|
||||
|
||||
char *Prefix = NULL;
|
||||
char *Comment = NULL;
|
||||
char *Comment = NULL;
|
||||
char *Desc = NULL;
|
||||
char *SrcDir = NULL;
|
||||
char *Display = NULL;
|
||||
|
@ -38,6 +38,7 @@ char *Require = NULL;
|
|||
char *ExcludeFrom = NULL;
|
||||
char *Mtree = NULL;
|
||||
char *Pkgdeps = NULL;
|
||||
char *Pkgcfl = NULL;
|
||||
char PlayPen[FILENAME_MAX];
|
||||
int Dereference = 0;
|
||||
int PlistOnly = 0;
|
||||
|
@ -125,6 +126,10 @@ main(int argc, char **argv)
|
|||
Pkgdeps = optarg;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
Pkgcfl = optarg;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
|
@ -158,9 +163,9 @@ static void
|
|||
usage()
|
||||
{
|
||||
fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
||||
"usage: pkg_create [-YNOhv] [-P pkgs] [-p prefix] [-f contents] [-i iscript]",
|
||||
" [-k dscript] [-r rscript] [-t template] [-X excludefile]",
|
||||
" [-D displayfile] [-m mtreefile] -c comment -d description",
|
||||
" -f packlist pkg-name");
|
||||
"usage: pkg_create [-YNOhv] [-P dpkgs] [-C cpkgs] [-p prefix] [-f contents]",
|
||||
" [-i iscript] [-k dscript] [-r rscript] [-t template]",
|
||||
" [-X excludefile] [-D displayfile] [-m mtreefile]",
|
||||
" -c comment -d description -f packlist pkg-name");
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: perform.c,v 1.6 1997/10/18 11:05:45 lukem Exp $ */
|
||||
/* $NetBSD: perform.c,v 1.7 1998/06/05 11:22:20 frueauf 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.6 1997/10/18 11:05:45 lukem Exp $");
|
||||
__RCSID("$NetBSD: perform.c,v 1.7 1998/06/05 11:22:20 frueauf Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -92,6 +92,22 @@ pkg_perform(char **pkgs)
|
|||
printf(".\n");
|
||||
}
|
||||
|
||||
/* Put the conflicts directly after the dependencies, if any */
|
||||
if (Pkgcfl) {
|
||||
if (Verbose && !PlistOnly)
|
||||
printf("Registering conflicts:");
|
||||
while (Pkgcfl) {
|
||||
cp = strsep(&Pkgcfl, " \t\n");
|
||||
if (*cp) {
|
||||
add_plist(&plist, PLIST_PKGCFL, 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)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: pkg_create.1,v 1.7 1998/02/06 06:22:09 perry Exp $
|
||||
.\" $NetBSD: pkg_create.1,v 1.8 1998/06/05 11:22:20 frueauf Exp $
|
||||
.\"
|
||||
.\" FreeBSD install - a package for the installation and maintainance
|
||||
.\" of non-core utilities.
|
||||
|
@ -33,7 +33,8 @@
|
|||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl YNOhv
|
||||
.Op Fl P Ar pkgs
|
||||
.Op Fl P Ar dpkgs
|
||||
.Op Fl C Ar cpkgs
|
||||
.Op Fl p Ar prefix
|
||||
.Op Fl f Ar contents
|
||||
.Op Fl i Ar iscript
|
||||
|
@ -105,13 +106,20 @@ Set
|
|||
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 P Ar pkgs
|
||||
.It Fl P Ar dpkgs
|
||||
Set the initial package dependency list to
|
||||
.Ar pkgs .
|
||||
.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 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 p Ar prefix
|
||||
Set
|
||||
.Ar prefix
|
||||
|
@ -353,6 +361,16 @@ 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 @pkgcfl Ar pkgcflname
|
||||
Declare a conflict to the
|
||||
.Ar pkgcflname
|
||||
package. The
|
||||
.Ar pkgcflname
|
||||
package must
|
||||
.Cm not
|
||||
be installed if
|
||||
.Ar pkgname
|
||||
package gets installed cause they install the same files and thus conflict.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr pkg_add 1 ,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lib.h,v 1.4 1997/10/17 14:54:38 lukem Exp $ */
|
||||
/* $NetBSD: lib.h,v 1.5 1998/06/05 11:22:20 frueauf Exp $ */
|
||||
|
||||
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
|
||||
|
||||
|
@ -84,7 +84,7 @@ enum _plist_t {
|
|||
PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT, PLIST_IGNORE,
|
||||
PLIST_NAME, PLIST_UNEXEC, PLIST_SRC, PLIST_DISPLAY,
|
||||
PLIST_PKGDEP, PLIST_MTREE, PLIST_DIR_RM, PLIST_IGNORE_INST,
|
||||
PLIST_OPTION
|
||||
PLIST_OPTION, PLIST_PKGCFL
|
||||
};
|
||||
typedef enum _plist_t plist_t;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: plist.c,v 1.7 1998/03/27 12:16:26 agc Exp $ */
|
||||
/* $NetBSD: plist.c,v 1.8 1998/06/05 11:22:20 frueauf 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.7 1998/03/27 12:16:26 agc Exp $");
|
||||
__RCSID("$NetBSD: plist.c,v 1.8 1998/06/05 11:22:20 frueauf Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -229,6 +229,8 @@ plist_cmd(char *s, char **arg)
|
|||
return PLIST_DISPLAY;
|
||||
else if (!strcmp(cmd, "pkgdep"))
|
||||
return PLIST_PKGDEP;
|
||||
else if (!strcmp(cmd, "pkgcfl"))
|
||||
return PLIST_PKGCFL;
|
||||
else if (!strcmp(cmd, "mtree"))
|
||||
return PLIST_MTREE;
|
||||
else if (!strcmp(cmd, "dirrm"))
|
||||
|
@ -330,6 +332,10 @@ write_plist(Package *pkg, FILE *fp)
|
|||
fprintf(fp, "%cpkgdep %s\n", CMD_CHAR, plist->name);
|
||||
break;
|
||||
|
||||
case PLIST_PKGCFL:
|
||||
fprintf(fp, "%cpkgcfl %s\n", CMD_CHAR, plist->name);
|
||||
break;
|
||||
|
||||
case PLIST_MTREE:
|
||||
fprintf(fp, "%cmtree %s\n", CMD_CHAR, plist->name);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue