| Youri-Package documentation | Contained in the Youri-Package distribution. |
Youri::Package::RPM - Base class for all RPM-based package implementation
This bases class factorize code between various RPM-based package implementation.
Returns the name of a class corresponding to currently available perl RPM bindings:
Youri::Package::RPM::RPM4 if RPM4 is availableYouri::Package::RPM::RPM if RPM is availableYouri::Package::RPM::URPM if URPM is availableThis allow to write binding-independant code, by using methods of this class instead of using bindings-specific functions.
This method calls underlying binding corresponding function.
This method calls underlying binding corresponding function.
This method calls underlying binding corresponding function.
This method calls underlying binding corresponding function.
This method calls the constructor of the underlying binding Header class.
This method calls the constructor of the underlying binding Spec class.
This method calls the constructor of the underlying binding Transaction class.
| Youri-Package documentation | Contained in the Youri-Package distribution. |
# $Id: RPM.pm 2306 2011-01-22 12:45:01Z guillomovitch $ package Youri::Package::RPM;
use strict; use warnings; use base 'Youri::Package'; use version; our $VERSION = qv('0.2.0'); use Carp; use UNIVERSAL::require;
sub get_wrapper_class { if (RPM4->require()) { Youri::Package::RPM::RPM4->require(); return 'Youri::Package::RPM::RPM4'; } if (RPM->require()) { Youri::Package::RPM::RPM->require(); return 'Youri::Package::RPM::RPM'; } if (URPM->require()) { Youri::Package::RPM::URPM->require(); return 'Youri::Package::RPM::URPM'; } croak "No RPM bindings available"; } sub get_pattern { my ($class, $name, $version, $release, $arch) = @_; return $class->get_unquoted_pattern( $name ? quotemeta($name) : undef, $version ? quotemeta($version) : undef, $release ? quotemeta($release) : undef, $arch ? quotemeta($arch) : undef ); } sub get_unquoted_pattern { my ($class, $name, $version, $release, $arch) = @_; return ($name ? $name : '[\w-]+' ). '-' . ($version ? $version : '[^-]+' ). '-' . ($release ? $release : '[^-]+' ). '\.' . ($arch ? $arch : '\w+' ). '\.rpm'; } sub as_file { my ($self) = @_; croak "Not a class method" unless ref $self; return $self->{_file}; } sub is_debug { my ($self) = @_; croak "Not a class method" unless ref $self; return $self->get_name() =~ /-debug$/; } 1;