commit:     e58107167fffbe1d0e4c0560b8be5a9d28c5c55d
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  7 12:34:14 2016 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Jun  7 12:34:14 2016 +0000
URL:        https://gitweb.gentoo.org/proj/emacs-tools.git/commit/?id=e5810716

Run qfile under xargs since it has lost the -f option.

* emacs-updater: Run qfile under xargs since portage-utils-0.61
has lost the -f option. Fixes bug 584984. Enable the pipefail
option in bash, in order to check qfile's exit status.

 ChangeLog     |  6 ++++++
 emacs-updater | 10 +++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7f8124d..8954223 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-07  Ulrich Müller  <[email protected]>
+
+       * emacs-updater: Run qfile under xargs since portage-utils-0.61
+       has lost the -f option. Fixes bug 584984. Enable the pipefail
+       option in bash, in order to check qfile's exit status.
+
 2014-06-05  Ulrich Müller  <[email protected]>
 
        * Version 1.14 released.

diff --git a/emacs-updater b/emacs-updater
index 8d33bae..361817b 100755
--- a/emacs-updater
+++ b/emacs-updater
@@ -268,6 +268,7 @@ cleanup() {
 }
 
 trap cleanup EXIT
+set -o pipefail
 
 TMPFILE="$(mktemp ${TMPDIR:-/tmp}/emacs-updater.files.XXXXXX)"
 PKGFILE="$(mktemp ${TMPDIR:-/tmp}/emacs-updater.pkgs.XXXXXX)"
@@ -286,14 +287,17 @@ NO_OF_FILES=$(wc -l <"${TMPFILE}")
 message "Assigning ${NO_OF_FILES} file${s} to packages ..."
 
 if [[ ${ORPHANS} ]]; then
-    qfile -oCR -f "${TMPFILE}" | sort -u > "${PKGFILE}"
+    xargs qfile -oCR <"${TMPFILE}" | sort -u >"${PKGFILE}"
 elif [[ ${EXACT} ]]; then
-    qfile -eqCR -f "${TMPFILE}" | sort -u | sed 's/^/=/' > "${PKGFILE}"
+    xargs qfile -eqCR <"${TMPFILE}" | sort -u | sed 's/^/=/' >"${PKGFILE}"
 else
     # Get package and slot number, requires >=portage-utils-0.3
-    qfile -SqCR -f "${TMPFILE}" | sort -u > "${PKGFILE}"
+    xargs qfile -SqCR <"${TMPFILE}" | sort -u >"${PKGFILE}"
 fi
 
+ret=$?
+[[ ${ret} -eq 0 ]] || { failure "Error running qfile"; exit ${ret}; }
+
 NO_OF_PACKAGES=$(wc -l <"${PKGFILE}")
 [[ ${NO_OF_PACKAGES} -eq 1 ]] && s= || s=s
 if [[ ${ORPHANS} ]]; then

Reply via email to