summaryrefslogtreecommitdiff
path: root/scripts/dpkg-genbuildinfo.pl
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2017-09-10 16:18:15 +0200
committerGuillem Jover <guillem@debian.org>2017-10-12 00:49:47 +0200
commitd920305d9deb52fa7c1fb8b0f01bfc31cf517e41 (patch)
tree6aba0205a24cc69e0c4151ee1c32b90bf71402b4 /scripts/dpkg-genbuildinfo.pl
parentb964b3d6270a6205b74c4910e6d2783123850982 (diff)
downloaddpkg-d920305d9deb52fa7c1fb8b0f01bfc31cf517e41.tar.gz
dpkg-genbuildinfo: Add support for new Build-Kernel-Version field
Packages intended to be built in a generic way must never rely on the currently running kernel on the build system (an exception could be an optimization rebuild using the current system as the reference baseline). But to be able to detect when a package might not be reproducible due to varying kernel information it is still useful to be able to record this information. Although that information can be very sensitive. When the builder has explicitly enabled the Build-Kernel-Version field with the new dpkg-genbuildinfo --always-include-kernel option, it will get included in the generated .buildinfo file. Closes: #873937
Diffstat (limited to 'scripts/dpkg-genbuildinfo.pl')
-rwxr-xr-xscripts/dpkg-genbuildinfo.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl
index 3682f2f02..45c45089d 100755
--- a/scripts/dpkg-genbuildinfo.pl
+++ b/scripts/dpkg-genbuildinfo.pl
@@ -61,6 +61,7 @@ my $outputfile;
my $stdout = 0;
my $admindir = $Dpkg::ADMINDIR;
my %use_feature = (
+ kernel => 0,
path => 0,
);
my @build_profiles = get_build_profiles();
@@ -294,6 +295,7 @@ sub usage {
-F<changelog-format> force changelog format.
-O[<buildinfo-file>] write to stdout (or <buildinfo-file>).
-u<upload-files-dir> directory with files (default is '..').
+ --always-include-kernel always include Build-Kernel-Version.
--always-include-path always include Build-Path.
--admindir=<directory> change the administrative directory.
-?, --help show this help message.
@@ -325,6 +327,8 @@ while (@ARGV) {
} elsif (m/^--buildinfo-id=.*$/) {
# Deprecated option
warning('--buildinfo-id is deprecated, it is without effect');
+ } elsif (m/^--always-include-kernel$/) {
+ $use_feature{kernel} = 1;
} elsif (m/^--always-include-path$/) {
$use_feature{path} = 1;
} elsif (m/^--admindir=(.*)$/) {
@@ -415,6 +419,11 @@ $fields->{'Build-Origin'} = get_current_vendor();
$fields->{'Build-Architecture'} = get_build_arch();
$fields->{'Build-Date'} = get_build_date();
+if ($use_feature{kernel}) {
+ my (undef, undef, $kern_rel, $kern_ver, undef) = POSIX::uname();
+ $fields->{'Build-Kernel-Version'} = "$kern_rel $kern_ver";
+}
+
my $cwd = cwd();
if ($use_feature{path}) {
$fields->{'Build-Path'} = $cwd;