Unbundle all modules
This commit is contained in:
parent
af6b06db33
commit
05a090766e
114
fatunpack
Executable file
114
fatunpack
Executable file
@ -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*'([^']*)'\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<lib>.
|
||||||
|
|
||||||
|
=item B<--filter REGULAR_EXPRESSION>
|
||||||
|
|
||||||
|
Save only modules whose file name matches the B<REGULAR_EXPRESSION>. 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 1.
|
||||||
|
|
||||||
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
|
Copyright © 2013 Petr Písař <ppisar@redhat.com>.
|
||||||
|
|
||||||
|
=head1 LICENSE
|
||||||
|
|
||||||
|
This is free software. You may redistribute copies of it under the terms of
|
||||||
|
the GNU General Public License L<http://www.gnu.org/licenses/gpl.html>.
|
||||||
|
There is NO WARRANTY, to the extent permitted by law.
|
||||||
|
|
||||||
|
=cut
|
@ -1,72 +1,114 @@
|
|||||||
Name: perl-App-cpanminus
|
Name: perl-App-cpanminus
|
||||||
Version: 1.6927
|
Version: 1.6927
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: Get, unpack, build and install CPAN modules
|
Summary: Get, unpack, build and install CPAN modules
|
||||||
License: GPL+ or Artistic
|
License: GPL+ or Artistic
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
URL: http://search.cpan.org/dist/App-cpanminus/
|
URL: http://search.cpan.org/dist/App-cpanminus/
|
||||||
Source0: http://www.cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-%{version}.tar.gz
|
Source0: http://www.cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-%{version}.tar.gz
|
||||||
|
Source1: fatunpack
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
BuildRequires: %{_bindir}/podselect
|
||||||
BuildRequires: perl
|
BuildRequires: perl
|
||||||
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.30
|
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.30
|
||||||
# Tests:
|
BuildRequires: perl(File::Path)
|
||||||
|
BuildRequires: perl(File::Spec)
|
||||||
|
BuildRequires: perl(Getopt::Long)
|
||||||
BuildRequires: perl(strict)
|
BuildRequires: perl(strict)
|
||||||
|
BuildRequires: perl(warnings)
|
||||||
|
# Run-time:
|
||||||
|
# Nothing special. The tests are very poor. But we run perl -c at built-time
|
||||||
|
# to check for correct unpacking. So we need non-optional run-time
|
||||||
|
# dependencies at build-time too:
|
||||||
|
BuildRequires: perl(aliased)
|
||||||
|
BuildRequires: perl(Config)
|
||||||
|
BuildRequires: perl(constant)
|
||||||
|
# CPAN::DistnameInfo not needed for compilation
|
||||||
|
# CPAN::Meta not needed for copmilation
|
||||||
|
# CPAN::Meta::Check not needed for compilation
|
||||||
|
# CPAN::Meta::Prereqs not needed for compilation
|
||||||
|
BuildRequires: perl(CPAN::Meta::Requirements)
|
||||||
|
# CPAN::Meta::YAML not needed for compilation
|
||||||
|
BuildRequires: perl(Cwd)
|
||||||
|
# Digest::SHA not needed for compilation
|
||||||
|
BuildRequires: perl(File::Basename)
|
||||||
|
BuildRequires: perl(File::Copy)
|
||||||
|
BuildRequires: perl(File::Find)
|
||||||
|
# File::pushd not needed for compilation
|
||||||
|
BuildRequires: perl(File::Temp)
|
||||||
|
# HTTP::Tiny not needed for compilation
|
||||||
|
# local::lib not needed for compilation
|
||||||
|
# JSON::PP not needed for compilation
|
||||||
|
# Module::CPANfile not needed for compilation
|
||||||
|
# Module::CoreList not needed for compilation
|
||||||
|
# Module::Metadata not needed for compilation
|
||||||
|
BuildRequires: perl(Parse::CPAN::Meta)
|
||||||
|
# Safe not needed for compilation
|
||||||
|
BuildRequires: perl(String::ShellQuote)
|
||||||
|
BuildRequires: perl(Symbol)
|
||||||
|
BuildRequires: perl(version)
|
||||||
|
# version::vpp not needed for compilation
|
||||||
|
BuildRequires: perl(warnings::register)
|
||||||
|
# YAML not needed for compilation
|
||||||
|
# Tests:
|
||||||
BuildRequires: perl(Test::More)
|
BuildRequires: perl(Test::More)
|
||||||
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
|
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
|
||||||
# Required by bin/cpanm
|
# Current dependency generator cannot parse compressed code. Use PPI to find
|
||||||
Requires: perl(base)
|
# them, and list them manually:
|
||||||
Requires: perl(Carp)
|
Requires: perl(aliased)
|
||||||
|
# Archive::Tar is optional
|
||||||
|
# Archive::Zip is optional
|
||||||
|
# Compress::Zlib is optional
|
||||||
|
Requires: perl(Config)
|
||||||
Requires: perl(constant)
|
Requires: perl(constant)
|
||||||
# CPAN::DistnameInfo bundled
|
Requires: perl(CPAN::DistnameInfo)
|
||||||
# CPAN::Meta not used
|
Requires: perl(CPAN::Meta)
|
||||||
# CPAN::Meta::Check bundled
|
Requires: perl(CPAN::Meta::Check)
|
||||||
# CPAN::Meta::Converter bundled
|
Requires: perl(CPAN::Meta::Prereqs)
|
||||||
# CPAN::Meta::Feature bundled
|
Requires: perl(CPAN::Meta::Requirements)
|
||||||
# CPAN::Meta::History bundled
|
Requires: perl(CPAN::Meta::YAML)
|
||||||
# CPAN::Meta::Prereqs bundled
|
|
||||||
# CPAN::Meta::Requirements bundled
|
|
||||||
# CPAN::Meta::Spec bundled
|
|
||||||
# CPAN::Meta::Validator bundled
|
|
||||||
# CPAN::Meta::YAML bundled
|
|
||||||
Requires: perl(Cwd)
|
Requires: perl(Cwd)
|
||||||
Requires: perl(Digest::SHA)
|
Requires: perl(Digest::SHA)
|
||||||
Requires: perl(Encode)
|
|
||||||
# Exporter bundled
|
|
||||||
# Exporter::Heavy bundled
|
|
||||||
Requires: perl(ExtUtils::Install) >= 1.46
|
Requires: perl(ExtUtils::Install) >= 1.46
|
||||||
Requires: perl(ExtUtils::MakeMaker) >= 6.31
|
Requires: perl(ExtUtils::MakeMaker) >= 6.31
|
||||||
|
Requires: perl(File::Basename)
|
||||||
|
Requires: perl(File::Copy)
|
||||||
|
Requires: perl(File::Find)
|
||||||
|
# File::HomeDir is optional
|
||||||
Requires: perl(File::Path)
|
Requires: perl(File::Path)
|
||||||
# File::pushd bundled
|
Requires: perl(File::pushd)
|
||||||
Requires: perl(File::Spec)
|
Requires: perl(File::Spec)
|
||||||
|
Requires: perl(File::Temp)
|
||||||
Requires: perl(Getopt::Long)
|
Requires: perl(Getopt::Long)
|
||||||
# HTTP getter by LWP::UserAgent or wget or curl or HTTP::Tiny
|
# HTTP getter by LWP::UserAgent or wget or curl or HTTP::Tiny
|
||||||
# HTTP::Tiny bundled
|
Requires: perl(HTTP::Tiny)
|
||||||
Requires: perl(IO::File)
|
Requires: perl(JSON::PP)
|
||||||
Requires: perl(IO::Socket)
|
Requires: perl(local::lib)
|
||||||
# JSON::PP bundled
|
# LWP::UserAgent is optional
|
||||||
# lib::core::only not used
|
# LWP::Protocol::https is optional
|
||||||
# local::lib bundled
|
|
||||||
Requires: perl(Math::BigFloat)
|
|
||||||
Requires: perl(Math::BigInt)
|
|
||||||
Requires: perl(Module::Build)
|
Requires: perl(Module::Build)
|
||||||
|
Requires: perl(Module::CPANfile)
|
||||||
Requires: perl(Module::CoreList)
|
Requires: perl(Module::CoreList)
|
||||||
# Module::CPANfile bundled
|
Requires: perl(Module::Metadata)
|
||||||
# Module::Metadata bundled
|
# Module::Signature is optional
|
||||||
Requires: perl(Module::Signature)
|
Requires: perl(Parse::CPAN::Meta)
|
||||||
# Parse::CPAN::Meta bundled
|
|
||||||
Requires: perl(Safe)
|
Requires: perl(Safe)
|
||||||
Requires: perl(Scalar::Util)
|
Requires: perl(String::ShellQuote)
|
||||||
Requires: perl(Time::Local)
|
Requires: perl(Symbol)
|
||||||
# version bundled
|
Requires: perl(version)
|
||||||
# version::vpp bundled
|
Requires: perl(version::vpp)
|
||||||
|
# Win32 not used
|
||||||
Requires: perl(YAML)
|
Requires: perl(YAML)
|
||||||
|
Provides: perl(App::cpanminus) = %{version}
|
||||||
# XXX: Keep Provides: cpanminus to allow `yum install cpanminus' instead of
|
# XXX: Keep Provides: cpanminus to allow `yum install cpanminus' instead of
|
||||||
# longer `yum install perl-App-cpanminus'.
|
# longer `yum install perl-App-cpanminus'.
|
||||||
Provides: cpanminus = %{version}-%{release}
|
Provides: cpanminus = %{version}-%{release}
|
||||||
Obsoletes: cpanminus <= 1.2002
|
Obsoletes: cpanminus <= 1.2002
|
||||||
|
|
||||||
# Do not require/export in-place modules
|
# Filter under-specified dependencies
|
||||||
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(App::cpanminus::script\\)$
|
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\(App::cpanminus\\)$
|
||||||
|
# Filter private modules
|
||||||
|
%global __provides_exclude %{__provides_exclude}|^perl\\(ModuleBuildSkipMan\\)
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Why? It's dependency free, requires zero configuration, and stands alone
|
Why? It's dependency free, requires zero configuration, and stands alone
|
||||||
@ -75,6 +117,11 @@ scripting. When running, it requires only 10 MB of RAM.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n App-cpanminus-%{version}
|
%setup -q -n App-cpanminus-%{version}
|
||||||
|
# Unbundle fat-packed modules
|
||||||
|
podselect lib/App/cpanminus.pm > lib/App/cpanminus.pod
|
||||||
|
%{SOURCE1} --libdir lib --filter '^App/cpanminus' bin/cpanm >bin/cpanm.stripped
|
||||||
|
perl -c -Ilib bin/cpanm.stripped
|
||||||
|
mv bin/cpanm{.stripped,}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
perl Makefile.PL INSTALLDIRS=vendor
|
perl Makefile.PL INSTALLDIRS=vendor
|
||||||
@ -96,6 +143,9 @@ make test
|
|||||||
%{_bindir}/cpanm
|
%{_bindir}/cpanm
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Sep 11 2013 Petr Pisar <ppisar@redhat.com> - 1.6927-3
|
||||||
|
- Unbundle all modules (bug #907464)
|
||||||
|
|
||||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6927-2
|
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6927-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user