r38328 - in /trunk/dh-make-perl/lib: Debian/AptContents.pm Debian/Control/FromCPAN.pm Debian/Dependency.pm Debian/Version.pm DhMakePerl.pm
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Sat Jun 20 16:04:52 UTC 2009
Author: dmn
Date: Sat Jun 20 16:04:34 2009
New Revision: 38328
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=38328
Log:
move debian package version comparison in Debian::Version
Added:
trunk/dh-make-perl/lib/Debian/Version.pm
Modified:
trunk/dh-make-perl/lib/Debian/AptContents.pm
trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm
trunk/dh-make-perl/lib/Debian/Dependency.pm
trunk/dh-make-perl/lib/DhMakePerl.pm
Modified: trunk/dh-make-perl/lib/Debian/AptContents.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/AptContents.pm?rev=38328&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/AptContents.pm (original)
+++ trunk/dh-make-perl/lib/Debian/AptContents.pm Sat Jun 20 16:04:34 2009
@@ -31,6 +31,7 @@
);
use Debian::Dependency;
+use Debian::Version qw(deb_ver_cmp);
use File::Spec::Functions qw( catfile catdir splitpath );
use IO::Uncompress::Gunzip;
use Module::CoreList ();
@@ -424,7 +425,7 @@
next unless defined($ver);
# if the core module version is sufficiently new, we're done
- if( $AptPkg::Config::_config->system->versioning->compare( $ver, $version ) >= 0 ) {
+ if( deb_ver_cmp( $ver, $version ) >= 0 ) {
$core_ver = $_;
last;
}
Modified: trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm?rev=38328&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm Sat Jun 20 16:04:34 2009
@@ -18,6 +18,7 @@
use base 'Debian::Control';
use YAML ();
+use Debian::Version qw(deb_ver_cmp);
use File::Spec qw( catfile );
use constant min_perl_version => '5.6.0-12';
@@ -259,8 +260,7 @@
and (
not $dep->ver # unversioned dependency is redundant
or $dep->rel =~ />/
- and $AptPkg::Config::_config->system->versioning->compare(
- $dep->ver, $self->oldstable_perl_version ) <= 0
+ and deb_ver_cmp( $dep->ver, $self->oldstable_perl_version ) <= 0
);
return $dep;
Modified: trunk/dh-make-perl/lib/Debian/Dependency.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Dependency.pm?rev=38328&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Dependency.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Dependency.pm Sat Jun 20 16:04:34 2009
@@ -5,6 +5,7 @@
use AptPkg::Config;
use Carp;
+use Debian::Version qw(deb_ver_cmp);
use List::MoreUtils qw(mesh);
=head1 NAME
@@ -219,9 +220,7 @@
return 0 unless $left->ver; # both have no version
- $res = $AptPkg::Config::_config->system->versioning->compare(
- $left->ver, $right->ver,
- );
+ $res = deb_ver_cmp( $left->ver, $right->ver );
return $res if $res != 0;
@@ -397,9 +396,7 @@
return 0 if not $self->rel;
# from this point below both $dep and we have relation (and version)
- my $cmpver = $AptPkg::Config::_config->system->versioning->compare(
- $self->ver, $dep->ver,
- );
+ my $cmpver = deb_ver_cmp( $self->ver, $dep->ver );
if( $self->rel eq '>>' ) {
# >> 4 satisfies also >> 3
Added: trunk/dh-make-perl/lib/Debian/Version.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Version.pm?rev=38328&op=file
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Version.pm (added)
+++ trunk/dh-make-perl/lib/Debian/Version.pm Sat Jun 20 16:04:34 2009
@@ -1,0 +1,77 @@
+package Debian::Version;
+
+=head1 NAME
+
+Debian::Version - working with Debian package versions
+
+=head1 DESCRIPTION
+
+One day this package may be a class for encapsulating Debian versions with all
+of their epochs, versions and revisions. For now, thhough, it only provides a
+single comparison function.
+
+=cut
+
+use Exporter;
+
+our @EXPORT_OK = qw( deb_ver_cmp );
+
+use AptPkg::Config;
+
+=head1 FUNCTIONS
+
+=over
+
+=item deb_ver_cmp( $ver1, $ver2 )
+
+Compares teo Debian versions and returns -1, 0 or +1 if the first version is
+smaller, equal or bigger than the second.
+
+This function is a short-named wrapper around C<<
+$AptPkg::Config::_config->system->versioning->compare >>. The rules for
+comparing Debian versions are defined in the L<Debian Policy Manual>.
+
+=cut
+
+sub deb_ver_cmp {
+ my ( $ver1, $ver2 ) = @_;
+
+ return $AptPkg::Config::_config->system->versioning->compare( $ver1,
+ $ver2 );
+}
+
+=back
+
+=head1 SEE ALSO
+
+=over
+
+=item AptPkg::Config
+
+=item Dpkg::Version
+
+=back
+
+=head1 COPYRIGHT & LICENSE
+
+=over 4
+
+=item Copyright (C) 2009 Damyan Ivanov <dmn at debian.org>
+
+=back
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License version 2 as published by the Free
+Software Foundation.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+=cut
+
+1;
Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=38328&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Sat Jun 20 16:04:34 2009
@@ -36,7 +36,6 @@
=cut
use AptPkg::Cache ();
-use AptPkg::Config ();
use Config qw( %Config );
use CPAN ();
use Cwd qw( getcwd );
@@ -45,6 +44,7 @@
use Debian::Control::FromCPAN ();
use Debian::Dependencies ();
use Debian::Dependency ();
+use Debian::Version qw(deb_ver_cmp);
use Parse::DebianChangelog;
use DhMakePerl::Config;
use DhMakePerl::PodParser ();
@@ -1018,8 +1018,7 @@
$deps{$p} = $v
if defined($v) and not defined($cur_ver)
- or $AptPkg::Config::_config->system->versioning->compare(
- $cur_ver, $v ) < 0;
+ or deb_ver_cmp( $cur_ver, $v ) < 0;
}
else {
$deps{$p} = $v;
More information about the Pkg-perl-cvs-commits
mailing list