Package: dpkg
Version: 1.17.0
Severity: wishlist
Tags: patch

Dear Maintainer,

As part of 1.17.0 bug report
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=700177 was fixed, which
whilst enforcing Debian Policy, breaks backwards compatability for 3rd
party packages that (ab)use bad version numbers. In effort to preserve
backwards compatibility where such packages still need to be maintained
please allow override is_native version check in dpkg 3.0 Native format.

Patch attached.

Regards,

Dimitri.

>From 29da323dccc5d3eaf76046c79f6513fcab5c2195 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <[email protected]>
Date: Tue, 4 Feb 2014 13:43:13 +0000
Subject: [PATCH] Add --force-native dpkg-source option to override is_native
 version check in "3.0 (Native)" format to preserve backwards compatibility
 for those that maintain packages which abused bad version numbers with dpkg
 << 1.17.0.

---
 debian/changelog                         |  6 ++++++
 scripts/Dpkg/Source/Package/V3/Native.pm | 20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 3128c68..f17ec42 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,12 @@ dpkg (1.17.7) UNRELEASED; urgency=low
   * German (Helge Kreutzmann).
   * Swedish (Peter Krefting).
  
+  [ Dimitri John Ledkov ]
+  * Add --force-native dpkg-source option to override is_native version
+    check in "3.0 (Native)" format to preserve backwards compatibility for
+    those that maintain packages which abused bad version numbers with
+    dpkg << 1.17.0.
+
  -- Guillem Jover <[email protected]>  Wed, 15 Jan 2014 19:02:55 +0100
 
 dpkg (1.17.6) unstable; urgency=low
diff --git a/scripts/Dpkg/Source/Package/V3/Native.pm b/scripts/Dpkg/Source/Package/V3/Native.pm
index 5b833e1..22760f6 100644
--- a/scripts/Dpkg/Source/Package/V3/Native.pm
+++ b/scripts/Dpkg/Source/Package/V3/Native.pm
@@ -37,6 +37,24 @@ use File::Temp qw(tempfile);
 
 our $CURRENT_MINOR_VERSION = '0';
 
+sub init_options {
+    my ($self) = @_;
+    $self->{options}{force_native} = 0
+        unless exists $self->{options}{force_native};
+
+    $self->SUPER::init_options();
+}
+
+sub parse_cmdline_option {
+    my ($self, $opt) = @_;
+    return 1 if $self->SUPER::parse_cmdline_option($opt);
+    if ($opt =~ /^--force-native$/) {
+        $self->{options}{force_native} = 1;
+        return 1;
+    }
+    return 0;
+}
+
 sub do_extract {
     my ($self, $newdirectory) = @_;
     my $sourcestyle = $self->{options}{sourcestyle};
@@ -70,7 +88,7 @@ sub can_build {
 
     my $v = Dpkg::Version->new($self->{fields}->{'Version'});
     return (0, _g('native package version may not have a revision'))
-        unless $v->is_native();
+        unless ($v->is_native() or $self->{options}{force_native});
 
     return 1;
 }
-- 
1.9.rc1

Reply via email to