1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Add --asdeps option to pacman

This replaces the former -D operation that was undocumented and rather
hacky. It can be used with add, upgrade, or sync transactions and will affect
all packages installed. Should close FS #7193.

Also tell makepkg to use this new flag.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-07-15 12:44:18 -04:00
parent c2920033d0
commit a1e57cbec8
8 changed files with 59 additions and 20 deletions

View File

@ -332,8 +332,12 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
RET_ERR(PM_ERR_MEMORY, -1);
}
/* copy over the install reason */
/* copy over the install reason (unless alldeps is set) */
if(trans->flags & PM_TRANS_FLAG_ALLDEPS) {
newpkg->reason = PM_PKG_REASON_DEPEND;
} else {
newpkg->reason = alpm_pkg_get_reason(local);
}
/* pre_upgrade scriptlet */
if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {

View File

@ -864,11 +864,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
if((ptr = calloc(512, sizeof(char))) == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
if(trans->flags & PM_TRANS_FLAG_ALLDEPS) {
doremove=1;
} else {
QUESTION(trans, PM_TRANS_CONV_CORRUPTED_PKG, (char *)pkgname, NULL, NULL, &doremove);
}
if(doremove) {
unlink(str);
snprintf(ptr, 512, _("archive %s was corrupted (bad MD5 or SHA1 checksum)\n"), pkgname);

19
pactest/tests/sync030.py Normal file
View File

@ -0,0 +1,19 @@
self.description = "Sync packages non-explicitly"
lp1 = pmpkg("pkg1")
lp1.reason = 0
self.addpkg2db("local", lp1)
p1 = pmpkg("pkg1", "1.0-2")
p2 = pmpkg("pkg2", "1.0-2")
for p in p1, p2:
self.addpkg2db("sync", p)
self.args = "-S --asdeps %s" % " ".join([p.name for p in p1, p2])
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=pkg1|1.0-2")
self.addrule("PKG_VERSION=pkg2|1.0-2")
self.addrule("PKG_REASON=pkg1|1")
self.addrule("PKG_REASON=pkg2|1")

View File

@ -0,0 +1,19 @@
self.description = "Install packages non-explicitly"
lp1 = pmpkg("pkg1")
lp1.reason = 0
self.addpkg2db("local", lp1)
p1 = pmpkg("pkg1", "1.0-2")
p2 = pmpkg("pkg2", "1.0-2")
for p in p1, p2:
self.addpkg(p)
self.args = "-U --asdeps %s" % " ".join([p.filename() for p in p1, p2])
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=pkg1|1.0-2")
self.addrule("PKG_VERSION=pkg2|1.0-2")
self.addrule("PKG_REASON=pkg1|1")
self.addrule("PKG_REASON=pkg2|1")

View File

@ -327,9 +327,9 @@ handledeps() {
local ret=0
if [ "$ASROOT" = 0 ]; then
sudo pacman $PACMAN_OPTS -S $striplist || ret=$?
sudo pacman $PACMAN_OPTS -S --asdeps $striplist || ret=$?
else
pacman $PACMAN_OPTS -S $striplist || ret=$?
pacman $PACMAN_OPTS -S --asdeps $striplist || ret=$?
fi
if [ $ret -ne 0 ]; then

View File

@ -36,7 +36,6 @@ typedef struct __config_t {
unsigned short logmask;
/* command line options */
unsigned short op_d_resolve;
unsigned short op_q_isfile;
unsigned short op_q_info;
unsigned short op_q_list;

View File

@ -88,6 +88,7 @@ static void usage(int op, char *myname)
if(op == PM_OP_ADD) {
printf("%s: %s {-A --add} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
printf("%s:\n", str_opt);
printf(_(" --asdeps install packages as non-explicitly installed\n"));
printf(_(" -d, --nodeps skip dependency checks\n"));
printf(_(" -f, --force force install, overwrite conflicting files\n"));
} else if(op == PM_OP_REMOVE) {
@ -106,6 +107,7 @@ static void usage(int op, char *myname)
printf("%s: %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
}
printf("%s:\n", str_opt);
printf(_(" --asdeps install packages as non-explicitly installed\n"));
printf(_(" -d, --nodeps skip dependency checks\n"));
printf(_(" -f, --force force install, overwrite conflicting files\n"));
} else if(op == PM_OP_QUERY) {
@ -126,6 +128,7 @@ static void usage(int op, char *myname)
} else if(op == PM_OP_SYNC) {
printf("%s: %s {-S --sync} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
printf("%s:\n", str_opt);
printf(_(" --asdeps install packages as non-explicitly installed\n"));
printf(_(" -c, --clean remove old packages from cache directory (-cc for all)\n"));
printf(_(" -d, --nodeps skip dependency checks\n"));
printf(_(" -e, --dependsonly install dependencies only\n"));
@ -292,6 +295,7 @@ static int parseargs(int argc, char *argv[])
{"noscriptlet", no_argument, 0, 1005},
{"ask", required_argument, 0, 1006},
{"cachedir", required_argument, 0, 1007},
{"asdeps", no_argument, 0, 1008},
{0, 0, 0, 0}
};
struct stat st;
@ -345,6 +349,9 @@ static int parseargs(int argc, char *argv[])
}
alpm_option_add_cachedir(optarg);
break;
case 1008:
config->flags |= PM_TRANS_FLAG_ALLDEPS;
break;
case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break;
case 'F':
config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_UPGRADE);
@ -754,7 +761,7 @@ if(0) {
if((config->op == PM_OP_SYNC && !config->op_s_sync &&
(config->op_s_search || config->group || config->op_q_list || config->op_q_info
|| config->flags & PM_TRANS_FLAG_PRINTURIS))
|| (config->op == PM_OP_DEPTEST && config->op_d_resolve)
|| config->op == PM_OP_DEPTEST
|| (strcmp(alpm_option_get_root(), "/") != 0)) {
/* special case: PM_OP_SYNC can be used w/ config->op_s_search by any user */
/* special case: ignore root user check if -r is specified, fall back on

View File

@ -703,10 +703,6 @@ int pacman_sync(alpm_list_t *targets)
} else {
confirm = yesno(_("Proceed with download? [Y/n] "));
}
} else {
/* don't get any confirmation if we're called from makepkg */
if(config->op_d_resolve) {
confirm = 1;
} else {
if(config->noconfirm) {
printf(_("Beginning upgrade process...\n"));
@ -715,7 +711,6 @@ int pacman_sync(alpm_list_t *targets)
confirm = yesno(_("Proceed with installation? [Y/n] "));
}
}
}
if(!confirm) {
goto cleanup;
}