From 80a7b7fb320a907a60a270070d495b1122904e7a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 5 Nov 2014 11:16:37 -0400 Subject: add format marker for package list to avoid spamming commit message with big diff when format changes --- list-installed.d/50list-installed | 29 +++++++++++++++++++---------- post-install.d/50vcs-commit | 6 ++---- pre-install.d/10packagelist | 1 + 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/list-installed.d/50list-installed b/list-installed.d/50list-installed index ac34202..2ac569a 100755 --- a/list-installed.d/50list-installed +++ b/list-installed.d/50list-installed @@ -1,12 +1,21 @@ #!/bin/sh -# Output to stdout a *sorted* list of all currently installed -# (or removed but still with config-files) packages, in the -# format "package version\n" (or something similar). -if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then - dpkg-query -W -f '${Status}\t${Package} ${Version} ${Architecture}\n' | \ - egrep '(ok installed|ok config-files)' | cut -f2,3 -elif [ "$LOWLEVEL_PACKAGE_MANAGER" = rpm ]; then - rpm -qa --qf "%|epoch?{%{epoch}}:{0}|:%{name}-%{version}-%{release}.%{arch}\n" | sort -elif [ "$LOWLEVEL_PACKAGE_MANAGER" = pacman ]; then - pacman -Q +if [ "$1" = fmt ]; then + # If the list format changes, change the fmt + if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then + echo 2 + else + echo "" + fi +else + # Output to stdout a *sorted* list of all currently installed + # (or removed but still with config-files) packages, in the + # format "package version\n" (or something similar). + if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then + dpkg-query -W -f '${Status}\t${Package} ${Version} ${Architecture}\n' | \ + egrep '(ok installed|ok config-files)' | cut -f2,3 + elif [ "$LOWLEVEL_PACKAGE_MANAGER" = rpm ]; then + rpm -qa --qf "%|epoch?{%{epoch}}:{0}|:%{name}-%{version}-%{release}.%{arch}\n" | sort + elif [ "$LOWLEVEL_PACKAGE_MANAGER" = pacman ]; then + pacman -Q + fi fi diff --git a/post-install.d/50vcs-commit b/post-install.d/50vcs-commit index 36f3ee4..53138c8 100755 --- a/post-install.d/50vcs-commit +++ b/post-install.d/50vcs-commit @@ -7,7 +7,7 @@ if etckeeper unclean; then message="committing changes in /etc after $HIGHLEVEL_PACKAGE_MANAGER run" set +e - if [ -e $pl.pre-install ]; then + if [ -e $pl.pre-install ] && [ "$(cat $pl.fmt 2>/dev/null || true)" = "$(etckeeper list-installed fmt)" ]; then ( echo "$message" echo @@ -25,6 +25,4 @@ if etckeeper unclean; then fi fi -if [ -e $pl.pre-install ]; then - rm -f $pl.pre-install -fi +rm -f $pl.pre-install $pl.fmt diff --git a/pre-install.d/10packagelist b/pre-install.d/10packagelist index e5fefa8..fbd4ac3 100755 --- a/pre-install.d/10packagelist +++ b/pre-install.d/10packagelist @@ -2,3 +2,4 @@ # This list will be later used when committing. mkdir -p /var/cache/etckeeper/ etckeeper list-installed > /var/cache/etckeeper/packagelist.pre-install +etckeeper list-installed fmt > /var/cache/etckeeper/packagelist.fmt -- cgit v1.2.3