[pkg-perl-tools] 02/02: gc: support parallel from both GNU moreutils

Damyan Ivanov dmn at moszumanska.debian.org
Sun Dec 3 23:20:08 UTC 2017


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to branch master
in repository pkg-perl-tools.

commit 83f916f657a73b2fcfc95d2eb19bec4ed2e48a36
Author: Damyan Ivanov <dmn at debian.org>
Date:   Sun Dec 3 23:13:24 2017 +0000

    gc: support parallel from both GNU moreutils
---
 debian/control |  2 +-
 scripts/gc     | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/debian/control b/debian/control
index 90c684c..b5d84e5 100644
--- a/debian/control
+++ b/debian/control
@@ -82,7 +82,7 @@ Suggests: bc,
           cdbs,
           duck,
           moreutils,
-          parallel,
+          parallel | moreutils,
           perl-depends,
           python,
           python-launchpadlib
diff --git a/scripts/gc b/scripts/gc
index d7fca6f..6436f7f 100755
--- a/scripts/gc
+++ b/scripts/gc
@@ -27,9 +27,13 @@ while getopts vshp opt; do
         ;;
         p)
             if which parallel > /dev/null ; then
-                PARALLEL=1
+                if parallel --will-cite < /dev/null > /dev/null; then
+                    PARALLEL=GNU
+                else
+                    PARALLEL="moreutils"
             else
-                echo "W: 'parallel' not available, wil run sequentially" >&2
+                echo "W: 'parallel' not available, will run sequentially" >&2
+                echo "W: you may want to install 'parallel' or 'moreutils'" >&2
             fi
         ;;
         v) VERBOSE=1;;
@@ -78,8 +82,13 @@ if [ -n "$STATS" ]; then
 fi
 
 if [ -n "$PARALLEL" ]; then
-    find . -maxdepth 2 -type d -name .git | \
-        parallel --will-cite sh -c "GIT_DIR='{}' git gc --quiet"
+    if [ "$PARALLEL" = "GNU" ]; then
+        find . -maxdepth 2 -type d -name .git | \
+            parallel --will-cite sh -c "GIT_DIR='{}' git gc --quiet"
+    else
+        find . -maxdepth 2 -type d -name .git -print0 | \
+            xargs -r0 parallel -i sh -c "GIT_DIR='{}' git gc --quiet" --
+    fi
 else
     for d in `find . -maxdepth 1 -type d`; do
         [ -d "$d/.git" ] || continue

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/pkg-perl-tools.git



More information about the Pkg-perl-cvs-commits mailing list