Import rpm: 609bbcfd4a527574b647aaaea1f827e452aad077

This commit is contained in:
James Antill 2023-02-20 02:05:09 -05:00
commit 61c3f137b9
5 changed files with 372 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/generators-1.10.tar.gz

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -0,0 +1,208 @@
diff --git a/t/02_list.t b/t/02_list.t
index a0b8206..507fd43 100644
--- a/t/02_list.t
+++ b/t/02_list.t
@@ -13,7 +13,13 @@ my @provides = qx($PERL_PROV $file);
#
# Provides
-is(scalar(@provides), 0, 'No package is provided');
+my @expectedprovides = (
+ "$perl_ns(NoCleanA)\n",
+ "$perl_ns(NoCleanB)\n",
+ "$perl_ns(ToRemove)\n",
+ "$perl_ns(Foo)\n",
+);
+is_deeply([ sort @provides ], [ sort @expectedprovides ], "All expected provides were found.");
#
# Requires
@@ -38,6 +44,8 @@ my @expectedrequires = (
"$perl_ns(TARGET_CLASS)\n",
"$perl_ns(XML::XQL::Element)\n",
"$perl_ns(Class::Accessor::Fast)\n",
+ "$perl_ns(NoCleanA)\n",
+ "$perl_ns(NoCleanB)\n",
);
is_deeply([ sort @requires ], [ sort @expectedrequires ], "Only expected requires were found.");
diff --git a/t/data/list b/t/data/list
index f7b1a19..a40c76b 100644
--- a/t/data/list
+++ b/t/data/list
@@ -36,3 +36,14 @@ use base TARGET_CLASS;
# Do not ignore line which contains '->' in a coment
use base 'XML::XQL::Element'; # L -> L
+
+use NoCleanA;
+package NoCleanA;
+
+package NoCleanB;
+require NoCleanB;
+
+package ToRemove;
+sub foo{}
+package Foo;
+use base 'ToRemove';
diff --git a/template/bin/perl.req b/template/bin/perl.req
index 9e2e016..45cbd1a 100755
--- a/template/bin/perl.req
+++ b/template/bin/perl.req
@@ -26,18 +26,29 @@ $HAVE_VERSION = 0;
eval { require version; $HAVE_VERSION = 1; };
use Fedora::VSP ();
+use File::Basename;
+my $dir = dirname($0);
+$HAVE_PROV = 0;
+if ( -e "$dir/perl.prov" ) {
+ $HAVE_PROV = 1;
+ $prov_script = "$dir/perl.prov";
+}
if ("@ARGV") {
- foreach (@ARGV) {
- process_file($_);
+ foreach my $file (@ARGV) {
+ process_file($file);
+ process_file_provides($file);
+ compute_global_requires();
}
} else {
# notice we are passed a list of filenames NOT as common in unix the
# contents of the file.
- foreach (<>) {
- process_file($_);
+ foreach my $file (<>) {
+ process_file($file);
+ process_file_provides($file);
+ compute_global_requires();
}
}
@@ -45,8 +56,9 @@ if ("@ARGV") {
foreach $perlver (sort keys %perlreq) {
print "$perl_ns(:VERSION) >= $perlver\n";
}
-foreach $module (sort keys %require) {
- if (length($require{$module}) == 0) {
+
+foreach my $module (sort keys %global_require) {
+ if (length($global_require{$module}) == 0) {
print "$perl_ns($module)\n";
} else {
@@ -54,13 +66,48 @@ foreach $module (sort keys %require) {
# operators. Also I will need to change the processing of the
# $RPM_* variable when I upgrade.
- print "$perl_ns($module) >= $require{$module}\n";
+ print "$perl_ns($module) >= $global_require{$module}\n";
}
}
exit 0;
+sub compute_global_requires {
+
+# restrict require_removable to all non provided by the file
+ foreach my $moduler (sort keys %require_removable) {
+ if (exists $provide{$moduler} && length($require_removable{$moduler}) == 0) {
+ $require_removable = delete $require_removable{$moduler};
+ }
+ }
+# store requires to global_requires
+ foreach my $module (sort keys %require) {
+ my $oldver = $global_require{$module};
+ my $newver = $require{$module};
+ if ($oldver) {
+ $global_require{$module} = $newver
+ if ($HAVE_VERSION && $newver && version->new($oldver) < $newver);
+ } else {
+ $global_require{$module} = $newver;
+ }
+ }
+# store requires_removable to global_requires
+ foreach my $module (sort keys %require_removable) {
+ my $oldver = $global_require{$module};
+ my $newver = $require_removable{$module};
+ if ($oldver) {
+ $global_require{$module} = $newver
+ if ($HAVE_VERSION && $newver && version->new($oldver) < $newver);
+ } else {
+ $global_require{$module} = $newver;
+ }
+ }
+# remove all local requires and provides
+ undef %require;
+ undef %require_removable;
+ undef %provide;
+}
sub add_require {
my ($module, $newver) = @_;
@@ -82,6 +129,26 @@ sub add_require {
}
}
+sub add_require_removable {
+ my ($module, $newver) = @_;
+
+ # __EXAMPLE__ is not valid requirement
+ return if ($module =~ m/^__[A-Z]+__$/o);
+
+ # To prevent that module does not end with '::'
+ # Example: use base Object::Event::;
+ $module =~ s/::$//;
+
+ my $oldver = $require_removable{$module};
+ if ($oldver) {
+ $require_removable{$module} = $newver
+ if ($HAVE_VERSION && $newver && version->new($oldver) < $newver);
+ }
+ else {
+ $require_removable{$module} = $newver;
+ }
+}
+
sub process_file {
my ($file) = @_;
@@ -312,7 +379,14 @@ sub process_file {
# use base|parent qw(Foo) dependencies
# use aliased qw(Foo::Bar) dependencies
- if ($statement eq "use" && ($module eq "base" || $module eq "aliased")) {
+ if ($statement eq "use" && $module eq "base") {
+ add_require($module, $version);
+ if (defined($list) && $list ne "") {
+ add_require_removable($_, undef) for split(' ', $list);
+ }
+ next;
+ }
+ if ($statement eq "use" && $module eq "aliased") {
add_require($module, $version);
if (defined($list) && $list ne "") {
add_require($_, undef) for split(' ', $list);
@@ -353,3 +427,17 @@ sub process_file {
return;
}
+
+sub process_file_provides {
+
+ my ($file) = @_;
+ chomp $file;
+
+ return if (! $HAVE_PROV);
+
+ my @result = readpipe( "$prov_script $file" );
+ foreach my $prov (@result) {
+ $provide{$1} = undef if $prov =~ /perl\(([_:a-zA-Z0-9]+)\)/;
+ }
+
+}

156
perl-generators.spec Normal file
View File

@ -0,0 +1,156 @@
Name: perl-generators
Version: 1.10
Release: 10%{?dist}
Summary: RPM Perl dependencies generators
Group: Development/Libraries
License: GPL+
URL: http://jplesnik.fedorapeople.org/generators
Source0: %{url}/generators-%{version}.tar.gz
Patch0: generators-1.10-remove-perl-provides-from-requires.patch
BuildArch: noarch
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: make
BuildRequires: perl-interpreter >= 4:5.22.0-351
%if !%{defined perl_bootstrap}
# Break build cycle: reflexive dependency
BuildRequires: perl-generators
%endif
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(Fedora::VSP)
BuildRequires: perl(File::Copy)
BuildRequires: perl(File::Find)
BuildRequires: perl(strict)
BuildRequires: perl(Test::More)
BuildRequires: perl(warnings)
BuildRequires: sed
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl-interpreter >= 4:5.22.0-351
# Per Perl packaging guidelines, build-requiring perl-generators should
# deliver Perl macros
Requires: perl-macros
%if %{defined perl_bootstrap}
# Supply run-time dependencies manually when perl-generators is not available
Requires: perl(Fedora::VSP)
%endif
# The generators and attribute files were split from rpm-build
Conflicts: rpm-build < 4.11.2-15
%description
This package provides RPM Perl dependencies generators which are used for
getting provides and requires from Perl binaries and modules.
%prep
%setup -q -n generators-%{version}
%patch0 -p1
%build
perl Makefile.PL INSTALLDIRS=vendor INSTALLVENDORSCRIPT=%{_rpmconfigdir}
make %{?_smp_mflags}
%install
make pure_install DESTDIR=%{buildroot}
find $RPM_BUILD_ROOT -type f -name .packlist -delete
%{_fixperms} $RPM_BUILD_ROOT/*
mkdir -p %{buildroot}%{_rpmconfigdir}/fileattrs/
install -p -m 644 fileattrs/* '%{buildroot}%{_rpmconfigdir}/fileattrs'
%check
make test
%files
%doc Changes TODO
%{_rpmconfigdir}/perl.*
%{_rpmconfigdir}/fileattrs/perl*.attr
%changelog
* Wed May 29 2019 Jitka Plesnikova <jplesnik@redhat.com> - 1.10-10
- Update filter for removing perl dependencies (bug#1690773)
* Fri Mar 29 2019 Jitka Plesnikova <jplesnik@redhat.com> - 1.10-9
- Rebuild with enable hardening (bug #1636329)
* Wed Mar 20 2019 Jitka Plesnikova <jplesnik@redhat.com> - 1.10-8
- Remove perl dependencies that are provided in the same file (bug#1690773)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.10-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.10-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Thu Jul 13 2017 Petr Pisar <ppisar@redhat.com> - 1.10-5
- perl dependency renamed to perl-interpreter
<https://fedoraproject.org/wiki/Changes/perl_Package_to_Install_Core_Modules>
* Wed Jun 07 2017 Jitka Plesnikova <jplesnik@redhat.com> - 1.10-4
- Perl 5.26 re-rebuild of bootstrapped packages
* Sat Jun 03 2017 Jitka Plesnikova <jplesnik@redhat.com> - 1.10-3
- Perl 5.26 rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jul 12 2016 Jitka Plesnikova <jplesnik@redhat.com> - 1.10-1
- 1.10 bump
* Thu Jun 23 2016 Jitka Plesnikova <jplesnik@redhat.com> - 1.09-1
- 1.09 bump
* Wed Jun 15 2016 Petr Pisar <ppisar@redhat.com> - 1.08-4
- Run-require perl-macros to provide the Perl macros for building Perl packages
* Wed Jun 01 2016 Petr Pisar <ppisar@redhat.com> - 1.08-3
- Supply run-time depenencies manually when perl-generators is not available on
bootstrap
* Sat May 14 2016 Jitka Plesnikova <jplesnik@redhat.com> - 1.08-2
- Perl 5.24 rebuild
* Mon Mar 21 2016 Jitka Plesnikova <jplesnik@redhat.com> - 1.08-1
- 1.08 bump; Resolves BZ#1318658
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.07-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Oct 20 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.07-2
- Add epoch to perl BR
* Tue Oct 20 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.07-1
- 1.07 bump
- Return perl version as normalized perl(:VERSION) symbol
* Tue Oct 06 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.06-1
- 1.06 bump
* Tue Sep 29 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.05-1
- 1.05 bump
- Resolves: bug #1267267
* Wed Jul 29 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.04-1
- 1.04 bump
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.03-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed Jun 03 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.03-2
- Perl 5.22 rebuild
* Mon Feb 02 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.03-1
- 1.03 bump
- Update parcing of here-doc and quoted section
* Fri Dec 12 2014 Jitka Plesnikova <jplesnik@redhat.com> - 1.02-1
- 1.02 bump
* Tue Oct 21 2014 Jitka Plesnikova <jplesnik@redhat.com> - 1.01-1
- 1.01 bump
* Tue Aug 26 2014 Jitka Plesnikova <jplesnik@redhat.com> - 1.00-2
- Perl 5.20 rebuild
* Mon Jun 16 2014 Jitka Plesnikova <jplesnik@redhat.com> - 1.00-1
- Introduce Perl generators as a standalone package

1
sources Normal file
View File

@ -0,0 +1 @@
SHA1 (generators-1.10.tar.gz) = 18367a1ba110a64c42ca424cabe61ac0b9673327