tag 388567 + patch
thanks
Hello,
I have implemented support of the new source formats in
svn-inject/svn-buildpackage.
For svn-inject, I believe it's complete.
For svn-buildpackage it has limitations: multiple source tarballs only
work properly when they are stored in $origDir, you can't download them
since you don't know that they exist and the name that they have.
I haven't touched svn-upgrade, I don't use it.
I would be glad to see a new release with this patch merged so that
less people complain that svn-buildpackage doesn't support the new format
yet. :-)
Cheers,
--
Raphaël Hertzog
Index: svn-buildpackage
===================================================================
--- svn-buildpackage (révision 15176)
+++ svn-buildpackage (copie de travail)
@@ -387,6 +387,10 @@
$origfile = long_path($startdir . "/../tarballs/$orig");
}
};
+my $origDir = $$c{"origDir"} || "$startdir/../tarballs";
+my %otherOrigFiles = map { /\.orig-([\w-]+)\.tar\.(gz|bz2|lzma)$/ ? ($1 => $_)
: () } grep {
+ /(?:^|\/)\Q${package}_${upVersion}\E\.orig-[\w-]+\.tar\.(gz|bz2|lzma)$/
+} <$origDir/*>;
if(!defined($origfile)) {
$$c{"origDir"} = $startdir . "/../tarballs/" if(!defined($$c{"origDir"}));
@@ -492,36 +496,42 @@
else {
print (_g("W: %s not found, expect problems...\n"), $abs_origfile) if(!
-e $abs_origfile);
}
- if($origfile && -e $abs_origfile) {
- if(-e $orig_target) {
- if(((stat($abs_origfile))[7]) != ((stat($orig_target))[7]))
- {
- die sprintf(_g("%s exists but differs from %s!\nAborting, fix this
manually..."),
- $orig_target, $abs_origfile);
- }
+ foreach my $file ($origfile, values %otherOrigFiles) {
+ if (not defined $file) {
+ # no orig at all, try exporting
+ exportToOrigDir;
+ last;
}
- else {
- # orig in tarball-dir but not in build-area
- if($opt_nolinks) {
- withechoNoPrompt("cp", long_path($origfile), "$ba/$orig")
- ||
- exportToOrigDir;
+ my $absfile=long_path($file);
+ my $fname = basename($file);
+ my $target="$ba/$fname";
+ if (-e $absfile) {
+ if(-e $target) {
+ if(((stat($absfile))[7]) != ((stat($target))[7]))
+ {
+ die sprintf(_g("%s exists but differs from %s!\nAborting, fix
this manually..."),
+ $target, $absfile);
+ }
}
else {
- link(long_path($origfile),"$ba/".$orig)
- ||
- symlink(long_path($origfile),"$ba/".$orig)
- ||
- withechoNoPrompt("cp",long_path($origfile),"$ba/$orig")
- ||
- exportToOrigDir;
+ # orig in tarball-dir but not in build-area
+ if($opt_nolinks) {
+ withechoNoPrompt("cp", long_path($file), "$ba/$fname")
+ ||
+ (($file eq $origfile) && exportToOrigDir);
+ }
+ else {
+ link(long_path($file),"$ba/$fname")
+ ||
+ symlink(long_path($file),"$ba/$fname")
+ ||
+ withechoNoPrompt("cp",long_path($file),"$ba/$fname")
+ ||
+ (($file eq $origfile) && exportToOrigDir);
+ }
}
}
}
- else {
- # no orig at all, try exporting
- exportToOrigDir;
- }
}
# contents examination for "cp -l" emulation
@@ -575,6 +585,17 @@
# Otherwise, we put them into a new directory
withecho "mv", "$ba/tmp-$mod", $bdir;
}
+ foreach my $component (keys %otherOrigFiles) {
+ withecho "rm", "-rf", "$bdir/$component";
+ withecho "tar", "--no-same-owner", "--no-same-permissions",
"--extract", "--file", $otherOrigFiles{$component}, "--directory",
"$ba/tmp-$mod";
+ my @entries = (<$ba/tmp-$mod/*>);
+ if (@entries == 1) {
+ withecho "mv", (<$ba/tmp-$mod/*>), "$bdir/$component";
+ rmdir "$ba/tmp-$mod";
+ } else {
+ withecho "mv", "$ba/tmp-$mod", "$bdir/$component";
+ }
+ }
}
if($opt_nolinks || $opt_ignnew) {
withecho ("svn", "--force", "export", $$c{"trunkDir"},"$bdir");
Index: svn-inject
===================================================================
--- svn-inject (révision 15176)
+++ svn-inject (copie de travail)
@@ -138,6 +138,12 @@
"set-props|setprops" => \$opt_setprops,
);
+my %supported_formats = (
+ "1.0" => 1,
+ "3.0 (quilt)" => 1,
+ "3.0 (native)" => 1,
+);
+
#shamelessly copied and slightly modified from svn-bp
my @CONFARGS;
for my $file ($ENV{"HOME"}."/.svn-buildpackage.conf") {
@@ -277,11 +283,11 @@
my $package;
my $debVersion;
-my $dscOrigFilename;
my $dscDiff;
my $dscFormat;
+my $dscDebianTar;
+my %dscOtherOrig;
-
sub printImportDetails ()
{
return 0 if (!defined $opt_debug);
@@ -303,21 +309,25 @@
if(/^(\s\w+\s\d+\s+)((.*)_(.*).orig.tar.(gz|bz2))/)
{
$dscOrig="$fromDir/$2";
- $dscOrigFilename=$2;
$upsVersion=$4;
}
+ if (/^(\s\w+\s\d+\s+)((.*)_(.*).orig(?:-([\w-]+)).tar.(gz|bz2))/)
+ {
+ $dscOtherOrig{$5}="$fromDir/$2";
+ }
+ $dscDebianTar = "$fromDir/$1"
if(/^\s\w+\s\d+\s(.+\.debian\.tar\.(gz|bz2))\n/);
$dscDiff = "$fromDir/$1" if(/^\s\w+\s\d+\s(.+\.diff.(gz|bz2))\n/);
}
close($dsc);
-die _g("svn-buildpackage doesn't support Debian source package formats other
than 1.0. Aborting.")
- unless ($dscFormat == "1.0");
+die sprintf(_g("svn-buildpackage doesn't support Debian source package format
%s. Aborting."), $dscFormat)
+ unless $supported_formats{$dscFormat};
if($opt_checkout && -d "$basedir/$package") {
die sprintf(_g("%s/%s already exists, aborting...\n"), $basedir, $package);
}
-$dscDiff=long_path($dscDiff);
+$dscDiff=long_path($dscDiff) if defined $dscDiff;
if($dscOrig) {
$opt_tardir=long_path($opt_tardir ? $opt_tardir : "$basedir/tarballs");
@@ -333,16 +343,27 @@
my %ourfiles;
my $changed_non_debian=0;
# creating the list of relevant files for mergeWithUpstream mode
-if($opt_onlychanged && $dscDiff) {
- open(my $dl, (($dscDiff=~/bz2/i)?"bz":"z")."cat $dscDiff|");
- while(<$dl>) {
- if(/^\+\+\+\ [^\/]+\/(.+)\n/) {
- my $file=$1;
- $ourfiles{$file}=1;
- $changed_non_debian += ( ! ($file=~/^debian/));
+if($opt_onlychanged) {
+ if ($dscDiff) {
+ open(my $dl, (($dscDiff=~/bz2/i)?"bz":"z")."cat $dscDiff|");
+ while(<$dl>) {
+ if(/^\+\+\+\ [^\/]+\/(.+)\n/) {
+ my $file=$1;
+ $ourfiles{$file}=1;
+ $changed_non_debian += ( ! ($file=~/^debian/));
+ }
}
+ close($dl);
+ } elsif ($dscDebianTar) {
+ open(my $dl, "tar tf $dscDebianTar|"); # Tar detects compression alone
+ while(<$dl>) {
+ chomp;
+ print "ourfile: $_\n";
+ $ourfiles{$_}=1;
+ $changed_non_debian += ( ! ($_=~/^debian/));
+ }
+ close($dl);
}
- close($dl);
}
$changed_non_debian = 0 if($opt_nobranches); # ignore their original versions
in upstream branch
@@ -395,6 +416,29 @@
}
# also, would be nice with a little error checking to see if everything
worked.
withecho("mv",@filesInside, "current");
+
+ # Extract supplementary tarballs
+ foreach my $component (keys %dscOtherOrig) {
+ withecho("rm", "-rf", "current/$component");
+ mkdir "$component.svn-bp-tmp";
+ chdir "$component.svn-bp-tmp";
+ withecho "tar", $opt_tarquiet, "-x", "-f", $dscOtherOrig{$component};
+ oldSvnDirsCheck ".";
+ @filesInside=(<*>);
+ $folder_needed=0;
+ foreach my $file (@filesInside) {
+ $folder_needed=1 if -f $file
+ }
+
+ if($folder_needed) {
+ chdir "..";
+ withecho("mv", "$component.svn-bp-tmp", "current/$component");
+ } else {
+ withecho("mv", @filesInside, "../current/$component");
+ chdir "..";
+ rmdir "$component.svn-bp-tmp";
+ }
+ }
if($opt_onlychanged) {
chdir "current" || die _g("Internal operation error, unable to create
local import directory\n"); # code 42, stop before unlinking anything
@@ -457,7 +501,11 @@
}
mkdir "unpdir";
chdir "unpdir";
- withecho "dpkg-source -x $opt_dsc";
+ if ($dscFormat eq "3.0 (quilt)") {
+ withecho "dpkg-source --no-copy --skip-patches -x $opt_dsc";
+ } else {
+ withecho "dpkg-source -x $opt_dsc";
+ }
system "rm -f *.gz *.bz2";
# now use svn_load_dirs to upgrade the trunk fork to Debian versions.
# For mergeWithUpstream mode, drop all unchanged files
Index: debian/changelog
===================================================================
--- debian/changelog (révision 15176)
+++ debian/changelog (copie de travail)
@@ -1,3 +1,10 @@
+svn-buildpackage (0.7.1+nmu1) UNRELEASED; urgency=low
+
+ * Non-maintainer upload.
+ * Add support for "3.0 (quilt)" and "3.0 (native)" in svn-inject.
+
+ -- Raphaël Hertzog <[email protected]> Thu, 14 Jan 2010 15:40:22 +0100
+
svn-buildpackage (0.7.1) unstable; urgency=low
* Add dependency on liblocale-gettext-perl to support the