diff options
-rw-r--r-- | lib/libalpm/add.c | 8 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 6 | ||||
-rw-r--r-- | pactest/tests/sync030.py | 19 | ||||
-rw-r--r-- | pactest/tests/upgrade031.py | 19 | ||||
-rw-r--r-- | scripts/makepkg.sh.in | 4 | ||||
-rw-r--r-- | src/pacman/conf.h | 1 | ||||
-rw-r--r-- | src/pacman/pacman.c | 11 | ||||
-rw-r--r-- | src/pacman/sync.c | 11 |
8 files changed, 59 insertions, 20 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 8a50be4c..a91ada24 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -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 */ - newpkg->reason = alpm_pkg_get_reason(local); + /* 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)) { diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 41ed144a..c1d2f9e7 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -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); - } + 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); diff --git a/pactest/tests/sync030.py b/pactest/tests/sync030.py new file mode 100644 index 00000000..1fd97500 --- /dev/null +++ b/pactest/tests/sync030.py @@ -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") diff --git a/pactest/tests/upgrade031.py b/pactest/tests/upgrade031.py new file mode 100644 index 00000000..856de983 --- /dev/null +++ b/pactest/tests/upgrade031.py @@ -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") diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d340252e..002f89cc 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -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 diff --git a/src/pacman/conf.h b/src/pacman/conf.h index 252bb95a..60c116ad 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -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; diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 5281df65..549dfe9d 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -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")); @@ -288,10 +291,11 @@ static int parseargs(int argc, char *argv[]) {"config", required_argument, 0, 1001}, {"ignore", required_argument, 0, 1002}, {"debug", optional_argument, 0, 1003}, - {"noprogressbar", no_argument, 0, 1004}, + {"noprogressbar", no_argument, 0, 1004}, {"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 diff --git a/src/pacman/sync.c b/src/pacman/sync.c index d5888a57..77293709 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -704,16 +704,11 @@ int pacman_sync(alpm_list_t *targets) confirm = yesno(_("Proceed with download? [Y/n] ")); } } else { - /* don't get any confirmation if we're called from makepkg */ - if(config->op_d_resolve) { + if(config->noconfirm) { + printf(_("Beginning upgrade process...\n")); confirm = 1; } else { - if(config->noconfirm) { - printf(_("Beginning upgrade process...\n")); - confirm = 1; - } else { - confirm = yesno(_("Proceed with installation? [Y/n] ")); - } + confirm = yesno(_("Proceed with installation? [Y/n] ")); } } if(!confirm) { |