[v2] paclist: list packages which version differs from the repo version

Message ID 20181206112738.12078-1-michael.straube@posteo.de
State Accepted, archived
Headers show
Series
  • [v2] paclist: list packages which version differs from the repo version
Related show

Commit Message

Michael Straube Dec. 6, 2018, 11:27 a.m. UTC
Paclist does not list installed packages if the version is different
from the version in the repository. Change the awk command to also
match such packages from the 'pacman -Sl' output and print the
installed version. Also paclist fails for languages which translate
'installed' to more than one word. So do not use the field numbers
in a record for matching.

Fixes FS#60412

Signed-off-by: Michael Straube <michael.straube@posteo.de>
---
v1 -> v2
Do not use filed numbers for matching.
Also remove export of TEXTDOMAIN and TEXTDOMAINDIR.

 src/paclist.sh.in | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Patch

diff --git a/src/paclist.sh.in b/src/paclist.sh.in
index f827dcf..efd47af 100644
--- a/src/paclist.sh.in
+++ b/src/paclist.sh.in
@@ -20,16 +20,6 @@ 
 declare -r myname='paclist'
 declare -r myver='@PACKAGE_VERSION@'
 
-export TEXTDOMAIN='pacman'
-export TEXTDOMAINDIR='/usr/share/locale'
-
-# determine whether we have gettext; make it a no-op if we do not
-if ! type gettext &>/dev/null; then
-	gettext() {
-		echo "$@"
-	}
-fi
-
 usage() {
 	printf "%s v%s\n" "${myname}" "${myver}"
 	echo
@@ -59,8 +49,8 @@  elif [[ $1 = -@(V|-version) ]]; then
 	exit 0
 fi
 
-printf -v installed '[%s]' "$(gettext installed)"
-pacman -Sl $1 | awk -v i="$installed" '$NF == i { print $2,$3 }'
+pacman -Sl $1 | awk '/\[.*[[:alpha:]]+]$/ {print $2,$3};
+                     /\[.*[[:digit:]]+]$/ {print $2,substr($NF, 1, length($NF) - 1)}'
 
 # exit with pacman's return value, not awk's
 exit ${PIPESTATUS[0]}