Package: gitpkg
Version: 0.6
Severity: important
Tags: patch

When I run git-debimport with an absolute path, I get the error shown below:

$ git-debimport /absolute/path/to/package
Initialized empty Git repository in .git/
Initial import of /absolute/path/to/package/package_1.0.orig.tar.gz
tar: ..//absolute/path/to/package/package_1.0.orig.tar.gz: Cannot
open: No such file or directory
tar: Error is not recoverable: exiting now

But it works when I git-debimport it for the same directory location
but with a relative path.

git-debimport ../../../path/to/package

It appears that ../ is prefixed always in the get-debimport script
when looking up the original tar ball, which caused it to fail for
absolute paths.

I've attached a patch that fixes this and I've tested it for both
relative and absolute directories, and it seems to work. Appreciate if
you could review, and consider this for inclusion. Thanks.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

-- no debconf information

-- 
Anuradha Weeraman
http://www.linux.lk/~anu/
http://www.gnuromancer.org
--- git-debimport	2008-05-22 15:50:08.000000000 -0400
+++ git-debimport.new	2008-05-22 15:49:52.000000000 -0400
@@ -63,6 +63,11 @@
 PACKAGE_NAME="${1##*/}"
 PACKAGE_DIFFS="$(find $PACKAGES_DIR -type f -name ${PACKAGE_NAME}_*.diff.gz | sort)"
 CACHE_DIR="../${PACKAGE_NAME}-import-cache"
+FIRST_CH=`echo "$PACKAGES_DIR" | head -c 1`
+
+if [ "$FIRST_CH" != "/" ]; then
+	PREFIX="../"
+fi
 
 if [ -z "$PACKAGE_DIFFS" ]; then
     echo "No ${1}_*.diff.gz files found, aborting."
@@ -130,7 +135,7 @@
 
 	rm -rf "$CACHE_DIR"
 	mkdir -p "$CACHE_DIR/${PACKAGE_NAME}-${UPSTREAM_VERSION}.orig"
-	tar -xf "../$PACKAGES_DIR/${PACKAGE_NAME}_${UPSTREAM_VERSION}.orig.tar.gz" \
+	tar -xf "${PREFIX}$PACKAGES_DIR/${PACKAGE_NAME}_${UPSTREAM_VERSION}.orig.tar.gz" \
 	     -C "$CACHE_DIR/${PACKAGE_NAME}-${UPSTREAM_VERSION}.orig" --strip 1
 	for i in $(ls -A "$CACHE_DIR/${PACKAGE_NAME}-${UPSTREAM_VERSION}.orig"); do
 	    cp -al "$CACHE_DIR/${PACKAGE_NAME}-${UPSTREAM_VERSION}.orig/$i" .
@@ -183,7 +188,7 @@
     for i in $(ls -A "$CACHE_DIR/${PACKAGE_NAME}-${UPSTREAM_VERSION}.orig"); do
 	cp -al "$CACHE_DIR/${PACKAGE_NAME}-${UPSTREAM_VERSION}.orig/$i" .
     done
-    zcat "../$f" | patch -p1
+    zcat "${PREFIX}$f" | patch -p1
     chmod 755 debian/rules
 
     DATE=$(dpkg-parsechangelog | sed -n 's/Date: //p')

Reply via email to