perform.c (156497) | perform.c (173513) |
---|---|
1/* 2 * FreeBSD install - a package for the installation and maintainance 3 * of non-core utilities. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 5 unchanged lines hidden (view full) --- 14 * Jordan K. Hubbard 15 * 18 July 1993 16 * 17 * This is the main body of the add module. 18 * 19 */ 20 21#include <sys/cdefs.h> | 1/* 2 * FreeBSD install - a package for the installation and maintainance 3 * of non-core utilities. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 5 unchanged lines hidden (view full) --- 14 * Jordan K. Hubbard 15 * 18 July 1993 16 * 17 * This is the main body of the add module. 18 * 19 */ 20 21#include <sys/cdefs.h> |
22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/add/perform.c 156497 2006-03-09 14:49:19Z phk $"); | 22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/add/perform.c 173513 2007-11-10 09:40:39Z krion $"); |
23 24#include <err.h> 25#include <paths.h> 26#include "lib.h" 27#include "add.h" 28 29#include <libgen.h> 30#include <signal.h> --- 216 unchanged lines hidden (view full) --- 247 matchbyorigin(Plist.origin, NULL) != NULL) && !Force) { 248 warnx("package '%s' or its older version already installed%s", 249 Plist.name, FailOnAlreadyInstalled ? "" : " (ignored)"); 250 code = FailOnAlreadyInstalled != FALSE; 251 goto success; /* close enough for government work */ 252 } 253 254 /* Now check the packing list for conflicts */ | 23 24#include <err.h> 25#include <paths.h> 26#include "lib.h" 27#include "add.h" 28 29#include <libgen.h> 30#include <signal.h> --- 216 unchanged lines hidden (view full) --- 247 matchbyorigin(Plist.origin, NULL) != NULL) && !Force) { 248 warnx("package '%s' or its older version already installed%s", 249 Plist.name, FailOnAlreadyInstalled ? "" : " (ignored)"); 250 code = FailOnAlreadyInstalled != FALSE; 251 goto success; /* close enough for government work */ 252 } 253 254 /* Now check the packing list for conflicts */ |
255 if(!IgnoreDeps){ |
|
255 for (p = Plist.head; p != NULL; p = p->next) { 256 if (p->type == PLIST_CONFLICTS) { 257 int i; 258 conflict[0] = strdup(p->name); 259 conflict[1] = NULL; 260 matched = matchinstalled(MATCH_GLOB, conflict, &errcode); 261 free(conflict[0]); 262 if (errcode == 0 && matched != NULL) --- 28 unchanged lines hidden (view full) --- 291 if (deporigin != NULL) 292 printf(" with '%s' origin", deporigin); 293 printf(".\n"); 294 } 295 if (isinstalledpkg(p->name) <= 0 && 296 !(deporigin != NULL && matchbyorigin(deporigin, NULL) != NULL)) { 297 char path[FILENAME_MAX], *cp = NULL; 298 | 256 for (p = Plist.head; p != NULL; p = p->next) { 257 if (p->type == PLIST_CONFLICTS) { 258 int i; 259 conflict[0] = strdup(p->name); 260 conflict[1] = NULL; 261 matched = matchinstalled(MATCH_GLOB, conflict, &errcode); 262 free(conflict[0]); 263 if (errcode == 0 && matched != NULL) --- 28 unchanged lines hidden (view full) --- 292 if (deporigin != NULL) 293 printf(" with '%s' origin", deporigin); 294 printf(".\n"); 295 } 296 if (isinstalledpkg(p->name) <= 0 && 297 !(deporigin != NULL && matchbyorigin(deporigin, NULL) != NULL)) { 298 char path[FILENAME_MAX], *cp = NULL; 299 |
299 if (!Fake) { | 300 if (!Fake&&!IgnoreDeps) { |
300 char prefixArg[2 + MAXPATHLEN]; /* "-P" + Prefix */ 301 if (PrefixRecursive) { 302 strlcpy(prefixArg, "-P", sizeof(prefixArg)); 303 strlcat(prefixArg, Prefix, sizeof(prefixArg)); 304 } 305 if (!isURL(pkg) && !getenv("PKG_ADD_BASE")) { 306 const char *ext; 307 --- 55 unchanged lines hidden (view full) --- 363 Force ? " (proceeding anyway)" : "!"); 364 if (!Force) 365 ++code; 366 } 367 } 368 else if (Verbose) 369 printf(" - already installed.\n"); 370 } | 301 char prefixArg[2 + MAXPATHLEN]; /* "-P" + Prefix */ 302 if (PrefixRecursive) { 303 strlcpy(prefixArg, "-P", sizeof(prefixArg)); 304 strlcat(prefixArg, Prefix, sizeof(prefixArg)); 305 } 306 if (!isURL(pkg) && !getenv("PKG_ADD_BASE")) { 307 const char *ext; 308 --- 55 unchanged lines hidden (view full) --- 364 Force ? " (proceeding anyway)" : "!"); 365 if (!Force) 366 ++code; 367 } 368 } 369 else if (Verbose) 370 printf(" - already installed.\n"); 371 } |
372 } |
|
371 372 if (code != 0) 373 goto bomb; 374 375 /* Look for the requirements file */ 376 if (fexists(REQUIRE_FNAME)) { 377 vsystem("/bin/chmod +x %s", REQUIRE_FNAME); /* be sure */ 378 if (Verbose) --- 130 unchanged lines hidden (view full) --- 509 510 depnames = (deporigin != NULL) ? matchbyorigin(deporigin, NULL) : 511 NULL; 512 if (depnames == NULL) { 513 depnames = alloca(sizeof(*depnames) * 2); 514 depnames[0] = p->name; 515 depnames[1] = NULL; 516 } | 373 374 if (code != 0) 375 goto bomb; 376 377 /* Look for the requirements file */ 378 if (fexists(REQUIRE_FNAME)) { 379 vsystem("/bin/chmod +x %s", REQUIRE_FNAME); /* be sure */ 380 if (Verbose) --- 130 unchanged lines hidden (view full) --- 511 512 depnames = (deporigin != NULL) ? matchbyorigin(deporigin, NULL) : 513 NULL; 514 if (depnames == NULL) { 515 depnames = alloca(sizeof(*depnames) * 2); 516 depnames[0] = p->name; 517 depnames[1] = NULL; 518 } |
519 if(!IgnoreDeps){ |
|
517 for (i = 0; depnames[i] != NULL; i++) { 518 sprintf(contents, "%s/%s/%s", LOG_DIR, depnames[i], 519 REQUIRED_BY_FNAME); 520 if (strcmp(p->name, depnames[i]) != 0) 521 warnx("warning: package '%s' requires '%s', but '%s' " 522 "is installed", Plist.name, p->name, depnames[i]); 523 contfile = fopen(contents, "a"); 524 if (!contfile) 525 warnx("can't open dependency file '%s'!\n" 526 "dependency registration is incomplete", contents); 527 else { 528 fprintf(contfile, "%s\n", Plist.name); 529 if (fclose(contfile) == EOF) 530 warnx("cannot properly close file %s", contents); 531 } 532 } 533 } | 520 for (i = 0; depnames[i] != NULL; i++) { 521 sprintf(contents, "%s/%s/%s", LOG_DIR, depnames[i], 522 REQUIRED_BY_FNAME); 523 if (strcmp(p->name, depnames[i]) != 0) 524 warnx("warning: package '%s' requires '%s', but '%s' " 525 "is installed", Plist.name, p->name, depnames[i]); 526 contfile = fopen(contents, "a"); 527 if (!contfile) 528 warnx("can't open dependency file '%s'!\n" 529 "dependency registration is incomplete", contents); 530 else { 531 fprintf(contfile, "%s\n", Plist.name); 532 if (fclose(contfile) == EOF) 533 warnx("cannot properly close file %s", contents); 534 } 535 } 536 } |
537 } |
|
534 if (Verbose) 535 printf("Package %s registered in %s\n", Plist.name, LogDir); 536 } 537 538 if ((p = find_plist(&Plist, PLIST_DISPLAY)) != NULL) { 539 FILE *fp; 540 char buf[BUFSIZ]; 541 --- 69 unchanged lines hidden --- | 538 if (Verbose) 539 printf("Package %s registered in %s\n", Plist.name, LogDir); 540 } 541 542 if ((p = find_plist(&Plist, PLIST_DISPLAY)) != NULL) { 543 FILE *fp; 544 char buf[BUFSIZ]; 545 --- 69 unchanged lines hidden --- |