cosmetic : makes yum-arch's and createrepo's output readable
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 22 Aug 2006 12:37:08 +0000 (12:37 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 22 Aug 2006 12:37:08 +0000 (12:37 +0000)
mkfedora

index 4b0e25e..b439739 100755 (executable)
--- a/mkfedora
+++ b/mkfedora
@@ -13,7 +13,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2004-2006 The Trustees of Princeton University
 #
-# $Id: mkfedora,v 1.19 2006/08/16 01:23:53 mlhuang Exp $
+# $Id: mkfedora,v 1.20 2006/08/16 01:56:06 mlhuang Exp $
 #
 
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -75,6 +75,12 @@ usage()
     exit 1
 }
 
+### post-process output of createrepo --quiet or of yum-arch
+# replaces ^M with ^J, and removes whitespace-only lines
+function post-filter () {
+   tr '\r' '\n' | grep -v '^ *$'
+}
+
 # Get options
 while getopts "l:r:a:g:p:x:kvh" opt ; do
     case $opt in
@@ -292,14 +298,14 @@ if [ -n "$RPM_BUILD_DIR" ] ; then
     RPM_RPMS_DIR=$(cd $(dirname $RPM_BUILD_DIR)/RPMS && pwd -P)
     # yum-2.0.x
     if [ -x /usr/bin/yum-arch ] ; then
-       yum-arch $RPM_RPMS_DIR
+       yum-arch $RPM_RPMS_DIR | post-filter
     fi
     # yum-2.4.x
     if [ -x /usr/bin/createrepo ] ; then
        if [ -f $RPM_RPMS_DIR/yumgroups.xml ] ; then
            groupfile="-g yumgroups.xml"
        fi
-       createrepo $groupfile $RPM_RPMS_DIR
+       createrepo --quiet $groupfile $RPM_RPMS_DIR | post-filter
     fi
     # If run under sudo, allow user to delete the headers/ and
     # repodata/ directories.