Author: adam-guest
Date: 2008-03-24 17:49:16 +0000 (Mon, 24 Mar 2008)
New Revision: 1196
Added:
trunk/scripts/dcmd.1
trunk/scripts/dcmd.sh
Modified:
trunk/README
trunk/conf.default.in
trunk/debian/changelog
trunk/debian/control
trunk/po4a/devscripts-po4a.conf
Log:
dcmd: New script from Romain Francoise to run a given command replacing
the name of a .changes or .dsc file with each of the files referenced
therein (Closes: #472492)
Modified: trunk/README
===================================================================
--- trunk/README 2008-03-24 17:32:08 UTC (rev 1195)
+++ trunk/README 2008-03-24 17:49:16 UTC (rev 1196)
@@ -48,6 +48,9 @@
wrapper for cvs-buildpackage to use debuild as its package building
program.
+- dcmd: Run a given command replacing the name of a .changes or .dsc
+ file with each of the files referenced therein
+
- dd-list: Given a list of packages, pretty-print it ordered by maintainer.
- debc: List contents of current package. Do this after a successful
Modified: trunk/conf.default.in
===================================================================
--- trunk/conf.default.in 2008-03-24 17:32:08 UTC (rev 1195)
+++ trunk/conf.default.in 2008-03-24 17:49:16 UTC (rev 1196)
@@ -125,6 +125,10 @@
#
# No variables currently
+##### dcmd
+#
+# No variables currently
+
##### debc
#
# debc recognises the DEBRELEASE_DEBS_DIR variable; see debrelease
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-03-24 17:32:08 UTC (rev 1195)
+++ trunk/debian/changelog 2008-03-24 17:49:16 UTC (rev 1196)
@@ -18,6 +18,9 @@
disguising a non shell script as one
+ If more than one issue was found within a single line, output each
rather than just the first
+ * dcmd: New script from Romain Francoise to run a given command replacing
+ the name of a .changes or .dsc file with each of the files referenced
+ therein (Closes: #472492)
* debcheckout: Allow specific files from the repository to be retrieved
rather than checking out the repository (Closes: #469242)
* debcommit:
Modified: trunk/debian/control
===================================================================
--- trunk/debian/control 2008-03-24 17:32:08 UTC (rev 1195)
+++ trunk/debian/control 2008-03-24 17:49:16 UTC (rev 1196)
@@ -47,6 +47,8 @@
dupload | dput, ssh]
- cvs-debuild: run cvs-buildpackage using debuild (see below) as the
package building program [cvs-buildpackage, fakeroot, lintian, gnupg]
+ - dcmd: run a given command replacing the name of a .changes or .dsc file
+ with each of the files referenced therein
- dd-list: given a list of packages, pretty-print it ordered by maintainer
- debc: display the contents of just-built .debs
- debchange/dch: automagically add entries to debian/changelog files
Modified: trunk/po4a/devscripts-po4a.conf
===================================================================
--- trunk/po4a/devscripts-po4a.conf 2008-03-24 17:32:08 UTC (rev 1195)
+++ trunk/po4a/devscripts-po4a.conf 2008-03-24 17:49:16 UTC (rev 1196)
@@ -29,6 +29,8 @@
fr:fr/cvs-debrelease.fr.1 add_fr:add_fr/translator_man.add
[type:man] ../scripts/cvs-debuild.1 \
fr:fr/cvs-debuild.fr.1 add_fr:add_fr/translator_man.add
+[type:man] ../scripts/dcmd.1 \
+ fr:fr/dcmd.fr.1 add_fr:add_fr/translator_man.add
[type:man] ../scripts/dd-list.1 \
fr:fr/dd-list.fr.1 add_fr:add_fr/translator_man.add
[type:man] ../scripts/debc.1 \
Added: trunk/scripts/dcmd.1
===================================================================
--- trunk/scripts/dcmd.1 (rev 0)
+++ trunk/scripts/dcmd.1 2008-03-24 17:49:16 UTC (rev 1196)
@@ -0,0 +1,38 @@
+.TH DCMD 1 "Debian Utilities" "DEBIAN" \" -*- nroff -*-
+.SH NAME
+dcmd \- expand file lists of .dsc/.changes files in the command line
+.SH SYNOPSIS
+\fBdcmd\fR [command] [\fIchanges-file\fR|\fIdsc-file\fR] [...]
+.SH DESCRIPTION
+\fBdcmd\fR replaces any reference to a .dsc or .changes file in the
+command line with the list of files in its 'Files' section, plus the
+file itself. It allows easy manipulation of all the files involved in
+an upload (for changes files) or a source package (for dsc files).
+.SH "EXAMPLES"
+Copy the result of a build to another machine:
+
+.nf
+$ dcmd scp rcs_5.7-23_amd64.changes elegiac:/tmp
+rcs_5.7-23.dsc 100% 490 0.5KB/s 00:00
+rcs_5.7-23.diff.gz 100% 12KB 11.7KB/s 00:00
+rcs_5.7-23_amd64.deb 100% 363KB 362.7KB/s 00:00
+rcs_5.7-23_amd64.changes 100% 1095 1.1KB/s 00:00
+$
+.fi
+
+Check the contents of a source package:
+
+.nf
+$ dcmd md5sum rcs_5.7-23.dsc
+8fd09ea9654cda128f8d5c337d3b8de7 rcs_5.7.orig.tar.gz
+f0ceeae96603e823eacba6721a30b5c7 rcs_5.7-23.diff.gz
+5241db1e231b1f43ae5514b63d2523f8 rcs_5.7-23.dsc
+$
+.fi
+
+.SH "SEE ALSO"
+.BR dpkg-source (1),
+.BR dpkg-genchanges (1).
+.SH AUTHOR
+This program was written by Romain Francoise <[EMAIL PROTECTED]> and
+is released under the GPL, version 2 or later.
Added: trunk/scripts/dcmd.sh
===================================================================
--- trunk/scripts/dcmd.sh (rev 0)
+++ trunk/scripts/dcmd.sh 2008-03-24 17:49:16 UTC (rev 1196)
@@ -0,0 +1,88 @@
+#!/bin/sh
+#
+# dcmd: expand file lists of .dsc/.changes files in the command line
+#
+# Copyright (C) 2008 Romain Francoise <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Usage:
+#
+# dcmd replaces any reference to a .dsc or .changes file in the command
+# line with the list of files in its 'Files' section, plus the
+# .dsc/.changes file itself.
+#
+# $ dcmd sha1sum rcs_5.7-23_amd64.changes
+# f61254e2b61e483c0de2fc163321399bbbeb43f1 rcs_5.7-23.dsc
+# 7a2b283b4c505d8272a756b230486a9232376771 rcs_5.7-23.diff.gz
+# e3bac970a57a6b0b41c28c615f2919c931a6cb68 rcs_5.7-23_amd64.deb
+# c531310b18773d943249cfaa8b539a9b6e14b8f4 rcs_5.7-23_amd64.changes
+# $
+
+PROGNAME=`basename $0`
+
+version () {
+ echo \
+"This is $PROGNAME, from the Debian devscripts package, version ###VERSION###
+This code is copyright 2008 by Romain Francoise, all rights reserved.
+This program comes with ABSOLUTELY NO WARRANTY.
+You are free to redistribute this code under the terms of the
+GNU General Public License, version 2 or later."
+}
+
+usage()
+{
+ printf "Usage: %s [command] [dsc or changes file] [...]\n" $PROGNAME
+}
+
+endswith()
+{
+ [ $(basename "$1" $2)$2 = $(basename "$1") ]
+}
+
+# Instead of parsing the file completely as the previous Python
+# implementation did (using python-debian), let's just select lines
+# that look like they might be part of the file list.
+RE="^ [0-9a-f]{32} [0-9]+ ([a-z]+ [a-z]+ )?(.*)$"
+
+maybe_expand()
+{
+ local dir
+ if [ -f "$1" ] && (endswith "$1" .changes || endswith "$1" .dsc); then
+ dir=$(dirname "$1")
+ sed -rn "s,$RE,$dir/\2,p" <"$1" | sed 's,^\./,,'
+ fi
+}
+
+if [ "$1" = "--version" ] || [ "$1" = "-v" ]; then
+ version
+ exit 0
+elif [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
+ usage
+ exit 0
+elif [ $# -lt 2 ]; then
+ usage
+ exit 1
+fi
+
+cmd=$1
+shift
+
+args=""
+for arg in "$@"; do
+ args="$args $(maybe_expand "$arg") $arg"
+done
+
+exec $cmd $args
--
To unsubscribe, send mail to [EMAIL PROTECTED]