diff options
Diffstat (limited to 'lib/Youri/Package')
-rw-r--r-- | lib/Youri/Package/URPM.pm | 19 |
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; |