From: Dave Chinner Date: Thu, 30 Jul 2015 23:08:58 +0000 (+1000) Subject: libxfs-apply: reduce output verbosity X-Git-Tag: v4.2.0-rc1~3^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ee451f8a713aeab2b371854b9ca6e4372302b94;p=thirdparty%2Fxfsprogs-dev.git libxfs-apply: reduce output verbosity When applying a series of patches, there is lots of verbosity that hides the actual operations being done. Hide all that verbosity behind a --verbose CLI option. For patch based execution, turn the verbosity on by default, otherwise leave it off. Signed-off-by: Dave Chinner --- diff --git a/tools/libxfs-apply b/tools/libxfs-apply index 3b57298c6..80ade23cd 100755 --- a/tools/libxfs-apply +++ b/tools/libxfs-apply @@ -8,7 +8,7 @@ usage() echo $* echo echo "Usage:" - echo " libxfs-apply --source --commit " + echo " libxfs-apply [--verbose] --source --commit " echo " libxfs-apply --patch " echo echo "libxfs-apply should be run in the destination git repository." @@ -41,6 +41,7 @@ check_repo() REPO= PATCH= COMMIT_ID= +VERBOSE= GUILT=0 while [ $# -gt 0 ]; do @@ -48,6 +49,7 @@ while [ $# -gt 0 ]; do --source) REPO=$2 ; shift ;; --patch) PATCH=$2; shift ;; --commit) COMMIT_ID=$2 ; shift ;; + --verbose) VERBOSE=true ;; *) usage ;; esac shift @@ -57,6 +59,7 @@ if [ -n "$PATCH" ]; then if [ -n "$REPO" -o -n "$COMMIT_ID" ]; then usage "Need to specify either patch or source repo/commit" fi + VERBOSE=true elif [ -z "$REPO" -o -z "$COMMIT_ID" ]; then usage "Need to specify both source repo and commit id" fi @@ -109,7 +112,7 @@ filter_kernel_patch() local _patch=$1 local _libxfs_files="" - lsdiff $_patch | grep -q "a/libxfs/" + [ -n "$VERBOSE" ] || lsdiff $_patch | grep -q "a/libxfs/" if [ $? -ne 0 ]; then fail "Doesn't look like an xfsprogs patch with libxfs changes" fi @@ -134,7 +137,7 @@ filter_xfsprogs_patch() local _patch=$1 local _libxfs_files="" - lsdiff $_patch | grep -q "a/fs/xfs/libxfs/" + [ -n "$VERBOSE" ] || lsdiff $_patch | grep -q "a/fs/xfs/libxfs/" if [ $? -ne 0 ]; then fail "Doesn't look like a kernel patch with libxfs changes" fi @@ -165,15 +168,17 @@ apply_patch() filter_xfsprogs_patch $_patch > $_new_patch fi - echo "Filtered patch for $REPO contains:" - lsdiff $_new_patch + if [ -n "$VERBOSE" ]; then + echo "Filtered patch from $REPO contains:" + lsdiff $_new_patch + fi # Ok, now apply with guilt or patch; either may fail and require a force # and/or a manual reject fixup if [ $GUILT -eq 1 ]; then - echo "$REPO looks like a guilt directory." + [ -n "$VERBOSE" ] || echo "$REPO looks like a guilt directory." PATCHES=`guilt applied | wc -l` - if [ $PATCHES -gt 0 ]; then + if [ -n "$VERBOSE" -a $PATCHES -gt 0 ]; then echo -n "Top patch is: " guilt top fi