diff options
author | Florent Villard <warly@mandriva.com> | 2006-10-16 16:36:08 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2006-10-16 16:36:08 +0000 |
commit | 2946c8e811ab8faa46def9f59ae2520862cdfc3e (patch) | |
tree | 9b2fafbda54ae342d57b6f1fffa9cfe26ea93bbf /lib | |
parent | fd8fe296722bc8fb72604cd19a93a84f010ff1c3 (diff) | |
download | mga-youri-core-2946c8e811ab8faa46def9f59ae2520862cdfc3e.tar mga-youri-core-2946c8e811ab8faa46def9f59ae2520862cdfc3e.tar.gz mga-youri-core-2946c8e811ab8faa46def9f59ae2520862cdfc3e.tar.bz2 mga-youri-core-2946c8e811ab8faa46def9f59ae2520862cdfc3e.tar.xz mga-youri-core-2946c8e811ab8faa46def9f59ae2520862cdfc3e.zip |
merging dev with upstream
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Youri/Package.pm | 108 |
1 files changed, 81 insertions, 27 deletions
diff --git a/lib/Youri/Package.pm b/lib/Youri/Package.pm index 6218d6e..1571642 100644 --- a/lib/Youri/Package.pm +++ b/lib/Youri/Package.pm @@ -41,12 +41,10 @@ sub new { croak "Abstract class" if $class eq __PACKAGE__; my %options = ( - section => '', @_ ); my $self = bless { - _section => $options{section} }, $class; $self->_init(%options); @@ -58,35 +56,44 @@ sub _init { # do nothing } -sub _get_section { - my ($self) = @_; - $self->{_section} -} - =head2 get_pattern($name, $version, $release, $arch) Returns a pattern matching a file for a package, using available informations. -=head2 compare_versions($version1, $version2) +=head2 compare_revisions($revision1, $revision2) -Compares $version1 and $version2, and returns a numeric value: +Compares two revision tokens, and returns a numeric value: =over -=item > 0 if $version1 > $version2 +=item positive if first revision is higher -=item 0 if $version1 = $version2 +=item null if both revisions are equal -=item < 0 if $version1 < $version2 +=item negative if first revision is lower =back -=head2 compare_ranges($range1, $range2) +=head2 check_ranges_compatibility($range1, $range2) -Compares $range1 and $range2, and returns a true value if they are compatible. +Returns a true value if given revision ranges are compatible. =head1 INSTANCE METHODS +=head2 as_file() + +Returns the file corresponding to this package. + +=head2 as_string() + +Returns a string representation of this package. + +=head2 as_formated_string(I<format>) + +Returns a string representation of this package, formated according to +I<format>. Format is a string, where each %{foo} token will get replaced by +equivalent tag value. + =head2 get_name() Returns the name of this package. @@ -99,26 +106,18 @@ Returns the version of this package. Returns the release of this package. -=head2 get_arch() - -Returns the architecture of this package. - -=head2 get_revision_name() +=head2 get_revision() -Returns the revision name of this package (name-version-release). +Returns the revision of this package. -=head2 get_full_name() +=head2 get_arch() -Returns the full name of this package (name-version-release.arch). +Returns the architecture of this package. =head2 get_file_name() Returns the file name of this package (name-version-release.arch.extension). -=head2 get_file() - -Returns the file containing this package. - =head2 is_source() Returns true if this package is a source package. @@ -127,6 +126,10 @@ Returns true if this package is a source package. Returns true if this package is a binary package. +=head2 is_debug() + +Returns true if this package is a debug package. + =head2 get_type() Returns the type (binary/source) of this package. @@ -258,7 +261,22 @@ Returns the last change for this package, as as structure described before. =head2 compare($package) -Compares release ordering with other package. +Compares ordering with other package, according to their corresponding revision +tokens, and returns a numeric value: + +=over + +=item positive if this package is newer + +=item null if both have same revision + +=item negative if this package is older + +=back + +=head2 satisfy_range($range) + +Returns a true value if this package revision satisfies given revision range. =head2 sign($name, $path, $passphrase) @@ -280,4 +298,40 @@ This program is free software; you can redistribute it and/or modify it under th =cut +sub get_file { + my ($self) = @_; + carp "Deprecated method, use as_file now"; + + return $self->as_file(); +} + +sub get_full_name { + my ($self) = @_; + carp "Deprecated method, use as_string now"; + + return $self->as_string(); +} + +sub compare_versions { + my ($self, $version1, $version2) = @_; + carp "Deprecated method, use compare_revisions now"; + + return $self->compare_revisions($version1, $version2); +} + +sub compare_ranges { + my ($self, $range1, $range2) = @_; + carp "Deprecated method, use are_range_compatible now"; + + return $self->are_ranges_compatible($range1, $range2); +} + +sub get_revision_name { + my ($self) = @_; + carp "Deprecated method, use as_formated_string('%name-%version-%release') now"; + + return $self->as_formated_string('%{name}-%{version}-%{release}'); +} + + 1; |