[packages/rpm] - perl macros moved to perl-rpm-packaging
baggins
baggins at pld-linux.org
Mon Nov 25 04:04:47 CET 2024
commit 70441bb6bed06142f8fc5bbc848544f2bc841bf7
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Mon Nov 25 02:19:09 2024 +0100
- perl macros moved to perl-rpm-packaging
perl-heredoc-matching.patch | 39 ------------
perl.prov | 142 --------------------------------------------
rpm-perl-macros.patch | 124 --------------------------------------
rpm-perl-req-perlfile.patch | 123 --------------------------------------
rpm-perl_req-INC_dirs.patch | 34 -----------
5 files changed, 462 deletions(-)
---
diff --git a/perl-heredoc-matching.patch b/perl-heredoc-matching.patch
deleted file mode 100644
index 8ad0160..0000000
--- a/perl-heredoc-matching.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 73419594af15e94e77bae413d9754d3775cf0280 Mon Sep 17 00:00:00 2001
-From: Jan Palus <jpalus at fastmail.com>
-Date: Tue, 12 Dec 2023 19:45:54 +0100
-Subject: [PATCH] perl.req: make heredoc block matching more generic
-
-match any <<MARKER providing:
-
-- it is not in comment (not preceded by #)
-- it can't be string literal (not preceded by ' or ")
-- as a sanity check it must be preceded by either whitespace, comma or
- equals sign
-
-adds support for
-
- return <<"EOS";
-
- fun(arg, <<"EOS");
----
- scripts/perl.req | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/scripts/perl.req b/scripts/perl.req
-index 1b50c50847..8bfa38771e 100755
---- a/scripts/perl.req
-+++ b/scripts/perl.req
-@@ -102,10 +102,10 @@ sub process_file {
-
- while (<FILE>) {
-
-- # skip the "= <<" block
-+ # skip the heredoc block
-
-- if (m/^\s*(?:my\s*)?\$(?:.*)\s*=\s*<<\s*(["'`])(.+?)\1/ ||
-- m/^\s*(?:my\s*)?\$(.*)\s*=\s*<<(\w+)\s*;/) {
-+ if (m/^[^'"#]+[\s,=(]<<\s*(["'`])(.+?)\1/ ||
-+ m/^[^'"#]+[\s,=(](<<)(\w+)\s*;/) {
- $tag = $2;
- while (<FILE>) {
- chomp;
diff --git a/perl.prov b/perl.prov
deleted file mode 100644
index 6e98f9a..0000000
--- a/perl.prov
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-# perl.prov - find information about perl modules for RPM
-# $Id$
-
-# It's questionable if we should provide perl(Foo::Bar) for modules
-# from outside @INC (possibly shipped with some applications).
-# I think we should not, and provide them only for the perl.req script,
-# while it scans files in that particular application.
-
-
-# check if we are called directly
-if ($0 =~ m#(?:^|/)perl.prov$#) {
- my $prov = new RPM::PerlReq;
- # process @ARGV or STDIN
- foreach ( @ARGV ? @ARGV : <> ) {
- chomp;
- next if -l || !-f _; # skip non-files and symlinks
- next if m#/usr/(?:share/doc|src)/#; # lot of false alarms; warning: we omit ^ here
- next if !m#\.p[ml]$#; # we only care about *.pm and *.pl files
- $prov->process_file($_);
- }
- $prov->print_result;
-}
-
-
-package RPM::PerlReq;
-use Safe;
-
-sub new {
- my $class = shift;
- my $self = {
- inc => [
- sort { length $b cmp length $a } grep m#^/#,
- map { y#/#/#s; s#/$##; $_ } @INC
- ],
- provide => {},
- safe => Safe->new,
- @_,
- };
- bless $self, $class;
-}
-
-# print out what we found
-sub print_result {
- my $self = shift;
- for (sort keys %{ $self->{provide} }) {
- print "perl($_)"
- . (length $self->{provide}->{$_} ? " = $self->{provide}->{$_}" : '')
- . "\n";
- }
-}
-
-sub process_file {
- my $self = shift;
- my $file = shift;
- my ( $package, $version );
-
- # if the file lives under @INC, we can
- # obtain the package name from it's path
- for (@{ $self->{inc} }) {
- if ($file =~ m#\Q$_\E/(.+)$#) { # we can't use ^ here
- $package = $1;
-
- if ($package !~ s/\.pm$//) { # it's a *.pl
- # $package =~ m#([^/]+)$#;
- # $provide{$1} = '';
- return 1;
- }
-
- $package =~ s#/#::#g;
- last;
- }
- }
-
- # it can be a *.pl oustide @INC
- return if /\.pl$/;
-
- local *FILE;
- open FILE, $file or die "$0: cannot open file `$file': $!";
-
- while (<FILE>) {
-
- # skip the documentation
- next
- if m/^=(?:head1|head2|pod|item|begin|for|over)\b/
- ... ( m/^=(?:cut|end)\b/ || $. == 1 );
-
- # skip the data section
- last if m/^__(?:DATA|END)__$/;
-
- # search for the package name
- if (
- (!defined $package || !defined $version)
- && ( my ($pack, $ver) = m/^\s*(?:\{\s*)?package\s+([_:a-zA-Z0-9]+?)\s*(?:v?([0-9_.]+)\s*)?[;{]/)
- && $1 ne 'main'
- && match_the_path( $file, $1 )
- )
- {
- $package = $pack;
- $version = $ver;
- }
-
- if ( !defined $version && /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/ ) {
- ( $version = $self->{safe}->reval($_) ) =~ s/^\s+|alpha|beta|\s+$//g;
- if ( defined $version
- && length $version
- && ($version =~ /[^\d\._abcdefgh]/
- || $version =~ /^[^\d]*$/ ))
- {
- warn "$0: weird version number in $file: [$version]\n";
- $version = '';
- }
- }
- }
-
- unless ( defined $package ) {
- warn "$0: weird, cannot determine the package name for `$file'\n";
- return 0;
- }
-
- $self->{provide}->{$package} = $version;
-
- close FILE or die "$0: cannot close file `$file': $!";
-
- 1;
-}
-
-
-# Returns C<true> if the package name matches the path,
-# so you can use() it. C<false> otherwise.
-sub match_the_path {
- my ( $file, $pack ) = @_;
- $pack =~ s#::#/#g;
- $file =~ /\Q$pack\E(?:\.pm)?$/;
-}
-
-
-1;
-
-# vim: ts=4 sw=4 noet noai nosi cin
diff --git a/rpm-perl-macros.patch b/rpm-perl-macros.patch
deleted file mode 100644
index bd04c59..0000000
--- a/rpm-perl-macros.patch
+++ /dev/null
@@ -1,124 +0,0 @@
---- rpm-5.3.1/configure.ac.wiget 2010-05-22 17:15:11.000000000 +0200
-+++ rpm-5.3.1/configure.ac 2010-05-30 16:37:59.526924459 +0200
-@@ -1100,7 +1100,7 @@ AC_CONFIG_FILES([ po/Makefile.in
-
- AC_CONFIG_FILES([Makefile
- rpmio/Makefile lib/Makefile build/Makefile sign/Makefile
-- po/Makefile.in scripts/Makefile fileattrs/Makefile
-+ po/Makefile.in scripts/Makefile scripts/perl.req scripts/perl.prov fileattrs/Makefile
- misc/Makefile
- docs/Makefile
- docs/man/Makefile
---- 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
deleted file mode 100644
index 16ad595..0000000
--- a/rpm-perl-req-perlfile.patch
+++ /dev/null
@@ -1,123 +0,0 @@
---- 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 @@
- eval { require version; $HAVE_VERSION = 1; };
-
-
--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 "= <<" 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
deleted file mode 100644
index f15d401..0000000
--- a/rpm-perl_req-INC_dirs.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- 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 @@
- eval { require version; $HAVE_VERSION = 1; };
-
-
-+# *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";
- } else {
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/56f242e3a926c2e4d64b7a83a5adf3d277d814b7
More information about the pld-cvs-commit
mailing list