[packages/perl-rpm-packaging] - import patches from rpm package, rel 1
baggins
baggins at pld-linux.org
Sun Nov 24 22:20:12 CET 2024
commit a499dc27330893a83f4d83fe828c904cf755900e
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sun Nov 24 22:14:47 2024 +0100
- import patches from rpm package, rel 1
perl-rpm-packaging.spec | 8 ++-
rpm-perl-macros.patch | 113 ++++++++++++++++++++++++++++++++++++++++
rpm-perl-req-perlfile.patch | 123 ++++++++++++++++++++++++++++++++++++++++++++
rpm-perl_req-INC_dirs.patch | 34 ++++++++++++
4 files changed, 277 insertions(+), 1 deletion(-)
---
diff --git a/perl-rpm-packaging.spec b/perl-rpm-packaging.spec
index 1d55786..448b21e 100644
--- a/perl-rpm-packaging.spec
+++ b/perl-rpm-packaging.spec
@@ -3,11 +3,14 @@ Summary(de.UTF-8): Zusatzwerkzeuge fürs Nachsehen Perl-Abhängigkeiten in RPM-P
Summary(pl.UTF-8): Dodatkowe narzędzia do sprawdzenia zależności skryptów Perla w pakietach RPM
Name: perl-rpm-packaging
Version: 1.1
-Release: 0.1
+Release: 1
License: GPL v2
Group: Base
Source0: https://github.com/rpm-software-management/perl-rpm-packaging/archive/v%{version}/%{name}-%{version}.tar.gz
# Source0-md5: 7dfd1670fd1c3c002719b604bd2801e3
+Patch0: rpm-perl-macros.patch
+Patch1: rpm-perl-req-perlfile.patch
+Patch2: rpm-perl_req-INC_dirs.patch
URL: https://github.com/rpm-software-management/perl-rpm-packaging
BuildRequires: rpm-build >= 4.6
Requires: perl-Encode
@@ -34,6 +37,9 @@ pakietach RPM.
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p0
%build
diff --git a/rpm-perl-macros.patch b/rpm-perl-macros.patch
new file mode 100644
index 0000000..565c812
--- /dev/null
+++ b/rpm-perl-macros.patch
@@ -0,0 +1,113 @@
+--- rpm-5.3.1/scripts/perl.req.wiget 2008-10-26 10:50:53.000000000 +0100
++++ rpm-5.3.1/scripts/perl.req 2010-05-30 16:35:36.999438206 +0200
+@@ -45,7 +45,11 @@
+
+ if ("@ARGV") {
+ foreach (@ARGV) {
+- process_file($_);
++ if (m=/usr/(sbin|bin|lib|share|X11R6/(lib|bin))/=) {
++ if (! m=(/(doc|man|info|usr/src)/|\.(so|ph|h|html|pod)$)=) {
++ process_file($_);
++ }
++ }
+ }
+ } else {
+
+@@ -53,7 +57,11 @@
+ # contents of the file.
+
+ foreach (<>) {
+- process_file($_);
++ if (m=/usr/(sbin|bin|lib|share|X11R6/(lib|bin))/=) {
++ if (! m=(/(doc|man|info|usr/src)/|\.(so|ph|h|html|pod)$)=) {
++ process_file($_);
++ }
++ }
+ }
+ }
+
+@@ -261,19 +269,41 @@
+
+ $module =~ s/\(\s*\)$//;
+
+- if ( $module =~ m/^v?([0-9._]+)$/ ) {
++ if ( $module =~ m/^(v?)([0-9._]+)$/ ) {
+ # if module is a number then both require and use interpret that
+ # to mean that a particular version of perl is specified
+
+- my $ver = $1;
+- if ($ver =~ /5.00/) {
+- $perlreq{"0:$ver"} = 1;
+- next;
+- }
+- else {
+- $perlreq{"1:$ver"} = 1;
+- next;
+- }
++ my $ver=$2;
++ if (($1 eq 'v') or ($ver =~ /[0-9]+\.[0-9]+\.[0-9]+/)) {
++ # $V-style
++ if ($ver =~ m/5\.([0-5])(\.([0-9]+))?$/) {
++ if (defined $3) {
++ print "perl-base >= 0:5.00$1_$3\n";
++ } else {
++ print "perl-base >= 0:5.00$1\n";
++ }
++ } else {
++ print "perl-base >= 1:$ver\n";
++ }
++ } else {
++ # $]-style
++ if ($ver =~ m/5\.(00[0-5])_?([0-9]+)?$/) {
++ if (defined $2) {
++ print "perl-base >= 0:5.$1_$2\n";
++ } else {
++ print "perl-base >= 0:5.$1\n";
++ }
++ } else {
++ # expand to M.NNN_nnn form
++ $ver =~ s/^([0-9])$/$1./;
++ $ver =~ s/^([0-9]\.[0-9]{0,5}|[0-9]\.[0-9]{3}_[0-9]{0,2})$/${1}000000/;
++ $ver =~ s/^([0-9]\.[0-9]{3})_?([0-9]{3})0*$/$1_$2/;
++ # match trimming leading 0s
++ $ver =~ m/^([0-9])\.0*([1-9][0-9]*|0)_0*([1-9][0-9]*|0)$/;
++ print "perl-base >= 1:$1.$2.$3\n";
++ }
++ }
++ next;
+
+ };
+
+@@ -290,7 +320,31 @@
+ # will be included with the name sys/systeminfo.ph so only use the
+ # basename of *.ph files
+
+- ($module =~ m/\.ph$/) && next;
++ # ($module =~ m/\.ph$/) && ($module =~ s!.*/!!g );
++
++ # there is no need to generate dependencies for ph, pl or test files
++ # so let's just skip them.
++
++ ($module =~ m/\.(ph|pl|t)$/) && next;
++
++ # skip all modules for platforms other than linux.
++
++ ($module =~ m/Mac|OS2|MSDOS|Win32|VMS|vmsish/) && next;
++
++ # if the module name starts in a dot it is not a module name.
++
++ ($module =~ m/^\./) && next;
++
++ # if the module ends with .pm strip it to leave only basename.
++
++ $module =~ s/\.pm$//;
++
++ $module =~ s/\//::/;
++
++ # trim off trailing parenthesis if any. Sometimes people pass
++ # the module an empty list.
++
++ $module =~ s/\(\s*\)$//;
+
+ # use base|parent qw(Foo) dependencies
+ if ($statement eq "use" && ($module eq "base" || $module eq "parent")) {
diff --git a/rpm-perl-req-perlfile.patch b/rpm-perl-req-perlfile.patch
new file mode 100644
index 0000000..51b5d61
--- /dev/null
+++ b/rpm-perl-req-perlfile.patch
@@ -0,0 +1,123 @@
+--- rpm-4.2/scripts/perl.req.wigperl Tue Apr 1 13:33:52 2003
++++ rpm-4.2/scripts/perl.req Tue Apr 1 13:39:47 2003
+@@ -39,28 +39,19 @@
+ }
+ }
+
+-if ("@ARGV") {
+- foreach (@ARGV) {
++foreach ( @ARGV ? @ARGV : <> ) {
++ chomp;
+ if (m=/usr/(sbin|bin|lib|share|X11R6/(lib|bin))/=) {
+ if (! m=(/(doc|man|info|usr/src)/|\.(so|ph|h|html|pod)$)=) {
+- process_file($_);
++ process_file($_) if -f;
+ }
+ }
+- }
+-} else {
+-
+- # notice we are passed a list of filenames NOT as common in unix the
+- # contents of the file.
+-
+- foreach (<>) {
+- if (m=/usr/(sbin|bin|lib|share|X11R6/(lib|bin))/=) {
+- if (! m=(/(doc|man|info|usr/src)/|\.(so|ph|h|html|pod)$)=) {
+- process_file($_);
+- }
+- }
+- }
+ }
+
++foreach (sort keys %provide) {
++ delete $require{$_};
++}
++delete $require{the}; # don't count "use the sth" as perl module
+
+ foreach $perlver (sort keys %perlreq) {
+ print "perl >= $perlver\n";
+@@ -82,6 +74,53 @@
+ }
+ }
+
++sub is_perlfile {
++ my $file = shift;
++ my $fh = shift;
++
++ my $fl = <$fh>;
++
++ my $is_perl = 0;
++
++ my $nw = 0;
++
++ if ($file =~ /\.(so|ph|h|html|pod|gz|bz2|png|gif|jpg|xpm|a|patch|o|mo)$/) {
++ $is_perl = 0;
++
++ # .al, .pl, .pm and .plx (perl-Font-TTF contains *.plx files)
++ } elsif ($file =~ /\.p[lm]x?$/ || $file =~ /\.al$/) {
++ $is_perl = 1;
++ #print STDERR "$file PERL by ext\n";
++ } elsif ($fl =~ m|bin/perl| or $fl =~ m|env\s+perl| or $fl =~ m|exec\s+perl|) {
++ $is_perl = 1;
++ #print STDERR "$file PERL by perl\n";
++ } elsif ($fl =~ m|bin/sh|) {
++ while (<$fh>) {
++ if (/eval/ && /perl/) {
++ $is_perl = 1;
++ last;
++ }
++ $nw++ if (/^\s*BEGIN/);
++ $nw++ if (/^\s*sub\s+/);
++ $nw++ if (/^\s*package\s+/);
++ $nw++ if (/^\s*use\s+strict\s+;/);
++ $nw++ if (/^\s*use\s+vars\s*qw/);
++ last if ($. > 30);
++ }
++ }
++
++ seek($fh, 0, 0);
++
++ $is_perl = 1 if ($nw > 1); # propably perl file
++
++ #if (!$is_perl) {
++ # print STDERR "NOPERL $file\n";
++ # return 0;
++ #}
++ #print STDERR "PERL $file\n" if ($is_perl);
++ return $is_perl;
++}
++
+ sub process_file {
+
+ my ($file) = @_;
+@@ -90,6 +129,8 @@
+ return;
+ }
+
++ return if (!is_perlfile($file, \*FILE));
++
+ while (<FILE>) {
+
+ # skip the heredoc block
+@@ -111,6 +152,10 @@
+ last;
+ }
+
++ if (m/^\s*package\s+([_:a-zA-Z0-9]+)\s*;/) {
++ $provide{$1} = 1;
++ }
++
+ # Each keyword can appear multiple times. Don't
+ # bother with datastructures to store these strings,
+ # if we need to print it print it now.
+@@ -236,6 +281,10 @@
+
+ ($module =~ m/^\./) && next;
+
++ # name starts in a non alphanumeric character it is not a module
++ # name.
++ ($module =~ m/^\W/) && next;
++
+ # if the module ends with .pm strip it to leave only basename.
+
+ $module =~ s/\.pm$//;
diff --git a/rpm-perl_req-INC_dirs.patch b/rpm-perl_req-INC_dirs.patch
new file mode 100644
index 0000000..89b1075
--- /dev/null
+++ b/rpm-perl_req-INC_dirs.patch
@@ -0,0 +1,34 @@
+--- scripts/perl.req~ 2004-04-16 13:27:10.000000000 +0200
++++ scripts/perl.req 2004-04-26 23:54:42.128568344 +0200
+@@ -39,9 +39,18 @@
+ }
+ }
+
++# *inc variables are used to track dependencies on directories for modules.
++# These directories (especially arch-dependent) are likely to change some day.
++my @inc = sort { length $b cmp length $a }
++ map { s#/*$##; $_ }
++ grep m#^/.#, @INC;
++my %inc = map { $_ => 0 } @inc;
++my $inc = join '|', map "\Q$_\E", @inc;
++
+ foreach ( @ARGV ? @ARGV : <> ) {
+- chomp;
+- if (m=/usr/(sbin|bin|lib|share|X11R6/(lib|bin))/=) {
++ chomp;
++ $inc{$1}++ if m#($inc)/#; # can't anchor on ^
++ if (m=/usr/(sbin|bin|lib|lib64|libx32|share|X11R6/(lib|lib64|libx32|bin))/=) {
+ if (! m=(/(doc|man|info|usr/src)/|\.(so|ph|h|html|pod)$)=) {
+ process_file($_) if -f;
+ }
+@@ -53,7 +64,9 @@
+ foreach $perlver (sort keys %perlreq) {
+ print "perl >= $perlver\n";
+ }
++print "$_\n" for sort grep $inc{$_}, keys %inc;
++
+-foreach $module (sort keys %require) {
++foreach my $module (sort grep length, keys %require) {
+ if (length($require{$module}) == 0) {
+ print "perl($module)\n";
+ print "perln($module)\n" if !$perln;
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/perl-rpm-packaging.git/commitdiff/a499dc27330893a83f4d83fe828c904cf755900e
More information about the pld-cvs-commit
mailing list