diff --git a/scripts/lib/Devel/PatchPerl/Plugin/GitHubActions.pm b/scripts/lib/Devel/PatchPerl/Plugin/GitHubActions.pm index 608d06f3b..44d825e67 100644 --- a/scripts/lib/Devel/PatchPerl/Plugin/GitHubActions.pm +++ b/scripts/lib/Devel/PatchPerl/Plugin/GitHubActions.pm @@ -124,457 +124,472 @@ sub _ge { } sub _patch_db_file { - _patch(<<'PATCH'); ---- ext/DB_File/Makefile.PL -+++ ext/DB_File/Makefile.PL -@@ -1,42 +1,77 @@ --use strict; --use warnings; -+#! perl -w - --use ExtUtils::MakeMaker ; --use ExtUtils::Constant qw(WriteConstants); -+use strict ; -+use ExtUtils::MakeMaker 5.16 ; - use Config ; - -+die "DB_File needs Perl 5.004_05 or better. This is $]\n" -+ if $] <= 5.00404; -+ -+my $VER_INFO ; -+my $LIB_DIR ; -+my $INC_DIR ; -+my $DB_NAME ; -+my $LIBS ; -+my $COMPAT185 = "" ; -+ -+ParseCONFIG() ; -+ -+my @files = ('DB_File.pm', glob "t/*.t") ; -+UpDowngrade(@files); -+ -+if (defined $DB_NAME) -+ { $LIBS = $DB_NAME } -+else { -+ if ($^O eq 'MSWin32') -+ { $LIBS = $Config{cc} =~ /gcc/ ? '-ldb' : '-llibdb' } -+ else -+ { $LIBS = '-ldb' } -+} -+ -+# Solaris is special. -+#$LIBS .= " -lthread" if $^O eq 'solaris' ; -+ -+# AIX is special. -+$LIBS .= " -lpthread" if $^O eq 'aix' ; -+ - # OS2 is a special case, so check for it now. --my $OS2 = "-DOS2" if $Config{'osname'} eq 'os2' ; -+my $OS2 = "" ; -+$OS2 = "-DOS2" if $Config{'osname'} eq 'os2' ; - --my $LIB = "-ldb" ; --# so is win32 --$LIB = "-llibdb" if $^O eq 'MSWin32' ; -+my $WALL = '' ; -+#$WALL = ' -Wall '; - - WriteMakefile( - NAME => 'DB_File', -- LIBS => ["-L/usr/local/lib $LIB"], -- MAN3PODS => {}, # Pods will be built by installman. -- #INC => '-I/usr/local/include', -- VERSION_FROM => 'DB_File.pm', -- OBJECT => 'version$(OBJ_EXT) DB_File$(OBJ_EXT)', -+ LIBS => ["-L${LIB_DIR} $LIBS"], -+ INC => "-I$INC_DIR", -+ VERSION_FROM => 'DB_File.pm', -+ XS_VERSION => eval MM->parse_version('DB_File.pm'), - XSPROTOARG => '-noprototypes', -- DEFINE => $OS2 || "", -- INC => ($^O eq "MacOS" ? "-i ::::db:include" : ""), -- ((ExtUtils::MakeMaker->VERSION() gt '6.30') -- ? ('LICENSE' => 'perl') -- : () -+ DEFINE => "$OS2 $VER_INFO $COMPAT185 $WALL", -+ OBJECT => 'version$(OBJ_EXT) DB_File$(OBJ_EXT)', -+ ((ExtUtils::MakeMaker->VERSION() gt '6.30') -+ ? ('LICENSE' => 'perl') -+ : () - ), - ( -- $] >= 5.005 -- ? (ABSTRACT_FROM => 'DB_File.pm', -- AUTHOR => 'Paul Marquess ') -- : () -+ $] >= 5.005 -+ ? (ABSTRACT_FROM => 'DB_File.pm', -+ AUTHOR => 'Paul Marquess ') -+ : () - ), -+ - -- 'depend' => {'version$(OBJ_EXT)' => 'version.c'}, -- 'clean' => {FILES => 'constants.h constants.xs'}, -+ #OPTIMIZE => '-g', -+ 'depend' => { 'Makefile' => 'config.in', -+ 'version$(OBJ_EXT)' => 'version.c'}, -+ 'clean' => { FILES => 'constants.h constants.xs' }, -+ 'macro' => { INSTALLDIRS => 'perl', my_files => "@files" }, -+ 'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz', -+ DIST_DEFAULT => 'MyDoubleCheck tardist'}, - ); - -+ - my @names = qw( - BTREEMAGIC - BTREEVERSION -@@ -68,6 +103,7 @@ my @names = qw( - __R_UNUSED - ); - -+if (eval {require ExtUtils::Constant; 1}) { - # Check the constants above all appear in @EXPORT in DB_File.pm - my %names = map { $_, 1} @names; - open F, " 'DB_File', -- NAMES => \@names, -- C_FILE => 'constants.h', -- XS_FILE => 'constants.xs', -- ); -+ ExtUtils::Constant::WriteConstants( -+ NAME => 'DB_File', -+ NAMES => \@names, -+ C_FILE => 'constants.h', -+ XS_FILE => 'constants.xs', -+ -+ ); -+} -+else { -+ use File::Copy; -+ copy ('fallback.h', 'constants.h') -+ or die "Can't copy fallback.h to constants.h: $!"; -+ copy ('fallback.xs', 'constants.xs') -+ or die "Can't copy fallback.xs to constants.xs: $!"; -+} -+ -+exit; -+ -+ -+sub MY::libscan -+{ -+ my $self = shift ; -+ my $path = shift ; -+ -+ return undef -+ if $path =~ /(~|\.bak)$/ || -+ $path =~ /^\..*\.swp$/ ; -+ -+ return $path; -+} -+ -+ -+sub MY::postamble { <<'EOM' } ; -+ -+MyDoubleCheck: -+ @echo Checking config.in is setup for a release -+ @(grep "^LIB.*/usr/local/BerkeleyDB" config.in && \ -+ grep "^INCLUDE.*/usr/local/BerkeleyDB" config.in && \ -+ grep "^#DBNAME.*" config.in) >/dev/null || \ -+ (echo config.in needs fixing ; exit 1) -+ @echo config.in is ok -+ @echo -+ @echo Checking DB_File.xs is ok for a release. -+ @(perl -ne ' exit 1 if /^\s*#\s*define\s+TRACE/ ; ' DB_File.xs || \ -+ (echo DB_File.xs needs fixing ; exit 1)) -+ @echo DB_File.xs is ok -+ @echo -+ @echo Checking for $$^W in files: $(my_files) -+ @perl -ne ' \ -+ exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/;' $(my_files) || \ -+ (echo found unexpected $$^W ; exit 1) -+ @echo No $$^W found. -+ @echo -+ @echo Checking for 'use vars' in files: $(my_files) -+ @perl -ne ' \ -+ exit 0 if /^__(DATA|END)__/; \ -+ exit 1 if /^\s*use\s+vars/;' $(my_files) || \ -+ (echo found unexpected "use vars"; exit 1) -+ @echo No 'use vars' found. -+ @echo -+ @echo All files are OK for a release. -+ @echo -+ -+EOM -+ -+ -+ -+sub ParseCONFIG -+{ -+ my ($k, $v) ; -+ my @badkey = () ; -+ my %Info = () ; -+ my @Options = qw( INCLUDE LIB PREFIX HASH DBNAME COMPAT185 ) ; -+ my %ValidOption = map {$_, 1} @Options ; -+ my %Parsed = %ValidOption ; -+ my $CONFIG = 'config.in' ; -+ -+ print "Parsing $CONFIG...\n" ; -+ -+ # DBNAME & COMPAT185 are optional, so pretend they have -+ # been parsed. -+ delete $Parsed{'DBNAME'} ; -+ delete $Parsed{'COMPAT185'} ; -+ $Info{COMPAT185} = "No" ; -+ -+ -+ open(F, "$CONFIG") or die "Cannot open file $CONFIG: $!\n" ; -+ while () { -+ s/^\s*|\s*$//g ; -+ next if /^\s*$/ or /^\s*#/ ; -+ s/\s*#\s*$// ; -+ -+ ($k, $v) = split(/\s+=\s+/, $_, 2) ; -+ $k = uc $k ; -+ if ($ValidOption{$k}) { -+ delete $Parsed{$k} ; -+ $Info{$k} = $v ; -+ } -+ else { -+ push(@badkey, $k) ; -+ } -+ } -+ close F ; -+ -+ print "Unknown keys in $CONFIG ignored [@badkey]\n" -+ if @badkey ; -+ -+ # check parsed values -+ my @missing = () ; -+ die "The following keys are missing from $CONFIG file: [@missing]\n" -+ if @missing = keys %Parsed ; -+ -+ $INC_DIR = $ENV{'DB_FILE_INCLUDE'} || $Info{'INCLUDE'} ; -+ $LIB_DIR = $ENV{'DB_FILE_LIB'} || $Info{'LIB'} ; -+ $DB_NAME = $ENV{'DB_FILE_NAME'} || $Info{'DBNAME'} ; -+ $COMPAT185 = "-DCOMPAT185 -DDB_LIBRARY_COMPATIBILITY_API" -+ if (defined $ENV{'DB_FILE_COMPAT185'} && -+ $ENV{'DB_FILE_COMPAT185'} =~ /^\s*(on|true|1)\s*$/i) || -+ $Info{'COMPAT185'} =~ /^\s*(on|true|1)\s*$/i ; -+ my $PREFIX = $Info{'PREFIX'} ; -+ my $HASH = $Info{'HASH'} ; -+ -+ $VER_INFO = "-DmDB_Prefix_t=${PREFIX} -DmDB_Hash_t=${HASH}" ; -+ -+ print <) -+ { -+ print, last if /^__(END|DATA)__/ ; -+ -+ &{ $our_sub }(); -+ &{ $warn_sub }(); -+ print ; -+ } -+ -+ return if eof ; -+ -+ while (<>) -+ { print } -+} -+ -+# end of file Makefile.PL ---- /dev/null -+++ ext/DB_File/config.in -@@ -0,0 +1,97 @@ -+# Filename: config.in -+# -+# written by Paul Marquess -+# last modified 9th Sept 1997 -+# version 1.55 -+ -+# 1. Where is the file db.h? -+# -+# Change the path below to point to the directory where db.h is -+# installed on your system. -+ -+INCLUDE = /usr/local/BerkeleyDB/include -+#INCLUDE = /usr/local/include -+#INCLUDE = /usr/include -+ -+# 2. Where is libdb? -+# -+# Change the path below to point to the directory where libdb is -+# installed on your system. -+ -+LIB = /usr/local/BerkeleyDB/lib -+#LIB = /usr/local/lib -+#LIB = /usr/lib -+ -+# 3. What version of Berkely DB have you got? -+# -+# If you have version 2.0 or greater, you can skip this question. -+# -+# If you have Berkeley DB 1.78 or greater you shouldn't have to -+# change the definitions for PREFIX and HASH below. -+# -+# For older versions of Berkeley DB change both PREFIX and HASH to int. -+# Version 1.71, 1.72 and 1.73 are known to need this change. -+# -+# If you don't know what version you have have a look in the file db.h. -+# -+# Search for the string "DB_VERSION_MAJOR". If it is present, you -+# have Berkeley DB version 2 (or greater). -+# -+# If that didn't work, find the definition of the BTREEINFO typedef. -+# Check the return type from the prefix element. It should look like -+# this in an older copy of db.h: -+# -+# int (*prefix) __P((const DBT *, const DBT *)); -+# -+# and like this in a more recent copy: -+# -+# size_t (*prefix) /* prefix function */ -+# __P((const DBT *, const DBT *)); -+# -+# Change the definition of PREFIX, below, to reflect the return type -+# of the prefix function in your db.h. -+# -+# Now find the definition of the HASHINFO typedef. Check the return -+# type of the hash element. Older versions look like this: -+# -+# int (*hash) __P((const void *, size_t)); -+# -+# newer like this: -+# -+# u_int32_t /* hash function */ -+# (*hash) __P((const void *, size_t)); -+# -+# Change the definition of HASH, below, to reflect the return type of -+# the hash function in your db.h. -+# -+ -+PREFIX = size_t -+HASH = u_int32_t -+ -+# 4. Is the library called libdb? -+# -+# If you have copies of both 1.x and 2.x Berkeley DB installed on -+# your system it can sometimes be tricky to make sure you are using -+# the correct one. Renaming one (or creating a symbolic link) to -+# include the version number of the library can help. -+# -+# For example, if you have both Berkeley DB 2.3.12 and 1.85 on your -+# system and you want to use the Berkeley DB version 2 library you -+# could rename the version 2 library from libdb.a to libdb-2.3.12.a and -+# change the DBNAME line below to look like this: -+# -+# DBNAME = -ldb-2.3.12 -+# -+# That will ensure you are linking the correct version of the DB -+# library. -+# -+# Note: If you are building this module with Win32, -llibdb will be -+# used by default. -+# -+# If you have changed the name of the library, uncomment the line -+# below (by removing the leading #) and edit the line to use the name -+# you have picked. -+ -+#DBNAME = -ldb-2.4.10 -+ -+# end of file config.in -PATCH + my $fh; + chmod 0666, "ext/DB_File/Makefile.PL" or die "Can't chmod ext/DB_File/Makefile.PL: $!"; + open $fh, ">", "ext/DB_File/Makefile.PL" or die "Can't open ext/DB_File/Makefile.PL: $!"; + print $fh <<'MAKEFILE'; +#! perl -w + +use strict ; +use ExtUtils::MakeMaker 5.16 ; +use Config ; + +die "DB_File needs Perl 5.004_05 or better. This is $]\n" + if $] <= 5.00404; + +my $VER_INFO ; +my $LIB_DIR ; +my $INC_DIR ; +my $DB_NAME ; +my $LIBS ; +my $COMPAT185 = "" ; + +ParseCONFIG() ; + +my @files = ('DB_File.pm', glob "t/*.t") ; +UpDowngrade(@files); + +if (defined $DB_NAME) + { $LIBS = $DB_NAME } +else { + if ($^O eq 'MSWin32') + { $LIBS = $Config{cc} =~ /gcc/ ? '-ldb' : '-llibdb' } + else + { $LIBS = '-ldb' } +} + +# Solaris is special. +#$LIBS .= " -lthread" if $^O eq 'solaris' ; + +# AIX is special. +$LIBS .= " -lpthread" if $^O eq 'aix' ; + +# OS2 is a special case, so check for it now. +my $OS2 = "" ; +$OS2 = "-DOS2" if $Config{'osname'} eq 'os2' ; + +my $WALL = '' ; +#$WALL = ' -Wall '; + +WriteMakefile( + NAME => 'DB_File', + LIBS => ["-L${LIB_DIR} $LIBS"], + INC => "-I$INC_DIR", + VERSION_FROM => 'DB_File.pm', + XS_VERSION => eval MM->parse_version('DB_File.pm'), + XSPROTOARG => '-noprototypes', + DEFINE => "$OS2 $VER_INFO $COMPAT185 $WALL", + OBJECT => 'version$(OBJ_EXT) DB_File$(OBJ_EXT)', + ((ExtUtils::MakeMaker->VERSION() gt '6.30') + ? ('LICENSE' => 'perl') + : () + ), + ( + $] >= 5.005 + ? (ABSTRACT_FROM => 'DB_File.pm', + AUTHOR => 'Paul Marquess ') + : () + ), + + + #OPTIMIZE => '-g', + 'depend' => { 'Makefile' => 'config.in', + 'version$(OBJ_EXT)' => 'version.c'}, + 'clean' => { FILES => 'constants.h constants.xs' }, + 'macro' => { INSTALLDIRS => 'perl', my_files => "@files" }, + 'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz', + DIST_DEFAULT => 'MyDoubleCheck tardist'}, + ); + + +my @names = qw( + BTREEMAGIC + BTREEVERSION + DB_LOCK + DB_SHMEM + DB_TXN + HASHMAGIC + HASHVERSION + MAX_PAGE_NUMBER + MAX_PAGE_OFFSET + MAX_REC_NUMBER + RET_ERROR + RET_SPECIAL + RET_SUCCESS + R_CURSOR + R_DUP + R_FIRST + R_FIXEDLEN + R_IAFTER + R_IBEFORE + R_LAST + R_NEXT + R_NOKEY + R_NOOVERWRITE + R_PREV + R_RECNOSYNC + R_SETCURSOR + R_SNAPSHOT + __R_UNUSED + ); + +if (eval {require ExtUtils::Constant; 1}) { + # Check the constants above all appear in @EXPORT in DB_File.pm + my %names = map { $_, 1} @names; + open F, ") + { + last if /^\s*\@EXPORT\s+=\s+qw\(/ ; + } + + while () + { + last if /^\s*\)/ ; + /(\S+)/ ; + delete $names{$1} if defined $1 ; + } + close F ; + + if ( keys %names ) + { + my $missing = join ("\n\t", sort keys %names) ; + die "The following names are missing from \@EXPORT in DB_File.pm\n" . + "\t$missing\n" ; + } + + + ExtUtils::Constant::WriteConstants( + NAME => 'DB_File', + NAMES => \@names, + C_FILE => 'constants.h', + XS_FILE => 'constants.xs', + + ); +} +else { + use File::Copy; + copy ('fallback.h', 'constants.h') + or die "Can't copy fallback.h to constants.h: $!"; + copy ('fallback.xs', 'constants.xs') + or die "Can't copy fallback.xs to constants.xs: $!"; +} + +exit; + + +sub MY::libscan +{ + my $self = shift ; + my $path = shift ; + + return undef + if $path =~ /(~|\.bak)$/ || + $path =~ /^\..*\.swp$/ ; + + return $path; +} + + +sub MY::postamble { <<'EOM' } ; + +MyDoubleCheck: + @echo Checking config.in is setup for a release + @(grep "^LIB.*/usr/local/BerkeleyDB" config.in && \ + grep "^INCLUDE.*/usr/local/BerkeleyDB" config.in && \ + grep "^#DBNAME.*" config.in) >/dev/null || \ + (echo config.in needs fixing ; exit 1) + @echo config.in is ok + @echo + @echo Checking DB_File.xs is ok for a release. + @(perl -ne ' exit 1 if /^\s*#\s*define\s+TRACE/ ; ' DB_File.xs || \ + (echo DB_File.xs needs fixing ; exit 1)) + @echo DB_File.xs is ok + @echo + @echo Checking for $$^W in files: $(my_files) + @perl -ne ' \ + exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/;' $(my_files) || \ + (echo found unexpected $$^W ; exit 1) + @echo No $$^W found. + @echo + @echo Checking for 'use vars' in files: $(my_files) + @perl -ne ' \ + exit 0 if /^__(DATA|END)__/; \ + exit 1 if /^\s*use\s+vars/;' $(my_files) || \ + (echo found unexpected "use vars"; exit 1) + @echo No 'use vars' found. + @echo + @echo All files are OK for a release. + @echo + +EOM + + + +sub ParseCONFIG +{ + my ($k, $v) ; + my @badkey = () ; + my %Info = () ; + my @Options = qw( INCLUDE LIB PREFIX HASH DBNAME COMPAT185 ) ; + my %ValidOption = map {$_, 1} @Options ; + my %Parsed = %ValidOption ; + my $CONFIG = 'config.in' ; + + print "Parsing $CONFIG...\n" ; + + # DBNAME & COMPAT185 are optional, so pretend they have + # been parsed. + delete $Parsed{'DBNAME'} ; + delete $Parsed{'COMPAT185'} ; + $Info{COMPAT185} = "No" ; + + + open(F, "$CONFIG") or die "Cannot open file $CONFIG: $!\n" ; + while () { + s/^\s*|\s*$//g ; + next if /^\s*$/ or /^\s*#/ ; + s/\s*#\s*$// ; + + ($k, $v) = split(/\s+=\s+/, $_, 2) ; + $k = uc $k ; + if ($ValidOption{$k}) { + delete $Parsed{$k} ; + $Info{$k} = $v ; + } + else { + push(@badkey, $k) ; + } + } + close F ; + + print "Unknown keys in $CONFIG ignored [@badkey]\n" + if @badkey ; + + # check parsed values + my @missing = () ; + die "The following keys are missing from $CONFIG file: [@missing]\n" + if @missing = keys %Parsed ; + + $INC_DIR = $ENV{'DB_FILE_INCLUDE'} || $Info{'INCLUDE'} ; + $LIB_DIR = $ENV{'DB_FILE_LIB'} || $Info{'LIB'} ; + $DB_NAME = $ENV{'DB_FILE_NAME'} || $Info{'DBNAME'} ; + $COMPAT185 = "-DCOMPAT185 -DDB_LIBRARY_COMPATIBILITY_API" + if (defined $ENV{'DB_FILE_COMPAT185'} && + $ENV{'DB_FILE_COMPAT185'} =~ /^\s*(on|true|1)\s*$/i) || + $Info{'COMPAT185'} =~ /^\s*(on|true|1)\s*$/i ; + my $PREFIX = $Info{'PREFIX'} ; + my $HASH = $Info{'HASH'} ; + + $VER_INFO = "-DmDB_Prefix_t=${PREFIX} -DmDB_Hash_t=${HASH}" ; + + print <) + { + print, last if /^__(END|DATA)__/ ; + + &{ $our_sub }(); + &{ $warn_sub }(); + print ; + } + + return if eof ; + + while (<>) + { print } +} + +# end of file Makefile.PL +MAKEFILE + close $fh or die "Can't close ext/DB_File/Makefile.PL: $!"; + + open $fh, ">", "ext/DB_File/config.in" or die "Can't open ext/DB_File/config.in: $!"; + print $fh <<'CONFIG'; +# Filename: config.in +# +# written by Paul Marquess +# last modified 9th Sept 1997 +# version 1.55 + +# 1. Where is the file db.h? +# +# Change the path below to point to the directory where db.h is +# installed on your system. + +INCLUDE = /usr/local/BerkeleyDB/include +#INCLUDE = /usr/local/include +#INCLUDE = /usr/include + +# 2. Where is libdb? +# +# Change the path below to point to the directory where libdb is +# installed on your system. + +LIB = /usr/local/BerkeleyDB/lib +#LIB = /usr/local/lib +#LIB = /usr/lib + +# 3. What version of Berkely DB have you got? +# +# If you have version 2.0 or greater, you can skip this question. +# +# If you have Berkeley DB 1.78 or greater you shouldn't have to +# change the definitions for PREFIX and HASH below. +# +# For older versions of Berkeley DB change both PREFIX and HASH to int. +# Version 1.71, 1.72 and 1.73 are known to need this change. +# +# If you don't know what version you have have a look in the file db.h. +# +# Search for the string "DB_VERSION_MAJOR". If it is present, you +# have Berkeley DB version 2 (or greater). +# +# If that didn't work, find the definition of the BTREEINFO typedef. +# Check the return type from the prefix element. It should look like +# this in an older copy of db.h: +# +# int (*prefix) __P((const DBT *, const DBT *)); +# +# and like this in a more recent copy: +# +# size_t (*prefix) /* prefix function */ +# __P((const DBT *, const DBT *)); +# +# Change the definition of PREFIX, below, to reflect the return type +# of the prefix function in your db.h. +# +# Now find the definition of the HASHINFO typedef. Check the return +# type of the hash element. Older versions look like this: +# +# int (*hash) __P((const void *, size_t)); +# +# newer like this: +# +# u_int32_t /* hash function */ +# (*hash) __P((const void *, size_t)); +# +# Change the definition of HASH, below, to reflect the return type of +# the hash function in your db.h. +# + +PREFIX = size_t +HASH = u_int32_t + +# 4. Is the library called libdb? +# +# If you have copies of both 1.x and 2.x Berkeley DB installed on +# your system it can sometimes be tricky to make sure you are using +# the correct one. Renaming one (or creating a symbolic link) to +# include the version number of the library can help. +# +# For example, if you have both Berkeley DB 2.3.12 and 1.85 on your +# system and you want to use the Berkeley DB version 2 library you +# could rename the version 2 library from libdb.a to libdb-2.3.12.a and +# change the DBNAME line below to look like this: +# +# DBNAME = -ldb-2.3.12 +# +# That will ensure you are linking the correct version of the DB +# library. +# +# Note: If you are building this module with Win32, -llibdb will be +# used by default. +# +# If you have changed the name of the library, uncomment the line +# below (by removing the leading #) and edit the line to use the name +# you have picked. + +#DBNAME = -ldb-2.4.10 + +# end of file config.in +CONFIG + close $fh or die "Can't close ext/DB_File/config.in: $!"; } sub _patch_unixish {