This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=be1d6863fda782ce94d017aae5f035b92f54d6cb

commit be1d6863fda782ce94d017aae5f035b92f54d6cb
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Mon Mar 11 23:36:02 2019 +0100

    scripts: Give more context on field parsing errors
    
    While the line number and column are lost at the point were we parse the
    field values, printing the name of the binary package should help
    substantially on locating the required context in the file.
    
    Closes: #637060
---
 debian/changelog               |  1 +
 scripts/dpkg-checkbuilddeps.pl |  4 ++--
 scripts/dpkg-gencontrol.pl     | 17 +++++++++--------
 scripts/dpkg-shlibdeps.pl      |  2 +-
 scripts/dpkg-source.pl         |  5 +++--
 5 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 40b6e0379..3445832af 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -35,6 +35,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
     need to be processed for configuration and triggers. Closes: #926472
   * dpkg: Use DPKG_ADMINDIR to set the admindir. Closes: #900071
   * dpkg-source: Remove backwards compatibility code for legacy build-profiles.
+  * perl: Give more context on field parsing errors. Closes: #637060
   * Perl modules:
     - Dpkg::Source::Package: Verify original tarball signatures at build time.
     - Dpkg::BuildFlags: Add new unset() method.
diff --git a/scripts/dpkg-checkbuilddeps.pl b/scripts/dpkg-checkbuilddeps.pl
index d249ced45..8759a7f58 100755
--- a/scripts/dpkg-checkbuilddeps.pl
+++ b/scripts/dpkg-checkbuilddeps.pl
@@ -122,7 +122,7 @@ if ($bd_value) {
     my $dep = deps_parse($bd_value, reduce_restrictions => 1,
                          build_dep => 1, build_profiles => \@build_profiles,
                          host_arch => $host_arch);
-    error(g_('error occurred while parsing %s'),
+    error(g_('cannot parse %s field'),
           'Build-Depends/Build-Depends-Arch/Build-Depends-Indep')
         unless defined $dep;
     push @unmet, build_depends($dep, $facts);
@@ -131,7 +131,7 @@ if ($bc_value) {
     my $dep = deps_parse($bc_value, reduce_restrictions => 1, union => 1,
                          build_dep => 1, build_profiles => \@build_profiles,
                          host_arch => $host_arch);
-    error(g_('error occurred while parsing %s'),
+    error(g_('cannot parse %s field'),
           'Build-Conflicts/Build-Conflicts-Arch/Build-Conflicts-Indep')
         unless defined $dep;
     push @conflicts, build_conflicts($dep, $facts);
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index 04a5c68b9..4b0512243 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -221,8 +221,8 @@ foreach (keys %{$pkg}) {
 
            if (none { debarch_is($host_arch, $_) } @archlist) {
                error(g_("current host architecture '%s' does not " .
-                        "appear in package's architecture list (%s)"),
-                     $host_arch, "@archlist");
+                        "appear in package '%s' architecture list (%s)"),
+                     $host_arch, $oppackage, "@archlist");
            }
            $fields->{$_} = $host_arch;
        }
@@ -281,8 +281,8 @@ foreach my $field (field_list_pkg_dep()) {
            $dep = deps_parse($field_value, use_arch => 1,
                              reduce_arch => $reduce_arch,
                              reduce_profiles => 1);
-           error(g_('error occurred while parsing %s field: %s'), $field,
-                  $field_value) unless defined $dep;
+            error(g_("parsing package '%s' %s field: %s"), $oppackage,
+                  $field, $field_value) unless defined $dep;
            $dep->simplify_deps($facts, @seen_deps);
            # Remember normal deps to simplify even further weaker deps
            push @seen_deps, $dep;
@@ -290,13 +290,13 @@ foreach my $field (field_list_pkg_dep()) {
            $dep = deps_parse($field_value, use_arch => 1,
                              reduce_arch => $reduce_arch,
                              reduce_profiles => 1, union => 1);
-           error(g_('error occurred while parsing %s field: %s'), $field,
-                  $field_value) unless defined $dep;
+            error(g_("parsing package '%s' %s field: %s"), $oppackage,
+                  $field, $field_value) unless defined $dep;
            $dep->simplify_deps($facts);
             $dep->sort();
        }
        error(g_('the %s field contains an arch-specific dependency but the ' .
-                'package is architecture all'), $field)
+                "package '%s' is architecture all"), $field, $oppackage)
            if $dep->has_arch_restriction();
        $fields->{$field} = $dep->output();
        delete $fields->{$field} unless $fields->{$field}; # Delete empty field
@@ -320,7 +320,8 @@ if ($pkg_type eq 'udeb') {
     delete $fields->{'Homepage'};
 } else {
     for my $f (qw(Subarchitecture Kernel-Version Installer-Menu-Item)) {
-        warning(g_('%s package with udeb specific field %s'), $pkg_type, $f)
+        warning(g_("%s package '%s' with udeb specific field %s"),
+                $pkg_type, $oppackage, $f)
             if defined($fields->{$f});
     }
 }
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index 8142c85b4..937fc8d37 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -161,7 +161,7 @@ my $control = Dpkg::Control::Info->new();
 my $fields = $control->get_source();
 my $bd_value = deps_concat($fields->{'Build-Depends'}, 
$fields->{'Build-Depends-Arch'});
 my $build_deps = deps_parse($bd_value, build_dep => 1, reduce_restrictions => 
1);
-error(g_('error occurred while parsing %s'), 
'Build-Depends/Build-Depends-Arch')
+error(g_('cannot parse %s field'), 'Build-Depends/Build-Depends-Arch')
     unless defined $build_deps;
 
 my %dependencies;
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 17f916600..c2764af07 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -280,7 +280,7 @@ if ($options{opmode} =~ 
/^(build|print-format|(before|after)-build|commit)$/) {
            my $dep;
            my $type = field_get_dep_type($_);
            $dep = deps_parse($v, build_dep => 1, union => $type eq 'union');
-           error(g_('error occurred while parsing %s'), $_) unless defined 
$dep;
+           error(g_('cannot parse %s field'), $_) unless defined $dep;
            my $facts = Dpkg::Deps::KnownFacts->new();
            $dep->simplify_deps($facts);
            $dep->sort() if $type eq 'union';
@@ -334,7 +334,8 @@ if ($options{opmode} =~ 
/^(build|print-format|(before|after)-build|commit)$/) {
                     push(@sourcearch, $v) unless $archadded{$v}++;
                 } else {
                     for my $a (split(/\s+/, $v)) {
-                        error(g_("'%s' is not a legal architecture string"), 
$a)
+                        error(g_("'%s' is not a legal architecture string " .
+                                 "in package '%s'"), $a, $p)
                             if debarch_is_illegal($a);
                         error(g_('architecture %s only allowed on its ' .
                                  "own (list for package %s is '%s')"),

-- 
Dpkg.Org's dpkg

Reply via email to