URPM

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

- provide URPM::Signature as well

Version 0.93-3mdk - Aug 11 2003, by François Pons <fpons@mandrakesoft.com>
- fixed limit case for string extraction from headers (files_md5sum).
- removed unsatisfied_requires2 from xs not used and not finished.

Version 0.93-2mdk - Aug 11 2003, by François Pons <fpons@mandrakesoft.com>
- fixed pubkey management, fixed importation of pubkey in rpmdb.

Version 0.93 - Aug  6 2003, by François Pons <fpons@mandrakesoft.com>
- added URPM::Signature for handling armored gpg file and
  internal rpm pubkey.
- take care of PreReq when building hdlist or synthesis files.
- removed id log during hdlist or synthesis creation.

Version 0.92-4mdk - Aug  4 2003, by François Pons <fpons@mandrakesoft.com>
- sanity check on transaction set (should be the same as
  normal selection, else something wrong has occured).
- updated with newer rpm with obsoletes fixed among others.

Version 0.92-2mdk - Jul 30 2003, by François Pons <fpons@mandrakesoft.com>

Changes  view on Meta::CPAN

- fixed promotion of epoch to be rpm 4.2 compliant :
   - added promotion boolean to URPM::ranges_overlap.
   - changed URPM::find_candidate_packages interface.
- fixed compilation on old rpm-4.0.4.

Version 0.91 - Jun 16 2003, by François Pons <fpons@mandrakesoft.com>
- added transaction set methods.
- added disable_obsolete flags to improve installation mode of
  packages, now handled by resolve_requested.
- obsoleted URPM::compute_skip_flags (now URPM::compute_flags).
- fixed rpmdb.t test when gpg pubkey has been imported in rpmdb.

Version 0.90-10mdk - Jun 12 2003, by François Pons <fpons@mandrakesoft.com>
- changed return value of verify_rpm to allow looking at key id.

Version 0.90-9mdk - Jun 11 2003, by François Pons <fpons@mandrakesoft.com>
- fixed problem in disable_selected (ordering of operations).

Version 0.90-8mdk - Jun  5 2003, by François Pons <fpons@mandrakesoft.com>
- cleaned code to be more perl portable.
- fixed severe bug on perl stack manipulation when using callback.

URPM.xs  view on Meta::CPAN

	  if (len == 7 && !memcmp(s, "packing", 7))
	    packing = SvTRUE(ST(i + 1));
	  else if (len == 13 && !memcmp(s, "keep_all_tags", 13))
	    keep_all_tags = SvTRUE(ST(i+1));
	  else if (len == 8 && !memcmp(s, "callback", 8) && SvROK(ST(i+1)))
	    callback = ST(i+1);
	  else if (SvIV(ST(i+1))) {
             if (len == 5) {
                if (!memcmp(s, "nopgp", 5))
                  vsflags |= (RPMVSF_NOPAYLOAD | RPMVSF_NOSHA1HEADER);
                else if (!memcmp(s, "nogpg", 5))
                  vsflags |= (RPMVSF_NOPAYLOAD | RPMVSF_NOSHA1HEADER);
                else if (!memcmp(s, "nomd5", 5))
                  vsflags |= (RPMVSF_NOMD5 | RPMVSF_NOSHA256HEADER);
                else if (!memcmp(s, "norsa", 5))
                  vsflags |= (RPMVSF_NORSA | RPMVSF_NORSAHEADER);
                else if (!memcmp(s, "nodsa", 5))
                  vsflags |= (RPMVSF_NODSA | RPMVSF_NODSAHEADER);
             } else if (len == 9) {
                if (!memcmp(s, "nodigests", 9))
                  vsflags |= _RPMVSF_NODIGESTS;

URPM.xs  view on Meta::CPAN

      h = headerFree(h);
    (void)rpmtsFree(ts);
  }
  rpmlogSetMask(oldlogmask);

  OUTPUT:
  RETVAL


char *
Urpm_get_gpg_fingerprint(filename)
    char * filename
    PREINIT:
    uint8_t fingerprint[sizeof(pgpKeyID_t)];
    char fingerprint_str[sizeof(pgpKeyID_t) * 2 + 1];
    const uint8_t *pkt = NULL;
    size_t pktlen = 0;
    int rc;

    CODE:
    memset (fingerprint, 0, sizeof (fingerprint));

URPM/Signature.pm  view on Meta::CPAN

=head1 SYNOPSIS

=head1 DESCRIPTION

=over

=cut

=item parse_pubkeys($urpm, %options)

Parse from rpmlib db ("gpg-pubkey")

=cut

sub parse_pubkeys {
    my ($urpm, %options) = @_;

    my $db = $options{db};
    $db ||= URPM::DB::open($options{root}) or die "Can't open RPM DB, aborting\n";
    my @keys = parse_pubkeys_($db);

    $urpm->{keys}{$_->{id}} = $_ foreach @keys;
}
    
#- side-effects: none
sub parse_pubkeys_ {
    my ($db) = @_;
    
    my ($block, $content);
    my %keys;

    $db->traverse_tag('name', [ 'gpg-pubkey' ], sub {
	    my ($p) = @_;
            # the first blank separates the PEM headers from key data, this
            # flags we found it:
            my $found_blank = 0;
	    foreach (split "\n", $p->description) {
		if ($block) {
                    if (/^$/ && !$found_blank) {
                        # All content until now were the encapsulated pem
                        # headers...
                        $content = '';
                        $found_blank = 1;
                    }
                    elsif (/^-----END PGP PUBLIC KEY BLOCK-----$/) {
                        $keys{$p->version} = {
                            $p->summary =~ /^gpg\((.*)\)$/ ? (name => $1) : @{[]},
                            id => $p->version,
                            content => $content,
                            block => $p->description,
                        };
                        $block = undef;
                        $content = '';
                    }
                    else {
                        $content .= $_;
		    }

URPM/Signature.pm  view on Meta::CPAN

The callback signature is callback($id, $imported), aka the ID of the key and
whether it was imported or not.

=cut

sub import_needed_pubkeys_from_file {
    my ($db, $pubkey_file, $o_callback) = @_;

    my @keys = parse_pubkeys_($db);

    my $keyid = substr get_gpg_fingerprint($pubkey_file), 8;
    my ($kv) = grep { (hex($keyid) == hex($_->{id})) } @keys;
    my $imported;
    if (!$kv) {
	    $imported = import_pubkey_file($db, $pubkey_file);
	    @keys = parse_pubkeys_($db);
	    ($kv) = grep { (hex($keyid) == hex($_->{id})) } @keys;
    }

    #- let the caller know about what has been found.
    #- this is an error if the key is not found.



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