[Reproducible-commits] [dpkg] 07/09: dpkg-source: verify version of the quilt metadata before build

Holger Levsen holger at layer-acht.org
Tue May 3 08:43:02 UTC 2016


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

holger pushed a commit to annotated tag 1.14.28
in repository dpkg.

commit 83d1d5c8ae665c59d9593d2e2aa784ddac7b7c96
Author: Raphaël Hertzog <hertzog at debian.org>
Date:   Sun Nov 29 18:03:10 2009 +0100

    dpkg-source: verify version of the quilt metadata before build
    
    Since format "3.0 (quilt)" can now modify the content of the .pc
    directory, ensure it still uses the supported format (currently version
    2). Add an option --allow-version-of-quilt-db=<ver> to be able
    to force creation of a source package despite the unexpected version.
---
 man/dpkg-source.1                       |  8 ++++++++
 scripts/Dpkg/Source/Package/V3/quilt.pm | 30 ++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index 6a7e920..838a8fd 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -414,6 +414,14 @@ behaviour.
 .PP
 .B Build options
 .TP
+.BI \-\-allow\-version\-of\-quilt\-db= version
+Allow \fBdpkg\-source\fP to build the source package if the version of
+the quilt metadata is the one specified, even if \fBdpkg\-source\fP
+doesn't know about it. Effectively this says that the given version of the
+quilt metadata is compatible with the version 2 that \fBdpkg\-source\fP
+currently supports. The version of the quilt metadata is stored in
+\fB.pc/.version\fP.
+.TP
 .B \-\-include\-removal
 Do not ignore removed files and include them in the automatically
 generated patch.
diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm b/scripts/Dpkg/Source/Package/V3/quilt.pm
index 0d6cf9f..4ec79c3 100644
--- a/scripts/Dpkg/Source/Package/V3/quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/quilt.pm
@@ -38,12 +38,19 @@ our $CURRENT_MINOR_VERSION = "0";
 
 sub init_options {
     my ($self) = @_;
+    $self->{'options'}{'allow-version-of-quilt-db'} = []
+        unless exists $self->{'options'}{'allow-version-of-quilt-db'};
+
     $self->SUPER::init_options();
 }
 
 sub parse_cmdline_option {
     my ($self, $opt) = @_;
     return 1 if $self->SUPER::parse_cmdline_option($opt);
+    if ($opt =~ /^--allow-version-of-quilt-db=(.*)$/) {
+        push @{$self->{'options'}{'allow-version-of-quilt-db'}}, $1;
+        return 1;
+    }
     return 0;
 }
 
@@ -204,6 +211,29 @@ sub prepare_build {
     $self->{'diff_options'}{'diff_ignore_func'} = $func;
 }
 
+sub do_build {
+    my ($self, $dir) = @_;
+    my $pc_ver = File::Spec->catfile($dir, ".pc", ".version");
+    if (-f $pc_ver) {
+        open(VER, "<", $pc_ver) || syserr(_g("cannot read %s"), $pc_ver);
+        my $version = <VER>;
+        chomp $version;
+        close(VER);
+        if ($version != 2) {
+            if (scalar grep { $version eq $_ }
+                @{$self->{'options'}{'allow-version-of-quilt-db'}})
+            {
+                warning(_g("unsupported version of the quilt metadata: %s"),
+                        $version);
+            } else {
+                error(_g("unsupported version of the quilt metadata: %s"),
+                      $version);
+            }
+        }
+    }
+    $self->SUPER::do_build($dir);
+}
+
 sub check_patches_applied {
     my ($self, $dir) = @_;
     my $pc_applied = File::Spec->catfile($dir, ".pc", "applied-patches");

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