[Reproducible-commits] [dpkg] 23/37: dpkg-buildpackage: Use the same restrictions for buildinfo identifiers as package names

Jérémy Bobbio lunar at moszumanska.debian.org
Sun Jan 31 16:28:40 UTC 2016


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

lunar pushed a commit to branch pu/buildinfo
in repository dpkg.

commit ecda68c1db300acfa868bf488d21dce29cd42ff1
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Fri Jan 29 14:25:50 2016 +0000

    dpkg-buildpackage: Use the same restrictions for buildinfo identifiers as package names
    
    The means we must use a lowercase 'z' in the timestamp generated for the
    default identifier. Not ideal for ISO 8601 compliance.
---
 man/dpkg-buildpackage.1      | 7 +++++--
 scripts/dpkg-buildpackage.pl | 7 ++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index 54cee7b..a06f917 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -325,8 +325,11 @@ The upstream version.
 .BI \-\-buildinfo-identifier= identifier
 By default, \fBdpkg\-buildpackage\fP put the system hostname and the
 current time in the name of the \fB.buildinfo\fP file. An arbitrary
-identifier can be specified as a replacement (since dpkg 1.18.5). It must
-contain only alphanumeric characters and hyphens.
+identifier can be specified as a replacement (since dpkg 1.18.5).
+The identifier has the same restriction as package names: they
+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 \-p sign-command
 When \fBdpkg\-buildpackage\fP needs to execute GPG to sign a source
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 102558a..c346b11 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -428,8 +428,9 @@ if (defined $parallel) {
 }
 
 if (defined $buildinfo_identifier) {
-    error(g_('buildinfo identifiers must not be empty and only contain alphanumeric characters and hyphens'))
-        unless $buildinfo_identifier =~ /\A[A-Za-z0-9-]+\z/;
+    # .buildinfo identifiers have the same restrictions as package names
+    my $err = pkg_name_is_illegal($buildinfo_identifier);
+    error(g_("illegal .buildinfo identifier '%s': %s"), $buildinfo_identifier, $err) if $err;
 }
 
 set_build_profiles(@build_profiles) if @build_profiles;
@@ -603,7 +604,7 @@ if ($include & BUILD_BINARY) {
         if (!defined $buildinfo_identifier) {
             require Digest::MD5;
 
-            my $timestamp = strftime('%Y%m%dT%H%M%SZ', gmtime());
+            my $timestamp = strftime('%Y%m%dT%H%M%Sz', gmtime());
             my $buildinfo_md5 = Digest::MD5::md5_hex(@buildinfo_content);
             $buildinfo_identifier = "$timestamp-" . substr($buildinfo_md5, 0, 8);
         }

-- 
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