diff options
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | man/deb-buildinfo.man | 16 | ||||
-rw-r--r-- | man/dpkg-buildpackage.man | 11 | ||||
-rw-r--r-- | man/dpkg-genbuildinfo.man | 12 | ||||
-rw-r--r-- | scripts/Test/Dpkg.pm | 18 | ||||
-rwxr-xr-x | scripts/dpkg-buildpackage.pl | 16 | ||||
-rwxr-xr-x | scripts/dpkg-genbuildinfo.pl | 25 | ||||
-rw-r--r-- | scripts/t/dpkg_buildpackage/test-source_0_all.changes | 6 | ||||
-rw-r--r-- | scripts/t/dpkg_buildpackage/test-source_0_any.changes | 6 | ||||
-rw-r--r-- | scripts/t/dpkg_buildpackage/test-source_0_binary.changes | 6 | ||||
-rw-r--r-- | scripts/t/dpkg_buildpackage/test-source_0_full.changes | 6 |
11 files changed, 38 insertions, 86 deletions
diff --git a/debian/changelog b/debian/changelog index e45dbcd5c..2c5475e0e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ dpkg (1.18.15) UNRELEASED; urgency=medium * On source builds add 'source' to the Architecture field in the .buildinfo file in dpkg-genbuildinfo. * Add new Build-Date field to .buildinfo files. + * Generate deterministic .buildinfo filenames in dpkg-genbuildinfo, + following the same pattern as used for .changes files. * Perl modules: - Validate architecture arguments in Dpkg::Deps deps_parse(). Prompted by Johannes Schauer <josch@debian.org>. diff --git a/man/deb-buildinfo.man b/man/deb-buildinfo.man index fba3b62ff..18aac6730 100644 --- a/man/deb-buildinfo.man +++ b/man/deb-buildinfo.man @@ -46,14 +46,14 @@ see below). The control data might be enclosed in an OpenPGP ASCII Armored signature, as specified in RFC4880. .PP -The \fB.buildinfo\fP filename by default has the following form: - -\fIsource-name\fP\fB_\fP\fIsource-version\fP\fB_\fP\fIbuildinfo-id\fP\fB.buildinfo\fP - -where \fIbuildinfo-id\fP is composed of the build time formatted as -\fBstrftime\fP(2) «%Y%m%dT%H%M%Sz», followed by a minus ‘\-’ and the -eight left-most characters from the \fB.buildinfo\fP's file contents MD5 -digest. +The name of the \fB.buildinfo\fP file will depend on the type of build and +will be as specific as necessary but not more; +for a build that includes \fBany\fP the name will be +\fIsource-name\fP\fB_\fP\fIsource-version\fP\fB_\fP\fIarch\fP\fB.buildinfo\fP, +or otherwise for a build that includes \fBall\fP the name will be +\fIsource-name\fP\fB_\fP\fIsource-version\fP\fB_\fP\fBall.buildinfo\fP, +or otherwise for a build that includes \fBsource\fP the name will be +\fIsource-name\fP\fB_\fP\fIsource-version\fP\fB_\fP\fBsource.buildinfo\fP. . .SH FIELDS .TP diff --git a/man/dpkg-buildpackage.man b/man/dpkg-buildpackage.man index 6129ea605..728467604 100644 --- a/man/dpkg-buildpackage.man +++ b/man/dpkg-buildpackage.man @@ -373,17 +373,6 @@ The source package version (without the epoch). The upstream version. .RE .TP -.BI \-\-buildinfo-id= identifier -Specify the identifier part of the \fB.buildinfo\fP file name -(since dpkg 1.18.11). -By default, \fBdpkg\-buildpackage\fP will create an identifier using -the current time and the first characters of the MD5 hash. -An arbitrary identifier can be specified as a replacement. -The identifier has the same restriction as package names: it must consist -only of lower case letters (a-z), digits (0-9), plus (+) and minus (\-) -signs, and periods (.), be at least two characters long and must start -with an alphanumeric character. -.TP .BI \-\-buildinfo\-option= opt Pass option \fIopt\fP to \fBdpkg\-genbuildinfo\fP (since dpkg 1.18.11). Can be used multiple times. diff --git a/man/dpkg-genbuildinfo.man b/man/dpkg-genbuildinfo.man index 683f9b38e..5a39a7617 100644 --- a/man/dpkg-genbuildinfo.man +++ b/man/dpkg-genbuildinfo.man @@ -92,7 +92,7 @@ for information about alternative formats. .BR \-O [\fIfilename\fP] Print the buildinfo file to standard output (or \fIfilename\fP if specified) rather than to -.IB dir / source-name _ source-version _ buildinfo-id .buildinfo +.IB dir / source-name _ source-version _ arch .buildinfo (where \fIdir\fP is \fB..\fP by default or \fIupload-files-dir\fP if \fB\-u\fP was used). .TP @@ -104,16 +104,6 @@ rather than (\fBdpkg\-genbuildinfo\fP needs to find these files so that it can include their sizes and checksums in the \fB.buildinfo\fP file). .TP -.BI \-\-buildinfo-id= identifier -Specify the identifier part of the \fB.buildinfo\fP file name. -By default, \fBdpkg\-genbuildinfo\fP will create an identifier using -the current time and the first characters of the MD5 hash. -An arbitrary identifier can be specified as a replacement. -The identifier has the same restriction as package names: it must consist -only of lower case letters (a-z), digits (0-9), plus (+) and minus (\-) -signs, and periods (.), be at least two characters long and must start -with an alphanumeric character. -.TP .BI \-\-always\-include\-path By default, the \fBBuild\-Path\fR field will only be written if the current directory starts with a whitelisted pattern. diff --git a/scripts/Test/Dpkg.pm b/scripts/Test/Dpkg.pm index ff60df177..e0395dec6 100644 --- a/scripts/Test/Dpkg.pm +++ b/scripts/Test/Dpkg.pm @@ -111,24 +111,6 @@ sub test_neutralize_checksums open my $fh, '<', $filename or die; while (<$fh>) { s/^ ([0-9a-f]{32,}) [1-9][0-9]* /q{ } . $1 =~ tr{0-9a-f}{0}r . q{ 0 }/e; - s{^ - ( - \s - # Digest - 0{32,} - \s - # Size - 0 - # Optional Section and Priority - (?:\s[\w]*\s[\w]*)? - \s - # Filename (package and version) - [^_]*_[^_]* - ) - # Filename (architecture and extension) - _[^.]*\.(buildinfo) - $ - }{$1_20160101T123000z-00000000.$2}x; print { $fhnew } $_; } close $fh or die; diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl index b1d644d8c..728916ee3 100755 --- a/scripts/dpkg-buildpackage.pl +++ b/scripts/dpkg-buildpackage.pl @@ -95,7 +95,6 @@ sub usage { --hook-<name>=<command> set <command> as the hook <name>, known hooks: init preclean source build binary buildinfo changes postclean check sign done - --buildinfo-id=<id> set the <id> part of the .buildinfo filename. --buildinfo-option=<opt> pass option <opt> to dpkg-genbuildinfo. -p, --sign-command=<command> @@ -172,7 +171,6 @@ my $since; my $maint; my $changedby; my $desc; -my $buildinfo_id; my @buildinfo_opts; my @changes_opts; my @hook_names = qw( @@ -235,8 +233,9 @@ while (@ARGV) { usageerr(g_('missing hook %s command'), $hook_name) if not defined $hook_cmd; $hook{$hook_name} = $hook_cmd; - } elsif (/^--buildinfo-id=(.*)$/) { - $buildinfo_id = $1; + } elsif (/^--buildinfo-id=.*$/) { + # Deprecated option + warning('--buildinfo-id is deprecated, it is without effect'); } elsif (/^(?:-p|--sign-command=)(.*)$/) { $signcommand = $1; } elsif (/^(?:-k|--sign-key=)(.*)$/) { @@ -404,14 +403,6 @@ if (defined $parallel) { $build_opts->export(); } -if (defined $buildinfo_id) { - # The .buildinfo identifiers have the same restrictions as package names. - my $err = pkg_name_is_illegal($buildinfo_id); - if ($err) { - error(g_("illegal .buildinfo ID '%s': %s"), $buildinfo_id, $err); - } -} - set_build_profiles(@build_profiles) if @build_profiles; my $cwd = cwd(); @@ -564,7 +555,6 @@ if (build_has_any(BUILD_BINARY)) { run_hook('buildinfo', 1); push @buildinfo_opts, "--build=$build_types" if build_has_none(BUILD_DEFAULT); -push @buildinfo_opts, "--buildinfo-id=$buildinfo_id" if $buildinfo_id; push @buildinfo_opts, "--admindir=$admindir" if $admindir; withecho('dpkg-genbuildinfo', @buildinfo_opts); diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl index 32c7e7344..9e93d552c 100755 --- a/scripts/dpkg-genbuildinfo.pl +++ b/scripts/dpkg-genbuildinfo.pl @@ -33,7 +33,7 @@ use Dpkg (); use Dpkg::Gettext; use Dpkg::Checksums; use Dpkg::ErrorHandling; -use Dpkg::Arch qw(get_build_arch); +use Dpkg::Arch qw(get_build_arch get_host_arch); use Dpkg::Build::Types; use Dpkg::Build::Info qw(get_build_env_whitelist); use Dpkg::BuildFlags; @@ -62,7 +62,6 @@ my $admindir = $Dpkg::ADMINDIR; my $always_include_path = 0; my @build_profiles = get_build_profiles(); my $buildinfo_format = '0.1'; -my $buildinfo_id; my $buildinfo; my $checksums = Dpkg::Checksums->new(); @@ -289,7 +288,6 @@ 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 '..'). - --buildinfo-id=<id> specify the buildinfo id for the output file. --always-include-path always include Build-Path. --admindir=<directory> change the administrative directory. -?, --help show this help message. @@ -315,8 +313,9 @@ while (@ARGV) { $stdout = 1; } elsif (m/^-O(.*)$/) { $outputfile = $1; - } elsif (m/^--buildinfo-id=(.*)$/) { - $buildinfo_id = $1; + } elsif (m/^--buildinfo-id=.*$/) { + # Deprecated option + warning('--buildinfo-id is deprecated, it is without effect'); } elsif (m/^--always-include-path$/) { $always_include_path = 1; } elsif (m/^--admindir=(.*)$/) { @@ -433,17 +432,17 @@ if ($stdout) { } elsif (defined $outputfile) { $buildinfo = basename($outputfile); } else { - if (not defined $buildinfo_id) { - require Digest::MD5; + my $arch; - my $buildinfo_contents = $fields->output(); - - my $timestamp = strftime('%Y%m%dT%H%M%Sz', gmtime); - my $buildinfo_md5 = Digest::MD5::md5_hex($buildinfo_contents); - $buildinfo_id = "$timestamp-" . substr($buildinfo_md5, 0, 8); + if (build_has_any(BUILD_ARCH_DEP)) { + $arch = get_host_arch(); + } elsif (build_has_any(BUILD_ARCH_INDEP)) { + $arch = 'all'; + } elsif (build_has_any(BUILD_SOURCE)) { + $arch = 'source'; } - $buildinfo = "${spackage}_${sversion}_${buildinfo_id}.buildinfo"; + $buildinfo = "${spackage}_${sversion}_${arch}.buildinfo"; $outputfile = "$uploadfilesdir/$buildinfo"; } diff --git a/scripts/t/dpkg_buildpackage/test-source_0_all.changes b/scripts/t/dpkg_buildpackage/test-source_0_all.changes index 9c4bdb4b0..ebe0890e2 100644 --- a/scripts/t/dpkg_buildpackage/test-source_0_all.changes +++ b/scripts/t/dpkg_buildpackage/test-source_0_all.changes @@ -18,10 +18,10 @@ Changes: * Entry. Closes: #12345 Checksums-Sha1: 0000000000000000000000000000000000000000 0 test-binary-all_0_all.deb - 0000000000000000000000000000000000000000 0 test-source_0_20160101T123000z-00000000.buildinfo + 0000000000000000000000000000000000000000 0 test-source_0_all.buildinfo Checksums-Sha256: 0000000000000000000000000000000000000000000000000000000000000000 0 test-binary-all_0_all.deb - 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0_20160101T123000z-00000000.buildinfo + 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0_all.buildinfo Files: 00000000000000000000000000000000 0 test optional test-binary-all_0_all.deb - 00000000000000000000000000000000 0 test optional test-source_0_20160101T123000z-00000000.buildinfo + 00000000000000000000000000000000 0 test optional test-source_0_all.buildinfo diff --git a/scripts/t/dpkg_buildpackage/test-source_0_any.changes b/scripts/t/dpkg_buildpackage/test-source_0_any.changes index 6b2c29715..098277f14 100644 --- a/scripts/t/dpkg_buildpackage/test-source_0_any.changes +++ b/scripts/t/dpkg_buildpackage/test-source_0_any.changes @@ -18,10 +18,10 @@ Changes: * Entry. Closes: #12345 Checksums-Sha1: 0000000000000000000000000000000000000000 0 test-binary-any_0_amd64.deb - 0000000000000000000000000000000000000000 0 test-source_0_20160101T123000z-00000000.buildinfo + 0000000000000000000000000000000000000000 0 test-source_0_amd64.buildinfo Checksums-Sha256: 0000000000000000000000000000000000000000000000000000000000000000 0 test-binary-any_0_amd64.deb - 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0_20160101T123000z-00000000.buildinfo + 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0_amd64.buildinfo Files: 00000000000000000000000000000000 0 test optional test-binary-any_0_amd64.deb - 00000000000000000000000000000000 0 test optional test-source_0_20160101T123000z-00000000.buildinfo + 00000000000000000000000000000000 0 test optional test-source_0_amd64.buildinfo diff --git a/scripts/t/dpkg_buildpackage/test-source_0_binary.changes b/scripts/t/dpkg_buildpackage/test-source_0_binary.changes index cd57b7f94..7470ce50c 100644 --- a/scripts/t/dpkg_buildpackage/test-source_0_binary.changes +++ b/scripts/t/dpkg_buildpackage/test-source_0_binary.changes @@ -19,12 +19,12 @@ Changes: Checksums-Sha1: 0000000000000000000000000000000000000000 0 test-binary-all_0_all.deb 0000000000000000000000000000000000000000 0 test-binary-any_0_amd64.deb - 0000000000000000000000000000000000000000 0 test-source_0_20160101T123000z-00000000.buildinfo + 0000000000000000000000000000000000000000 0 test-source_0_amd64.buildinfo Checksums-Sha256: 0000000000000000000000000000000000000000000000000000000000000000 0 test-binary-all_0_all.deb 0000000000000000000000000000000000000000000000000000000000000000 0 test-binary-any_0_amd64.deb - 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0_20160101T123000z-00000000.buildinfo + 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0_amd64.buildinfo Files: 00000000000000000000000000000000 0 test optional test-binary-all_0_all.deb 00000000000000000000000000000000 0 test optional test-binary-any_0_amd64.deb - 00000000000000000000000000000000 0 test optional test-source_0_20160101T123000z-00000000.buildinfo + 00000000000000000000000000000000 0 test optional test-source_0_amd64.buildinfo diff --git a/scripts/t/dpkg_buildpackage/test-source_0_full.changes b/scripts/t/dpkg_buildpackage/test-source_0_full.changes index 6eec5523a..fef013c65 100644 --- a/scripts/t/dpkg_buildpackage/test-source_0_full.changes +++ b/scripts/t/dpkg_buildpackage/test-source_0_full.changes @@ -21,16 +21,16 @@ Checksums-Sha1: 0000000000000000000000000000000000000000 0 test-source_0.tar.xz 0000000000000000000000000000000000000000 0 test-binary-all_0_all.deb 0000000000000000000000000000000000000000 0 test-binary-any_0_amd64.deb - 0000000000000000000000000000000000000000 0 test-source_0_20160101T123000z-00000000.buildinfo + 0000000000000000000000000000000000000000 0 test-source_0_amd64.buildinfo Checksums-Sha256: 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0.dsc 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0.tar.xz 0000000000000000000000000000000000000000000000000000000000000000 0 test-binary-all_0_all.deb 0000000000000000000000000000000000000000000000000000000000000000 0 test-binary-any_0_amd64.deb - 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0_20160101T123000z-00000000.buildinfo + 0000000000000000000000000000000000000000000000000000000000000000 0 test-source_0_amd64.buildinfo Files: 00000000000000000000000000000000 0 test optional test-source_0.dsc 00000000000000000000000000000000 0 test optional test-source_0.tar.xz 00000000000000000000000000000000 0 test optional test-binary-all_0_all.deb 00000000000000000000000000000000 0 test optional test-binary-any_0_amd64.deb - 00000000000000000000000000000000 0 test optional test-source_0_20160101T123000z-00000000.buildinfo + 00000000000000000000000000000000 0 test optional test-source_0_amd64.buildinfo |