diff --git a/.github/workflows/perltest.yml b/.github/workflows/perltest.yml index 9b2c868..57fcbfc 100644 --- a/.github/workflows/perltest.yml +++ b/.github/workflows/perltest.yml @@ -21,7 +21,7 @@ jobs: perl: [ 'latest' ] name: Perl ${{ matrix.perl }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up perl uses: shogo82148/actions-setup-perl@v1 with: diff --git a/Changes b/Changes index d566588..8b647f5 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +2022-12-09 Dave Cross + + * Support ExcludeArch, ExclusiveArch, ExcluseOS, ExclusiveOS + 2021-01-23 Dave Cross * Version 1.0.3 diff --git a/lib/Parse/RPM/Spec.pm b/lib/Parse/RPM/Spec.pm index c1f2cbb..30fda27 100644 --- a/lib/Parse/RPM/Spec.pm +++ b/lib/Parse/RPM/Spec.pm @@ -7,7 +7,7 @@ use warnings; use Carp; use Moose; -our $VERSION = 'v1.0.3'; +our $VERSION = 'v1.1.0'; has file => ( is => 'ro', isa => 'Str', required => 1 ); has name => ( is => 'rw', isa => 'Str' ); @@ -23,6 +23,8 @@ has buildroot => ( is => 'rw', isa => 'Str' ); has buildarch => ( is => 'rw', isa => 'Str' ); has buildrequires => ( is => 'rw', isa => 'ArrayRef[Str]', default => sub { [] } ); has requires => ( is => 'rw', isa => 'ArrayRef[Str]', default => sub { [] } ); +has [ qw( excluderach exclusivearch excludeos exclusiveos ) ] + => ( is => 'rw', isa => 'Str' ); has parse_spec => ( is => 'ro', @@ -43,6 +45,10 @@ sub _build_parse_spec { url => qr[^URL:\s*(\S+)], buildroot => qr[^BuildRoot:\s*(\S+)], buildarch => qr[^BuildArch:\s*(\S+)], + excludearch => qr[^ExcludeArch:\s*(\S+)], + exclusivearch => qr[^ExclusiveArch:\s*(\S+)], + excludeos => qr[^ExcludeOS:\s*(\S+)], + exclusiveos => qr[^ExclusiveOS:\s*(\S+)], }, arrays => { source => qr[^Source\d*:\s*(\S+)], diff --git a/t/file.spec b/t/file.spec index c2956d6..844028f 100644 --- a/t/file.spec +++ b/t/file.spec @@ -12,6 +12,7 @@ BuildArch: noarch BuildRequires: perl >= 1:5.6.0 BuildRequires: perl(Module::Build) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +ExclusiveArch: megaCPU %description If you have two arrays and you want to know if they are the same or diff --git a/t/parse-rpm-spec.t b/t/parse-rpm-spec.t index b5f8fb8..84376c4 100644 --- a/t/parse-rpm-spec.t +++ b/t/parse-rpm-spec.t @@ -17,11 +17,13 @@ is($spec->epoch, 1, 'Correct epoch'); is($spec->version, '1.16', 'Correct version'); $spec->version('1.17'); is($spec->version, '1.17', 'Changed version correctly'); -is($spec->buildarch, 'noarch', 'Correct build arrchitecture'); +is($spec->buildarch, 'noarch', 'Correct build architecture'); is(@{$spec->buildrequires}, 2, 'Correct number of build requirements'); is($spec->buildrequires->[0], 'perl >= 1:5.6.0', 'First build requirement is correct'); +is($spec->exclusivearch, 'megaCPU', 'Correct exclusive architecture'); + dies_ok { Parse::RPM::Spec->new } 'No spec file given'; dies_ok { Parse::RPM::Spec->new( file => 'not-there') }