From b916e61f0feb8eb37d9f00bbd4066c4f1b53babe Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 28 Mar 2014 03:13:52 +0100 Subject: dpkg-source: Add a new extraction --ignore-bad-version option This allows to extract ancient source packages with broken versions, that used to be accepted at some point in time by dpkg-source. Closes: #740883 --- scripts/Dpkg/Source/Package.pm | 8 +++++++- scripts/Dpkg/Source/Package/V1.pm | 4 ++++ scripts/Dpkg/Source/Package/V2.pm | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'scripts/Dpkg') diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm index 60efef0a0..68d634ad1 100644 --- a/scripts/Dpkg/Source/Package.pm +++ b/scripts/Dpkg/Source/Package.pm @@ -463,7 +463,13 @@ sub extract { my $newdirectory = $_[0]; my ($ok, $error) = version_check($self->{fields}{'Version'}); - error($error) unless $ok; + if (not $ok) { + if ($self->{options}{ignore_bad_version}) { + warning($error); + } else { + error($error); + } + } # Copy orig tarballs if ($self->{options}{copy_orig_tarballs}) { diff --git a/scripts/Dpkg/Source/Package/V1.pm b/scripts/Dpkg/Source/Package/V1.pm index 268a8aa72..70970fc11 100644 --- a/scripts/Dpkg/Source/Package/V1.pm +++ b/scripts/Dpkg/Source/Package/V1.pm @@ -53,6 +53,7 @@ sub init_options { 'debian/source/local-patch-header'; $self->{options}{sourcestyle} ||= 'X'; $self->{options}{skip_debianization} ||= 0; + $self->{options}{ignore_bad_version} ||= 0; $self->{options}{abort_on_upstream_changes} ||= 0; # V1.0 only supports gzip compression. @@ -73,6 +74,9 @@ sub parse_cmdline_option { } elsif ($opt =~ m/^--skip-debianization$/) { $o->{skip_debianization} = 1; return 1; + } elsif ($opt =~ m/^--ignore-bad-version$/) { + $o->{ignore_bad_version} = 1; + return 1; } elsif ($opt =~ m/^--abort-on-upstream-changes$/) { $o->{abort_on_upstream_changes} = 1; return 1; diff --git a/scripts/Dpkg/Source/Package/V2.pm b/scripts/Dpkg/Source/Package/V2.pm index 262326737..70d19ca3e 100644 --- a/scripts/Dpkg/Source/Package/V2.pm +++ b/scripts/Dpkg/Source/Package/V2.pm @@ -67,6 +67,8 @@ sub init_options { unless exists $self->{options}{create_empty_orig}; $self->{options}{auto_commit} = 0 unless exists $self->{options}{auto_commit}; + $self->{options}{ignore_bad_version} = 0 + unless exists $self->{options}{ignore_bad_version}; } sub parse_cmdline_option { @@ -104,6 +106,9 @@ sub parse_cmdline_option { } elsif ($opt =~ /^--auto-commit$/) { $self->{options}{auto_commit} = 1; return 1; + } elsif ($opt =~ /^--ignore-bad-version$/) { + $self->{options}{ignore_bad_version} = 1; + return 1; } return 0; } -- cgit v1.2.3