diff options
author | Bryan Drewery <bryan@shatow.net> | 2021-09-07 23:02:06 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2021-09-07 23:02:08 +0300 |
commit | cad7965f5cbfd51ad41a5e1f8910d10a2b79f23f (patch) | |
tree | 5d3847b9dc6b6c0567caff11d2248358672c7f64 /src | |
parent | d6b16764f12a03edab9be9055c9a86e68a012ca2 (diff) |
bulk: Require -a or -f to delete unqueued packages.
Issue #493
Issue #915
Fixes: dda7b8fa835d3047 ("bulk [-a] -f: Delete packages unknown...")
Diffstat (limited to 'src')
-rw-r--r-- | src/share/poudriere/common.sh | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh index f570d5aa..ba232053 100644 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -5562,7 +5562,7 @@ delete_old_pkg() { local pkgbase new_pkgbase flavor pkg_flavor originspec local dep_pkgname dep_pkgbase dep_origin dep_flavor dep_dep_args local ignore new_origin stale_pkg dep_args pkg_dep_args - local pkg_arch no_arch arch is_sym + local pkg_arch no_arch arch is_sym listpkgs pkgfile="${pkg##*/}" pkgname="${pkgfile%.*}" @@ -5607,17 +5607,21 @@ delete_old_pkg() { # delete everything but that package in the repository here. # An override is also provided for cases not thought of ("no") or for # users who don't mind subsets deleting everything else ("always"). - case "${DELETE_UNQUEUED_PACKAGES},${PORTTESTING}${CLEAN_LISTED},${ALL}" in + if [ -z "${LISTPKGS}" ]; then + listpkgs=0 + else + listpkgs=1 + fi + case "${DELETE_UNQUEUED_PACKAGES},${PORTTESTING}${CLEAN_LISTED},${ALL},${listpkgs}" in always,*) delete_unqueued=1 ;; # -a owns the repo - yes,*,1) delete_unqueued=1 ;; + yes,*,1,*) delete_unqueued=1 ;; # Avoid deleting everything if the user is testing as they likely # have queued a small subset of the repo. Testing is considered to # be testport, bulk -t, or bulk -C. - yes,*1*,0) delete_unqueued=0 ;; - # If we are not concerned about testing or subsets then we are free to - # delete everything. - yes,*) delete_unqueued=1 ;; + yes,*1*,*,*) delete_unqueued=0 ;; + # -f owns the repo if testing/-C isn't happening + yes,*,*,1) delete_unqueued=1 ;; *) delete_unqueued=0 ;; esac |