[devscripts] 02/02: dcmd: Add --debtar option and restrict --tar/--orig to orig.tar.*

James McCoy jamessan at debian.org
Tue Aug 12 02:57:29 UTC 2014


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

jamessan pushed a commit to branch master
in repository devscripts.

commit 4e0844cc2c428f01d89e1b4f013ff1199b12ca4f
Author: James McCoy <jamessan at debian.org>
Date:   Mon Aug 11 22:47:40 2014 -0400

    dcmd: Add --debtar option and restrict --tar/--orig to orig.tar.*
    
    Closes: #622561
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog |  2 ++
 scripts/dcmd.1   | 16 +++++++++++++---
 scripts/dcmd.sh  | 30 ++++++++++++++++++++++++++++--
 3 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a1a95e7..2844344 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ devscripts (2.14.7) UNRELEASED; urgency=low
     is given.  (Closes: #757481)
   * debcheckout: Always define $origtgz_name when a URL is specified on the
     command line.  (Closes: #757614)
+  * dcmd: Add --debtar option and restrict --tar/--orig to orig.tar.*.  Thanks
+    to Osamu Aoki for the patch.  (Closes: #622561)
 
  -- Cyril Brulebois <kibi at debian.org>  Fri, 08 Aug 2014 01:27:12 +0200
 
diff --git a/scripts/dcmd.1 b/scripts/dcmd.1
index 2195620..0438082 100644
--- a/scripts/dcmd.1
+++ b/scripts/dcmd.1
@@ -48,10 +48,10 @@ Select architecture-independent \fI.udeb\fR binary packages.
 Select \fI.udeb\fR binary packages. Implies \fB\-\-archudeb\fR and \fB\-\-indepudeb\fR.
 .TP
 .BR \-\-tar ,\  \-\-orig
-Select the \fI.tar\fR file.
+Select the upstream \fI.tar\fR file.
 .TP
-.B \-\-diff
-Select the Debian \fI.diff\fR file.
+.BR \-\-diff ,\  \-\-debtar
+Select the Debian \fI.debian.tar\fR or \fI.diff\fR file.
 .PP
 Each option may be prefixed by \fB\-\-no\fR to indicate that all files
 \fInot\fR matching the specification should be selected.
@@ -62,6 +62,16 @@ and negative filtering options (e.g. \fB\-\-no\-changes\fR) in the same
 .TP
 .B \-\-no\-fail\-on\-missing\fR, \fB\-r
 If any of the requested files were not found, do not output an error.
+.TP
+.B \-\-package\fR, \fB\-p
+Output package name part only.
+.TP
+.B \-\-sort\fR, \fB\-s
+Sort output alphabetically.
+.TP
+.B \-\-tac\fR, \fB\-t
+Reverse output order.
+
 .SH "EXAMPLES"
 Copy the result of a build to another machine:
 
diff --git a/scripts/dcmd.sh b/scripts/dcmd.sh
index 3fb7d33..525123f 100755
--- a/scripts/dcmd.sh
+++ b/scripts/dcmd.sh
@@ -80,6 +80,9 @@ maybe_expand()
 DSC=1; BCHANGES=1; SCHANGES=1; ARCHDEB=1; INDEPDEB=1; TARBALL=1; DIFF=1
 CHANGES=1; DEB=1; ARCHUDEB=1; INDEPUDEB=1; UDEB=1;
 FILTERED=0; FAIL_MISSING=1
+EXTRACT_PACKAGE_NAME=0
+SORT=0
+TAC=0
 
 while [ $# -gt 0 ]; do
     TYPE=""
@@ -88,6 +91,9 @@ while [ $# -gt 0 ]; do
 	--help|-h) usage; exit 0;;
 	--no-fail-on-missing|-r) FAIL_MISSING=0;;
 	--fail-on-missing) FAIL_MISSING=1;;
+	--package|-p) EXTRACT_PACKAGE_NAME=1;;
+	--sort|-s) SORT=1;;
+	--tac|-t) TAC=1;;
 	--) shift; break;;
 	--no-*)
 	    TYPE=${1#--no-}
@@ -127,7 +133,7 @@ while [ $# -gt 0 ]; do
 	archudeb) [ "$FILTERED" = "1" ] && ARCHUDEB=1 || ARCHUDEB=0;;
 	indepudeb) [ "$FILTERED" = "1" ] && INDEPUDEB=1 || INDEPUDEB=0;;
 	tar|orig) [ "$FILTERED" = "1" ] && TARBALL=1 || TARBALL=0;;
-	diff) [ "$FILTERED" = "1" ] && DIFF=1 || DIFF=0;;
+	diff|debtar) [ "$FILTERED" = "1" ] && DIFF=1 || DIFF=0;;
 	*) echo "$PROGNAME: Unknown option '$1'" >&2; exit 1;;
     esac
     shift
@@ -175,6 +181,12 @@ $THISARG\";"
 		[ "$ARCHUDEB" = "0" ] || echo "newarg=\"\$newarg
 $THISARG\";"
 		echo "SEEN_ARCHUDEB=1;"
+	    elif endswith "$THISARG" .debian.tar.gz || \
+		 endswith "$THISARG" .debian.tar.xz || \
+		 endswith "$THISARG" .debian.tar.bz2; then
+		[ "$DIFF" = "0" ] || echo "newarg=\"\$newarg
+$THISARG\";"
+		echo "SEEN_DIFF=1;"
 	    elif endswith "$THISARG" .tar.gz || \
 		 endswith "$THISARG" .tar.xz || \
 		 endswith "$THISARG" .tar.lzma || \
@@ -265,7 +277,7 @@ $THISARG\";"
 		MISSING=1; echo "$arg: upstream tar not found" >&2
 	    fi
 	    if [ "$DIFF" = "1" ] && [ "$SEEN_DIFF" = "0" ]; then
-		MISSING=1; echo "$arg: Debian diff not found" >&2
+		MISSING=1; echo "$arg: Debian debian.tar/diff not found" >&2
 	    fi
 
 	    [ "$MISSING" = "0" ] || exit 1
@@ -280,6 +292,20 @@ done
 
 IFS='
 '
+if [ "$EXTRACT_PACKAGE_NAME" = "1" ]; then
+    packages=""
+    for arg in $args; do
+        packages="$packages
+$(echo "$arg" |sed s/_.*//)"
+    done
+    args="$packages"
+fi
+if [ "$SORT" = "1" ]; then
+    args="$(echo "$args"| sort -)"
+fi
+if [ "$TAC" = "1" ]; then
+    args="$(echo "$args"| tac -)"
+fi
 if [ -z "$cmd" ]; then
     for arg in $args; do
 	echo $arg

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list