[Reproducible-commits] [dpkg] 06/37: Dpkg::Control: Add new CTRL_COPYRIGHT control block types

Jérémy Bobbio lunar at moszumanska.debian.org
Sun Jan 31 16:28:38 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 4b88120061f92ba94441afe9f88421325d99b305
Author: Guillem Jover <guillem at debian.org>
Date:   Sun Jan 3 18:56:28 2016 +0100

    Dpkg::Control: Add new CTRL_COPYRIGHT control block types
    
    The types are CTRL_COPYRIGHT_HEADER, CTRL_COPYRIGHT_FILES and
    CTRL_COPYRIGHT_LICENSE. These describe the different control blocks
    of a machine readable debian/copyright file, as specified in
    <https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/>.
---
 debian/changelog                   |  2 ++
 scripts/Dpkg/Control.pm            | 27 ++++++++++++++++++++++++++-
 scripts/Dpkg/Control/FieldsCore.pm | 35 ++++++++++++++++++++++++++++++++---
 scripts/Dpkg/Control/Types.pm      |  9 +++++++++
 scripts/Dpkg/Index.pm              |  8 ++++++++
 5 files changed, 77 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b88eb9d..3b6fa7c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
   * Use EACCES instead of EWOULDBLOCK for fcntl(2) F_SETLK in dselect.
   * Perl modules:
     - Add new CTRL_REPO_RELEASE control block type to Dpkg::Control.
+    - Add new CTRL_COPYRIGHT_HEADER, CTRL_COPYRIGHT_FILES and
+      CTRL_COPYRIGHT_LICENSE control block types to Dpkg::Control.
   * Documentation:
     - Say value instead of option in deb-control(5).
     - Mark debian changelog format in bold in dpkg-parsechangelog(1).
diff --git a/scripts/Dpkg/Control.pm b/scripts/Dpkg/Control.pm
index 301a11e..b3d4e71 100644
--- a/scripts/Dpkg/Control.pm
+++ b/scripts/Dpkg/Control.pm
@@ -32,6 +32,9 @@ our @EXPORT = qw(
     CTRL_FILE_VENDOR
     CTRL_FILE_STATUS
     CTRL_CHANGELOG
+    CTRL_COPYRIGHT_HEADER
+    CTRL_COPYRIGHT_FILES
+    CTRL_COPYRIGHT_LICENSE
 );
 
 use Exporter qw(import);
@@ -116,6 +119,21 @@ Corresponds to an entry in dpkg's F<status> file ($Dpkg::ADMINDIR/status).
 
 Corresponds to the output of dpkg-parsechangelog.
 
+=item CTRL_COPYRIGHT_HEADER
+
+Corresponds to the header control block in a F<debian/copyright> file in
+machine readable format.
+
+=item CTRL_COPYRIGHT_FILES
+
+Corresponds to a files control block in a F<debian/copyright> file in
+machine readable format.
+
+=item CTRL_COPYRIGHT_LICENSE
+
+Corresponds to a license control block in a F<debian/copyright> file in
+machine readable format.
+
 =back
 
 =head1 METHODS
@@ -169,6 +187,12 @@ sub set_options {
             $$self->{name} = g_("package's section of control info file");
         } elsif ($t == CTRL_CHANGELOG) {
             $$self->{name} = g_('parsed version of changelog');
+        } elsif ($t == CTRL_COPYRIGHT_HEADER) {
+            $$self->{name} = g_('header stanza of copyright file');
+        } elsif ($t == CTRL_COPYRIGHT_FILES) {
+            $$self->{name} = g_('files stanza of copyright file');
+        } elsif ($t == CTRL_COPYRIGHT_HEADER) {
+            $$self->{name} = g_('license stanza of copyright file');
         } elsif ($t == CTRL_REPO_RELEASE) {
             $$self->{name} = sprintf(g_("repository's %s file"), 'Release');
         } elsif ($t == CTRL_INDEX_SRC) {
@@ -211,7 +235,8 @@ sub get_type {
 
 =head2 Version 1.01 (dpkg 1.18.5)
 
-New types: CTRL_REPO_RELEASE.
+New types: CTRL_REPO_RELEASE, CTRL_COPYRIGHT_HEADER, CTRL_COPYRIGHT_FILES,
+CTRL_COPYRIGHT_LICENSE.
 
 =head2 Version 1.00 (dpkg 1.15.6)
 
diff --git a/scripts/Dpkg/Control/FieldsCore.pm b/scripts/Dpkg/Control/FieldsCore.pm
index f93a028..3af6fa7 100644
--- a/scripts/Dpkg/Control/FieldsCore.pm
+++ b/scripts/Dpkg/Control/FieldsCore.pm
@@ -50,6 +50,7 @@ use constant {
     ALL_PKG => CTRL_INFO_PKG | CTRL_INDEX_PKG | CTRL_PKG_DEB | CTRL_FILE_STATUS,
     ALL_SRC => CTRL_INFO_SRC | CTRL_INDEX_SRC | CTRL_PKG_SRC,
     ALL_CHANGES => CTRL_FILE_CHANGES | CTRL_CHANGELOG,
+    ALL_COPYRIGHT => CTRL_COPYRIGHT_HEADER | CTRL_COPYRIGHT_FILES | CTRL_COPYRIGHT_LICENSE,
 };
 
 use constant {
@@ -159,6 +160,9 @@ our %FIELDS = (
     'Codename' => {
         allowed => CTRL_REPO_RELEASE,
     },
+    'Comment' => {
+        allowed => ALL_COPYRIGHT,
+    },
     'Components' => {
         allowed => CTRL_REPO_RELEASE,
         separator => FIELD_SEP_SPACE,
@@ -176,6 +180,9 @@ our %FIELDS = (
         dependency => 'union',
         dep_order => 6,
     },
+    'Copyright' => {
+        allowed => CTRL_COPYRIGHT_HEADER | CTRL_COPYRIGHT_FILES,
+    },
     'Date' => {
         allowed => ALL_CHANGES | CTRL_REPO_RELEASE,
     },
@@ -188,6 +195,9 @@ our %FIELDS = (
     'Description' => {
         allowed => ALL_PKG | CTRL_FILE_CHANGES | CTRL_REPO_RELEASE,
     },
+    'Disclaimer' => {
+        allowed => CTRL_COPYRIGHT_HEADER,
+    },
     'Directory' => {
         allowed => CTRL_INDEX_SRC,
     },
@@ -208,11 +218,11 @@ our %FIELDS = (
         separator => FIELD_SEP_LINE | FIELD_SEP_SPACE,
     },
     'Files' => {
-        allowed => CTRL_PKG_SRC | CTRL_FILE_CHANGES,
+        allowed => CTRL_PKG_SRC | CTRL_FILE_CHANGES | CTRL_COPYRIGHT_FILES,
         separator => FIELD_SEP_LINE | FIELD_SEP_SPACE,
     },
     'Format' => {
-        allowed => CTRL_PKG_SRC | CTRL_FILE_CHANGES,
+        allowed => CTRL_PKG_SRC | CTRL_FILE_CHANGES | CTRL_COPYRIGHT_HEADER,
     },
     'Homepage' => {
         allowed => ALL_SRC | ALL_PKG,
@@ -229,6 +239,9 @@ our %FIELDS = (
     'Label' => {
         allowed => CTRL_REPO_RELEASE,
     },
+    'License' => {
+        allowed => ALL_COPYRIGHT,
+    },
     'Origin' => {
         allowed => (ALL_PKG | ALL_SRC | CTRL_REPO_RELEASE) & (~CTRL_INFO_PKG),
     },
@@ -286,7 +299,7 @@ our %FIELDS = (
         separator => FIELD_SEP_LINE | FIELD_SEP_SPACE,
     },
     'Source' => {
-        allowed => (ALL_PKG | ALL_SRC | ALL_CHANGES) &
+        allowed => (ALL_PKG | ALL_SRC | ALL_CHANGES | CTRL_COPYRIGHT_HEADER) &
                    (~(CTRL_INDEX_SRC | CTRL_INFO_PKG)),
     },
     'Standards-Version' => {
@@ -331,6 +344,12 @@ our %FIELDS = (
         allowed => ALL_SRC,
         separator => FIELD_SEP_COMMA,
     },
+    'Upstream-Name' => {
+        allowed => CTRL_COPYRIGHT_HEADER,
+    },
+    'Upstream-Contact' => {
+        allowed => CTRL_COPYRIGHT_HEADER,
+    },
     'Urgency' => {
         allowed => ALL_CHANGES,
     },
@@ -419,6 +438,16 @@ our %FIELD_ORDER = (
         qw(Origin Label Suite Codename Changelogs Date Valid-Until
         Architectures Components Description), @sum_fields
     ],
+    CTRL_COPYRIGHT_HEADER() => [
+        qw(Format Upstream-Name Upstream-Contact Source Disclaimer Comment
+        License Copyright)
+    ],
+    CTRL_COPYRIGHT_FILES() => [
+        qw(Files Copyright License Comment)
+    ],
+    CTRL_COPYRIGHT_LICENSE() => [
+        qw(License Comment)
+    ],
 );
 # Order for CTRL_INDEX_PKG is derived from CTRL_PKG_DEB
 $FIELD_ORDER{CTRL_INDEX_PKG()} = [ @{$FIELD_ORDER{CTRL_PKG_DEB()}} ];
diff --git a/scripts/Dpkg/Control/Types.pm b/scripts/Dpkg/Control/Types.pm
index ba3658d..93498eb 100644
--- a/scripts/Dpkg/Control/Types.pm
+++ b/scripts/Dpkg/Control/Types.pm
@@ -30,6 +30,9 @@ our @EXPORT = qw(
     CTRL_FILE_VENDOR
     CTRL_FILE_STATUS
     CTRL_CHANGELOG
+    CTRL_COPYRIGHT_HEADER
+    CTRL_COPYRIGHT_FILES
+    CTRL_COPYRIGHT_LICENSE
 );
 
 use Exporter qw(import);
@@ -64,6 +67,12 @@ use constant {
     CTRL_CHANGELOG => 512,   # Output of dpkg-parsechangelog
     # Repository's (In)Release file.
     CTRL_REPO_RELEASE => 1024,
+    # Header control block in debian/copyright.
+    CTRL_COPYRIGHT_HEADER => 2048,
+    # Files control block in debian/copyright.
+    CTRL_COPYRIGHT_FILES => 4096,
+    # License control block in debian/copyright.
+    CTRL_COPYRIGHT_LICENSE => 8192,
 };
 
 =head1 CHANGES
diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm
index 03e130a..cb7dbc0 100644
--- a/scripts/Dpkg/Index.pm
+++ b/scripts/Dpkg/Index.pm
@@ -101,6 +101,14 @@ sub set_options {
 	    $self->{get_key_func} = sub {
 		return $_[0]->{Source} . '_' . $_[0]->{Version};
 	    };
+        } elsif ($t == CTRL_COPYRIGHT_HEADER) {
+            # This is a bit pointless, because the value will almost always
+            # be the same, but guarantees that we use a known field.
+            $self->{get_key_func} = sub { return $_[0]->{Format}; };
+        } elsif ($t == CTRL_COPYRIGHT_FILES) {
+            $self->{get_key_func} = sub { return $_[0]->{Files}; };
+        } elsif ($t == CTRL_COPYRIGHT_LICENSE) {
+            $self->{get_key_func} = sub { return $_[0]->{License}; };
         } elsif ($t == CTRL_FILE_CHANGES) {
 	    $self->{get_key_func} = sub {
 		return $_[0]->{Source} . '_' . $_[0]->{Version} . '_' .

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