tags #653465 patch
thanks

Hi Joey,

On Do 29 Dez 2011 17:03:56 CET Joey Hess wrote:

Mike Gabriel wrote:
I might have time for that tomorrow... Such a feature is needed for
one of my projects, so it is a good time to work on that.

I'll send patches to this report...

Thanks.. Don't worry about pretty, a series of hacks that make it work
for you would be very helpful.

BTW: where is your development Vcs (pristine-tar upstream)?

git://git.kitenet.net/pristine-tar/

attached you find an approach that adds a --relsrcbase option to pristine-tar which then takes in the relative location of the source tree in the Git upstream source refspec.

This --relsrcbase option has to be passed on commit _and_ checkout. However, it would be much more genuine if the .delta file would store this relsrcbase, so on checkout no extra option would be necessary.

Greets,
Mike




--

DAS-NETZWERKTEAM
mike gabriel, dorfstr. 27, 24245 barmissen
fon: +49 (4302) 281418, fax: +49 (4302) 281419

GnuPG Key ID 0xB588399B
mail: mike.gabr...@das-netzwerkteam.de, http://das-netzwerkteam.de

freeBusy:
https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xfb
diff --git a/Pristine/Tar.pm b/Pristine/Tar.pm
index 1d31a48..fca6690 100644
--- a/Pristine/Tar.pm
+++ b/Pristine/Tar.pm
@@ -12,11 +12,12 @@ use Exporter q{import};
 
 our @EXPORT = qw(error message debug vprint doit try_doit doit_redir
 	tempdir dispatch
-	$verbose $debug $keep);
+	$verbose $debug $keep $relsrcbase);
 
 our $verbose=0;
 our $debug=0;
 our $keep=0;
+our $relsrcbase="";
 
 sub progname {
 	my $name=$0;
@@ -84,6 +85,7 @@ sub dispatch {
 	Getopt::Long::Configure("bundling");
 	if (! GetOptions(%options,
 			"v|verbose!" => \$verbose,
+			"b|relsrcbase=s" => \$relsrcbase,
 			"d|debug!" => \$debug,
 			"k|keep!" => \$keep) ||
 	    ! @ARGV) {
@@ -104,6 +106,11 @@ sub dispatch {
 		$i=$commands{$command};
 	}
 
+	if (length $relsrcbase) {
+		debug("relsrcbase is $relsrcbase");
+		$relsrcbase = "/$relsrcbase";
+	}
+
 	$i->[0]->(@ARGV);
 }
 
diff --git a/pristine-tar b/pristine-tar
index 67a5bd2..baa68af 100755
--- a/pristine-tar
+++ b/pristine-tar
@@ -6,13 +6,13 @@ pristine-tar - regenerate pristine tarballs
 
 =head1 SYNOPSIS
 
-B<pristine-tar> [-vdk] gendelta I<tarball> I<delta>
+B<pristine-tar> [-vdk] [-b I<relsrcbase>] gendelta I<tarball> I<delta>
 
-B<pristine-tar> [-vdk] gentar I<delta> I<tarball>
+B<pristine-tar> [-vdk] [-b I<relsrcbase>] gentar I<delta> I<tarball>
 
-B<pristine-tar> [-vdk] [-m message] commit I<tarball> [I<upstream>]
+B<pristine-tar> [-vdk] [-b I<relsrcbase>] [-m message] commit I<tarball> [I<upstream>]
 
-B<pristine-tar> [-vdk] checkout I<tarball>
+B<pristine-tar> [-vdk] [-b I<relsrcbase>] checkout I<tarball>
 
 B<pristine-tar> [-vdk] list
 
@@ -254,7 +254,7 @@ sub recreatetarball {
 			last;
 		}
 	}
-		
+
 	if (length $subdir) {
 		debug("subdir is $subdir");
 		doit("mkdir", "$tempdir/workdir");
@@ -262,10 +262,10 @@ sub recreatetarball {
 	}
 
 	if (! $options{clobber_source}) {
-		doit("cp", "-a", $source, "$tempdir/workdir$subdir");
+		doit("cp", "-a", "$source$relsrcbase", "$tempdir/workdir$subdir");
 	}
 	else {
-		doit("mv", $source, "$tempdir/workdir$subdir");
+		doit("mv", "$source$relsrcbase", "$tempdir/workdir$subdir");
 	}
 
 	# It's important that this create an identical tarball each time
@@ -291,7 +291,7 @@ sub recreatetarball {
 				mkpath "$tempdir/workdir/$file";
 			}
 		}
-		
+
 		if (-d "$tempdir/workdir/$file" && (-u _ || -g _ || -k _)) {
 			# tar behaves weirdly for some special modes
 			# and ignores --mode, so clear them.

Attachment: pgpLZGDujgclY.pgp
Description: Digitale PGP-Unterschrift

Reply via email to