View | Details | Raw Unified | Return to bug 13649 | Differences between
and this patch

Collapse All | Expand All

(-)pkg_install/add/perform.c (+31 lines)
Lines 77-82 Link Here
77
    char pre_script[FILENAME_MAX] = INSTALL_FNAME;
77
    char pre_script[FILENAME_MAX] = INSTALL_FNAME;
78
    char post_script[FILENAME_MAX];
78
    char post_script[FILENAME_MAX];
79
    char pre_arg[FILENAME_MAX], post_arg[FILENAME_MAX];
79
    char pre_arg[FILENAME_MAX], post_arg[FILENAME_MAX];
80
    int conflictsfound=0;
80
81
81
    code = 0;
82
    code = 0;
82
    zapLogDir = 0;
83
    zapLogDir = 0;
Lines 246-251 Link Here
246
	      Plist.name);
247
	      Plist.name);
247
	code = 1;
248
	code = 1;
248
	goto success;	/* close enough for government work */
249
	goto success;	/* close enough for government work */
250
    }
251
252
    /* Now check the packing list for conflicts */
253
    for (p = Plist.head; p ; p = p->next) {
254
	if (p->type == PLIST_PKGCFL) {
255
	    char *conflict[2];
256
	    char **matched;
257
	    int i,errcode;
258
259
	    conflict[0]=strdup(p->name);
260
	    conflict[1]=NULL;
261
	    matched = matchinstalled(MATCH_GLOB,conflict,&errcode);
262
	    if(errcode == 0 && matched != NULL)
263
		for(i=0; matched[i] != NULL; i++)
264
		    if(isinstalledpkg(matched[i])) {
265
			warnx("Package '%s' conflicts with %s", Plist.name,
266
								matched[i]);
267
			conflictsfound=1;
268
		    }
269
270
	    continue;
271
	}
272
    }
273
    if(conflictsfound) {
274
	if(!Force) {
275
	    warnx("please use pkg_delete first to remove it (them)");
276
	    code = 1;
277
	    goto bomb;
278
	} else
279
	    warnx("proceeding anyway");
249
    }
280
    }
250
281
251
    /* Now check the packing list for dependencies */
282
    /* Now check the packing list for dependencies */
(-)pkg_install/add/pkg_add.1 (-9 / +21 lines)
Lines 208-227 Link Here
208
.Sh TECHNICAL DETAILS
208
.Sh TECHNICAL DETAILS
209
The
209
The
210
.Nm
210
.Nm
211
utility is fairly simple.  It extracts each package's "packing list"
211
utility extracts each package's "packing list" into a special staging 
212
into a special staging directory, parses it,
212
directory in /tmp (or $PKG_TMPDIR if set), parses it, and then runs 
213
and then runs through the following sequence to fully extract the contents:
213
through the following sequence to fully extract the contents of the package:
214
.Bl -enum
214
.Bl -enum
215
.It
215
.It
216
Check if the package is already recorded as installed.  If so,
216
A check is made to determine if the package is already recorded as installed.
217
terminate installation.
217
If it is, installation is terminated.
218
.It
219
A check is made to determine if the package conflicts (from
220
.Cm @pkgcfl
221
directives, see
222
.Xr pkg_create 1 )
223
with an already recorded as installed package. If it is,
224
installation is terminated.
218
.It
225
.It
219
Scan all the package dependencies (from
226
Scan all the package dependencies (from
220
.Cm @pkgdep
227
.Cm @pkgdep
221
directives, see
228
directives, see
222
.Xr pkg_create 1 )
229
.Xr pkg_create 1 )
223
and make sure each one is met.  If not, try and find the missing
230
are read from the packing list.
224
dependencies' packages and auto-install them; if they can't be found
231
If any of these required packages is not currently installed,
232
an attempt is made to find and install it;
233
if the missing package cannot be found or installed,
225
the installation is terminated.
234
the installation is terminated.
226
.It
235
.It
227
Search for any
236
Search for any
Lines 384-394 Link Here
384
consists of a directory name.
393
consists of a directory name.
385
The current directory may be indicated
394
The current directory may be indicated
386
implicitly by an empty directory name, or explicitly by a single
395
implicitly by an empty directory name, or explicitly by a single
387
period.
396
period. It is usually set to
397
.Pa /usr/ports/packages/All .
388
.Pp
398
.Pp
389
The environment variable
399
The environment variable
390
.Ev PKG_DBDIR
400
.Ev PKG_DBDIR
391
specifies an alternative location for the installed package database.
401
specifies an alternative location for the installed package database,
402
default location is
403
.Pa /var/db/pkg .
392
.Pp
404
.Pp
393
The environment variables
405
The environment variables
394
.Ev PKG_TMPDIR
406
.Ev PKG_TMPDIR
(-)pkg_install/create/create.h (+1 lines)
Lines 37-42 Link Here
37
extern char	*ExcludeFrom;
37
extern char	*ExcludeFrom;
38
extern char	*Mtree;
38
extern char	*Mtree;
39
extern char	*Pkgdeps;
39
extern char	*Pkgdeps;
40
extern char	*Pkgcfl;
40
extern char	*Origin;
41
extern char	*Origin;
41
extern char	*InstalledPkg;
42
extern char	*InstalledPkg;
42
extern char	PlayPen[];
43
extern char	PlayPen[];
(-)pkg_install/create/main.c (-6 / +11 lines)
Lines 16-22 Link Here
16
#include "lib.h"
16
#include "lib.h"
17
#include "create.h"
17
#include "create.h"
18
18
19
static char Options[] = "YNOhjvyzf:p:P:c:d:i:I:k:K:r:t:X:D:m:s:o:b:";
19
static char Options[] = "YNOhjvyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:o:b:";
20
20
21
char	*Prefix		= NULL;
21
char	*Prefix		= NULL;
22
char	*Comment        = NULL;
22
char	*Comment        = NULL;
Lines 32-37 Link Here
32
char	*ExcludeFrom	= NULL;
32
char	*ExcludeFrom	= NULL;
33
char	*Mtree		= NULL;
33
char	*Mtree		= NULL;
34
char	*Pkgdeps	= NULL;
34
char	*Pkgdeps	= NULL;
35
char    *Pkgcfl         = NULL;
35
char	*Origin		= NULL;
36
char	*Origin		= NULL;
36
char	*InstalledPkg	= NULL;
37
char	*InstalledPkg	= NULL;
37
char	PlayPen[FILENAME_MAX];
38
char	PlayPen[FILENAME_MAX];
Lines 78-83 Link Here
78
	    Contents = optarg;
79
	    Contents = optarg;
79
	    break;
80
	    break;
80
81
82
	case 'C':
83
	    Pkgcfl = optarg;
84
	    break;
85
81
	case 'c':
86
	case 'c':
82
	    Comment = optarg;
87
	    Comment = optarg;
83
	    break;
88
	    break;
Lines 195-205 Link Here
195
usage()
200
usage()
196
{
201
{
197
    fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n",
202
    fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n",
198
"usage: pkg_create [-YNOhvy] [-P pkgs] [-p prefix] [-f contents] [-i iscript]",
203
"usage: pkg_create [-YNOhvy] [-P pkgs] [-C cpkgs] [-p prefix] [-f contents] ",
199
"                  [-I piscript] [-k dscript] [-K pdscript] [-r rscript] ",
204
"                  [-i iscript] [-I piscript] [-k dscript] [-K pdscript] ",
200
"                  [-t template] [-X excludefile] [-D displayfile] ",
205
"                  [-r rscript] [-t template] [-X excludefile] ",
201
"                  [-m mtreefile] [-o origin] -c comment -d description ",
206
"                  [-D displayfile] [-m mtreefile] [-o origin] ",
202
"                  -f packlist pkg-filename",
207
"                  -c comment -d description -f packlist pkg-filename",
203
"       pkg_create [-YNhvy] -b pkg-name [pkg-filename]");
208
"       pkg_create [-YNhvy] -b pkg-name [pkg-filename]");
204
    exit(1);
209
    exit(1);
205
}
210
}
(-)pkg_install/create/perform.c (+16 lines)
Lines 145-150 Link Here
145
	    printf(".\n");
145
	    printf(".\n");
146
    }
146
    }
147
147
148
    /* Put the conflicts directly after the dependencies, if any */
149
    if (Pkgcfl) {
150
	if (Verbose && !PlistOnly)
151
	    printf("Registering conflicts:");
152
	while (Pkgcfl) {
153
	   cp = strsep(&Pkgcfl, " \t\n");
154
	   if (*cp) {
155
		add_plist(&plist, PLIST_PKGCFL, cp);
156
		if (Verbose && !PlistOnly)
157
		    printf(" %s", cp);
158
	   }
159
	}
160
	if (Verbose && !PlistOnly)
161
	    printf(".\n");
162
    }
163
148
    /* If a SrcDir override is set, add it now */
164
    /* If a SrcDir override is set, add it now */
149
    if (SrcDir) {
165
    if (SrcDir) {
150
	if (Verbose && !PlistOnly)
166
	if (Verbose && !PlistOnly)
(-)pkg_install/create/pkg_create.1 (+13 lines)
Lines 32-37 Link Here
32
.Sh SYNOPSIS
32
.Sh SYNOPSIS
33
.Nm
33
.Nm
34
.Op Fl YNOhjvyz
34
.Op Fl YNOhjvyz
35
.Op Fl C Ar cpkgs
35
.Op Fl P Ar pkgs
36
.Op Fl P Ar pkgs
36
.Op Fl p Ar prefix
37
.Op Fl p Ar prefix
37
.Op Fl f Ar contents
38
.Op Fl f Ar contents
Lines 142-147 Link Here
142
when the package is later installed.
143
when the package is later installed.
143
It will be passed the package's name as
144
It will be passed the package's name as
144
the first argument.
145
the first argument.
146
.It Fl C Ar cpkgs
147
Set the initial package conflict list to
148
.Ar cpkgs .
149
This is assumed to be a whitespace separated list of package names
150
and is meant as a convenient shorthand for specifying multiple
151
.Cm @pkgcfl
152
directives in the packing list (see PACKING LIST DETAILS section below).
145
.It Fl P Ar pkgs
153
.It Fl P Ar pkgs
146
Set the initial package dependency list to
154
Set the initial package dependency list to
147
.Ar pkgs .
155
.Ar pkgs .
Lines 482-487 Link Here
482
package is deinstalled.  Multiple
490
package is deinstalled.  Multiple
483
.Cm @pkgdep
491
.Cm @pkgdep
484
directives may be used if the package depends on multiple other packages.
492
directives may be used if the package depends on multiple other packages.
493
.It Cm @pkgcfl Ar pkgcflname
494
Declare a conflict with the
495
.Ar pkgcflname
496
package, as the two packages contain references to the same files,
497
and so cannot co-exist on the same system.
485
.El
498
.El
486
.Sh ENVIRONMENT
499
.Sh ENVIRONMENT
487
The environment variable
500
The environment variable
(-)pkg_install/info/show.c (+4 lines)
Lines 158-163 Link Here
158
		"\tdependency origin: %s\n", p->name);
158
		"\tdependency origin: %s\n", p->name);
159
	    break;
159
	    break;
160
160
161
	case PLIST_PKGCFL:
162
	    printf(Quiet ? "@pkgcfl %s\n" : "Conflicts: %s\n", p->name);
163
	    break;
164
161
	case PLIST_MTREE:
165
	case PLIST_MTREE:
162
	    printf(Quiet ? "@mtree %s\n" : "\tPackage mtree file: %s\n", p->name);
166
	    printf(Quiet ? "@mtree %s\n" : "\tPackage mtree file: %s\n", p->name);
163
	    break;
167
	    break;
(-)pkg_install/lib/lib.h (-3 / +3 lines)
Lines 86-92 Link Here
86
 * Version of the package tools - increase only when some
86
 * Version of the package tools - increase only when some
87
 * functionality used by bsd.port.mk is changed, added or removed
87
 * functionality used by bsd.port.mk is changed, added or removed
88
 */
88
 */
89
#define PKG_INSTALL_VERSION	20020908
89
#define PKG_INSTALL_VERSION	20021201
90
90
91
#define PKG_WRAPCONF_FNAME	"/var/db/pkg_install.conf"
91
#define PKG_WRAPCONF_FNAME	"/var/db/pkg_install.conf"
92
#define main(argc, argv)	real_main(argc, argv)
92
#define main(argc, argv)	real_main(argc, argv)
Lines 99-106 Link Here
99
    PLIST_FILE, PLIST_CWD, PLIST_CMD, PLIST_CHMOD,
99
    PLIST_FILE, PLIST_CWD, PLIST_CMD, PLIST_CHMOD,
100
    PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT, PLIST_IGNORE,
100
    PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT, PLIST_IGNORE,
101
    PLIST_NAME, PLIST_UNEXEC, PLIST_SRC, PLIST_DISPLAY,
101
    PLIST_NAME, PLIST_UNEXEC, PLIST_SRC, PLIST_DISPLAY,
102
    PLIST_PKGDEP, PLIST_MTREE, PLIST_DIR_RM, PLIST_IGNORE_INST,
102
    PLIST_PKGDEP, PLIST_PKGCFL, PLIST_MTREE, PLIST_DIR_RM, 
103
    PLIST_OPTION, PLIST_ORIGIN, PLIST_DEPORIGIN
103
    PLIST_IGNORE_INST, PLIST_OPTION, PLIST_ORIGIN, PLIST_DEPORIGIN
104
};
104
};
105
typedef enum _plist_t plist_t;
105
typedef enum _plist_t plist_t;
106
106
(-)pkg_install/lib/plist.c (+6 lines)
Lines 241-246 Link Here
241
	return PLIST_DISPLAY;
241
	return PLIST_DISPLAY;
242
    else if (!strcmp(cmd, "pkgdep"))
242
    else if (!strcmp(cmd, "pkgdep"))
243
	return PLIST_PKGDEP;
243
	return PLIST_PKGDEP;
244
    else if (!strcmp(cmd, "pkgcfl"))
245
	return PLIST_PKGCFL;
244
    else if (!strcmp(cmd, "mtree"))
246
    else if (!strcmp(cmd, "mtree"))
245
	return PLIST_MTREE;
247
	return PLIST_MTREE;
246
    else if (!strcmp(cmd, "dirrm"))
248
    else if (!strcmp(cmd, "dirrm"))
Lines 362-367 Link Here
362
364
363
	case PLIST_PKGDEP:
365
	case PLIST_PKGDEP:
364
	    fprintf(fp, "%cpkgdep %s\n", CMD_CHAR, plist->name);
366
	    fprintf(fp, "%cpkgdep %s\n", CMD_CHAR, plist->name);
367
	    break;
368
369
	case PLIST_PKGCFL:
370
	    fprintf(fp, "%cpkgcfl %s\n", CMD_CHAR, plist->name);
365
	    break;
371
	    break;
366
372
367
	case PLIST_MTREE:
373
	case PLIST_MTREE:

Return to bug 13649