[pacman-dev] [PATCH] makepkg: avoid using comm for diff'ing package lists
Whereas comm will check inputs to see if they're sorted (and warn when they aren't), grep doesn't even care about ordering. In this particular instance -- neither do we. We're only interested that the two lists are equivalent. Fixes FS#26580. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- scripts/makepkg.sh.in | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 26a2789..11f9adb 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -506,10 +506,10 @@ remove_deps() { # check for packages removed during dependency install (e.g. due to conflicts) # removing all installed packages is risky in this case - if [[ -n $(comm -23 <(printf "%s\n" "${original_pkglist[@]}") \ - <(printf "%s\n" "${current_pkglist[@]}")) ]]; then - warning "$(gettext "Failed to remove installed dependencies.")" - return 0 + if [[ -n $(grep -xvFf <(printf '%s\n' "${current_packagelist[@]}") \ + <(printf '%s\n' "${original_packagelist[@]}") ) ]]; then + warning "$(gettext "Failed to remove installed dependencies.")" + return 0 fi local deplist=($(comm -13 <(printf "%s\n" "${original_pkglist[@]}") \ -- 1.7.7.4
ignore this garbage... On Mon, Nov 21, 2011 at 11:46:05PM -0500, Dave Reisner wrote:
Whereas comm will check inputs to see if they're sorted (and warn when they aren't), grep doesn't even care about ordering. In this particular instance -- neither do we. We're only interested that the two lists are equivalent.
Fixes FS#26580.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- scripts/makepkg.sh.in | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 26a2789..11f9adb 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -506,10 +506,10 @@ remove_deps() {
# check for packages removed during dependency install (e.g. due to conflicts) # removing all installed packages is risky in this case - if [[ -n $(comm -23 <(printf "%s\n" "${original_pkglist[@]}") \ - <(printf "%s\n" "${current_pkglist[@]}")) ]]; then - warning "$(gettext "Failed to remove installed dependencies.")" - return 0 + if [[ -n $(grep -xvFf <(printf '%s\n' "${current_packagelist[@]}") \ + <(printf '%s\n' "${original_packagelist[@]}") ) ]]; then + warning "$(gettext "Failed to remove installed dependencies.")" + return 0 fi
local deplist=($(comm -13 <(printf "%s\n" "${original_pkglist[@]}") \ -- 1.7.7.4
participants (1)
-
Dave Reisner