From 7f64bc6544061ba534541a66ae4dab8c88a96a14 Mon Sep 17 00:00:00 2001 From: Raphaël Hertzog Date: Sun, 22 Nov 2009 16:34:11 +0100 Subject: dpkg-source: fail if several orig.tar files are available This concerns formats 2.0 and 3.0 (quilt) where the upstream tarball can be available with different compression schemes. We need precisely one file otherwise it doesn't know which one should be used and might pick the wrong one. --- scripts/Dpkg/Source/Package/V2.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts/Dpkg') diff --git a/scripts/Dpkg/Source/Package/V2.pm b/scripts/Dpkg/Source/Package/V2.pm index e1874cb2d..6757795c3 100644 --- a/scripts/Dpkg/Source/Package/V2.pm +++ b/scripts/Dpkg/Source/Package/V2.pm @@ -248,6 +248,10 @@ sub do_build { my @origtarballs; foreach (sort $self->find_original_tarballs()) { if (/\.orig\.tar\.$comp_regex$/) { + if (defined($tarfile)) { + error(_g("several orig.tar files found (%s and %s) but only " . + "one is allowed"), $tarfile, $_); + } $tarfile = $_; push @origtarballs, $_; $self->add_file($_); -- cgit v1.2.3 From b8c2b200c3dd0678988593c5839be3cd2aecf84a Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 22 Nov 2009 22:23:59 +0100 Subject: Dpkg::Control::Hash: Strip leading spaces in the first line of a field's value The fields in a compliant control-style file are allowed to have values starting with any number of spaces. But that only applies to the first line on multi-line field values, so do not do the same on subsequent lines as those are handled differently. Regression introduced in commit 7d8d193332478de82e20ed5b49053378801d160f. Closes: #557547 --- debian/changelog | 2 ++ scripts/Dpkg/Control/Hash.pm | 2 +- scripts/t/700_Dpkg_Control.t | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts/Dpkg') diff --git a/debian/changelog b/debian/changelog index 1ac63e9c8..f386065e7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ dpkg (1.15.5.3) UNRELEASED; urgency=low * Verify that the alternative used in update-alternatives --set has been registered instead of failing with an undefined value in the slave method. Closes: #554136 + * Strip leading spaces in the first line of a field's value in + Dpkg::Control::Hash. Closes: #557547 -- Raphael Hertzog Sat, 21 Nov 2009 14:57:50 +0100 diff --git a/scripts/Dpkg/Control/Hash.pm b/scripts/Dpkg/Control/Hash.pm index afb177b7e..06d34d1e1 100644 --- a/scripts/Dpkg/Control/Hash.pm +++ b/scripts/Dpkg/Control/Hash.pm @@ -168,7 +168,7 @@ sub parse_fh { next if (m/^$/ and $paraborder); next if (m/^#/); $paraborder = 0; - if (m/^(\S+?)\s*:\s?(.*)$/) { + if (m/^(\S+?)\s*:\s*(.*)$/) { if (exists $self->{$1}) { unless ($$self->{'allow_duplicate'}) { syntaxerr($desc, sprintf(_g("duplicate field %s found"), $1)); diff --git a/scripts/t/700_Dpkg_Control.t b/scripts/t/700_Dpkg_Control.t index d30a068e9..5714025e9 100644 --- a/scripts/t/700_Dpkg_Control.t +++ b/scripts/t/700_Dpkg_Control.t @@ -48,7 +48,7 @@ Depends: hello Package: mypackage3 Depends: hello -Description: short one +Description: short one long one very long one '; -- cgit v1.2.3 From 77b078af402eb41027227117c7ef223a3941b457 Mon Sep 17 00:00:00 2001 From: Raphaël Hertzog Date: Mon, 23 Nov 2009 08:58:29 +0100 Subject: Dpkg::Control::Hash: document how leading/trailing spaces are treated --- scripts/Dpkg/Control/Hash.pm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts/Dpkg') diff --git a/scripts/Dpkg/Control/Hash.pm b/scripts/Dpkg/Control/Hash.pm index 06d34d1e1..75fbc8957 100644 --- a/scripts/Dpkg/Control/Hash.pm +++ b/scripts/Dpkg/Control/Hash.pm @@ -52,6 +52,9 @@ unchanged directly after the field name, supplementary lines are modified. Empty lines and lines containing only dots are prefixed with " ." (space + dot) while other lines are prefixed with a single space. +During parsing, trailing spaces are stripped on all lines while leading +spaces are stripped only on the first line of each field. + =head1 FUNCTIONS =over 4 -- cgit v1.2.3 From 15afc8e967d5083ca3060caa10405dad82f701b8 Mon Sep 17 00:00:00 2001 From: Raphaël Hertzog Date: Mon, 23 Nov 2009 22:02:33 +0100 Subject: Dpkg::Changelog::Entry::Debian: add missing "use Dpkg::Gettext" --- debian/changelog | 2 ++ scripts/Dpkg/Changelog/Entry/Debian.pm | 1 + 2 files changed, 3 insertions(+) (limited to 'scripts/Dpkg') diff --git a/debian/changelog b/debian/changelog index f386065e7..7b39dcc16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ dpkg (1.15.5.3) UNRELEASED; urgency=low * Let dpkg-source fail if several upstream orig.tar files are available (using different compression scheme) since we don't know which one to use. + * Add missing "use Dpkg::Gettext" in Dpkg::Changelog::Entry::Debian. + Closes: #557668 [ Guillem Jover ] * Verify that the alternative used in update-alternatives --set has been diff --git a/scripts/Dpkg/Changelog/Entry/Debian.pm b/scripts/Dpkg/Changelog/Entry/Debian.pm index 9399888e8..ccaf5046c 100644 --- a/scripts/Dpkg/Changelog/Entry/Debian.pm +++ b/scripts/Dpkg/Changelog/Entry/Debian.pm @@ -25,6 +25,7 @@ our @EXPORT_OK = qw($regex_header $regex_trailer find_closes); use Date::Parse; +use Dpkg::Gettext; use Dpkg::Control::Changelog; use Dpkg::Version; -- cgit v1.2.3 From 6dbf501ff1c09aa3ef2ea09259b23322fa5bea02 Mon Sep 17 00:00:00 2001 From: Raphaël Hertzog Date: Tue, 24 Nov 2009 00:51:59 +0100 Subject: Dpkg::Source::Package::V3::quilt: set QUILT_PATCH_OPTS to mimick D::S::Patch When building "3.0 (quilt)" source packages, use QUILT_PATCH_OPTS="-t -F 0 -N -u -V never -g0" so that quilt is as strict as dpkg-source's internal implementation of quilt that relies on Dpkg::Source::Patch::apply(). --- debian/changelog | 3 +++ scripts/Dpkg/Source/Package/V3/quilt.pm | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'scripts/Dpkg') diff --git a/debian/changelog b/debian/changelog index 7b39dcc16..6c18471a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,9 @@ dpkg (1.15.5.3) UNRELEASED; urgency=low to use. * Add missing "use Dpkg::Gettext" in Dpkg::Changelog::Entry::Debian. Closes: #557668 + * When building "3.0 (quilt)" source packages, use QUILT_PATCH_OPTS="-t -F 0 + -N -u -V never -g0" so that quilt is as strict as dpkg-source's internal + implementation of quilt. Closes: #557664 [ Guillem Jover ] * Verify that the alternative used in update-alternatives --set has been diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm b/scripts/Dpkg/Source/Package/V3/quilt.pm index 2400c96fa..df68e06c1 100644 --- a/scripts/Dpkg/Source/Package/V3/quilt.pm +++ b/scripts/Dpkg/Source/Package/V3/quilt.pm @@ -114,7 +114,10 @@ sub run_quilt { } my %opts = ( env => { QUILT_PATCHES => "$absdir/debian/patches", - QUILT_SERIES => $series }, + QUILT_SERIES => $series, + # Kept as close as possible to default patch options in + # Dpkg::Source::Patch (used in without_quilt mode) + QUILT_PATCH_OPTS => "-t -F 0 -N -u -V never -g0" }, 'chdir' => $dir, 'exec' => [ 'quilt', '--quiltrc', '/dev/null', @$params ], %more_opts @@ -169,7 +172,6 @@ sub apply_patches { $opts{"to_file"} = "/dev/null" if $skip_auto; info(_g("applying all patches with %s"), "quilt push -q " . $patches[-1]) unless $skip_auto; $self->run_quilt($dir, ['push', '-q', $patches[-1]], - delete_env => ['QUILT_PATCH_OPTS'], wait_child => 1, %opts); foreach my $patch (@patches) { foreach my $fn (keys %{$panalysis->{$patch}->{'filepatched'}}) { -- cgit v1.2.3 From e1b5e94395d10bf533015268beafb6604197632f Mon Sep 17 00:00:00 2001 From: Raphaël Hertzog Date: Tue, 24 Nov 2009 01:39:43 +0100 Subject: Dpkg::Source::Package::V3::quilt: check debian/patches{,series} before build Before accepting to build a 3.0 (quilt) source packages, ensure that debian/patches is a directory (or non-existing) and that debian/patches/series is a file (or non-existing). --- debian/changelog | 3 +++ scripts/Dpkg/Source/Package/V3/quilt.pm | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'scripts/Dpkg') diff --git a/debian/changelog b/debian/changelog index 6c18471a8..66f8ece75 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,9 @@ dpkg (1.15.5.3) UNRELEASED; urgency=low * When building "3.0 (quilt)" source packages, use QUILT_PATCH_OPTS="-t -F 0 -N -u -V never -g0" so that quilt is as strict as dpkg-source's internal implementation of quilt. Closes: #557664 + * Before accepting to build a 3.0 (quilt) source packages, ensure that + debian/patches is a directory (or non-existing) and that + debian/patches/series is a file (or non-existing). Closes: #557618 [ Guillem Jover ] * Verify that the alternative used in update-alternatives --set has been diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm b/scripts/Dpkg/Source/Package/V3/quilt.pm index df68e06c1..ca527c193 100644 --- a/scripts/Dpkg/Source/Package/V3/quilt.pm +++ b/scripts/Dpkg/Source/Package/V3/quilt.pm @@ -55,6 +55,24 @@ sub parse_cmdline_option { return 0; } +sub can_build { + my ($self, $dir) = @_; + my ($code, $msg) = $self->SUPER::can_build($dir); + return ($code, $msg) if $code eq 0; + my $pd = File::Spec->catdir($dir, "debian", "patches"); + if (-e $pd and not -d _) { + return (0, sprintf(_g("%s should be a directory or non-existing"), $pd)); + } + my $series_vendor = $self->get_series_file($dir); + my $series_main = File::Spec->catfile($pd, "series"); + foreach my $series ($series_vendor, $series_main) { + if (defined($series) and -e $series and not -f _) { + return (0, sprintf(_g("%s should be a file or non-existing"), $series)); + } + } + return (1, ""); +} + sub get_autopatch_name { my ($self) = @_; return "debian-changes-" . $self->{'fields'}{'Version'}; -- cgit v1.2.3 From 7169f0d3cf463be84b7b5609859c98e6cbd8ba2c Mon Sep 17 00:00:00 2001 From: Raphaël Hertzog Date: Thu, 26 Nov 2009 14:21:13 +0100 Subject: Dpkg::IPC::fork_and_exec(): put modified environment variables in error messages The descriptive command-line given to wait_child() now also includes the environment variables that have been set since they may affect the behaviour of the executed command and are likely needed to reproduce the problem. With this change, the quilt failures within dpkg-source are better identified: QUILT_PATCHES can be checked to know if it was working on the main tree or the temporary one and QUILT_PATCH_OPTS is seen by users who can then independently reproduce the failure (and not wonder why they can't reproduce it). --- debian/changelog | 3 +++ scripts/Dpkg/IPC.pm | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'scripts/Dpkg') diff --git a/debian/changelog b/debian/changelog index 66f8ece75..1a0f04706 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,9 @@ dpkg (1.15.5.3) UNRELEASED; urgency=low * Before accepting to build a 3.0 (quilt) source packages, ensure that debian/patches is a directory (or non-existing) and that debian/patches/series is a file (or non-existing). Closes: #557618 + * Dpkg::IPC::fork_and_exec() now includes the changed environment + variables in the default error message displayed when the sub-process + fails. [ Guillem Jover ] * Verify that the alternative used in update-alternatives --set has been diff --git a/scripts/Dpkg/IPC.pm b/scripts/Dpkg/IPC.pm index 4302ffa92..116051d32 100644 --- a/scripts/Dpkg/IPC.pm +++ b/scripts/Dpkg/IPC.pm @@ -278,8 +278,14 @@ sub fork_and_exec { ${$opts{"error_to_string"}} = readline($error_to_string_pipe); } if ($opts{"wait_child"}) { + my $cmdline = "@prog"; + if ($opts{"env"}) { + foreach (keys %{$opts{"env"}}) { + $cmdline = "$_=\"" . $opts{"env"}{$_} . "\" $cmdline"; + } + } wait_child($pid, nocheck => $opts{"nocheck"}, - timeout => $opts{"timeout"}, cmdline => "@prog"); + timeout => $opts{"timeout"}, cmdline => $cmdline); return 1; } -- cgit v1.2.3