浏览代码

Dpkg::Vendor::Debian: Add support for a reproducible feature area

Signed-off-by: Guillem Jover <guillem@debian.org>
Paul Wise 11 年之前
父节点
当前提交
24ce14e24f
共有 3 个文件被更改,包括 26 次插入2 次删除
  1. 2 0
      debian/changelog
  2. 7 2
      man/dpkg-buildflags.1
  3. 17 0
      scripts/Dpkg/Vendor/Debian.pm

+ 2 - 0
debian/changelog

@@ -45,6 +45,8 @@ dpkg (1.17.14) UNRELEASED; urgency=low
       build flags propagation. Closes: #628516
       build flags propagation. Closes: #628516
   * Pass DEB_BUILD_OPTIONS to dpkg-buildflags in buildflags.mk, required to
   * Pass DEB_BUILD_OPTIONS to dpkg-buildflags in buildflags.mk, required to
     get noopt to work at all, for example.
     get noopt to work at all, for example.
+  * Add a new dpkg-buildflags reproducible feature area:
+    Thanks to Paul Wise <pabs@debian.org>. Closes: #762683
 
 
   [ Raphaël Hertzog ]
   [ Raphaël Hertzog ]
   * Explain better in deb-triggers(5) why interest/activate-noawait should be
   * Explain better in deb-triggers(5) why interest/activate-noawait should be

+ 7 - 2
man/dpkg-buildflags.1

@@ -135,8 +135,8 @@ the flag is set/modified by an environment-specific configuration.
 .TP
 .TP
 .BI \-\-query\-features " area"
 .BI \-\-query\-features " area"
 Print the features enabled for a given area. The only currently recognized
 Print the features enabled for a given area. The only currently recognized
-areas are \fBqa\fP and \fBhardening\fP, see the \fBFEATURE AREAS\fP section
-for more details.
+areas are \fBqa\fP, \fBreproducible\fP and \fBhardening\fP,
+see the \fBFEATURE AREAS\fP section for more details.
 Exits with 0 if the area is known otherwise exits with 1.
 Exits with 0 if the area is known otherwise exits with 1.
 .IP
 .IP
 The output is in RFC822 format, with one section per feature.
 The output is in RFC822 format, with one section per feature.
@@ -338,6 +338,11 @@ architectures (most notably i386) can see performance losses of up to
 15% in very text-segment-heavy application workloads; most workloads
 15% in very text-segment-heavy application workloads; most workloads
 see less than 1%. Architectures with more general registers (e.g. amd64)
 see less than 1%. Architectures with more general registers (e.g. amd64)
 do not see as high a worst-case penalty.
 do not see as high a worst-case penalty.
+.SS Reproducibility
+The compile-time options detailed below can be used to help improve
+build reproducibility or provide additional warning messages during
+compilation. Except as noted below, these are enabled by default for
+architectures that support them.
 .
 .
 .SH ENVIRONMENT
 .SH ENVIRONMENT
 There are 2 sets of environment variables doing the same operations, the
 There are 2 sets of environment variables doing the same operations, the

+ 17 - 0
scripts/Dpkg/Vendor/Debian.pm

@@ -68,6 +68,7 @@ sub run_hook {
 	}
 	}
     } elsif ($hook eq 'update-buildflags') {
     } elsif ($hook eq 'update-buildflags') {
 	$self->_add_qa_flags(@params);
 	$self->_add_qa_flags(@params);
+	$self->_add_reproducible_flags(@params);
 	$self->_add_hardening_flags(@params);
 	$self->_add_hardening_flags(@params);
     } else {
     } else {
         return $self->SUPER::run_hook($hook, @params);
         return $self->SUPER::run_hook($hook, @params);
@@ -145,6 +146,22 @@ sub _add_qa_flags {
     }
     }
 }
 }
 
 
+sub _add_reproducible_flags {
+    my ($self, $flags) = @_;
+
+    # Default feature states.
+    my %use_feature = (
+    );
+
+    # Adjust features based on user or maintainer's desires.
+    $self->_parse_feature_area('reproducible', \%use_feature);
+
+    # Store the feature usage.
+    while (my ($feature, $enabled) = each %use_feature) {
+       $flags->set_feature('reproducible', $feature, $enabled);
+    }
+}
+
 sub _add_hardening_flags {
 sub _add_hardening_flags {
     my ($self, $flags) = @_;
     my ($self, $flags) = @_;
     my $arch = get_host_arch();
     my $arch = get_host_arch();