summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2018-07-15 21:57:56 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2018-10-07 19:00:51 -0400
commit11213498bea98dd8fa3fd77b5bdae6e03e96d50d (patch)
treef9ad7e04369979ca25c922f79dfc976fe1c6f672
parentc09e8c45175970ed66c0a4124618e07b252a5fc6 (diff)
db-move, db-remove: Have more informative output
-rwxr-xr-xdb-move12
-rwxr-xr-xdb-remove23
2 files changed, 30 insertions, 5 deletions
diff --git a/db-move b/db-move
index 06d1345..d7280bc 100755
--- a/db-move
+++ b/db-move
@@ -57,7 +57,15 @@ for pkgbase in "${args[@]:2}"; do
declare -n add_pkgs="add_pkgs_${tarch}"
declare -n remove_pkgs="remove_pkgs_${tarch}"
vcs_move_arch "$tarch"
- while read -r pkgname pkgver pkgfile; do
+ while read -r _pkgbase pkgname pkgver pkgfile; do
+ plain 'pkgname=%s (%s)' "$pkgname" "$pkgver"
+ [[ $_pkgbase != '(null)' ]] || _pkgbase=$pkgname
+ [[ $_pkgbase != '(null)' ]] || _pkgbase=$pkgname
+ if [[ $_pkgbase != $pkgbase ]]; then
+ warning "'%s' is a member of pkgbase=%s" "$pkgname" "$_pkgbase"
+ warning "It is the only member being removed;"
+ warning "you will need to move the others yourself!"
+ fi
ln -s "../../../${PKGPOOL}/${pkgfile}" "${ftppath_to}/${tarch}/"
if [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig ]]; then
@@ -65,7 +73,7 @@ for pkgbase in "${args[@]:2}"; do
fi
add_pkgs+=("${FTP_BASE}/${PKGPOOL}/${pkgfile}")
remove_pkgs+=("${pkgname}")
- done < <(arch_expac_pkgbase "$repo_from" "$tarch" '%n %v %f' "$pkgbase")
+ done < <(arch_expac_pkgbase "$repo_from" "$tarch" '%e %n %v %f' "$pkgbase")
done
vcs_move_finish
done
diff --git a/db-remove b/db-remove
index a9d8eb4..5c6762c 100755
--- a/db-remove
+++ b/db-remove
@@ -22,16 +22,33 @@ else
tarches=("$arch")
fi
+msg "Removing packages from [%s]..." "$repo"
+
for tarch in "${tarches[@]}"; do
repo_lock "$repo" "$tarch" || exit 1
declare -a remove_pkgs_$tarch
done
for pkgbase in "${pkgbases[@]}"; do
- msg "Removing %s from [%s]..." "$pkgbase" "$repo"
for tarch in "${tarches[@]}"; do
+ msg2 "%s (%s)" "$pkgbase" "$tarch"
declare -n remove_pkgs="remove_pkgs_${tarch}"
- mapfile -t pkgnames < <(arch_expac_pkgbase "$repo" "$tarch" '%n' "$pkgbase")
- remove_pkgs+=("${pkgnames[@]}")
+ # We could just use %n and a single `mapfile`, but
+ # getting extra info and printing everything is more
+ # user-friendly.
+ found=false
+ while read -r _pkgbase pkgname pkgver; do
+ plain 'pkgname=%s (%s)' "${pkgname}" "$pkgver"
+ [[ $_pkgbase != '(null)' ]] || _pkgbase=$pkgname
+ if [[ $_pkgbase != $pkgbase ]]; then
+ warning "'%s' is a member of pkgbase=%s" "$pkgname" "$_pkgbase"
+ warning "It is the only member being removed;"
+ warning "you will need to remove the others yourself!"
+ fi
+
+ remove_pkgs+=("${pkgname}")
+ found=true
+ done < <(arch_expac_pkgbase "$repo" "$tarch" '%e %n %v' "$pkgbase")
+ [[ $found = true ]] || plain '(none)'
vcs_remove "$repo" "$tarch" "$pkgbase"
done
done