[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

.orig.tar.gz which unpacks into `pwd`



Here's a patch for dpkg-source which allows -x to handle a source tar
which unpacks into the current directory.  I wanted to air it here
before I submitted it to the bug system.

--- /usr/bin/dpkg-source	Mon Jul 14 01:51:09 1997
+++ ./dpkg-source	Tue Jan 13 18:16:28 1998
@@ -895,11 +895,19 @@
     opendir(D,"$dirchdir") || &syserr("Unable to open dir $dirchdir");
     @dirchdirfiles = grep($_ ne "." && $_ ne "..",readdir(D));
     closedir(D) || &syserr("Unable to close dir $dirchdir");
-    (@dirchdirfiles==1 && -d "$dirchdir/$dirchdirfiles[0]") ||
-	&error("$tarfileread extracted into >1 directory");
-    rename("$dirchdir/$dirchdirfiles[0]", "$dirchdir/$newtopdir") ||
-	&syserr("Unable to rename $dirchdir/$dirchdirfiles[0] to ".
-		"$dirchdir/$newtopdir");
+    if (@dirchdirfiles==1 && -d "$dirchdir/$dirchdirfiles[0]") {
+	rename("$dirchdir/$dirchdirfiles[0]", "$dirchdir/$newtopdir") ||
+	    &syserr("Unable to rename $dirchdir/$dirchdirfiles[0] to ".
+		    "$dirchdir/$newtopdir");
+    } else {
+	mkdir("$dirchdir/$newtopdir", 0777) ||
+	    &syserr("Unable to mkdir $dirchdir/$newtopdir");
+	for (@dirchdirfiles) {
+	    rename("$dirchdir/$_", "$dirchdir/$newtopdir/$_") ||
+		&syserr("Unable to rename $dirchdir/$_ to ".
+			"$dirchdir/$newtopdir/$_");
+	}
+    }
 }
 
 sub cpiostderr {

-- 
Roderick Schertler
roderick@argon.org


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: