* Raphael Hertzog <[email protected]> [130209 18:14]:
> I would not apply this change without a prior discussion on debian-devel
> resulting in some consensus about this change.
>
> Non-native packages with native versions are much less common so this
> part of the change is certainly less problematic.
To ease adoption, patch split into two attached.
Bernhard R. Link
>From b10e8210cdebe3fd897a13e6d8194ca4b454cb59 Mon Sep 17 00:00:00 2001
From: "Bernhard R. Link" <[email protected]>
Date: Sat, 9 Feb 2013 14:59:00 +0100
Subject: [PATCH 1/2] Dpkg::Version, Dpkg::Source::Package::V3::quilt: catch
native version strings
Ensure that a 3.0 (quilt) package has a non-native version.
To get the information, extend Dpkg::Version with a is_native method to
check whether a version has a revision or not.
---
scripts/Dpkg/Source/Package/V3/quilt.pm | 2 ++
scripts/Dpkg/Version.pm | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm b/scripts/Dpkg/Source/Package/V3/quilt.pm
index f5875c1..8a6cc54 100644
--- a/scripts/Dpkg/Source/Package/V3/quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/quilt.pm
@@ -72,6 +72,8 @@ sub can_build {
my ($self, $dir) = @_;
my ($code, $msg) = $self->SUPER::can_build($dir);
return ($code, $msg) if $code eq 0;
+ my $v = Dpkg::Version->new($self->{'fields'}->{'Version'});
+ return (0, _g("version does not contain a revision")) if $v->is_native();
my $quilt = $self->build_quilt_object($dir);
$msg = $quilt->find_problems();
return (0, $msg) if $msg;
diff --git a/scripts/Dpkg/Version.pm b/scripts/Dpkg/Version.pm
index 371b91a..19c4509 100644
--- a/scripts/Dpkg/Version.pm
+++ b/scripts/Dpkg/Version.pm
@@ -145,6 +145,17 @@ sub revision {
return $self->{'revision'};
}
+=item $v->is_native()
+
+Returns true if the version is native, false if it has a revision.
+
+=cut
+
+sub is_native {
+ my $self = shift;
+ return $self->{'no_revision'};
+}
+
=item $v1 <=> $v2, $v1 < $v2, $v1 <= $v2, $v1 > $v2, $v1 >= $v2
Numerical comparison of various versions numbers. One of the two operands
--
1.7.10.4
>From 47f029c37c738a6e03b4f482281e7fb6d470ca14 Mon Sep 17 00:00:00 2001
From: "Bernhard R. Link" <[email protected]>
Date: Sat, 9 Feb 2013 14:59:00 +0100
Subject: [PATCH 2/2] Dpkg::Source::Package::V3::native: catch invalid version
strings
Ensure that a 3.0 (native) package has a native version.
---
scripts/Dpkg/Source/Package/V3/native.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/Dpkg/Source/Package/V3/native.pm b/scripts/Dpkg/Source/Package/V3/native.pm
index ba6539a..32e3c1b 100644
--- a/scripts/Dpkg/Source/Package/V3/native.pm
+++ b/scripts/Dpkg/Source/Package/V3/native.pm
@@ -64,7 +64,9 @@ sub do_extract {
}
sub can_build {
- return 1;
+ my ($self, $dir) = @_;
+ my $v = Dpkg::Version->new($self->{'fields'}->{'Version'});
+ return (!!$v->is_native(), _g("native package version may not have a revision"));
}
sub do_build {
--
1.7.10.4