diff options
author | cturner <devnull@localhost> | 2004-09-13 18:55:24 +0000 |
---|---|---|
committer | cturner <devnull@localhost> | 2004-09-13 18:55:24 +0000 |
commit | 59293dd8928d6f0033a45fdef9e9f50a296a3a0b (patch) | |
tree | 2f6925afe83a7439c7ea81cbd71885648fdda6d7 /perl-RPM2 | |
parent | dd17e87985c3fd2e76fc122c9dc01159fc8f11b9 (diff) | |
download | librpm-tizen-59293dd8928d6f0033a45fdef9e9f50a296a3a0b.tar.gz librpm-tizen-59293dd8928d6f0033a45fdef9e9f50a296a3a0b.tar.bz2 librpm-tizen-59293dd8928d6f0033a45fdef9e9f50a296a3a0b.zip |
add call to get headerUnload
CVS patchset: 7418
CVS date: 2004/09/13 18:55:24
Diffstat (limited to 'perl-RPM2')
-rw-r--r-- | perl-RPM2/RPM2.pm | 13 | ||||
-rw-r--r-- | perl-RPM2/RPM2.xs | 12 | ||||
-rw-r--r-- | perl-RPM2/test.pl | 6 |
3 files changed, 28 insertions, 3 deletions
diff --git a/perl-RPM2/RPM2.pm b/perl-RPM2/RPM2.pm index a4ec81dd8..419cea307 100644 --- a/perl-RPM2/RPM2.pm +++ b/perl-RPM2/RPM2.pm @@ -8,7 +8,7 @@ use File::Basename qw/basename dirname/; use File::Spec (); use vars qw/$VERSION/; -$VERSION = '0.66'; +$VERSION = '0.67'; use vars qw/@ISA/; @ISA = qw/DynaLoader/; @@ -335,6 +335,12 @@ sub changelog { return @{$self->{changelog}}; } +sub raw_header { + my $self = shift; + + return RPM2::C::Header::_unload($self->{c_header}); +} + package RPM2::PackageIterator; sub new_iterator { @@ -711,6 +717,11 @@ If epoch is undefined for this package, it and the leading colon are omitted. TODO. +=item $hdr->raw_header() + +Return the binary representation of the header (ie, the rpm file +itself without the actual content of the files in the cpio archive). + =item $hdr->changelog() Returns a list of hash refs containing the change log data of the package. diff --git a/perl-RPM2/RPM2.xs b/perl-RPM2/RPM2.xs index 1daf49248..3b90739a2 100644 --- a/perl-RPM2/RPM2.xs +++ b/perl-RPM2/RPM2.xs @@ -300,7 +300,7 @@ _read_package_info(fp, vsflags) PUSHs(h_sv); } else { - croak("error reading package"); + croak("error reading package (%d)", rc); } #ifdef RPM2_RPM41 ts = rpmtsFree(ts); @@ -512,6 +512,16 @@ _header_sprintf(h, format) PUSHs(sv_2mortal(newSVpv((char *)s, 0))); s = _free(s); +void +_unload(h) + Header h + PREINIT: + char *buf; + unsigned int size; + PPCODE: + size = headerSizeof(h, 0); + buf = headerUnload(h); + PUSHs(sv_2mortal(newSVpv(buf, size))); MODULE = RPM2 PACKAGE = RPM2::C::Transaction diff --git a/perl-RPM2/test.pl b/perl-RPM2/test.pl index 4910476e2..b7620fe5d 100644 --- a/perl-RPM2/test.pl +++ b/perl-RPM2/test.pl @@ -11,7 +11,7 @@ use strict; use Test; use strict; -BEGIN { plan tests => 63 }; +BEGIN { plan tests => 64 }; use RPM2; ok(1); # If we made it this far, we're ok. @@ -193,3 +193,7 @@ ok($t->close_db()); my @headers = RPM2->open_hdlist("hdlist-test.hdr"); ok(scalar @headers, 3, 'found three headers in hdlist-test.hdr'); ok(grep { $_->tag('name') eq 'mod_perl' } @headers); + +# ensure the raw header from hdlist-test.hdr's first entry is correct +my $binary_header = $headers[0]->raw_header; +ok(length($binary_header) == 6560); |