Sort package manifests under LC_ALL=C
pkg-snapshot and dots used plain sort, which is locale-dependent: the same package set ordered differently on two machines, so dots reported drift that did not exist. A maintenance tool that always cries wolf is the exact failure mode dots exists to avoid.
This commit is contained in:
1 parent
c0bd4f5b1d
commit
4d4242f103
2 files changed
+5
-5
No files matched your search
+2
-2
@@ -19,10 +19,10 @@ fi
|
||||
pkgdrift=0
|
||||
tmp=$(mktemp)
|
||||
if command -v pacman >/dev/null 2>&1; then
|
||||
pacman -Qqen | sort > "$tmp"
|
||||
pacman -Qqen | LC_ALL=C sort > "$tmp"
|
||||
[[ -f "packages/${HOST}.pacman" ]] && ! diff -q "$tmp" "packages/${HOST}.pacman" >/dev/null && pkgdrift=1
|
||||
elif command -v apt-mark >/dev/null 2>&1; then
|
||||
apt-mark showmanual | sort > "$tmp"
|
||||
apt-mark showmanual | LC_ALL=C sort > "$tmp"
|
||||
[[ -f "packages/${HOST}.apt" ]] && ! diff -q "$tmp" "packages/${HOST}.apt" >/dev/null && pkgdrift=1
|
||||
fi
|
||||
rm -f "$tmp"
|
||||
|
||||
@@ -9,11 +9,11 @@ OUT="${REPO}/packages"
|
||||
mkdir -p "$OUT"
|
||||
|
||||
if command -v pacman >/dev/null 2>&1; then
|
||||
pacman -Qqen | sort > "${OUT}/${HOST}.pacman"
|
||||
pacman -Qqem | sort > "${OUT}/${HOST}.aur"
|
||||
pacman -Qqen | LC_ALL=C sort > "${OUT}/${HOST}.pacman"
|
||||
pacman -Qqem | LC_ALL=C sort > "${OUT}/${HOST}.aur"
|
||||
echo "wrote ${HOST}.pacman ($(wc -l < "${OUT}/${HOST}.pacman")) and ${HOST}.aur ($(wc -l < "${OUT}/${HOST}.aur"))"
|
||||
elif command -v apt-mark >/dev/null 2>&1; then
|
||||
apt-mark showmanual | sort > "${OUT}/${HOST}.apt"
|
||||
apt-mark showmanual | LC_ALL=C sort > "${OUT}/${HOST}.apt"
|
||||
echo "wrote ${HOST}.apt ($(wc -l < "${OUT}/${HOST}.apt"))"
|
||||
else
|
||||
echo "pkg-snapshot: no pacman or apt-mark on this machine" >&2; exit 1
|
||||
|
||||
Reference in new issue
Block a user