use File::Spec ();
use vars qw/$VERSION/;
-$VERSION = '0.66';
+$VERSION = '0.67';
use vars qw/@ISA/;
@ISA = qw/DynaLoader/;
return @{$self->{changelog}};
}
+sub raw_header {
+ my $self = shift;
+
+ return RPM2::C::Header::_unload($self->{c_header});
+}
+
package RPM2::PackageIterator;
sub new_iterator {
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.
PUSHs(h_sv);
}
else {
- croak("error reading package");
+ croak("error reading package (%d)", rc);
}
#ifdef RPM2_RPM41
ts = rpmtsFree(ts);
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
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.
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);