[Reproducible-commits] [dpkg] 34/105: dpkg-deb, scripts: Make the Architecture field mandatory on package builds

Niko Tyni ntyni at moszumanska.debian.org
Mon May 2 13:49:49 UTC 2016


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

ntyni pushed a commit to branch ntyni/reproducible_builds
in repository dpkg.

commit 09300f0f870f19ad1123f9a798f7c702912f3b55
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Feb 27 12:44:41 2016 +0100

    dpkg-deb, scripts: Make the Architecture field mandatory on package builds
    
    We still accept source and binary packages with missing or empty
    Architecture fields, but when building either of these, we require
    the field to be present.
---
 debian/changelog               |  1 +
 dpkg-deb/build.c               | 15 +++++----------
 scripts/Dpkg/Source/Package.pm |  4 ++--
 scripts/dpkg-genchanges.pl     |  2 +-
 scripts/dpkg-gencontrol.pl     |  8 ++++----
 5 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3538402..99ac2cf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -50,6 +50,7 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
     is very simple, and a simple hand-written parser is smaller and avoids a
     build dependency.
   * Be more strict when parsing the COLUMNS environment variable in dpkg-query.
+  * Make the Architecture field mandatory on package builds.
   * Portability:
     - Move DPKG_ADMINDIR environment variable name out from update-alternatives
       code, to make life easier for non-dpkg-based systems.
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index df9b922..0b384ff 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -325,6 +325,9 @@ check_control_file(const char *ctrldir)
   if (strspn(pkg->set->name, "abcdefghijklmnopqrstuvwxyz0123456789+-.") !=
       strlen(pkg->set->name))
     ohshit(_("package name has characters that aren't lowercase alphanums or '-+.'"));
+  if (pkg->available.arch->type == DPKG_ARCH_NONE ||
+      pkg->available.arch->type == DPKG_ARCH_EMPTY)
+    ohshit(_("package architecture is missing or empty"));
   if (pkg->priority == PKG_PRIO_OTHER)
     warning(_("'%s' contains user-defined Priority value '%s'"),
             controlfile, pkg->otherpriority);
@@ -405,17 +408,9 @@ gen_dest_pathname(const char *dir, const char *dest)
 static char *
 gen_dest_pathname_from_pkg(const char *dir, struct pkginfo *pkg)
 {
-  const char *arch_sep;
-
-  if (pkg->available.arch->type == DPKG_ARCH_NONE ||
-      pkg->available.arch->type == DPKG_ARCH_EMPTY)
-    arch_sep = "";
-  else
-    arch_sep = "_";
-
-  return str_fmt("%s/%s_%s%s%s%s", dir, pkg->set->name,
+  return str_fmt("%s/%s_%s_%s%s", dir, pkg->set->name,
                  versiondescribe(&pkg->available.version, vdew_never),
-                 arch_sep, pkg->available.arch->name, DEBEXT);
+                 pkg->available.arch->name, DEBEXT);
 }
 
 typedef void filenames_feed_func(const char *dir, int fd_out);
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 77cfe88..de48bc6 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -609,12 +609,12 @@ sub write_dsc {
     }
 
     unless ($opts{nocheck}) {
-        foreach my $f (qw(Source Version)) {
+        foreach my $f (qw(Source Version Architecture)) {
             unless (defined($fields->{$f})) {
                 error(g_('missing information for critical output field %s'), $f);
             }
         }
-        foreach my $f (qw(Maintainer Architecture Standards-Version)) {
+        foreach my $f (qw(Maintainer Standards-Version)) {
             unless (defined($fields->{$f})) {
                 warning(g_('missing information for output field %s'), $f);
             }
diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index e55dc5a..c6b9cca 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -310,7 +310,7 @@ if (build_has(BUILD_BINARY)) {
 # Scan control info of all binary packages
 foreach my $pkg ($control->get_packages()) {
     my $p = $pkg->{'Package'};
-    my $a = $pkg->{'Architecture'} // '';
+    my $a = $pkg->{'Architecture'};
     my $bp = $pkg->{'Build-Profiles'};
     my $d = $pkg->{'Description'} || 'no description available';
     $d = $1 if $d =~ /^(.*)\n/;
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index d537a61..7e66fcd 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -305,11 +305,11 @@ foreach my $field (field_list_pkg_dep()) {
 
 $fields->{'Built-For-Profiles'} = join ' ', get_build_profiles();
 
-for my $f (qw(Package Version)) {
+for my $f (qw(Package Version Architecture)) {
     error(g_('missing information for output field %s'), $f)
         unless defined $fields->{$f};
 }
-for my $f (qw(Maintainer Description Architecture)) {
+for my $f (qw(Maintainer Description)) {
     warning(g_('missing information for output field %s'), $f)
         unless defined $fields->{$f};
 }
@@ -374,7 +374,7 @@ for my $f (keys %remove) {
 my $sversion = $fields->{'Version'};
 $sversion =~ s/^\d+://;
 $forcefilename //= sprintf('%s_%s_%s.%s', $fields->{'Package'}, $sversion,
-                           $fields->{'Architecture'} || '', $pkg_type);
+                           $fields->{'Architecture'}, $pkg_type);
 $forcefilename = $substvars->substvars($forcefilename);
 my $section = $substvars->substvars($fields->{'Section'} || '-');
 my $priority = $substvars->substvars($fields->{'Priority'} || '-');
@@ -396,7 +396,7 @@ foreach my $file ($dist->get_files()) {
     if (defined $file->{package} &&
         ($file->{package} eq $fields->{'Package'}) &&
         ($file->{package_type} eq $pkg_type) &&
-        (debarch_eq($file->{arch}, $fields->{'Architecture'} || '') ||
+        (debarch_eq($file->{arch}, $fields->{'Architecture'}) ||
          debarch_eq($file->{arch}, 'all'))) {
         $dist->del_file($file->{filename});
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list