Accepting request 238610 from devel:languages:perl
- fix one more require - fix provides/obsoletes of cpanm - borrow fedora's solution to unpack the fat script into its dependencies OBS-URL: https://build.opensuse.org/request/show/238610 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/perl-App-cpanminus?expand=0&rev=3
This commit is contained in:
commit
a370f1e65f
114
fatunpack
Normal file
114
fatunpack
Normal 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*;/) {
|
||||
# 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 2.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright © 2013, 2014 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,3 +1,18 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 25 11:25:40 UTC 2014 - coolo@suse.com
|
||||
|
||||
- fix one more require
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 23 14:30:19 UTC 2014 - coolo@suse.com
|
||||
|
||||
- fix provides/obsoletes of cpanm
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 17 06:35:21 UTC 2014 - coolo@suse.com
|
||||
|
||||
- borrow fedora's solution to unpack the fat script into its dependencies
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Jun 8 10:08:03 UTC 2014 - coolo@suse.com
|
||||
|
||||
|
@ -24,7 +24,8 @@ Summary: get, unpack, build and install modules from CPAN
|
||||
License: Artistic-1.0 or GPL-1.0+
|
||||
Group: Development/Libraries/Perl
|
||||
Url: http://search.cpan.org/dist/App-cpanminus/
|
||||
Source: http://www.cpan.org/authors/id/M/MI/MIYAGAWA/%{cpan_name}-%{version}.tar.gz
|
||||
Source0: http://www.cpan.org/authors/id/M/MI/MIYAGAWA/%{cpan_name}-%{version}.tar.gz
|
||||
Source1: http://pkgs.fedoraproject.org/cgit/perl-App-cpanminus.git/plain/fatunpack
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: perl
|
||||
@ -36,6 +37,78 @@ Requires: perl(ExtUtils::Install) >= 1.46
|
||||
Requires: perl(ExtUtils::MakeMaker) >= 6.31
|
||||
Requires: perl(Module::Build) >= 0.36
|
||||
%{perl_requires}
|
||||
# MANUAL
|
||||
# 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(Config)
|
||||
BuildRequires: perl(aliased)
|
||||
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
|
||||
# Dumpvalue not needed for compilation
|
||||
# ExtUtils::Manifest 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
|
||||
# JSON::PP not needed for compilation
|
||||
# local::lib not needed for compilation
|
||||
# Module::CoreList not needed for compilation
|
||||
# Module::CPANfile not needed for compilation
|
||||
# Module::Metadata not needed for compilation
|
||||
BuildRequires: perl(Parse::CPAN::Meta)
|
||||
# POSIX not needed for compilation
|
||||
# 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)
|
||||
# Current dependency generator cannot parse compressed code. Use PPI to find
|
||||
# them, and list them manually:
|
||||
# Archive::Tar is optional
|
||||
# Archive::Zip is optional
|
||||
# Compress::Zlib is optional
|
||||
Requires: perl(CPAN::DistnameInfo)
|
||||
Requires: perl(CPAN::Meta)
|
||||
Requires: perl(CPAN::Meta::Check)
|
||||
Requires: perl(CPAN::Meta::Prereqs)
|
||||
Requires: perl(CPAN::Meta::YAML)
|
||||
Requires: perl(Digest::SHA)
|
||||
Requires: perl(ExtUtils::Install) >= 1.46
|
||||
Requires: perl(ExtUtils::MakeMaker) >= 6.31
|
||||
Requires: perl(ExtUtils::Manifest)
|
||||
# File::HomeDir is optional
|
||||
Requires: perl(File::pushd)
|
||||
# HTTP getter by LWP::UserAgent or wget or curl or HTTP::Tiny
|
||||
Requires: perl(HTTP::Tiny)
|
||||
Requires: perl(local::lib)
|
||||
# LWP::Protocol::https is optional
|
||||
# LWP::UserAgent is optional
|
||||
Requires: perl(Module::Build)
|
||||
Requires: perl(Module::CPANfile)
|
||||
Requires: perl(Module::CoreList)
|
||||
Requires: perl(Module::Metadata)
|
||||
# Module::Signature is optional
|
||||
Requires: perl(String::ShellQuote)
|
||||
# Win32 not used
|
||||
Requires: perl(YAML)
|
||||
|
||||
Provides: cpanm = %{version}-%{release}
|
||||
Obsoletes: cpanm <= 1.5010
|
||||
|
||||
%description
|
||||
cpanminus is a script to get, unpack, build and install modules from CPAN
|
||||
@ -47,6 +120,15 @@ and stands alone. When running, it requires only 10MB of RAM.
|
||||
%prep
|
||||
%setup -q -n %{cpan_name}-%{version}
|
||||
find . -type f -print0 | xargs -0 chmod 644
|
||||
# MANUAL
|
||||
# Unbundle fat-packed modules
|
||||
podselect lib/App/cpanminus.pm > lib/App/cpanminus.pod
|
||||
|
||||
for F in bin/cpanm lib/App/cpanminus/fatscript.pm; do
|
||||
perl %{SOURCE1} --libdir lib --filter '^App/cpanminus' "$F" > "${F}.stripped"
|
||||
perl -c -Ilib "${F}.stripped"
|
||||
mv "${F}.stripped" "$F"
|
||||
done
|
||||
|
||||
%build
|
||||
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
||||
|
Loading…
Reference in New Issue
Block a user