aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Youri/Package
diff options
context:
space:
mode:
authorMandrake <mandrake@mandriva.com>2006-09-12 11:34:08 +0000
committerMandrake <mandrake@mandriva.com>2006-09-12 11:34:08 +0000
commit1b1ee9eae49d6ef24ac4d81130a91ceab392fd2c (patch)
tree388dec4c867c21d60629f1600e9f5c6d03d54644 /lib/Youri/Package
parentb60cd5db35074f9137a149cd64632b180aa5ea0e (diff)
downloadmga-youri-core-1b1ee9eae49d6ef24ac4d81130a91ceab392fd2c.tar
mga-youri-core-1b1ee9eae49d6ef24ac4d81130a91ceab392fd2c.tar.gz
mga-youri-core-1b1ee9eae49d6ef24ac4d81130a91ceab392fd2c.tar.bz2
mga-youri-core-1b1ee9eae49d6ef24ac4d81130a91ceab392fd2c.tar.xz
mga-youri-core-1b1ee9eae49d6ef24ac4d81130a91ceab392fd2c.zip
add a range_check functions
Diffstat (limited to 'lib/Youri/Package')
-rw-r--r--lib/Youri/Package/URPM.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Youri/Package/URPM.pm b/lib/Youri/Package/URPM.pm
index 3cd8aa4..fb02170 100644
--- a/lib/Youri/Package/URPM.pm
+++ b/lib/Youri/Package/URPM.pm
@@ -117,6 +117,25 @@ sub get_full_version {
return $self->{_header}->epoch() ."-" . $self->{_header}->version() . "-". $self->{_header}->release()
}
+sub range_check {
+ my ($self, $obsolete, $package) = @_;
+ croak "Not a class method" unless ref $self;
+ my $obs = $obsolete->[Youri::Package::DEPENDENCY_NAME];
+ my $range = $obsolete->[Youri::Package::DEPENDENCY_RANGE];
+ my ($flag, $version) = $range =~ /(\S+)\s+(.*)/;
+ if ($version) {
+ my ($epoch, $ver, $release) = $version =~ /(?:(\d+):)?([^-]+(?:-[^-]*)?)/;
+ $release ||= '0';
+ $epoch ||= '0';
+ $range = "$flag $epoch-$ver-$release";
+ my $full_version = $package->get_full_version;
+ print "Comparing $range with $full_version\n";
+ return URPM::ranges_overlap($range, "== $full_version")
+ } else {
+ return 1
+ }
+}
+
sub get_release {
my ($self) = @_;
croak "Not a class method" unless ref $self;