On Mon, Jun 27, 2005 at 12:20:19PM +0200, Marc Haber wrote:
> I have to apologize. My advice was completely wrong, and the bug
> report is absolutely valid.

No need to apologize, it is not always easy to understand each other via
mail :-)

In the meantime I patched dpatch-get-origtargz to implement properly (I
hope) the path idea. Patch is attached both for the script and for the
manpage describing the new behaviour.

I left in place the DPGO_ORIGTARDIR as first attempt to find the
tarball, but of course it is now redundant. I suggest to mark it as
deprectated in the manpage (but I didn't do it by myself, it's up to
you).

The only aspect I'm not happy with is that the patched script "manually"
sources /etc/dpatch.conf and ~/.dpatch.conf while some scripts of the
dpatch suite (not all, though) uses a SYSCONFDIR instead of hard coded
"/etc" which is filled at compiler time using awk. I doubt it will be
ever a problem thought.

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/scripts/dpatch-get-origtargz 
dpatch-2.0.13/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/scripts/dpatch-get-origtargz  2005-06-27 12:24:34.000000000 
+0200
@@ -10,10 +10,14 @@
 
 # Usage: dpatch-get-origtargz origtardir
 
+[[ -f /etc/dpatch.conf ]] && . /etc/dpatch.conf
+[[ -f ~/.dpatch.conf ]] && . ~/.dpatch.conf
+DPGO_ORIGTARPATH="${DPGO_ORIGTARPATH:-$conf_origtarpath}"
+
 ORIGTARDIR="$1"
 shift
 if [ -z "$ORIGTARDIR" ] || [ -n "$1" ]; then
-  echo >&2 "${DPFO_BASENAME}: Usage: dpat-find-origtargz <origtardir>"
+  echo >&2 "${DPFO_BASENAME}: Usage: dpatch-get-origtargz <origtardir>"
   exit 1
 fi
 
@@ -24,15 +28,26 @@
   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
+if [ ! -f  "${ORIGTARDIR}/$ORIGTARGZ" ]; then # path and other methods failed, 
try heuristics
+  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 "${DPFO_BASENAME}: Error: apt-get source $PACKAGENAME 
delivered wrong version of $ORIGTARGZ"
+      fi
+    else
+      echo >&2 "${DPFO_BASENAME}: Error: apt-get source $PACKAGENAME failed"
     fi
-  else
-    echo >&2 "${DPFO_BASENAME}: Error: apt-get source $PACKAGENAME failed"
   fi
 fi
 
diff -ur dpatch-2.0.13.orig/scripts/dpatch-get-origtargz.1 
dpatch-2.0.13/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/scripts/dpatch-get-origtargz.1        2005-06-27 
12:11:08.000000000 +0200
@@ -17,11 +17,13 @@
 .br
 1) in the directory pointed to by \fBDPGO_ORIGTARDIR\fR,
 .br
-2) in the parent directory of the current work directory,
+2) in all directories listed in the \fBorig tar path\fR,
 .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 +31,19 @@
 repository configured, and finally, the internet server
 pointed to by debian/watch.
 
+The \fBorig tar path\fR is a colon separated list of directories where
+upstream tarballs are looked for during step 2. It can either be set in
+dpatch configuration files with the \fBconf_origtarpath\fR variable
+(e.g. conf_origtarpath=/public/tarballs:../upstream) or using the
+\fBDPGO_ORIGTARPATH\fR environment variable (which overrides
+configuration files settings).
+
+.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

Reply via email to