diff --git a/fatunpack b/fatunpack new file mode 100644 index 0000000..0cc0652 --- /dev/null +++ b/fatunpack @@ -0,0 +1,114 @@ +#!/usr/bin/perl +use strict; +use warnings; +use File::Path; +use File::Spec; +use Getopt::Long; + +my $libdir = 'lib'; +my $filter = ''; + +GetOptions('libdir=s' => \$libdir, 'filter=s' => \$filter) or + die "Could not parse arguments\n"; +if ($filter eq '') { + # Empty pattern passes previous result by definition. Do not use it. + # Interpolared compilation is fixed in perl 5.18.0. RT#119095. + $filter = qr/(?:)/; +} +eval { $filter = qr{$filter}; 1} or + die "Could not compile filter as a regular expression: $@\n"; + +my ($file, $filename, $delimiter); +while (<>) { + if (/^\$fatpacked\{\s*"([^"]*)"\s*\}\s*=.*<<\s*'([^']*)'\s*;/) { + # Packed module beginning found + $filename = $1; + $delimiter = $2; + if ($filename =~ $filter) { + print STDERR "Extracting `$filename'\n"; + my $directory = (File::Spec->splitpath($filename))[1]; + File::Path::make_path(File::Spec->catfile($libdir, $directory)); + if ($file) { + die "Unballanced fat-packed module at line $.\n"; + } + open($file, '>', File::Spec->catfile($libdir, $filename)) or + die "Could not create `", + File::Spec->catfile($libdir, $filename), "': $!\n"; + } else { + print STDERR "Removing `$filename'\n"; + } + } elsif (defined $delimiter and /^\Q$delimiter\E$/) { + # Packed module end found + if (defined $file) { + close($file) or + die "Could not close `", + File::Spec->catfile($libdir, $filename), "': $!\n"; + $file = undef; + } + $filename = undef; + $delimiter = undef; + } elsif (defined $file) { + # Packed module to extract + s/^ //; # de-escape recursive here-documents + print $file $_; + } elsif (! defined $delimiter) { + # Rest of code to output + print STDOUT $_; + } +} + +__END__ + +=encoding utf8 + +=head1 NAME + +fatunpack - Unpacker for App::FatPacker packets + +=head1 SYNOPSYS + +fatunpack [OPTION…] [PACKED_SCRIPT…] + +=head1 DESCRIPTION + +This tool unpacks scripts packed with App::FatPacker. + +Packed script's file names are specified as positional arguments. If no +argument is given, a script from standard intput will be processed. + +The content of packed script stripped of all bundled modules is written to +standard output. + +=head1 OPTIONS + +=over 8 + +=item B<--libdir DIRECTORY> + +Directory to output unpacked modules to that where bundled into the input +script. Default value is C. + +=item B<--filter REGULAR_EXPRESSION> + +Save only modules whose file name matches the B. The file +names are compared without B<--libdir> prefix. The expession is not anchored +by default. Empty expression matches any file name. Default value is empty +regular expression, i.e. to save all modules. + +=back + +=head1 VERSION + +This is version 2. + +=head1 COPYRIGHT + +Copyright © 2013, 2014 Petr Písař . + +=head1 LICENSE + +This is free software. You may redistribute copies of it under the terms of +the GNU General Public License L. +There is NO WARRANTY, to the extent permitted by law. + +=cut diff --git a/perl-App-cpanminus.spec b/perl-App-cpanminus.spec index 1efde1f..5c2f28e 100644 --- a/perl-App-cpanminus.spec +++ b/perl-App-cpanminus.spec @@ -1,8 +1,8 @@ %define perl_major_ver %(eval `perl -V:version`; echo ${version%*.[0-9]*}.0) Name: perl-App-cpanminus -Version: 1.7044 -Release: 2mamba +Version: 1.7046 +Release: 1mamba Summary: cpanm - get, unpack build and install modules from CPAN Group: System/Libraries/Perl Vendor: openmamba @@ -10,11 +10,11 @@ Distribution: openmamba Packager: Silvan Calarco URL: https://www.cpan.org/ Source: https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-%{version}.tar.gz +Source1: fatunpack License: GPL, Artistic ## AUTOBUILDREQ-BEGIN BuildRequires: libperl -BuildRequires: perl(App::cpanminus::Dependency) -BuildRequires: perl(String::ShellQuote) +BuildRequires: perl-String-ShellQuote BuildRequires: perl-devel ## AUTOBUILDREQ-END BuildRequires: perl >= 2:5.36.0 @@ -26,7 +26,17 @@ cpanm - get, unpack build and install modules from CPAN. %prep %setup -q -n App-cpanminus-%{version} +# Unbundle fat-packed modules +podselect lib/App/cpanminus.pm > lib/App/cpanminus.pod + +for F in bin/cpanm lib/App/cpanminus/fatscript.pm; do + %{SOURCE1} --libdir lib --filter '^App/cpanminus' "$F" > "${F}.stripped" + perl -c -Ilib "${F}.stripped" + mv "${F}.stripped" "$F" +done + %build +export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps %{__perl} Makefile.PL PREFIX=%{_prefix} INSTALLDIRS=vendor OPTIMIZE="%{optflags}" %make @@ -52,10 +62,11 @@ done %files -f .packlist %defattr(-,root,root) %doc LICENSE -## note: eventually add the remaining documents (if any) -# %doc README %changelog +* Wed Apr 19 2023 Silvan Calarco 1.7046-1mamba +- update to 1.7046 + * Mon Apr 17 2023 Sdk Build System 1.7044-2mamba - rebuilt with perl 5.36.0