On Mon, Jun 27, 2005 at 12:50:01PM +0200, Stefano Zacchiroli wrote:
> > set up the environment variable. I think this is the most general
> > interface, keeping dpgo independent from dpatch configuration.
> I agree and I'm implementing this solution.
Done, patch attached.
Executive summary:
- added support to dpgo for the DPGO_ORIGTARPATH env variable
- dpgo manpage updated (still to be decided what to do with
DPGO_ORIGTARDIR)
- added support to dpep for
* a -p/--origtargzpath CLI switch
* a DPEP_ORIGTARGZPATH env variable
* a conf_origtargzpath setting
resulting value is passed to dpgo via DPGO_ORIGTARPATH env variable
Rename settings/env variable as you prefer.
Cheers.
--
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
[EMAIL PROTECTED],debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-
diff -ur dpatch-2.0.13.orig/dpep/dpatch-edit-patch
dpatch-2.0.13+zack/dpep/dpatch-edit-patch
--- dpatch-2.0.13.orig/dpep/dpatch-edit-patch 2005-06-26 15:29:31.000000000
+0200
+++ dpatch-2.0.13+zack/dpep/dpatch-edit-patch 2005-06-27 12:57:13.000000000
+0200
@@ -34,6 +34,7 @@
DPEP_TMPDIR="${DPEP_TMPDIR:-${conf_tmpdir:-${TMPDIR:-/tmp}}}"
DPEP_SHELL="${DPEP_SHELL:-${conf_shell:-${SHELL:-$(getent passwd $(id -un) |
cut -f7- -d:)}}}"
DPEP_EXCLUDE="${DPEP_EXCLUDE:-${conf_exclude:-CVS .svn}}"
+DPEP_ORIGTARGZPATH="${DPEP_ORIGTARGZPATH:-${conf_origtargzpath:-}}"
# We special-case $DPEP_ROOTCMD later, after dpep_parse_options()
@@ -166,6 +167,7 @@
PACKAGENAME="$(dpkg-parsechangelog | sed -n
'/^Source:/{s/^Source:[[:space:]]\+\(.*\)/\1/;p;q}')"
UPSTREAMVERSION="$(dpkg-parsechangelog | sed -n
'/^Version:/{s/^Version:[[:space:]]\+\([^-]\+\).*/\1/;p;q}')"
ORIGTARGZ="${PACKAGENAME}_${UPSTREAMVERSION}.orig.tar.gz"
+ export DPGO_ORIGTARPATH="$DPEP_ORIGTARGZPATH"
if ! eval "$DPEP_GETORIGTARGZ $REFPDIR"; then
dpep_message error "unable to obtain upstream tarball,
$DPEP_GET_ORIGTARGZ failed"
exit 1
diff -ur dpatch-2.0.13.orig/dpep/dpatch-edit-patch.1
dpatch-2.0.13+zack/dpep/dpatch-edit-patch.1
--- dpatch-2.0.13.orig/dpep/dpatch-edit-patch.1 2005-06-26 15:29:31.000000000
+0200
+++ dpatch-2.0.13+zack/dpep/dpatch-edit-patch.1 2005-06-27 13:39:15.000000000
+0200
@@ -133,6 +133,15 @@
and \fBconf_origtargz\fR (\fI~/.dpatch.conf\fR), Environment Variables
\fBDPEP_DEBIANONLY\fR and \fBDPEP_ORIGTARGZ\fR.
.TP
+.IB "\-p, \-\-origtargzpath="path
+When
+.IB \-b
+is in use, specify the path where upstream tarballs should be looked for.
+.B path
+is a colon-separated list of directories.
+Configuration variables: \fBconf_origtargzpath\fR (\fI~/.dpatch.conf\fR),
+Environment Variables \fBDPEP_ORIGTARGZPATH\fR.
+.TP
.IB "\-r, \-\-rootcmd="value
Command used to gain root privileges used to clean DPEP_SOURCEDIR.
Configuration variable \fBconf_rootcmd\fR, environment variable
\fBDPEP_ROOTCMD\fR.
@@ -309,7 +318,7 @@
.SH AUTHOR
This manual page was written by David B Harris <[EMAIL PROTECTED]>
-and modified in the course of development by Gergely Nagy <[EMAIL PROTECTED]>
-and Marc Haber <[EMAIL PROTECTED]>.
+and modified in the course of development by Gergely Nagy <[EMAIL PROTECTED]>,
+Marc Haber <[EMAIL PROTECTED]>, and Stefano Zacchiroli <[EMAIL PROTECTED]>.
.\" arch-tag: 7c0644f7-93aa-4308-bf43-b50d415e282e
diff -ur dpatch-2.0.13.orig/dpep/dpatch-edit-patch.functions
dpatch-2.0.13+zack/dpep/dpatch-edit-patch.functions
--- dpatch-2.0.13.orig/dpep/dpatch-edit-patch.functions 2005-06-26
15:29:31.000000000 +0200
+++ dpatch-2.0.13+zack/dpep/dpatch-edit-patch.functions 2005-06-27
13:33:11.000000000 +0200
@@ -25,17 +25,20 @@
directory.
Options:
- -d|--description=desc Description for the new patch, if applicable.
- -o|--outdir=dir Output directory for patches, defaults to
- \$(pwd)/debian/patches/
- -s|--sourcedir=dir Source directory, defaults to \$(pwd)
- -t|--tmpdir=dir Temporary directory, defaults to \$TMPDIR or /tmp/
- -e|--exclude List of files and directories to be excluded
- -b|--debianonly[=path] Unpack .orig.tar.gz before invoking the shell
- -k|--keeptemp Keep working source tree after exit.
- -c|--clean Clean the current directory.
- -l|--shell=shell Which shell should be invoked.
- -h|--help Print this message.
+ -d|--description=desc Description for the new patch, if applicable.
+ -o|--outdir=dir Output directory for patches, defaults to
+ \$(pwd)/debian/patches/
+ -s|--sourcedir=dir Source directory, defaults to \$(pwd)
+ -t|--tmpdir=dir Temporary directory, defaults to \$TMPDIR or /tmp/
+ -e|--exclude List of files and directories to be excluded
+ -b|--debianonly[=path] Unpack .orig.tar.gz before invoking the shell
+ -k|--keeptemp Keep working source tree after exit.
+ -c|--clean Clean the current directory.
+ -l|--shell=shell Which shell should be invoked.
+ -p|--origtargzpath=path Path where to look for upstream tarballs
+ (colon-separated list of directories,
+ meaninfgul only with -b).
+ -h|--help Print this message.
Examples:
dpatch-edit-patch 20_upstream_fix2 19_upstream_fix1
@@ -95,8 +98,8 @@
}
dpep_parse_options() {
- TEMP=$(getopt -o d:o:s:t:e:b::l:kch \
- --long
description:,outdir:,sourcedir:,tmpdir:,exclude:,debianonly::,shell:,keeptemp,clean,help
\
+ TEMP=$(getopt -o d:o:s:t:e:b::l:kchp: \
+ --long
description:,outdir:,sourcedir:,tmpdir:,exclude:,debianonly::,shell:,keeptemp,clean,help,origtargzpath:
\
-n 'dpatch-edit-patch' -- "$@")
@@ -114,6 +117,7 @@
-t|--tmpdir) DPEP_TMPDIR="$2"; shift 2;;
-e|--exclude) DPEP_EXCLUDE="$2"; shift 2;;
-b|--debianonly) DPEP_DEBIANONLY=1; DPEP_ORIGTARGZ="$2"; shift 2;;
+ -p|--origtargzpath) DPEP_ORIGTARGZPATH="$2"; shift 2;;
-k|--keeptemp) DPEP_KEEPTEMP=1; shift;;
-c|--clean) DPEP_CLEAN=1; shift;;
-r|--rootcmd) DPEP_ROOTCMD="$2"; shift 2;;
diff -ur dpatch-2.0.13.orig/scripts/dpatch-get-origtargz
dpatch-2.0.13+zack/scripts/dpatch-get-origtargz
--- dpatch-2.0.13.orig/scripts/dpatch-get-origtargz 2005-06-26
15:29:31.000000000 +0200
+++ dpatch-2.0.13+zack/scripts/dpatch-get-origtargz 2005-06-27
13:07:46.000000000 +0200
@@ -2,7 +2,7 @@
set -e
-DPFO_BASENAME="$(basename $0)"
+DPGO_BASENAME="$(basename $0)"
# makes sure that there is a .orig.tar.gz in a given directory.
# This script is to be invoked from a package build directory as it uses
@@ -13,37 +13,52 @@
ORIGTARDIR="$1"
shift
if [ -z "$ORIGTARDIR" ] || [ -n "$1" ]; then
- echo >&2 "${DPFO_BASENAME}: Usage: dpat-find-origtargz <origtardir>"
+ echo >&2 "${DPGO_BASENAME}: Usage: dpatch-get-origtargz <origtardir>"
exit 1
fi
PACKAGENAME="$(dpkg-parsechangelog | sed -n
'/^Source:/{s/^Source:[[:space:]]\+\(.*\)/\1/;p;q}')"
UPSTREAMVERSION="$(dpkg-parsechangelog | sed -n
'/^Version:/{s/^Version:[[:space:]]\+\([^-]\+\).*/\1/;p;q}')"
ORIGTARGZ="${PACKAGENAME}_${UPSTREAMVERSION}.orig.tar.gz"
+
if [ -f "${ORIGTARDIR}/$ORIGTARGZ" ]; then
true
elif [ -f "${DPGO_ORIGTARDIR}/$ORIGTARGZ" ]; then
cp $(readlink -f "${DPGO_ORIGTARDIR}/$ORIGTARGZ") $ORIGTARDIR
-elif [ -f "../$ORIGTARGZ" ]; then
- cp $(readlink -f "../$ORIGTARGZ") $ORIGTARDIR
-elif [ -x $(which apt-get) ]; then
- if ! (cd $ORIGTARDIR && apt-get --tar-only source "$PACKAGENAME"); then
- if ! [ -f "${ORIGTARDIR}/$ORIGTARGZ" ]; then
- echo >&2 "${DPFO_BASENAME}: Error: apt-get source $PACKAGENAME delivered
wrong version of $ORIGTARGZ"
+elif [ ! -z "${DPGO_ORIGTARPATH}" ]; then
+ for dir in $(echo ${DPGO_ORIGTARPATH} | cut -d: -f 1- --output-delimiter='
'); do
+ dir=$(echo $dir | sed s+/*$++)
+ if [ -f "$dir/$ORIGTARGZ" ]; then
+ cp $(readlink -f "$dir/$ORIGTARGZ") $ORIGTARDIR
+ break
+ fi
+ done
+fi
+
+# path and other methods failed, try heuristics and apt
+
+if [ ! -f "${ORIGTARDIR}/$ORIGTARGZ" ]; then
+ if [ -f "../$ORIGTARGZ" ]; then
+ cp $(readlink -f "../$ORIGTARGZ") $ORIGTARDIR
+ elif [ -x $(which apt-get) ]; then
+ if ! (cd $ORIGTARDIR && apt-get --tar-only source "$PACKAGENAME"); then
+ if ! [ -f "${ORIGTARDIR}/$ORIGTARGZ" ]; then
+ echo >&2 "${DPGO_BASENAME}: Error: apt-get source $PACKAGENAME
delivered wrong version of $ORIGTARGZ"
+ fi
+ else
+ echo >&2 "${DPGO_BASENAME}: Error: apt-get source $PACKAGENAME failed"
fi
- else
- echo >&2 "${DPFO_BASENAME}: Error: apt-get source $PACKAGENAME failed"
fi
fi
# as a last resort, use debian/watch
if [ ! -f "${ORIGTARDIR}/$ORIGTARGZ" -a -f "debian/watch" -a -x $(which curl)
] && ! curl "$(< debian/watch sed -n
"/^\\(http\\|ftp\\)/{s/^\\([^(]\\+\\)([^)]*)\\([^
]*\\).*/\\1${UPSTREAMVERSION}\\2/;s/\\\\//g;p;q;}")" >
${ORIGTARDIR}/$ORIGTARGZ; then
- echo >&2 "${DPFO_BASENAME}: Error: cannot curl $ORIGTARGZ from debian/watch
location"
+ echo >&2 "${DPGO_BASENAME}: Error: cannot curl $ORIGTARGZ from debian/watch
location"
fi
if [ ! -f "${ORIGTARDIR}/$ORIGTARGZ" ]; then
- echo >&2 "${DPFO_BASENAME}: Error: unable to obtain $ORIGTARGZ from anywhere"
+ echo >&2 "${DPGO_BASENAME}: Error: unable to obtain $ORIGTARGZ from anywhere"
exit 1
fi
diff -ur dpatch-2.0.13.orig/scripts/dpatch-get-origtargz.1
dpatch-2.0.13+zack/scripts/dpatch-get-origtargz.1
--- dpatch-2.0.13.orig/scripts/dpatch-get-origtargz.1 2005-06-26
15:29:31.000000000 +0200
+++ dpatch-2.0.13+zack/scripts/dpatch-get-origtargz.1 2005-06-27
12:46:14.000000000 +0200
@@ -15,13 +15,16 @@
will try to find the upstream tarball using one of the following
methods:
.br
-1) in the directory pointed to by \fBDPGO_ORIGTARDIR\fR,
+1) in the directory pointed to by the \fBDPGO_ORIGTARDIR\fR environment
variable,
.br
-2) in the parent directory of the current work directory,
+2) in all directories listed in the \fBDPGO_ORIGTARPATH\fR environment
+variable (colon-separated list of directories),
.br
-3) on the Debian mirror configured into apt, and
+3) in the parent directory of the current work directory,
.br
-4) on the Internet, using the first URL found in debian/watch.
+4) on the Debian mirror configured into apt, and
+.br
+5) on the Internet, using the first URL found in debian/watch.
.br
If not, it tries to obtain the upstream tarball from a
@@ -29,8 +32,12 @@
repository configured, and finally, the internet server
pointed to by debian/watch.
+.SH SEE ALSO
+\fIdpatch\fR(1)
+
.SH AUTHOR
dpatch\-get\-origtargz and this manual page was written by Marc Haber
-<[EMAIL PROTECTED]>.
+<[EMAIL PROTECTED]> and modified by Stefano Zacchiroli
+<[EMAIL PROTECTED]>.
.\" arch-tag: a8bdf178-9016-4721-a6b0-e5d492df89b7