Skip to content

Commit

Permalink
Added support for Epoch field. And tests for it.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Cross committed Feb 10, 2010
1 parent 988fa07 commit 8594393
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/Parse/RPM/Spec.pm
Expand Up @@ -12,6 +12,7 @@ our $VERSION = '0.05';
has file => ( is => 'rw', isa => 'Str', required => 1 );
has name => ( is => 'rw', isa => 'Str' );
has version => ( is => 'rw', isa => 'Str' );
has epoch => ( is => 'rw', isa => 'Str' );
has release => ( is => 'rw', isa => 'Str' );
has summary => ( is => 'rw', isa => 'Str' );
has license => ( is => 'rw', isa => 'Str' );
Expand Down Expand Up @@ -59,6 +60,7 @@ sub parse_file {
while (<$fh>) {
/^Name:\s*(\S+)/ and $self->{name} = $1;
/^Version:\s*(\S+)/ and $self->{version} = $1;
/^Epoch:\s*(\S+)/ and $self->{epoch} = $1;
/^Release:\s*(\S+)/ and $self->{release} = $1;
/^Summary:\s*(.+)/ and $self->{summary} = $1;
/^License:\s*(.+)/ and $self->{license} = $1;
Expand Down
1 change: 1 addition & 0 deletions t/file.spec
@@ -1,5 +1,6 @@
Name: perl-Array-Compare
Version: 1.16
Epoch: 1
Release: 1%{?dist}
Summary: Perl extension for comparing arrays
License: GPL+ or Artistic
Expand Down
3 changes: 2 additions & 1 deletion t/parse-rpm-spec.t
@@ -1,11 +1,12 @@
use Test::More tests => 10;
use Test::More tests => 11;
BEGIN { use_ok('Parse::RPM::Spec') };

ok($spec = Parse::RPM::Spec->new( { file => 't/file.spec' } ));
isa_ok($spec, 'Parse::RPM::Spec');

is($spec->name, 'perl-Array-Compare');
is($spec->summary, 'Perl extension for comparing arrays');
is($spec->epoch, 1);

is($spec->version, '1.16');
$spec->version('1.17');
Expand Down

0 comments on commit 8594393

Please sign in to comment.