]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
libxfs-apply: reduce output verbosity
authorDave Chinner <david@fromorbit.com>
Thu, 2 Jul 2015 03:07:00 +0000 (13:07 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 2 Jul 2015 03:07:00 +0000 (13:07 +1000)
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 <david@fromorbit.com>
tools/libxfs-apply

index 3b57298c66b07224eb7ca69403f89a18cd205d11..80ade23cd9ddfa5d2bf60cb4db9df83a526b8d94 100755 (executable)
@@ -8,7 +8,7 @@ usage()
        echo $*
        echo
        echo "Usage:"
-       echo "  libxfs-apply --source <repodir> --commit <commit_id>"
+       echo "  libxfs-apply [--verbose] --source <repodir> --commit <commit_id>"
        echo "  libxfs-apply --patch <patchfile>"
        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