Compare commits

...

22 commits

Author SHA1 Message Date
cbfad9f5ca Add URL fix for SUSE's spec and add test
Some checks failed
CI / build (push) Has been cancelled
CI / coverage (push) Has been cancelled
CI / perlcritic (push) Has been cancelled
CI / complexity (push) Has been cancelled
2024-08-05 14:07:09 +08:00
e491d549e7 Fix Url for SUSE's spec
Some checks are pending
CI / coverage (push) Waiting to run
CI / perlcritic (push) Waiting to run
CI / complexity (push) Waiting to run
CI / build (push) Waiting to run
2024-08-05 13:12:19 +08:00
Dave Cross
ae8b3ac2f8 Fix GitHub URLs 2024-01-23 13:23:26 +00:00
Dave Cross
9e62d29643 Standardise CPAN Actions 2024-01-22 20:31:28 +00:00
Dave Cross
eaca7b7c4d
Merge pull request #9 from davorg-cpan/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2023-09-11 09:34:13 +01:00
dependabot[bot]
1a27e209a0
Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 00:33:48 +00:00
Dave Cross
dc1eda7b67 Add dependabot.yml 2023-02-16 09:37:10 +00:00
Dave Cross
dd6cfc1536 Prep for release 2023-01-13 10:50:48 +00:00
Dave Cross
623e7fc65c
Merge pull request #8 from davorg/7-issue-with-method-name-excludearch
7 issue with method name excludearch
2023-01-13 10:49:22 +00:00
Dave Cross
e229a81b61 Make test pass 2023-01-13 10:41:18 +00:00
Dave Cross
e1dd92a4f9 Add failing test 2023-01-13 10:40:00 +00:00
Dave Cross
b61e9b4921 Prep for release 2023-01-12 18:11:43 +00:00
Dave Cross
f7c21bdcba Fix failing test 2023-01-12 18:09:03 +00:00
Dave Cross
529c06b04c Failing test for license-parsing 2023-01-12 18:06:01 +00:00
Dave Cross
5bfd739b70 Version 1.1.0 2023-01-12 18:01:03 +00:00
Dave Cross
e3115ec498
Merge pull request #4 from hakonhagland/travis
Remove .travis.yml since travis-ci.org has shut down
2022-12-09 08:35:59 +00:00
Håkon Hægland
99838215e0 Remove .travis.yml
travis-ci.org has shut down. We can use GitHub actions for continuous
integration as a replacement.
2022-03-25 20:33:20 +01:00
Dave Cross
780b0b886f Act on some Kritika feedback 2021-01-23 12:12:20 +00:00
Dave Cross
43d0bfc5d8 Add bugtracker to metadata. Prep for release 2021-01-23 11:47:17 +00:00
Dave Cross
ef2401b092 Stop testing on Windows 2020-11-09 12:05:48 +00:00
Dave Cross
674c06c6e8 Added Github workflow 2020-11-05 17:02:11 +00:00
Dave Cross
939e064b5f Add Test::Exception to prereqs. Bump version 2020-11-04 07:51:04 +00:00
12 changed files with 245 additions and 45 deletions

10
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,10 @@
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"

21
.github/workflows/perltest.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
uses: PerlToolsTeam/github_workflows/.github/workflows/cpan-test.yml@main
coverage:
uses: PerlToolsTeam/github_workflows/.github/workflows/cpan-coverage.yml@main
perlcritic:
uses: PerlToolsTeam/github_workflows/.github/workflows/cpan-perlcritic.yml@main
complexity:
uses: PerlToolsTeam/github_workflows/.github/workflows/cpan-complexity.yml@main

View file

@ -1,25 +0,0 @@
language: perl
matrix:
include:
- perl: "5.30"
- perl: "5.28"
- perl: "5.26"
- perl: "5.24"
- perl: "5.22"
- perl: "5.20"
dist: trusty
- perl: "5.18"
dist: trusty
- perl: "5.16"
dist: trusty
- perl: "5.14"
dist: trusty
- perl: "5.12"
dist: trusty
- perl: "5.10"
dist: trusty
before_install:
cpanm -n Devel::Cover::Report::Coveralls
script:
perl Build.PL && ./Build build && cover -test -report coveralls

View file

@ -11,6 +11,7 @@ my $build = Module::Build->new(
},
build_requires => {
'Test::More' => 0,
'Test::Exception' => 0,
},
build_recommends => {
'Test::Pod' => 0,
@ -22,8 +23,11 @@ my $build = Module::Build->new(
resources => {
repository => {
type => 'git',
url => 'git://github.com/davorg/parse-rpm-spec.git',
web => 'https://github.com/davorg/parse-rpm-spec',
url => 'git://github.com/davorg-cpan/parse-rpm-spec.git',
web => 'https://github.com/davorg-cpan/parse-rpm-spec',
},
bugtracker => {
web => 'https://github.com/davorg-cpan/parse-rpm-spec/issues',
},
},
},

27
Changes
View file

@ -1,4 +1,29 @@
2020-11-3 Dave Cross <dave@perlhaskc.com>
2023-01-13 Dave Cross <dave@perlhacks.com>
* Version 1.1.2
* Fix name of excludearch method (thanks Michal Josef Špaček)
2023-01-12 Dave Cross <dave@perlhacks.com>
* Version 1.1.1
* Fix problem parsing perl-License-Syntax.spec (thanks Michal Josef Špaček)
2022-12-09 Dave Cross <dave@perlhacks.com>
* Version 1.1.0
* Support ExcludeArch, ExclusiveArch, ExcluseOS, ExclusiveOS
2021-01-23 Dave Cross <dave@perlhacks.com>
* Version 1.0.3
* Add bugtracker to metadata
2020-11-04 Dave Cross <dave@perlhacks.com>
* Version 1.0.2
* Add Test::Exception to prereqs
2020-11-03 Dave Cross <dave@perlhacks.com>
* Version 1.0.1
* Improved tests

View file

@ -7,7 +7,7 @@ use warnings;
use Carp;
use Moose;
our $VERSION = 'v1.0.1';
our $VERSION = 'v1.1.2';
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( excludearch exclusivearch excludeos exclusiveos ) ]
=> ( is => 'rw', isa => 'Str' );
has parse_spec => (
is => 'ro',
@ -33,21 +35,25 @@ has parse_spec => (
sub _build_parse_spec {
return {
scalars => {
name => qr[^Name:\s*(\S+)],
version => qr[^Version:\s*(\S+)],
epoch => qr[^Epoch:\s*(\S+)],
release => qr[^Release:\s*(\S+)],
summary => qr[^Summary:\s*(.+)],
license => qr[^License:\s*(.+)],
group => qr[^Group:\s*(\S+)],
url => qr[^URL:\s*(\S+)],
buildroot => qr[^BuildRoot:\s*(\S+)],
buildarch => qr[^BuildArch:\s*(\S+)],
name => qr[^Name:\s+(\S+)],
version => qr[^Version:\s+(\S+)],
epoch => qr[^Epoch:\s+(\S+)],
release => qr[^Release:\s+(\S+)],
summary => qr[^Summary:\s+(.+)],
license => qr[^License:\s+(.+)],
group => qr[^Group:\s+(\S+)],
url => qr[^(?:URL|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+)],
buildrequires => qr[^BuildRequires:\s*(.+)],
requires => qr[^Requires:\s*(.+)],
source => qr[^Source\d*:\s+(\S+)],
buildrequires => qr[^BuildRequires:\s+(.+)],
requires => qr[^Requires:\s+(.+)],
},
};
}
@ -83,7 +89,7 @@ sub parse_file {
croak "Spec file $file is empty\n";
}
open my $fh, $file or croak "Cannot open $file: $!\n";
open my $fh, '<', $file or croak "Cannot open $file: $!\n";
my $scalars = $self->parse_spec->{scalars};
my $arrays = $self->parse_spec->{arrays};

View file

@ -12,6 +12,8 @@ BuildArch: noarch
BuildRequires: perl >= 1:5.6.0
BuildRequires: perl(Module::Build)
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
ExclusiveArch: megaCPU
ExcludeArch: crapCPU
%description
If you have two arrays and you want to know if they are the same or

View file

@ -0,0 +1,13 @@
use strict;
use warnings;
use Test::More;
use Test::Exception;
use Parse::RPM::Spec;
my $spec = Parse::RPM::Spec->new( { file => 't/perl-License-Syntax.spec' } );
is($spec->license, 'GPL-1.0-or-later OR Artistic-1.0-Perl', 'Correct license');
done_testing;

View file

@ -1,24 +1,31 @@
use strict;
use warnings;
use Test::More;
use Test::Exception;
BEGIN { use_ok('Parse::RPM::Spec') };
ok($spec = Parse::RPM::Spec->new( { file => 't/file.spec' } ),
ok(my $spec = Parse::RPM::Spec->new( { file => 't/file.spec' } ),
'Got an object');
isa_ok($spec, 'Parse::RPM::Spec');
is($spec->name, 'perl-Array-Compare', 'Correct name');
is($spec->summary, 'Perl extension for comparing arrays', 'Correct summary');
is($spec->url, 'http://search.cpan.org/dist/Array-Compare/', 'Correct URL');
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');
is($spec->excludearch, 'crapCPU', 'Correct excluded architecture');
dies_ok { Parse::RPM::Spec->new }
'No spec file given';
dies_ok { Parse::RPM::Spec->new( file => 'not-there') }

131
t/perl-License-Syntax.spec Normal file
View file

@ -0,0 +1,131 @@
Name: perl-License-Syntax
Version: 0.13
Release: 23%{?dist}
Summary: Coding and decoding of license strings using SPDX and SUSE syntax
License: GPL-1.0-or-later OR Artistic-1.0-Perl
URL: https://metacpan.org/release/License-Syntax
Source0: https://cpan.metacpan.org/authors/id/J/JN/JNW/License-Syntax-%{version}.tar.gz
BuildArch: noarch
# Build
BuildRequires: coreutils
BuildRequires: make
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
# Runtime
BuildRequires: perl(Carp)
BuildRequires: perl(Data::Dumper)
BuildRequires: perl(DBD::SQLite)
BuildRequires: perl(DBI)
BuildRequires: perl(POSIX)
BuildRequires: perl(Text::CSV)
# Tests only
BuildRequires: perl(Test::More)
# Optional tests only
BuildRequires: perl(Pod::Coverage) >= 0.18
BuildRequires: perl(Test::Pod) >= 1.22
BuildRequires: perl(Test::Pod::Coverage) >= 1.08
Requires: perl(:MODULE_COMPAT_%(eval "$(perl -V:version)"; echo $version))
Requires: perl(DBD::SQLite)
%description
License::Syntax is an object oriented module. When constructing new
License::Syntax objects, you can provide a mapping table for license
names. The table is used for recognizing alternate alias names for the
licenses (left hand side) and also defines the canonical short names of
the licenses (right hand side). The mapping table is consulted twice,
before and after decoding the syntax, thus non-terminal mappings may
actually be followed.
%prep
%setup -q -n License-Syntax-%{version}
chmod -c a-x license_syntax.pl
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_build}
%install
%{make_install}
rm -f %{buildroot}/%{perl_vendorlib}/License/license_syntax.pl
%{_fixperms} %{buildroot}/*
%check
make test
%files
%doc Changes README license_syntax.pl synopsis.csv
%{perl_vendorlib}/*
%{_mandir}/man3/*
%changelog
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue May 31 2022 Jitka Plesnikova <jplesnik@redhat.com> - 0.13-22
- Perl 5.36 rebuild
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri May 21 2021 Jitka Plesnikova <jplesnik@redhat.com> - 0.13-19
- Perl 5.34 rebuild
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jun 23 2020 Jitka Plesnikova <jplesnik@redhat.com> - 0.13-16
- Perl 5.32 rebuild
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri May 31 2019 Jitka Plesnikova <jplesnik@redhat.com> - 0.13-13
- Perl 5.30 rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jun 28 2018 Jitka Plesnikova <jplesnik@redhat.com> - 0.13-10
- Perl 5.28 rebuild
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon Jun 05 2017 Jitka Plesnikova <jplesnik@redhat.com> - 0.13-7
- Perl 5.26 rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Sun May 15 2016 Jitka Plesnikova <jplesnik@redhat.com> - 0.13-5
- Perl 5.24 rebuild
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.13-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Fri Jun 05 2015 Jitka Plesnikova <jplesnik@redhat.com> - 0.13-2
- Perl 5.22 rebuild
* Thu Apr 02 2015 Petr Šabata <contyk@redhat.com> 0.13-1
- Initial packaging

View file

@ -1,3 +1,6 @@
use strict;
use warnings;
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;

View file

@ -1,3 +1,6 @@
use strict;
use warnings;
use Test::More;
eval "use Test::Pod::Coverage 1.00";
plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;