Re: new source package format in dpkg-dev
On Fri, 28 Mar 2008, Robert Luberda wrote:
> dpkg-source: error: diff
> `dictd-1.10.10.dfsg.orig.Ly3JcL/debian/patches/colorit-bashisms.patch'
> patches file with no subdirectory
>
> ... because colorit-bashisms.patch contains:
> Index: dictd/colorit.in
> ===================================================================
> --- colorit.in 2007/09/29 18:57:47 1.7
> +++ colorit.in 2008/02/08 10:59:15 1.8
> @@ -16,7 +16,7 @@
I investigated this a bit further and this works only if you modify files
from the top level directory or if you adjust the patch option by putting
"-p0" after the patch name in the series file (but this is a feature of
quilt that is not supported by dpkg-source).
Thus I'm not sure if we should really accept those patches. In any case,
a possible fix is attached.
Comments are welcome.
Cheers,
--
Raphaël Hertzog
Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/
diff --git a/scripts/Dpkg/Source/Package/V3_0/quilt.pm b/scripts/Dpkg/Source/Package/V3_0/quilt.pm
index 1229fed..0e889b5 100644
--- a/scripts/Dpkg/Source/Package/V3_0/quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3_0/quilt.pm
@@ -111,7 +111,7 @@ sub apply_patches {
my $patch_obj = Dpkg::Source::Patch->new(filename => $path);
if ($have_quilt and not $self->{'options'}{'without_quilt'}) {
info(_g("applying %s with quilt"), $patch) unless $skip_auto;
- my $analysis = $patch_obj->analyze($dir);
+ my $analysis = $patch_obj->analyze($dir, allow_nosubdir => 1);
foreach my $dir (keys %{$analysis->{'dirtocreate'}}) {
eval { mkpath($dir); };
syserr(_g("cannot create directory %s"), $dir) if $@;
@@ -133,7 +133,7 @@ sub apply_patches {
info(_g("applying %s"), $patch) unless $skip_auto;
$patch_obj->apply($dir, timestamp => $now,
force_timestamp => 1, create_dirs => 1,
- add_options => [ '-E' ]);
+ add_options => [ '-E' ], allow_nosubdir => 1);
}
}
}
diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm
index f3d0e84..e47277c 100644
--- a/scripts/Dpkg/Source/Patch.pm
+++ b/scripts/Dpkg/Source/Patch.pm
@@ -283,6 +283,7 @@ sub analyze {
HUNK:
while (defined($_) || not eof($diff_handle)) {
+ my $nosubdir = 0;
# skip comments leading up to patch (if any)
until (/^--- /) {
last HUNK if not defined($_ = <$diff_handle>);
@@ -295,7 +296,13 @@ sub analyze {
}
s/\t.*//; # Strip any timestamp at the end
unless ($_ eq '/dev/null' or s{^(\./)?[^/]+/}{$destdir/}) {
- error(_g("diff `%s' patches file with no subdirectory"), $diff);
+ if ($opts{'allow_nosubdir'}) {
+ warning(_g("diff `%s' patches file with no subdirectory"), $diff);
+ $_ = "$destdir/$_";
+ $nosubdir = 1;
+ } else {
+ error(_g("diff `%s' patches file with no subdirectory"), $diff);
+ }
}
if (/\.dpkg-orig$/) {
error(_g("diff `%s' patches file with name ending .dpkg-orig"), $diff);
@@ -306,10 +313,13 @@ sub analyze {
error(_g("diff `%s' finishes in middle of ---/+++ (line %d)"), $diff, $.);
}
s/\t.*//; # Strip any timestamp at the end
- unless (s/^\+\+\+ // and ($_ eq '/dev/null' or s!^(\./)?[^/]+/!!)) {
+ unless (s/^\+\+\+ //) {
error(_g("line after --- isn't as expected in diff `%s' (line %d)"),
$diff, $.);
}
+ unless ($_ eq '/dev/null' or s{^(\./)?[^/]+/}{} or $nosubdir) {
+ error(_g("diff `%s' patches file with no subdirectory"), $diff);
+ }
if ($fn eq '/dev/null') {
error(_g("original and modified files are /dev/null in diff `%s' (line %d)"),
Reply to: