From 698d3f4f7ab99d03bac0042dc043ce6f520b6938 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Fri, 30 Jun 2023 07:34:42 +0200 Subject: [PATCH] re-import sources as agreed with the maintainer --- .gitignore | 4 +- STAGE2-perl | 29 +++ checkemptydirs | 11 ++ checkpackageversion | 93 +++++++++ clean-manifest.pl | 39 ++++ diffrpms | 33 ++++ generatedependencies | 163 ++++++++++++++++ ...2-Perl_my_setenv-handle-integer-wrap.patch | 182 ++++++++++++++++++ perl-5.8.0-libnet.cfg | 15 ++ perl.rpmlintrc | 3 + system-owned-directories | 7 + 11 files changed, 578 insertions(+), 1 deletion(-) create mode 100644 STAGE2-perl create mode 100644 checkemptydirs create mode 100644 checkpackageversion create mode 100644 clean-manifest.pl create mode 100644 diffrpms create mode 100644 generatedependencies create mode 100644 perl-5.26.2-Perl_my_setenv-handle-integer-wrap.patch create mode 100644 perl-5.8.0-libnet.cfg create mode 100644 perl.rpmlintrc create mode 100644 system-owned-directories diff --git a/.gitignore b/.gitignore index 35852c7..01152f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ -SOURCES/perl-5.26.3.tar.bz2 +/perl-5.26.1.tar.bz2 +/perl-5.26.2-RC1.tar.bz2 +/perl-5.26.2.tar.bz2 /perl-5.26.3.tar.bz2 diff --git a/STAGE2-perl b/STAGE2-perl new file mode 100644 index 0000000..8a4676a --- /dev/null +++ b/STAGE2-perl @@ -0,0 +1,29 @@ +#requires gdbm + +mcd $BUILDDIR/perl + +GV=$(cd $SRC; echo perl-*) +SONAME_VER=`echo $GV | cut -f2- -d'-' | sed 's/^\\([^.]*\\.[^.]*\\).*/\\1/'` +PERL_VER=`echo $GV | cut -f2- -d'-'` + +cd $SRC/$GV + +sh $SRC/$GV/Configure -des -Dprefix=/usr -Dlibpth="/usr/local/lib$SUFFIX /lib$SUFFIX /usr/lib$SUFFIX" -Darchlib="/usr/lib$SUFFIX/perl5" -Dsitelib="/usr/local/share/perl5" -DDEBUGGING=-g -Dcc=gcc -Dmyhostname=localhost -Dperladmin=root@localhost -Duseshrplib -Dusethreads -Duseithreads -Uusedtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto + +BUILD_BZIP2=0 +BZIP2_LIB=%{_libdir} +export BUILD_BZIP2 BZIP2_LIB + +ln -sf libperl.so libperl.so.${SONAME_VER} + +make + +rm -f /usr/lib${SUFFIX}/perl5/CORE/libperl.so + +make install + +rm -f /usr/lib${SUFFIX}/libperl.so.${PERL_VER} +mv /usr/lib${SUFFIX}/perl5/CORE/libperl.so /usr/lib${SUFFIX}/libperl.so.${PERL_VER} +ln -sf libperl.so.${PERL_VER} /usr/lib${SUFFIX}/libperl.so.${SONAME_VER} +ln -sf libperl.so.${PERL_VER} /usr/lib${SUFFIX}/libperl.so +ln -sf libperl.so.${PERL_VER} /usr/lib${SUFFIX}/perl5/CORE/libperl.so diff --git a/checkemptydirs b/checkemptydirs new file mode 100644 index 0000000..a68335f --- /dev/null +++ b/checkemptydirs @@ -0,0 +1,11 @@ +#!/bin/bash +for P in "$@"; do + echo "Empty directories in RPM package $P:" + + for D in $(rpm -qlvp "$P" | \ + perl -ne \ + 'if (/\Adrwx/) {$n=${[split /\s+/]}[8]; print qq{$n\n}}' | \ + sort -f); do + test $(rpm -qlp "$P" | grep -c -F "$D/") == 0 && echo "$D"; + done +done diff --git a/checkpackageversion b/checkpackageversion new file mode 100644 index 0000000..f857253 --- /dev/null +++ b/checkpackageversion @@ -0,0 +1,93 @@ +#!/usr/bin/perl +use strict; +use warnings; +use utf8; + +use RPM2; + +for my $rpm_file (@ARGV) { + my $package = RPM2->open_package($rpm_file) + or die q{Could not open `} . $rpm_file . q{'.}; + + my $package_name = $package->tag('NAME'); + my $package_version = $package->tag('VERSION'); + + my $module_name = $package_name; + $module_name =~ s/^([^-]+)-(.*)/$1($2)/; + $module_name =~ s/-/::/g; + + my @names = $package->tag('PROVIDENAME'); + my @flags = $package->tag('PROVIDEFLAGS'); + my @versions = $package->tag('PROVIDEVERSION'); + if (!($#names == $#flags) && ($#names == $#versions)) { + die (q{Inconsistent number of provides names, flags, and versions in `} + . $rpm_file . q{'.}); + } + + my $found = 0; + for my $name (@names) { + my $flag = shift @flags; + my $version = shift @versions; + if ($name eq $module_name) { + $found = 1; + + if (($flag & 0x8) && (($flag & (0x2+0x4)) == 0)) { + if (!($package_version eq $version)) { + print $rpm_file . q{: Package version `} . + $package_version . q{' differs from `} . + $module_name . q{' module version `} . + $version . q{'.} . "\n"; + } + last; + } else { + print $rpm_file . q{: `} . $module_name . + q{' in list of provides is not qualified (}; + printf '0x%x', $flag; + print q{) as equaled.} . "\n"; + } + } + } + + if ($found == 0) { + print $rpm_file . q{: missing `} . $module_name . + q{' in list of provides.} . "\n"; + } +} + +__END__ +=encoding utf8 + +=head1 NAME + +checkpackageversion - Check a RPM package version matches main Perl module +version + +=head1 SYNOPSIS + +checkpackageversion RPM_PACKAGE... + +It opens each RPM_PACKAGE, guesses a main Perl module from package name, finds +it in list of provides (e.g. perl-Foo-Bar → perl(Foo::Bar) and compares +versions. It reports any irregularities to standard output. + +Petr Písař + +=head1 COPYING + +Copyright (C) 2011 Petr Písař + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +=cut + diff --git a/clean-manifest.pl b/clean-manifest.pl new file mode 100644 index 0000000..6b7e162 --- /dev/null +++ b/clean-manifest.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl -w +use strict; + +my ($arch, $patfile, $infile, $outfile, $libdir, $thread_arch) = @ARGV; + +if (not $arch or not $patfile or not $infile or not $outfile or not $libdir) { + die "Usage: $0 arch thread_arch pattern-file in-file out-file libdir [ threadarch ]"; +} + +$thread_arch ||= ''; + +open IN, "<$infile" + or die "Can't open $infile: $!"; +open OUT, ">$outfile" + or die "Can't open $outfile: $!"; +open PATTERN, "<$patfile" + or die "Can't open $patfile: $!"; + +my @patterns = ; +chomp @patterns; +for my $p (@patterns) { + $p =~ s/%{_libdir}/$libdir/g; + $p =~ s/%{_arch}/$arch/g; + $p =~ s/%{thread_arch}/$thread_arch/g; +} + +my %exclude = map { $_ => 1 } @patterns; + +close PATTERN; + +while() { + chomp; + + print OUT "$_\n" + unless exists $exclude{$_} +} + +close IN; +close OUT; diff --git a/diffrpms b/diffrpms new file mode 100644 index 0000000..b3a6edc --- /dev/null +++ b/diffrpms @@ -0,0 +1,33 @@ +#!/bin/bash + +if [ "$#" != 2 ]; then + cat<= 1" dependencies string into ("A", "B >= 1") list. +sub appendsymbols { + my ($array, $line) = @_; + my $qualified; + my $dependency; + for my $token (split(/\s/, $line)) { + if ($token =~ /\A[<>]?=\z/) { + $qualified = 1; + $dependency .= ' ' . $token; + next; + } + if (!$qualified) { + if (defined $dependency) { + push @$array, $dependency; + } + $dependency = $token; + next; + } + if ($qualified) { + $qualified = 0; + $dependency .= ' ' . $token; + push @$array, $dependency; + $dependency = undef; + next; + } + } + if (defined $dependency) { + push @$array, $dependency; + } +} + +# Return true if the argument is a Perl dependency. Otherwise return false. +sub is_perl_dependency { + my $dependency = shift; + return ($dependency =~ /\Aperl\(/); +} + +my $file = shift @ARGV; +if (!defined $file) { + die "Missing an argument with an RPM build log!\n" +} + +# Parse build log +open(my $log, '<', $file) or die "Could not open `$file': $!\n"; +my ($package, %packages); +while (!eof($log)) { + defined($_ = <$log>) or die "Error while reading from `$file': $!\n"; + chomp; + + if (/\AProcessing files: ([\S]+)-[^-]+-[^-]+$/) { + $package = $1; + $packages{$package}{requires} = []; + $packages{$package}{provides} = []; + } elsif ($package && /\AProvides: (.*)\z/) { + appendsymbols($packages{$package}{provides}, $1); + } elsif ($package && /\ARequires: (.*)\z/) { + appendsymbols($packages{$package}{requires}, $1); + } +} +close($log); + +# Save dependencies into file +my $filename = 'gendep.macros'; +open (my $gendep, '>', $filename) or + die "Could not open `$filename' for writing: $!\n"; +for my $package (sort keys %packages) { + # Macro name + my $macro = 'gendep_' . $package; + $macro =~ s/[+-]/_/g; + $gendep->print("%global $macro \\\n"); + # Macro value + for my $dependency (@{$packages{$package}{requires}}) { + if (is_perl_dependency($dependency)) { + $gendep->print("Requires: $dependency \\\n"); + } + } + for my $dependency (@{$packages{$package}{provides}}) { + if (is_perl_dependency($dependency)) { + $gendep->print("Provides: $dependency \\\n"); + } + } + # Macro trailer + $gendep->print("%{nil}\n"); +} +close($gendep) or die "Could not close `$filename': $!\n"; + + +__END__ +=encoding utf8 + +=head1 NAME + +generatedependencies - Distil generated Perl dependencies from a build log + +=head1 SYNOPSIS + +B I + +=head1 DESCRIPTION + +It opens specified RPM build log I. It locates a protocol about +autogenerated dependencies. It stores the reported dependencies into F<./gendep.macros> file. + +The output file will define macros C>. A macro +for each binary package. The macro name will use underscores instead of +hyphens or other SPEC language special characters. + +It will ignore non-Perl dependencies (not C) as they do not come from +Perl dependency generator. + +=head1 EXIT CODE + +Returns zero, if no error occurred. Otherwise non-zero code is returned. + +=head1 EXAMPLE + +The invocation is: + + $ generatedependencies .build-5.24.0-364.fc25.log + +The output is: + + $ grep -A5 perl_Devel_Peek gendep.macros + %global gendep_perl_Devel_Peek \ + Requires: perl(Exporter) \ + Requires: perl(XSLoader) \ + Provides: perl(Devel::Peek) = 1.23 \ + %nil{} + %global gendep_perl_Devel_SelfStubber \ + + +The output can be used in a spec file like: + + Name: perl + Source0: gendep.macros + %include %{SOURCE0} + %package Devel-Peek + %gendep_Devel_Peek + %package Devel-SelfStubber + %gendep_Devel_SelfStubber + +=head1 COPYING + +Copyright (C) 2016 Petr Písař + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +=cut diff --git a/perl-5.26.2-Perl_my_setenv-handle-integer-wrap.patch b/perl-5.26.2-Perl_my_setenv-handle-integer-wrap.patch new file mode 100644 index 0000000..b30ff53 --- /dev/null +++ b/perl-5.26.2-Perl_my_setenv-handle-integer-wrap.patch @@ -0,0 +1,182 @@ +From c3ae24b135b28366330eb3dd4b8d61a0f0ee34d5 Mon Sep 17 00:00:00 2001 +From: David Mitchell +Date: Fri, 29 Jun 2018 13:37:03 +0100 +Subject: [PATCH] Perl_my_setenv(); handle integer wrap +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RT #133204 + +Wean this function off int/I32 and onto UV/Size_t. +Also, replace all malloc-ish calls with a wrapper that does +overflow checks, + +In particular, it was doing (nlen + vlen + 2) which could wrap when +the combined length of the environment variable name and value +exceeded around 0x7fffffff. + +The wrapper check function is probably overkill, but belt and braces... + +NB this function has several variant parts, #ifdef'ed by platform +type; I have blindly changed the parts that aren't compiled under linux. + +Petr Písař: Ported to 5.26.2 from upstream 34716e2a6ee commit. + +Signed-off-by: Petr Písař +--- + util.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 53 insertions(+), 23 deletions(-) + +diff --git a/util.c b/util.c +index 69763bc..1e0c95f 100644 +--- a/util.c ++++ b/util.c +@@ -2064,8 +2064,40 @@ Perl_new_warnings_bitfield(pTHX_ STRLEN *buffer, const char *const bits, + *(s+(nlen+1+vlen)) = '\0' + + #ifdef USE_ENVIRON_ARRAY +- /* VMS' my_setenv() is in vms.c */ ++ ++/* small wrapper for use by Perl_my_setenv that mallocs, or reallocs if ++ * 'current' is non-null, with up to three sizes that are added together. ++ * It handles integer overflow. ++ */ ++static char * ++S_env_alloc(void *current, Size_t l1, Size_t l2, Size_t l3, Size_t size) ++{ ++ void *p; ++ Size_t sl, l = l1 + l2; ++ ++ if (l < l2) ++ goto panic; ++ l += l3; ++ if (l < l3) ++ goto panic; ++ sl = l * size; ++ if (sl < l) ++ goto panic; ++ ++ p = current ++ ? safesysrealloc(current, sl) ++ : safesysmalloc(sl); ++ if (p) ++ return (char*)p; ++ ++ panic: ++ croak_memory_wrap(); ++} ++ ++ ++/* VMS' my_setenv() is in vms.c */ + #if !defined(WIN32) && !defined(NETWARE) ++ + void + Perl_my_setenv(pTHX_ const char *nam, const char *val) + { +@@ -2081,28 +2113,27 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val) + #ifndef PERL_USE_SAFE_PUTENV + if (!PL_use_safe_putenv) { + /* most putenv()s leak, so we manipulate environ directly */ +- I32 i; +- const I32 len = strlen(nam); +- int nlen, vlen; ++ UV i; ++ Size_t vlen, nlen = strlen(nam); + + /* where does it go? */ + for (i = 0; environ[i]; i++) { +- if (strnEQ(environ[i],nam,len) && environ[i][len] == '=') ++ if (strnEQ(environ[i], nam, nlen) && environ[i][nlen] == '=') + break; + } + + if (environ == PL_origenviron) { /* need we copy environment? */ +- I32 j; +- I32 max; ++ UV j, max; + char **tmpenv; + + max = i; + while (environ[max]) + max++; +- tmpenv = (char**)safesysmalloc((max+2) * sizeof(char*)); ++ /* XXX shouldn't that be max+1 rather than max+2 ??? - DAPM */ ++ tmpenv = (char**)S_env_alloc(NULL, max, 2, 0, sizeof(char*)); + for (j=0; j [], + 'ph_hosts' => [], + 'inet_domain' => undef, + 'time_hosts' => [], + 'daytime_hosts' => [], + 'smtp_hosts' => [], + 'test_exist' => 1, + 'test_hosts' => 1, + 'nntp_hosts' => [], + 'ftp_testhost' => undef, + 'snpp_hosts' => [], + 'ftp_int_passive' => 1, + 'ftp_ext_passive' => 1, +} diff --git a/perl.rpmlintrc b/perl.rpmlintrc new file mode 100644 index 0000000..669ede9 --- /dev/null +++ b/perl.rpmlintrc @@ -0,0 +1,3 @@ +from Config import * +addFilter("spelling-error .* (autoloaded|awk|gmtime|groff|libnet|localtime|Memoizing|metapackage|perlbug|perldoc|perlfunc|perlmain|perlpod|perlsub|reachability|rpmbuild|sed|splain|usr|writemain)"); +addFilter("unexpanded-macro %description .* %INC"); diff --git a/system-owned-directories b/system-owned-directories new file mode 100644 index 0000000..d9cadb4 --- /dev/null +++ b/system-owned-directories @@ -0,0 +1,7 @@ +%dir /usr +%dir /usr/bin +%dir /usr/lib +%dir /usr/share +%dir /usr/share/man +%dir /usr/share/man/man1 +%dir /usr/share/man/man3