Youri-Package

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

lib/Youri/Package/RPM/RPM4.pm
lib/Youri/Package/RPM/Test.pm
lib/Youri/Package/RPM/URPM.pm
Makefile.PL
MANIFEST			This list of files
MYMETA.json
MYMETA.yml
README
t/abstraction.t
t/cowsay-3.03-11mdv2007.0.noarch.rpm
t/gpghome/pubring.gpg
t/gpghome/secring.gpg
t/gpghome/trustdb.gpg
t/kwalitee.t
t/perlcritic.t
t/pod-coverage.t
t/pod.t
t/prereq.t
t/test.t
META.yml                                 Module YAML meta-data (added by MakeMaker)
META.json                                Module JSON meta-data (added by MakeMaker)

lib/Youri/Package.pm  view on Meta::CPAN

=head2 get_conflicts()

Returns the list of other packages conflicting with this one, as an array of
L<Youri::Package::Relationship> objects.

=head2 get_files()

Returns the list of files contained in this package, as an array of
L<Youri::Package::File> objects.

=head2 get_gpg_key()

Returns the gpg key id of package signature.

=head2 get_information()

Returns formated informations about the package.

=head2 get_changes()

Returns the list of changes for this package, as an array of
L<Youri::Package::Change> objects.

lib/Youri/Package/RPM/RPM.pm  view on Meta::CPAN

            push(@fileslist, Youri::Package::File->new(
                $files->filename(),
                $umode,
                $files->digest() || ''
            ));
        }
    }
    return @fileslist
}

sub get_gpg_key {
    my ($self) = @_;
    croak "Not a class method" unless ref $self;
    
    my $signature = $self->{_header}->tagformat('%{DSAHEADER:pgpsig}');
    return if $signature eq '(not a blob)';
    my $key_id = (split(/\s+/, $signature))[-1];
    return substr($key_id, 8);
}

sub get_changes {

lib/Youri/Package/RPM/RPM4.pm  view on Meta::CPAN

            push(@fileslist, Youri::Package::File->new(
                $files->filename(),
                $umode,
                $md5
            ));
        }
    }
    return @fileslist
}

sub get_gpg_key {
    my ($self) = @_;
    croak "Not a class method" unless ref $self;
    
    my $signature = $self->{_header}->queryformat('%{SIGGPG:pgpsig}');
    return if $signature eq '(not a blob)';
    my $key_id = (split(/\s+/, $signature))[-1];
    return substr($key_id, 8);
}

sub get_changes {

lib/Youri/Package/RPM/Test.pm  view on Meta::CPAN

    version
    release
    filename
    arch
    url
    summary
    description
    packager
    buildtime
    sourcerpm
    gpg_key
/;

my %tags = map { $_ => 1 } @tags;

sub check_ranges_compatibility {
    my ($class, $range1, $range2) = @_;

    return URPM::ranges_overlap($range1, $range2);
}

lib/Youri/Package/RPM/URPM.pm  view on Meta::CPAN

    croak "Not a class method" unless ref $self;

    my @modes   = $self->{_header}->files_mode();
    my @md5sums = $self->{_header}->files_md5sum();

    return map {
        Youri::Package::File->new($_, shift @modes, shift @md5sums)
    } $self->{_header}->files();
}

sub get_gpg_key {
    my ($self) = @_;
    croak "Not a class method" unless ref $self;
    
    my $signature = $self->{_header}->queryformat('%{SIGGPG:pgpsig}');
    return if $signature eq '(not a blob)';
    my $key_id = (split(/\s+/, $signature))[-1];
    return substr($key_id, 8);
}

sub get_changes {

lib/Youri/Package/RPM/URPM.pm  view on Meta::CPAN

    my ($self, $name, $path, $passphrase) = @_;
    croak "Not a class method" unless ref $self;

    # check if parent directory is writable
    my $parent = (File::Spec->splitpath($self->{_file}))[1];
    croak "Unsignable package, parent directory is read-only"
        unless -w $parent;

    my $command =
        'LC_ALL=C rpm --resign ' . $self->{_file} .
        ' --define "_signature gpg"' .
        ' --define "_gpg_name ' . $name . '"' .
        ' --define "_gpg_path ' . $path . '"';
    my $expect = Expect->spawn($command)
        or croak "Couldn't spawn command $command: $ERRNO\n";
    my @log;
    $expect->log_stdout(0);
    $expect->log_file(sub { push(@log, $_[0]); });
    $expect->expect(10, 'Enter pass phrase:')
        or croak "Unexpected output: $log[-1]\n";
    $expect->send("$passphrase\n");

    $expect->soft_close();

t/test.t  view on Meta::CPAN


    my $package;
    if ($class eq 'Youri::Package::RPM::Test') {
        # this one need a little help
        $package = $class->new(
            file => $file,
            tags => {
                summary  => 'Configurable talking cow',
                url      => 'http://www.nog.net/~tony/warez/cowsay.shtml',
                packager => 'Guillaume Rousse <guillomovitch@mandriva.org>',
                gpg_key  => '26752624',
            },
            requires  => $requires,
            provides  => $provides,
            obsoletes => $obsoletes,
            conflicts => $conflicts,
            files     => $files,
            changes   => [[
                'Guillaume Rousse <guillomovitch@mandriva.org> 3.03-11mdv2007.0',
                1149847200,
                "- %mkrel\n- rpmbuildupdate aware"

t/test.t  view on Meta::CPAN

    # name formating
    is($package->as_formated_string('%{name}-%{version}-%{release}'), 'cowsay-3.03-11mdv2007.0', 'formated string name');
    is($package->as_string(), 'cowsay-3.03-11mdv2007.0.noarch', 'default string');
    is($package, 'cowsay-3.03-11mdv2007.0.noarch', 'stringification');

    # type
    ok(!$package->is_source(), 'not a source package');
    ok($package->is_binary(), 'a binary package');
    is($package->get_type(), 'binary', 'a binary package');

    # gpg key
    is($package->get_gpg_key(), '26752624', 'get gpg key');

    # dependencies
    is_deeply(
        [ $package->get_requires() ],
        $requires,
        'requires'
    );
    is_deeply(
        [ $package->get_provides() ],
        $provides,

t/test.t  view on Meta::CPAN

        skip "rpm has no error control for signature", 3
            if $class eq 'Youri::Package::RPM::RPM';
        skip "rpmsign not available", 3
            if ! which("rpmsign");

        # signature test
        copy($file, $temp_dir);
        $package = $class->new(file => "$temp_dir/$rpm");

        throws_ok {
            $package->sign('Youri', "$dir/gpghome", 'Youri sux')
        } qr/^Signature error:/, 'signing with wrong key';

        lives_ok {
            $package->sign('Youri', "$dir/gpghome", 'Youri rulez')
        } 'signing with correct key';

        $package = $class->new(file => "$temp_dir/$rpm");
        is($package->get_gpg_key(), '2333e817', 'get gpg key');
    }
}



( run in 1.637 second using v1.01-cache-2.11-cpan-df04353d9ac )