diff options
-rw-r--r-- | doc/pacman.8.txt | 2 | ||||
-rw-r--r-- | lib/libalpm/alpm.h | 3 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 2 | ||||
-rw-r--r-- | pactest/tests/remove050.py | 20 | ||||
-rw-r--r-- | pactest/tests/remove051.py | 20 | ||||
-rw-r--r-- | src/pacman/pacman.c | 9 |
6 files changed, 51 insertions, 5 deletions
diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt index 82358750..bbb25c64 100644 --- a/doc/pacman.8.txt +++ b/doc/pacman.8.txt @@ -224,7 +224,7 @@ Remove Options[[RO]] that (A) they are not required by other packages; and (B) they were not explicitly installed by the user. This operation is recursive and analogous to a backwards '\--sync' operation, and helps keep a clean system without - orphans. + orphans. If you want to omit condition (B), pass this option twice. *-u, \--unneeded*:: Removes the targets that are not required by any other packages. diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 8e8446a2..b5294b90 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -280,7 +280,8 @@ typedef enum _pmtransflag_t { PM_TRANS_FLAG_PRINTURIS = 0x1000, PM_TRANS_FLAG_NEEDED = 0x2000, PM_TRANS_FLAG_ALLEXPLICIT = 0x4000, - PM_TRANS_FLAG_UNNEEDED = 0x8000 + PM_TRANS_FLAG_UNNEEDED = 0x8000, + PM_TRANS_FLAG_RECURSEALL = 0x10000 } pmtransflag_t; /* Transaction Events */ diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index b6ed115a..c04dab69 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -165,7 +165,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) if(trans->flags & PM_TRANS_FLAG_RECURSE) { _alpm_log(PM_LOG_DEBUG, "finding removable dependencies\n"); - _alpm_recursedeps(db, trans->packages, 0); + _alpm_recursedeps(db, trans->packages, trans->flags & PM_TRANS_FLAG_RECURSEALL); } if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) { diff --git a/pactest/tests/remove050.py b/pactest/tests/remove050.py new file mode 100644 index 00000000..44b0d18c --- /dev/null +++ b/pactest/tests/remove050.py @@ -0,0 +1,20 @@ +self.description = "-Rs test (exclude explicit)" + +lp1 = pmpkg("pkg1") +lp1.depends = ["pkg2" , "pkg3"] +self.addpkg2db("local", lp1) + +lp2 = pmpkg("pkg2") +lp2.reason = 1 +self.addpkg2db("local", lp2) + +lp3 = pmpkg("pkg3") +lp3.reason = 0 +self.addpkg2db("local", lp3) + +self.args = "-Rs %s" % lp1.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("!PKG_EXIST=pkg2") +self.addrule("PKG_EXIST=pkg3") diff --git a/pactest/tests/remove051.py b/pactest/tests/remove051.py new file mode 100644 index 00000000..bba87bba --- /dev/null +++ b/pactest/tests/remove051.py @@ -0,0 +1,20 @@ +self.description = "-Rss test (include explicit)" + +lp1 = pmpkg("pkg1") +lp1.depends = ["pkg2" , "pkg3"] +self.addpkg2db("local", lp1) + +lp2 = pmpkg("pkg2") +lp2.reason = 1 +self.addpkg2db("local", lp2) + +lp3 = pmpkg("pkg3") +lp3.reason = 0 +self.addpkg2db("local", lp3) + +self.args = "-Rss %s" % lp1.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("!PKG_EXIST=pkg2") +self.addrule("!PKG_EXIST=pkg3") diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index f87db275..579474cb 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -81,7 +81,8 @@ static void usage(int op, const char * const myname) printf(_(" -d, --nodeps skip dependency checks\n")); printf(_(" -k, --dbonly only remove database entry, do not remove files\n")); printf(_(" -n, --nosave remove configuration files as well\n")); - printf(_(" -s, --recursive remove dependencies also (that won't break packages)\n")); + printf(_(" -s, --recursive remove dependencies also (that won't break packages)\n" + " (-ss includes explicitly installed dependencies too)\n")); printf(_(" -u, --unneeded remove unneeded packages (that won't break packages)\n")); } else if(op == PM_OP_UPGRADE) { printf("%s: %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file); @@ -467,7 +468,11 @@ static int parseargs(int argc, char *argv[]) case 's': config->op_s_search = 1; config->op_q_search = 1; - config->flags |= PM_TRANS_FLAG_RECURSE; + if(config->flags & PM_TRANS_FLAG_RECURSE) { + config->flags |= PM_TRANS_FLAG_RECURSEALL; + } else { + config->flags |= PM_TRANS_FLAG_RECURSE; + } break; case 't': config->op_q_unrequired = 1; |