scripts: Make sorting consistent in listings with LC_ALL=C

master
Pierre Neidhardt 2016-10-14 09:47:18 +05:30
parent 8a717f202e
commit c8aaaa4526
4 changed files with 11 additions and 11 deletions

View File

@ -59,7 +59,7 @@ for i ; do
## different systems.
## The two following lines do the same for the same time cost. The former is shorter.
# find "$i" -type f | awk -v str="$i" '{l=length(str)+2; print substr($0, l)}' | sort > "$OUTPUT"
# find "$i" -type f | awk -v str="$i" '{l=length(str)+2; print substr($0, l)}' | LC_ALL=C sort > "$OUTPUT"
(cd -- "$i" && find . -type f) | sed 's/^.\///' | LC_ALL=C sort | \
if $opt_file; then
i="$(realpath -- "$i")"

View File

@ -2,9 +2,9 @@
usage () {
cat <<EOF>&2
Usage: ${0##*/} [-m|-e] [-q] FILE
Usage: ${0##*/} [-m] [-e] [-q] FILES...
Display packages listed in FILE but not installed.
Display packages listed in FILES but not installed.
-e: Compare FILE to explicitly installed packages.
-h: Display this help.
@ -49,7 +49,7 @@ fi
PKGLIST="$(mktemp)"
FILE="$(mktemp)"
pacman -Qq${OPTION_FOREIGN}${OPTION_EXPLICIT} | sort > "$PKGLIST"
sort "$@" > "$FILE"
comm -3 ${OPTION_LOCAL} "$PKGLIST" "$FILE"
pacman -Qq${OPTION_FOREIGN}${OPTION_EXPLICIT} | LC_ALL=C sort > "$PKGLIST"
LC_ALL=C sort "$@" > "$FILE"
LC_ALL=C comm -3 ${OPTION_LOCAL} "$PKGLIST" "$FILE"
rm -f "$PKGLIST" "$FILE"

View File

@ -8,8 +8,8 @@ mkdir -p "$PKG_ROOT"
## Arch Linux
if command -v pacman >/dev/null 2>&1; then
pacman -Qneq | sort >"$PKG_ROOT/arch-official"
pacman -Qmeq | sort >"$PKG_ROOT/arch-aur"
pacman -Qneq | LC_ALL=C sort >"$PKG_ROOT/arch-official"
pacman -Qmeq | LC_ALL=C sort >"$PKG_ROOT/arch-aur"
fi
## FreeBSD

View File

@ -41,12 +41,12 @@ i)
l)
## Note: We use <TAB> in the sed expressions.
TEXLIVE_BASIC="$(mktemp)"
tlmgr info collection-basic --list | sed -n '/^ /{s/ //g;p;}' | sort >"$TEXLIVE_BASIC"
tlmgr info collection-basic --list | sed -n '/^ /{s/ //g;p;}' | LC_ALL=C sort >"$TEXLIVE_BASIC"
TEXLIVE_ALL="$(mktemp)"
tlmgr info --only-installed | grep -v 'x86_64\|amd64' | cut -d' ' -f2 | cut -f1 -d':' | sort >"$TEXLIVE_ALL"
tlmgr info --only-installed | grep -v 'x86_64\|amd64' | cut -d' ' -f2 | cut -f1 -d':' | LC_ALL=C sort >"$TEXLIVE_ALL"
comm -3 "$TEXLIVE_BASIC" "$TEXLIVE_ALL" | sed 's/ //g' | \
LC_ALL=C comm -3 "$TEXLIVE_BASIC" "$TEXLIVE_ALL" | sed 's/ //g' | \
grep -vi 'collection-basic\|scheme-minimal\|texlive-common\|texlive-docindex\|texlive-en'
rm "$TEXLIVE_ALL" "$TEXLIVE_BASIC"