rpm-build-perl-0.82/0000755000076400007640000000000012031433716012100 5ustar atatrpm-build-perl-0.82/fake.pm0000644000076400007640000000250310762170527013353 0ustar atatpackage fake; use strict; # UPDATE: this actually won't help to autoconf, because `use' statements # are executed at compile time. So this file is basically a mistake. :) # from autoconf_2.5.spec: # %define __spec_autodep_custom_pre export autom4te_perllibdir=%buildroot%_datadir/%realname%suff # # from /usr/bin/autoheader-2.5: # BEGIN # { # my $datadir = $ENV{'autom4te_perllibdir'} || '/usr/share/autoconf-2.5'; # unshift @INC, "$datadir"; # } # use Autom4te::ChannelDefs; # use Autom4te::Channels; # use Autom4te::Configure_ac; # use Autom4te::FileUtils; # use Autom4te::General; # use Autom4te::XFile; # # The problem is that whenever autoconf is getting built, modules from # /usr/share/autoconf-2.5 of already installed autoconf package are used # instead of those in %buildroot. # # To solve this @INC should be reordered at INIT stage, so that %buildroot # directories take precedence. # # Typical invocation: # perl -Mfake -MO=Deparse $RPM_BUILD_ROOT/usr/bin/autoheader-2.5 sub adjusted_inc { my @inc; foreach my $path (grep { /^\// } @INC) { push @inc, "$ENV{RPM_BUILD_ROOT}$path" unless index($path, $ENV{RPM_BUILD_ROOT}) == 0 and grep { $_ eq "$ENV{RPM_BUILD_ROOT}$path" } @inc; push @inc, $path unless grep { $_ eq $path } @inc; } return @inc; } INIT { @INC = adjusted_inc() if $ENV{RPM_BUILD_ROOT}; } 1; rpm-build-perl-0.82/perl5-alt-rpm-macros0000644000076400007640000000775111525467232015727 0ustar atat%_perl_req_method normal %set_perl_req_method() %global _perl_req_method %* #_perl_lib_path %nil %add_perl_lib_path() %global _perl_lib_path %{?_perl_lib_path} %* # perl library paths %perl_vendor_privlib %(eval "`%__perl -V:installvendorlib`"; echo "$installvendorlib") %perl_vendor_archlib %(eval "`%__perl -V:installvendorarch`"; echo "$installvendorarch") %perl_vendor_autolib %perl_vendor_archlib/auto # MDK compatibility %perl_vendorlib %perl_vendor_privlib %perl_vendorarch %perl_vendor_archlib %makeinstall_std %make_install install DESTDIR=%buildroot # build with the same optimization as perl %perl_vendor_optflags %(eval "`%__perl -V:optimize`"; echo "$optimize") # automate various rpmbuild stages # MM stands for ExtUtils::MakeMaker # MB stands for Module::Build # %%build helpers %perl_vendor_build \ _perl_vendor_MB_build() { \ : writing Build script \ %__perl Build.PL installdirs=vendor "$@" =$v\\n" }' \\\ -e 'while (my ($k, $v) = each %%{$$req{recommends}}) { print "perl($k)>=$v\\n" }' | tee .perl.req \ : running Build script \ %__perl Build \ %{?!_without_test:%{?!_disable_test:: running tests; LD_BIND_NOW=1 PERL_DL_NONLAZY=1 %__perl Build test %{?_enable_debug:test_verbose=1}}} \ } \ _perl_vendor_MM_build() { \ %{?_without_smp:NPROCS=1; : NOTE: SMP-incompatible} \ %{?_disable_smp:NPROCS=1; : NOTE: SMP-incompatible} \ : looking for PREREQ dependencies \ %__perl Makefile.PL PRINT_PREREQ=1 "$@" ldtest.c \ gcc -Wl,--no-as-needed ldtest.c ${LD_LIBRARY_PATH:+-L$LD_LIBRARY_PATH} -lperl $BLIBS $EXTRA_BLIBS \ LD_BIND_NOW=1 ./a.out \ rm -f ldtest.c ./a.out \ } \ perl_vendor_build() { \ export PERL_EXTUTILS_AUTOINSTALL="${PERL_EXTUTILS_AUTOINSTALL:---skip}" \ export XSUBPP_STATIC_XS=${XSUBPP_STATIC_XS:-1} \ _perl_vendor_fixin \ if %__grep -qs -Ew '(dist|module)_name' Build.PL; then \ _perl_vendor_MB_build "$@" \ else \ _perl_vendor_MM_build "$@" \ fi \ #_perl_vendor_check_dso \ } \ perl_vendor_build # %%install helpers %perl_vendor_install \ _perl_vendor_MB_install() { \ : installing \ %__perl Build install destdir=%buildroot installdirs=vendor "$@" &2; then \ %__grep -F 'perl(' .perl.req >>%buildroot/.perl.req; fi \ } \ perl_vendor_install() { \ if %__grep -qs -Ew '(dist|module)_name' Build.PL; then \ _perl_vendor_MB_install "$@" \ else \ _perl_vendor_MM_install "$@" \ fi \ _perl_vendor_check_buildroot \ _perl_vendor_save_prereq \ } \ perl_vendor_install # sugar %perl_fix_local %__subst -p 's,/usr/local\\>,/usr,g' %CPAN() http://search.cpan.org/dist/%1/%nil rpm-build-perl-0.82/perl.req0000755000076400007640000002474612031423354013570 0ustar atat#!/usr/bin/perl use strict; use Config qw(%Config); use PerlReq::Utils qw(argv inc explode mod2dep path2dep); sub pod2usage { eval { require Pod::Usage } or die $@; goto &Pod::Usage::pod2usage; } use Getopt::Long 2.24 qw(GetOptions :config gnu_getopt); GetOptions "m|method=s" => \my $Method, "v|verbose+" => \my $Verbose, "h|help" => sub { pod2usage("00") } or pod2usage(2); $Verbose = 2 if $ENV{RPM_SCRIPTS_DEBUG}; $Method ||= $ENV{RPM_PERL_REQ_METHOD} || "normal"; $Method =~ s/\s//g; $Method eq "strict" || $Method eq "normal" || $Method eq "relaxed" || pod2usage("$0: invalid method $Method"); $| = 1; my @Skip = ( # qr(/usr/share/doc/), # qr(/[Dd]emos?/), # qr(/examples?/), qr(\bOS2|OS2\b), qr(\bMacPerl|\bMac\b), qr(\bMacOS|MacOS\b), qr(\bMacOSX|MacOSX\b), qr(\bvmsish\b), qr(\bVMS|VMS\b), qr(\bWin32|Win32\b), qr(\bCygwin|Cygwin\b), ); sub prereq_pm { my %prereq; my $dir = $ENV{RPM_BUILD_ROOT} || "."; open my $fh, "$dir/.perl.req" or return; warn "# processing $dir/.perl.req\n" if $Verbose; local $_ = join "" => grep /^perl[(]/ => <$fh>; while (s/\bperl[(]([\w:]+)[)]>=([v\d._]+)//) { my $dep = mod2dep($1); my $ver = $2; if ($ver) { use B qw(svref_2object); use PerlReq::Utils qw(sv_version); $ver = sv_version(svref_2object(\$ver)); } if ($ver) { use PerlReq::Utils qw(verf); $ver = verf($ver); warn "#\t$dep >= $ver\n" if $Verbose; $prereq{$dep}{$ver} = undef; } else { warn "#\t$dep\n" if $Verbose; $prereq{$dep} ||= undef; } } return %prereq; } # list of requires my %req; # modules outside established module path my %weak_prov; # process PRINT_PREREQ output my %prereq = prereq_pm(); # begin process_file($_) foreach argv(); sub process_file { my $fname = shift; my ($prefix, $basename) = explode($fname); if (not $prefix and $fname =~ /\.p[lmh]$/) { local $_ = $fname; s#^\Q$ENV{RPM_BUILD_ROOT}\E/*##g if $ENV{RPM_BUILD_ROOT}; $weak_prov{path2dep($_)} = $fname while s#.+?/##; } if ($Method ne "strict" and $basename and grep { $basename =~ $_ } @Skip) { warn "# $fname (builtin SKIP)\n"; return; } warn "# processing $fname\n" if $Verbose > 1; do_deparse($fname) and return; # deparse failed, handle errors if ($Method eq "relaxed") { warn "# $fname: deparse failed, but I don't care.\n"; return; } elsif ($Method eq "strict") { die "# $fname: deparse failed.\n"; } # we are not quite sure this is perl file unless ($prefix) { my $v = isPerl($fname); die "# $fname: deparse failed. isPerl=$v.\n" if $v > 0; warn "# $fname: deparse failed, isPerl=$v, ok.\n"; return; } # it's a module, try to recover goto bad if $Method eq "strict"; # find out a `superclass' and try to use it # examples: # Math::BigInt::CalcEmu implies Math::BigInt loaded # Pod::Perldoc::ToMan implies Pod::Perldoc loaded # Tk::Event::IO implies Tk::Event loaded # ... # bytes_heavy.pl implies bytes.pm loaded # my $super = $basename; $super =~ s/\//::/g and $super =~ s/(.+)::.*/$1/ or $super =~ s/(.+)_\w+\.pl$/$1/ or goto bad; warn "# $fname: deparse failed, trying to recover with -M$super\n"; my $ok2 = do_deparse($fname, "-M$super"); goto bad unless $ok2; return; bad: die "# $fname: deparse failed. prefix=$prefix\n"; } sub shebang_options { my $fname = shift; open my $fh, $fname or die "$0: $fname: $!\n"; local $_ = <$fh>; my @argv; if (s/^#!\s*\S*perl\S*//) { foreach my $arg (split) { last if $arg =~ /^#/; next if $arg eq "--"; push @argv, $arg; } } elsif (m[^#!\s*/bin/sh(\s|$)]) { # check for "perl -x" re-exec hack my $maybe_x; while (<$fh>) { # this is just a standard way to re-exec perl: last if /^eval\s+'exec\s/; if (/\bexec\s.*\bperl.*\s-x/) { $maybe_x = 1; } elsif ($maybe_x and s/^#!\s*\S*perl\S*//) { push @argv, "-x"; foreach my $arg (split) { last if $arg =~ /^#/; next if $arg eq "--"; push @argv, $arg; } last; } } } return @argv; } sub do_deparse { my ($fname, @add_arguments) = @_; # skip "syntax OK" messages # use Fcntl qw(F_SETFD); # fcntl(STDERR, F_SETFD, 1) if !$Debug && $Method eq 'relaxed'; # construct pipe command my $X = $^X; if ($ENV{RPM_BUILD_ROOT}) { # what if we build perl itself? # find deps with newer perl in order to avoid incompatible changes for my $perl ($^X, $Config{perlpath}, "/usr/bin/perl") { next unless $perl and -x "$ENV{RPM_BUILD_ROOT}$perl"; $X = "$ENV{RPM_BUILD_ROOT}$perl"; last; } # adjust LD_LIBRARY_PATH if there are libraries inside buildroot # spotted by Yury Konovalov for my $libdir ("/usr/lib64", "/usr/lib") { next unless glob "$ENV{RPM_BUILD_ROOT}$libdir/lib*.so*"; $ENV{LD_LIBRARY_PATH} .= ":" if $ENV{LD_LIBRARY_PATH}; $ENV{LD_LIBRARY_PATH} .= "$ENV{RPM_BUILD_ROOT}$libdir"; } } my @pipe = ($X, shebang_options($fname)); # known problems and workarounds: # - /usr/lib/rpm/base.pm apparently fixes possible dependency loops with base.pm # that make syntax check impossible; affected packages: perl-Tk, perl-Video-DVDRip # See also: # http://www.google.com/search?q="base.pm+and+eval"&filter=0 # http://www.google.com/search?q="base.pm+import+stuff"&filter=0 # - /usr/lib/rpm/fake.pm (preloaded with `use') rearranges @INC entries so that # fake %buildroot-dependent paths takes precedence at INIT stage; # affected packages: autoconf push @pipe, "-I/usr/lib/rpm", "-Mfake" if $Method ne "strict"; push @pipe, map { "-I$_" } inc(); push @pipe, "-MO=ConstOptree"; my $MO = "-MO=PerlReq"; $MO .= ",-$Method" if $Method ne "normal"; $MO .= ",-verbose" if $Verbose; $MO .= ",-debug" if $Verbose > 1; push @pipe, @add_arguments, $MO, "--", $fname; warn "# pipe: @pipe\n" if $Verbose > 1; # do deparse use 5.007_001; # the list form of open() for pipes open my $pipe, "-|", @pipe or die "$0: @pipe: $!\n"; local $_; while (<$pipe>) { my ($dep, undef, $v) = split; unless ($dep =~ /^perl\b/) { warn "# invalid dep: $_\n"; next; } if ($v) { $req{$dep}{$v} = undef; } else { $req{$dep} ||= undef; } } # flush buffers 1 while <$pipe>; return close $pipe; } # end foreach my $k (sort { uc($a) cmp uc($b) } keys %req) { if ($weak_prov{$k}) { warn "# $k internally povided by $weak_prov{$k}\n"; next; } my %ver = map { $_ ? %$_ : () } $req{$k}, $prereq{$k}; if (%ver) { print "$k >= $_\n" foreach sort { $a <=> $b } keys %ver; } else { print "$k\n"; } } # auxiliary stuff sub count($$) { warn "# @_\n" if $Verbose > 1; } sub isPerl { my $fname = shift; chomp $fname; open(FILE, $fname) || die "$0: $fname: $!\n"; warn "# checking if $fname is perl source\n" if $Verbose; # shortcut for non-text files return -1 unless -T FILE; local $_ = join "" => ; close FILE; my ($n, @n); # POSITIVE # variables @n = /\W[\$\%\@](?!Id[\$:])\w+/g; count @n, "variables"; $n += @n; # comments @n = /^\s*#/gm; count @n, "comments"; $n += @n; # blocks @n = /[}{]$|^\s*[}{]/gm; count @n, "blocks"; $n += @n; # keywords @n = /\b(unless|foreach|package|sub|use|strict)\b/gm; count @n, "keywords"; $n += @n; # pod @n = /^=(?:back|begin|cut|end|for|head|item|over|pod)/gm; count @n, "pod sections"; $n += @n; # modules @n = /^1;$/gm; count @n, "`1;'"; $n += @n; # NEGATIVE # prolog @n = /:-/g; count @n, "prolog :- operators"; $n -= @n; # prolog @n = /\![.,]$/gm; count @n, "prolog ! operators"; $n -= @n; # prolog @n = /\[\]/g; count @n, "prolog [] empty lists"; $n -= @n; # prolog @n = /(?:^|\s)%\s/gm; count @n, "prolog % comments"; $n -= @n; # prolog @n = /\(.*\)\.$/gm; count @n, "prolog ). EOF"; $n -= @n; # overall density $n /= (-s $fname) + 1; } __END__ =head1 NAME perl.req - list requirements for Perl scripts and libraries =head1 SYNOPSIS B [B<-h>|B<--help>] [B<-v>|B<--verbose>] [B<-m>|B<--method>=I|I|I] [I...] =head1 DESCRIPTION B calculates prerequisites for each Perl source I specified on a command line; alternatively, a list of files is obtained from standard input, one file per line. C, C and C statements are processed. The output of perl.req is suitable for automatic dependency tracking (e.g. for RPM packaging). For example, F requires, in particular, C<< perl(Fcntl.pm) >= 1.030 >> (as of perl-5.8.6). B is basically a wrapper for L Perl compiler backend. =head1 OPTIONS =over =item B<-m>, B<--method>=I Use particular I for dependency tracking. Alternatively, RPM_PERL_REQ_METHOD environement variable can be used to set the method. The following methods are available: =over =item B Search thoroughly and list all requirements. In particular, list platform-specific (non-UNIX) requirements and requirements found inside C blocks. =item B (default) Enable moderate search most acceptable for RPM packaging. That is, skip files known to be platform-specific; skip platform-specific requirements and those found inside C blocks; skip most common requirements (e.g. C). =item B Enable relaxed mode. That is, tolerate B::PerlReq failures; in addition to normal method, skip conditional requirements (e.g. C statements inside subroutines); skip C statements; list only essential dependencies. =back =item B<-v>, B<--verbose> Increase verbosity. =back =head1 AUTHOR Written by Alexey Tourbin , based on an earlier version by Ken Estes , with contributions from Mikhail Zabaluev . =head1 HISTORY Initial version of perl.req (part of RPM 3.0) done by Ken Estes in 1999. Regular expressions were used to extract dependencies. (Later a part of ALT Linux Master 2.0, with modifications from Mikhail Zabaluev.) Reworked in November 2002: complicated regular expressions were added to enhance search; methods added. (Later a part of ALT Linux Master 2.2.) Reworked in September 2003: L was utilized to re-format Perl code before dependency extraction; hence more simple and accurate. Decoupled from rpm-build package into rpm-build-perl. (Later a part of ALT Linux Master 2.4.) Reworked in December 2004: L was developed. Released on CPAN, see L. =head1 COPYING Copyright (c) 2003, 2004 Alexey Tourbin, ALT Linux Team. This is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. =head1 SEE ALSO L, L rpm-build-perl-0.82/perl.prov0000755000076400007640000001371011655066264013772 0ustar atat#!/usr/bin/perl use 5.006; use strict; use PerlReq::Utils qw(argv explode inc mod2path path2mod path2dep sv_version verf); sub pod2usage { eval { require Pod::Usage } or die $@; goto &Pod::Usage::pod2usage; } use Getopt::Long 2.24 qw(GetOptions :config gnu_getopt); GetOptions "v|verbose+" => \my $Verbose, "h|help" => sub { pod2usage("00") } or pod2usage(2); $Verbose = 2 if $ENV{RPM_SCRIPTS_DEBUG}; $| = 1; # list of provides my %prov; # begin process_file($_) foreach argv(); sub process_file { my $fname = shift; warn "# processing $fname\n" if $Verbose > 1; my ($prefix, $basename) = explode($fname); unless ($prefix) { warn "# $fname does not match any prefix\n" if $Verbose > 1; return; } else { warn "# $fname has prefix $prefix\n" if $Verbose > 1; } if ($fname =~ /\.p[lh]$/) { $prov{$basename}{prov} = 1; warn "# $fname has basename $basename\n" if $Verbose; return; } elsif ($basename =~ /\.pm$/) { $prov{$basename}{prov} = 1; warn "# $fname has basename $basename, checking version\n" if $Verbose; } elsif ($basename =~ /\.(al|ix)$/) { warn "# $fname (autoloaded file SKIP)" if $Verbose > 1; return; } elsif ($basename =~ /\.pod$/) { warn "# $fname (pod file SKIP)" if $Verbose > 1; return; } else { warn "# $fname has basename $basename (SKIP)\n"; return; } my $cur_pkg = my $pkg0 = "main"; my $pkg1; my $re_pkg = qr/\b\w+(?:::\w+)*/; open my $fh, $fname or die "$0: $fname: $!\n"; local $_; while (<$fh>) { chomp; next if /^\s*#/; next if /^=\w/ .. (/^=cut/ or eof); last if /^__(DATA|END)__\b/; s/\s+#\s.*//; # strip comments if (/^(\s*\{?\s*)package\s+($re_pkg)\s*;/) { if ($1) { # block package $cur_pkg = $pkg1 = $2; } else { # toplevel package $cur_pkg = $pkg0 = $2; undef $pkg1; } warn "# package $cur_pkg at $fname line $.\n" if $Verbose > 1; next; } elsif (/^}/ && $pkg1) { warn "# back from $pkg1 to $pkg0 at $fname line $.\n" if $Verbose > 1; $cur_pkg = $pkg0; undef $pkg1; } /\$(?:($re_pkg)::)?VERSION\s*\)?\s*=/ or next; # it's a version assignemnt my $pkg = $1; my $val = $'; if ($pkg and mod2path($pkg) ne $basename) { warn "# saw \$$pkg\::VERSION at $fname line $. (SKIP)\n"; next; } if (not $pkg and mod2path($cur_pkg) ne $basename) { warn "# saw \$VERSION in package $cur_pkg at $fname line $. (SKIP)\n"; next; } if ($val =~ /\b\d|\d\./) { # there's a version number # strip e.g. use vars qw($VERSION) s/\buse\s+vars\b[^;]*;//; # check next line if it has e.g. $VERSION = eval $VERSION if ((my $next_line = <$fh>) =~ /\bVERSION\b.*=/) { chomp $next_line; $_ .= "\n" . $next_line; } my $v = extract_version($fname, $_, $pkg); $prov{$basename}{ver}{$v} = 1 if $v; last; } elsif ($val =~ /\$($re_pkg)::VERSION\s*;/) { # holy Jesus! they assign the version from another package warn "# saw \$VERSION reference to \$$1::VERSION at $fname line $.\n" if $Verbose; my $basename2 = mod2path($1); $prov{$basename}{ver} = $prov{$basename2}{ver} ||= {}; $prov{$basename}{vref} = $basename2; last; } else { warn "# VERSION assignment not recognized at $fname line $. (SKIP)\n"; warn "# $_\n"; } } } # end foreach my $k (sort { uc($a) cmp uc($b) } keys %prov) { next unless $prov{$k}{prov}; my @v = sort keys %{$prov{$k}{ver}||{}}; if (not @v and my $k2 = $prov{$k}{vref}) { my $m1 = path2mod($k); my $m2 = path2mod($k2); warn "# unresolved reference from \$$m1\::VERSION to \$$m2\::VERSION\n"; } if (@v) { print path2dep($k) . " = $_\n" for @v; } else { print path2dep($k) . "\n"; } } sub extract_version { my ($fname, $line, $pkg) = @_; warn "# extracting version at line $.:\n# $line\n" if $Verbose > 1; my $code = "$line\n; \$VERSION"; $code =~ s/\$\Q$pkg\E::VERSION/\$VERSION/g if $pkg; if ($code =~ s/\buse\s+version\b[^;]*;//g or $code =~ /\bqv\b/ or $code =~ /\bversion(?:::)?->new\b/ or $code =~ /\bnew\s+version\b/) { package Sandbox; eval "use version"; warn $@ if $@; } my $version = do { package Sandbox; no strict; eval $code; }; goto bad if not $version; use B qw(svref_2object); my $v = sv_version(svref_2object(\$version)); if ($v) { $v = verf($v); warn "# VERSION $v at $fname line $.\n" if $Verbose; return $v; } bad: warn "# WARNING: failed to extract version at $fname line $.:\n"; warn "# $line\n"; warn "# $@\n" if $@; return; } __END__ =head1 NAME perl.prov - list what Perl source files provide =head1 SYNOPSIS B [B<-v>|B<--verbose>] [I...] =head1 DESCRIPTION This script calculates conventional name for each Perl source I specified on a command line, based on its location relative to standard Perl library paths; alternatively, a list of files is obtained from standard input, one file per line. F<*.pm>, F<*.pl>, and F<*.ph> files are processed (F<*.pm> files also suffer version extraction). The output of perl.prov is suitable for automatic dependency tracking (e.g. for RPM packaging). For example, F provides C (as of perl-5.8.6). perl.prov is a counterpart of L. =head1 OPTIONS =over =item B<-v>, B<--verbose> Increase verbosity. =back The RPM_PERL_LIB_PATH environment variable, if set, must contain the list of paths, separated by colons. These paths are considered as library paths used to determine relative names of provided perl files (in addition to paths from C<@INC> variable). =head1 AUTHOR Written by Alexey Tourbin , based on an earlier version by Ken Estes , with contributions from Mikhail Zabaluev . =head1 COPYING Copyright (c) 2003, 2004, 2006, 2007, 2008 Alexey Tourbin, ALT Linux Team. This is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. =head1 SEE ALSO L rpm-build-perl-0.82/perl.clean0000755000076400007640000000071611656645701014070 0ustar atat#!/bin/sh -eu PROG="${0##*/}" cd "${RPM_BUILD_ROOT:?}" set -- ./usr/*/perl5/ [ -d "$1" ] || exit 0 find "$@" -type f -name .packlist -exec \ rm -fv -- '{}' '+' find "$@" -type f -name \*.bs -size 0 -exec \ rm -fv -- '{}' '+' once= find "$@" -type f -name \*.bs | while read -r f; do [ -n "$once" ] || echo "WARNING: $PROG: non-empty *.bs file(s) found:" echo " $f" once=1 done >&2 find "$@" -type f -name perllocal.pod -exec \ rm -fv -- '{}' '+' rpm-build-perl-0.82/rpm-build-perl.spec0000644000076400007640000003255512031433673015623 0ustar atatName: rpm-build-perl Version: 0.82 Release: alt1 Summary: RPM helper scripts to calculate Perl dependencies License: GPL Group: Development/Other URL: %CPAN %name Source: %name-%version.tar.gz # Automatically added by buildreq on Thu Nov 17 2011 BuildRequires: perl-Encode-JP perl-Encode-KR perl-Filter perl-Try-Tiny perl-devel %description These herlper scripts will look at perl source files in your package, and will use this information to generate automatic Requires and Provides tags for the package. %prep %setup -q %build %perl_vendor_build %install %perl_vendor_install INSTALLSCRIPT=%_rpmlibdir INSTALLVENDORSCRIPT=%_rpmlibdir mv %buildroot%perl_vendor_archlib/fake.pm %buildroot%_rpmlibdir/ mkdir -p %buildroot/etc/rpm/macros.d cp -p perl5-alt-rpm-macros %buildroot/etc/rpm/macros.d/perl5 cp -p macros.env %buildroot/etc/rpm/macros.d/perl5.env %files %doc README.ALT %_rpmlibdir/perl.req %_rpmlibdir/perl.req.files %_rpmlibdir/perl.prov %_rpmlibdir/perl.prov.files %_rpmlibdir/perl.clean %_rpmlibdir/fake.pm %dir %perl_vendor_archlib/B %perl_vendor_archlib/B/Walker.pm %perl_vendor_archlib/B/ConstOptree.pm %perl_vendor_archlib/B/PerlReq.pm %perl_vendor_archlib/B/Clobbers.pm %dir %perl_vendor_autolib/B %dir %perl_vendor_autolib/B/ConstOptree %perl_vendor_autolib/B/ConstOptree/ConstOptree.so %dir %perl_vendor_archlib/PerlReq %perl_vendor_archlib/PerlReq/Utils.pm %config /etc/rpm/macros.d/perl5 %config /etc/rpm/macros.d/perl5.env %changelog * Sat Sep 29 2012 Alexey Tourbin 0.82-alt1 - B/ConstOptree.pm: new module, implements optree constant folding for $^O, $^V, and $] variables by installing custom PL_check hooks - B/PerlReq.pm: now handles if.pm import routine * Mon Sep 10 2012 Vladimir Lettiev 0.81-alt1 - updated test suite for perl-5.16 * Sat Nov 19 2011 Alexey Tourbin 0.80-alt1 - B/PerlReq.pm: IO::File->new(\$var, ...) requires PerlIO::scalar * Fri Nov 18 2011 Alexey Tourbin 0.79-alt1 - B/PerlReq.pm: unify func/method processing via entersub - B/PerlReq.pm: improved import method handling with list args - B/PerlReq.pm: improved 'my $_' handler introduced in 0.78 - B/PerlReq.pm: stacked filetests require perl >= 5.10 - B/PerlReq.pm: treat Try::Tiny::try() like eval * Mon Nov 14 2011 Alexey Tourbin 0.78-alt1 - MANIFEST: added perl.clean * Thu Nov 10 2011 Alexey Tourbin 0.77-alt1 - PerlReq/Utils.pm: handle quoted-string versions by upgrading them to version.pm object, according to post-perl-5.8 rules - B/PerlReq.pm: handle "use parent" import routine like that of "use base" - B/PerlReq.pm: recognize and make deps on perl-5.10 syntactic features * Fri Oct 21 2011 Alexey Tourbin 0.76-alt1 - updated test suite for perl-5.14 - B/Walker.pm: invoke optree handlers only with non-zero line number, to ignore the code generated by PERL5OPT and command line switches - perl.clean: factored from /usr/lib/rpm/brp-cleanup - perl.clean: do not die on non-emtpy *.bs files - perl.clean: also remove perllocal.pod files * Thu Oct 06 2011 Alexey Tourbin 0.75-alt1 - perl.{req,prov}.files: ignore */auto/share/{dist,module}/* - B/PerlReq.pm: bumped minimum autodep perl version 5.6 -> 5.10 * Sat Feb 12 2011 Alexey Tourbin 0.74-alt1 - B/PerlReq.pm: added warnings.pm to @Skip list * Mon Nov 15 2010 Vladimir Lettiev 0.73-alt2 - fixed fatal error in walk_gv() when method CV return not B::CV class object (Closes: #24564) * Mon Sep 20 2010 Alexey Tourbin 0.73-alt1 - updated for perl-5.12: - perl.req, perl.prov: relax dependency on Pod::Usage - perl.prov: use plain eval insted of Safe->reval - perl.prov: \Q stopped working without closing \E - macros: removed UNINST=undef - macros: removed OTHERLDFLAGS='-lperl -lpthread' - macros: removed INSTALLMAN1DIR= and INSTALLMAN3DIR= - macros: removed %%perl_vendor_man1dir and %%perl_vendor_man3dir * Tue Apr 20 2010 Alexey Tourbin 0.72-alt1 - B/PerlReq.pm: implemented support for Moose::with() * Sun Sep 27 2009 Alexey Tourbin 0.71-alt1 - PerlReq/Utils.pm: fixed RPM_PERL_LIB_PATH for whitespaces (ALT#21701) * Mon May 11 2009 Alexey Tourbin 0.70-alt1 - B/Walker.pm: new module, implements optree traversal - B/Clobbers.pm: new experimental module, for checking global variables - PerlReq/Utils.pm: updated version formatting algorithm for better precision; the most general version format for rpm dependencies is now d.ddd.ddd * Tue Mar 24 2009 Alexey Tourbin 0.6.8-alt3 - macros (_perl_vendor_check_dso): disabled this check * Tue Mar 24 2009 Alexey Tourbin 0.6.8-alt2 - macros (_perl_vendor_check_dso): gcc -Wl,--no-as-needed * Fri May 09 2008 Alexey Tourbin 0.6.8-alt1 - perl.prov: try to detect block-level packages, fixes MP3/Tag.pm version * Sat Mar 01 2008 Alexey Tourbin 0.6.7-alt1 - B/PerlReq.pm (grok_import): silence numerical warning * Wed Nov 21 2007 Alexey Tourbin 0.6.6-alt1 - perl.req (isPerl): use plain -T test instead of non-ascii char counter - perl.{req,prov}.files: use perl's -T test to recheck non-text files * Sun Sep 30 2007 Alexey Tourbin 0.6.5-alt1 - perl.req: implemented support for "perl -x" re-exec hack (fixes cvs2cl.pl) - perl.req: implemented self-requires elimination for modules outside established path, cf. ALT bug #7315 * Thu Sep 06 2007 Alexey Tourbin 0.6.4-alt1 - made a few fixes for a special case `use Module 0==0', which is internally translated into `Module->import(PL_sv_yes)' and should yield `perl(Module) >= 1.0' dependency; this also fixes a regression introduced in previous release - B/PerlReq.pm: in $SIG{__DIE__} handler, resort to Carp::cluck() without checking $^S (checking $^S is unreliable since O.pm uses eval) - resolved some test suite issues (hopefully should pass on perl-5.9.5) * Fri Aug 17 2007 Alexey Tourbin 0.6.3-alt1 - perl.req.files: fixed "text" pattern for file(1) - B/PerlReq.pm: fixed bug in prevDepF logic - macros.d/perl5: + when doing Build.PL, parse _build/prereqs and dump .perl.req + better check for valid Build.PL (must have "dist_name" or "module_name") - PerlReq/Utils.pm: updated sv_version() algorithm, cf. perlbug 32967 - perl.prov: + implemented initial support for version.pm + when version assignment is found, check next line if it has e.g. '$VERSION = eval $VERSION' + strip "use vars" statement before eval, fixes perl-Mozilla-LDAP * Wed Mar 28 2007 Alexey Tourbin 0.6.2-alt1 - B/PerlReq.pm: + fixed Carp::confess syntax problem (rt.cpan.org #22512, reported by Steve Peters); actually removed Carp::confess and added $^S check + added Cygwin pattern to OS-specific dependencies + grok_version: do nothing unless version is set, so that the code like 'Module->VERSION()', which yields Module version, does not produce dependency on the Module + enhanced `use encoding ...' and PerlIO dependency detection - updated test suite for recent perl-5.8 snapshot - added new files, for possible use with future rpm-build releases: + perl.req.files (perl.prov.files) - will select perl files for req/prov + /etc/rpm/macros.d/perl.env - piece of rpm-build scriplets' preamble + also placed a few rpm-build perl macros to /etc/rpm/macros.d/perl * Mon Oct 23 2006 Alexey Tourbin 0.6.1-alt1 - imported sources into git repo, which is available at git://git.altlinux.org/people/at/packages/rpm-build-perl.git - fixed test suite for recent perl-5.8.x snapshot - perl.{req,prov}: added pod2usage; removed --debug option, use -vv - perl.prov: implemented limited support for `$VERSION = $Other::VERSION' * Wed Jun 07 2006 Alexey Tourbin 0.6.0-alt1 - B/PerlReq.pm: + major internal cleanup + a sketch for event-driven optree analysis blah-blah-blah + changed rules for dependencies found in BEGIN blocks: - never list ones that have not been loaded according to %%INC, except for 'use autouse qw(Module)' case - always list loaded ones (there's no easy way to find out if it's been loaded by another module; I tried @INC hook + DB::DB debugger trap but it didn't work) + two-fold speedup - macros.d/perl5: + export PERL_EXTUTILS_AUTOINSTALL=--skip + OTHERLDFLAGS="-lperl -lpthread $EXTRA_LIBS" ("full linkage") - removed %_rpmlibdir/base.pm * Fri Jun 17 2005 Alexey Tourbin 0.5.2-alt2 - B/PerlReq.pm: enhanced PerlIO dependency tracking - B/Perlreq.pm: dbmopen() requires AnyDBM_File.pm - macros.d/perl5: export XSUBPP_STATIC_XS=1 -- this will make some XS functions static (experimental, perl-5.8.7-alt2) * Thu Jun 02 2005 Alexey Tourbin 0.5.2-alt1 - fixed various perl-5.8.7 build issues - bumped version and released on CPAN * Fri Apr 15 2005 Alexey Tourbin 0.5.1-alt5 - B/PerlReq.pm: track require_version() calls - perl.req: restrict LD_LIBRARY_PATH to /usr/lib64 and /usr/lib * Wed Apr 06 2005 Alexey Tourbin 0.5.1-alt4 - B/PerlReq.pm: track PerlIO dependencies for "open" and "binmode" - perl.prov: allow more opcodes for Safe->reval * Wed Mar 16 2005 Alexey Tourbin 0.5.1-alt3 - %name.spec: use the same %_prefix/lib/rpm directory on x86_64 - perl.prov: decrease verbosity when processing *.al files - macros.d/perl5: preserve timestamps when making test * Thu Dec 23 2004 Alexey Tourbin 0.5.1-alt2 - perl.req: explode() was not imported * Wed Dec 22 2004 Alexey Tourbin 0.5.1-alt1 - released on CPAN (see %url) - perl.prov: workaround perl bug #32967 - added partial support for relative paths - restored OS2 pattern in skip lists (Andrei Bulava, #5713) - enhanced error handling and debugging output * Mon Dec 06 2004 Alexey Tourbin 0.5-alt1 - bumped version (0.3 -> 0.5) to reflect major changes - implemented B::PerlReq and made perl.req use it instead of B::Deparse - new PerlReq::Utils module (convertion and formatting routines) - version numbers now rounded to 3 digits after decimal point - v-string versions now treated as floats (e.g. 1.2.3 -> 1.002) - all dependencies on particular perl version converted to 1:5.x.y form - enabled version extraction from PREREQ_PM in Makefile.PL - wrote/updated/enhanced documentation, started README.ALT - started test suite (more than 50 tests) - downgraded perl requirements to 5.6.0 * Thu Jul 01 2004 Alexey Tourbin 0.3-alt1.1 - perl.req: removed duplicating code - macros.d/perl: fixed quoting * Sun Jun 20 2004 Alexey Tourbin 0.3-alt1 - macros.d/perl: + MDK compatibility: added %%perl_vendor{lib,arch} directories + build: fix sharpbang magic lines (with a weired sed expression) + MM_install: don't fake PREFIX, rather specify DESTDIR (for gimp-perl) - perl.req: + adjust LD_LIBRARY_PATH for libraries inside buildroot (Yury Konovalov) + implemented tracker for dependencies like `use base qw(Foo Bar)' * Sat May 08 2004 Alexey Tourbin 0.2-alt5 - macros.d/perl: added build/install support for Module::Build * Wed Apr 28 2004 Alexey Tourbin 0.2-alt4 - perl.req: + s/use v5.8.0/use v5.8.1/ (to stop questions, it's all about B::Deparse) + don't simply require perl-base (don't bloat out, it's in basesystem) - macros.d/perl + don't remove comments produced by autosplit (line numbering lost) + drop PRINT_PREREQ stuff for a while * Thu Feb 26 2004 Alexey Tourbin 0.2-alt3 - perl.req: try to recover with -M$superclass on failures - perl.prov: enhanced version detection * Mon Dec 22 2003 Alexey Tourbin 0.2-alt2.2 - yet another hot fix * Thu Dec 18 2003 Alexey Tourbin 0.2-alt2.1 - yet another hot fix * Thu Dec 18 2003 Alexey Tourbin 0.2-alt2 - don't produce dependencies on fake.pm * Wed Dec 17 2003 Alexey Tourbin 0.2-alt1 - fake.pm introduced (@INC entries rearrangement) - perl.prov manpage introduced - various fixes * Tue Nov 04 2003 Alexey Tourbin 0.1-alt8 - perl.req: + use $RPM_BUILD_ROOT%_bindir/perl whenever available (experimental, makes it possible to build incompatible perl) - macros.d/perl5 + check for undefined symbols added + turned macro arguments into shell function arguments + %%CPAN macro added for easy URLs * Thu Oct 09 2003 Alexey Tourbin 0.1-alt7 - perl.req: + counter of perl variables in isPerl() fixed + prolog detection enhanced * Tue Oct 07 2003 Alexey Tourbin 0.1-alt6 - perl.req: + isPerl(): try to detect non-perl files (in particular, Polish and Prolog *.pl files) and allow failures even in normal mode + PRINT_PREREQ dependencies used only in strict mode * Fri Oct 03 2003 Alexey Tourbin 0.1-alt5 - perl.req: strip comments in shebang * Sun Sep 28 2003 Alexey Tourbin 0.1-alt4 - base.pm hacked and placed into %_rpmlibdir in order to avoid some weird syntax-check problems * Fri Sep 26 2003 Alexey Tourbin 0.1-alt3 - handling of #!perl command line options implemented * Tue Sep 23 2003 Alexey Tourbin 0.1-alt2 - /etc/rpm/macros.d/perl5 moved here from perl-devel package - fixed RPM_PERL_LIB_PATH processing * Thu Sep 18 2003 Alexey Tourbin 0.1-alt1 - the package spawned from rpm-build - fixed handling of taint-mode scripts - perl.req(1) manual page created rpm-build-perl-0.82/README0000644000076400007640000000100112031433052012741 0ustar atatrpm-build-perl version 0.82 B::PerlReq - Perl compiler backend to extract Perl dependencies perl.req - list requirements for Perl scripts and libraries perl.prov - list what Perl source files provide Copyright (c) 2003, 2004, 2006, 2007, 2008, 2010, 2011, 2012 Alexey Tourbin This 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 2 of the License, or (at your option) any later version. rpm-build-perl-0.82/perl.prov.files0000755000076400007640000000176611577223175015102 0ustar atat#!/bin/sh -efu # # Copyright (c) 2007 Alexey Tourbin, ALT Linux Team. # # 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 2 of the License, or # (at your option) any later version. # # This is /usr/lib/rpm/find-provides filter. It reads << file -NF$'\t' >> # output and decides which files should be processed with perl.prov. # while IFS=$'\t' read -r f t; do case "$f" in */auto/share/dist/*) continue ;; */auto/share/module/*) continue ;; esac case "$f" in *.pm | *.pl | *.ph ) ;; *) continue ;; esac case "$t" in *" text"*) echo "$f" ;; # file(1) check for text files is not quite reliable # I use perl for '-T $f' heuristic check (see perlfunc for details) *) if perl -e '$f=shift; exit( -T $f ? 0 : 1 )' "$f"; then echo "${0##*/}: $f: $t (PASS)" >&2 echo "$f" else echo "${0##*/}: $f: $t (IGNORE)" >&2 fi ;; esac done rpm-build-perl-0.82/Changes0000644000076400007640000002157012031433701013372 0ustar atat* Sat Sep 29 2012 Alexey Tourbin 0.82-alt1 - B/ConstOptree.pm: new module, implements optree constant folding for $^O, $^V, and $] variables by installing custom PL_check hooks - B/PerlReq.pm: now handles if.pm import routine * Mon Sep 10 2012 Vladimir Lettiev 0.81-alt1 - updated test suite for perl-5.16 * Sat Nov 19 2011 Alexey Tourbin 0.80-alt1 - B/PerlReq.pm: IO::File->new(\$var, ...) requires PerlIO::scalar * Fri Nov 18 2011 Alexey Tourbin 0.79-alt1 - B/PerlReq.pm: unify func/method processing via entersub - B/PerlReq.pm: improved import method handling with list args - B/PerlReq.pm: improved 'my $_' handler introduced in 0.78 - B/PerlReq.pm: stacked filetests require perl >= 5.10 - B/PerlReq.pm: treat Try::Tiny::try() like eval * Mon Nov 14 2011 Alexey Tourbin 0.78-alt1 - MANIFEST: added perl.clean * Thu Nov 10 2011 Alexey Tourbin 0.77-alt1 - PerlReq/Utils.pm: handle quoted-string versions by upgrading them to version.pm object, according to post-perl-5.8 rules - B/PerlReq.pm: handle "use parent" import routine like that of "use base" - B/PerlReq.pm: recognize and make deps on perl-5.10 syntactic features * Fri Oct 21 2011 Alexey Tourbin 0.76-alt1 - updated test suite for perl-5.14 - B/Walker.pm: invoke optree handlers only with non-zero line number, to ignore the code generated by PERL5OPT and command line switches - perl.clean: factored from /usr/lib/rpm/brp-cleanup - perl.clean: do not die on non-emtpy *.bs files - perl.clean: also remove perllocal.pod files * Thu Oct 06 2011 Alexey Tourbin 0.75-alt1 - perl.{req,prov}.files: ignore */auto/share/{dist,module}/* - B/PerlReq.pm: bumped minimum autodep perl version 5.6 -> 5.10 * Sat Feb 12 2011 Alexey Tourbin 0.74-alt1 - B/PerlReq.pm: added warnings.pm to @Skip list * Mon Nov 15 2010 Vladimir Lettiev 0.73-alt2 - fixed fatal error in walk_gv() when method CV return not B::CV class object (Closes: #24564) * Mon Sep 20 2010 Alexey Tourbin 0.73-alt1 - updated for perl-5.12: - perl.req, perl.prov: relax dependency on Pod::Usage - perl.prov: use plain eval insted of Safe->reval - perl.prov: \Q stopped working without closing \E - macros: removed UNINST=undef - macros: removed OTHERLDFLAGS='-lperl -lpthread' - macros: removed INSTALLMAN1DIR= and INSTALLMAN3DIR= - macros: removed %perl_vendor_man1dir and %perl_vendor_man3dir * Tue Apr 20 2010 Alexey Tourbin 0.72-alt1 - B/PerlReq.pm: implemented support for Moose::with() * Sun Sep 27 2009 Alexey Tourbin 0.71-alt1 - PerlReq/Utils.pm: fixed RPM_PERL_LIB_PATH for whitespaces (ALT#21701) * Mon May 11 2009 Alexey Tourbin 0.70-alt1 - B/Walker.pm: new module, implements optree traversal - B/Clobbers.pm: new experimental module, for checking global variables - PerlReq/Utils.pm: updated version formatting algorithm for better precision; the most general version format for rpm dependencies is now d.ddd.ddd * Tue Mar 24 2009 Alexey Tourbin 0.6.8-alt3 - macros (_perl_vendor_check_dso): disabled this check * Tue Mar 24 2009 Alexey Tourbin 0.6.8-alt2 - macros (_perl_vendor_check_dso): gcc -Wl,--no-as-needed * Fri May 09 2008 Alexey Tourbin 0.6.8-alt1 - perl.prov: try to detect block-level packages, fixes MP3/Tag.pm version * Sat Mar 01 2008 Alexey Tourbin 0.6.7-alt1 - B/PerlReq.pm (grok_import): silence numerical warning * Wed Nov 21 2007 Alexey Tourbin 0.6.6-alt1 - perl.req (isPerl): use plain -T test instead of non-ascii char counter - perl.{req,prov}.files: use perl's -T test to recheck non-text files * Sun Sep 30 2007 Alexey Tourbin 0.6.5-alt1 - perl.req: implemented support for "perl -x" re-exec hack (fixes cvs2cl.pl) - perl.req: implemented self-requires elimination for modules outside established path, cf. ALT bug #7315 * Thu Sep 06 2007 Alexey Tourbin 0.6.4-alt1 - made a few fixes for a special case `use Module 0==0', which is internally translated into `Module->import(PL_sv_yes)' and should yield `perl(Module) >= 1.0' dependency; this also fixes a regression introduced in previous release - B/PerlReq.pm: in $SIG{__DIE__} handler, resort to Carp::cluck() without checking $^S (checking $^S is unreliable since O.pm uses eval) - resolved some test suite issues (hopefully should pass on perl-5.9.5) * Fri Aug 17 2007 Alexey Tourbin 0.6.3-alt1 - perl.req.files: fixed "text" pattern for file(1) - B/PerlReq.pm: fixed bug in prevDepF logic - macros.d/perl5: + when doing Build.PL, parse _build/prereqs and dump .perl.req + better check for valid Build.PL (must have "dist_name" or "module_name") - PerlReq/Utils.pm: updated sv_version() algorithm, cf. perlbug 32967 - perl.prov: + implemented initial support for version.pm + when version assignment is found, check next line if it has e.g. '$VERSION = eval $VERSION' + strip "use vars" statement before eval, fixes perl-Mozilla-LDAP * Wed Mar 28 2007 Alexey Tourbin 0.6.2-alt1 - B/PerlReq.pm: + fixed Carp::confess syntax problem (rt.cpan.org #22512, reported by Steve Peters); actually removed Carp::confess and added $^S check + added Cygwin pattern to OS-specific dependencies + grok_version: do nothing unless version is set, so that the code like 'Module->VERSION()', which yields Module version, does not produce dependency on the Module + enhanced `use encoding ...' and PerlIO dependency detection - updated test suite for recent perl-5.8 snapshot - added new files, for possible use with future rpm-build releases: + perl.req.files (perl.prov.files) - will select perl files for req/prov + /etc/rpm/macros.d/perl.env - piece of rpm-build scriplets' preamble + also placed a few rpm-build perl macros to /etc/rpm/macros.d/perl * Mon Oct 23 2006 Alexey Tourbin 0.6.1-alt1 - imported sources into git repo, which is available at git://git.altlinux.org/people/at/packages/rpm-build-perl.git - fixed test suite for recent perl-5.8.x snapshot - perl.{req,prov}: added pod2usage; removed --debug option, use -vv - perl.prov: implemented limited support for `$VERSION = $Other::VERSION' * Wed Jun 07 2006 Alexey Tourbin 0.6.0-alt1 - B/PerlReq.pm: + major internal cleanup + a sketch for event-driven optree analysis blah-blah-blah + changed rules for dependencies found in BEGIN blocks: - never list ones that have not been loaded according to %INC, except for 'use autouse qw(Module)' case - always list loaded ones (there's no easy way to find out if it's been loaded by another module; I tried @INC hook + DB::DB debugger trap but it didn't work) + two-fold speedup - macros.d/perl5: + export PERL_EXTUTILS_AUTOINSTALL=--skip + OTHERLDFLAGS="-lperl -lpthread $EXTRA_LIBS" ("full linkage") - removed /usr/lib/rpm/base.pm * Fri Jun 17 2005 Alexey Tourbin 0.5.2-alt2 - B/PerlReq.pm: enhanced PerlIO dependency tracking - B/Perlreq.pm: dbmopen() requires AnyDBM_File.pm - macros.d/perl5: export XSUBPP_STATIC_XS=1 -- this will make some XS functions static (experimental, perl-5.8.7-alt2) * Thu Jun 02 2005 Alexey Tourbin 0.5.2-alt1 - fixed various perl-5.8.7 build issues - bumped version and released on CPAN * Fri Apr 15 2005 Alexey Tourbin 0.5.1-alt5 - B/PerlReq.pm: track require_version() calls - perl.req: restrict LD_LIBRARY_PATH to /usr/lib64 and /usr/lib * Wed Apr 06 2005 Alexey Tourbin 0.5.1-alt4 - B/PerlReq.pm: track PerlIO dependencies for "open" and "binmode" - perl.prov: allow more opcodes for Safe->reval * Wed Mar 16 2005 Alexey Tourbin 0.5.1-alt3 - rpm-build-perl.spec: use the same /usr/lib/rpm directory on x86_64 - perl.prov: decrease verbosity when processing *.al files - macros.d/perl5: preserve timestamps when making test * Thu Dec 23 2004 Alexey Tourbin 0.5.1-alt2 - perl.req: explode() was not imported * Wed Dec 22 2004 Alexey Tourbin 0.5.1-alt1 - released on CPAN (see http://search.cpan.org/dist/rpm-build-perl/) - perl.prov: workaround perl bug #32967 - added partial support for relative paths - restored OS2 pattern in skip lists (Andrei Bulava, #5713) - enhanced error handling and debugging output * Mon Dec 06 2004 Alexey Tourbin 0.5-alt1 - bumped version (0.3 -> 0.5) to reflect major changes - implemented B::PerlReq and made perl.req use it instead of B::Deparse - new PerlReq::Utils module (convertion and formatting routines) - version numbers now rounded to 3 digits after decimal point - v-string versions now treated as floats (e.g. 1.2.3 -> 1.002) - all dependencies on particular perl version converted to 1:5.x.y form - enabled version extraction from PREREQ_PM in Makefile.PL - wrote/updated/enhanced documentation, started README.ALT - started test suite (more than 50 tests) - downgraded perl requirements to 5.6.0 rpm-build-perl-0.82/lib/0000755000076400007640000000000012031433715012645 5ustar atatrpm-build-perl-0.82/lib/B/0000755000076400007640000000000012031433715013026 5ustar atatrpm-build-perl-0.82/lib/B/Walker.pm0000644000076400007640000000613112031141260014601 0ustar atatpackage B::Walker; our $VERSION = 0.11; use 5.006; use strict; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(padname padval const_sv walk); our $CV; sub padname ($) { my $targ = shift; return $CV->PADLIST->ARRAYelt(0)->ARRAYelt($targ); } sub padval ($) { my $targ = shift; return $CV->PADLIST->ARRAYelt(1)->ARRAYelt($targ); } sub const_sv ($) { my $op = shift; my $sv = $op->sv; $sv = padval($op->targ) unless $$sv; return $sv; } our $Level = 0; our $Line; our $Sub; our $Opname; our %Ops; our %BlockData; my %startblock = map { $_ => 1 } qw(leave leaveloop leavesub leavesublv leavetry grepwhile mapwhile scope); sub walk_root ($); sub walk_root ($) { my $op = shift; my $ref = ref($op); if ($ref eq "B::COP") { $Line = $op->line; return; } my $name = $op->name; use B qw(ppname); $name = ppname($op->targ) if $name eq "null"; local $Level = $Level + 1; local %BlockData = %BlockData if $startblock{$name}; local $Opname = $name if $Ops{$name}; $Ops{$name}->($op) if $Ops{$name} and $Line; if ($ref eq "B::PMOP") { my $root = $op->pmreplroot; if (ref($root) and $root->isa("B::OP")) { walk_root($root); } } use B qw(OPf_KIDS); if ($op->flags & OPf_KIDS) { for ($op = $op->first; $$op; $op = $op->sibling) { walk_root($op); } } } sub walk_cv ($); sub walk_av ($$) { my ($name, $av) = @_; return if ref($av) ne "B::AV"; local $Sub = $name; walk_cv($_) for $av->ARRAY; } sub walk_pad ($) { my $pad = shift; return unless $pad->can("ARRAY"); walk_av ANON => $pad->ARRAY; } sub walk_cv ($) { my $cv = shift; return if ref($cv) ne "B::CV"; return if $cv->FILE and $cv->FILE ne $0; local $CV = $cv; walk_root($cv->ROOT) if ${$cv->ROOT}; walk_pad($cv->PADLIST); } sub walk_blocks () { use B qw(begin_av init_av); walk_av "BEGIN" => begin_av; walk_av "INIT" => init_av; } sub walk_main () { use B qw(main_cv main_root); local $Sub = "MAIN"; local $CV = main_cv; walk_root(main_root) if ${main_root()}; walk_cv(main_cv); } sub walk_gv ($) { my $gv = shift; my $cv = $gv->CV; return unless ( $$cv && ref($cv) eq "B::CV" ); return if $cv->XSUB; local $Sub = $gv->SAFENAME; $Line = $gv->LINE; walk_cv($cv); } sub walk_stash ($$); sub walk_stash ($$) { # similar to B::walksymtable my ($symref, $prefix) = @_; while (my ($sym) = each %$symref) { no strict 'refs'; my $fullname = "*main::". $prefix . $sym; if ($sym =~ /::\z/) { $sym = $prefix . $sym; walk_stash(\%$fullname, $sym) if $sym ne "main::" && $sym ne "::"; } else { use B qw(svref_2object); walk_gv(svref_2object(\*$fullname)) if *$fullname{CODE}; } } } sub walk_subs () { walk_stash \%::, ''; } sub walk () { walk_blocks(); walk_main(); walk_subs(); } 1; __END__ =head1 NAME B::Walker - dumb walker, optree ranger =head1 COPYING Copyright (c) 2006, 2007 Alexey Tourbin, ALT Linux Team. This 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 2 of the License, or (at your option) any later version. =head1 SEE ALSO L rpm-build-perl-0.82/lib/B/PerlReq.pm0000644000076400007640000002654512031432773014755 0ustar atat# From `The UNIX-HATERS Handbook', p.55: # # Anyone who had both access to the source code and the # inclination to read it soon found themselves in for a rude # surprise: # # /* You are not expected to understand this */ # # Although this comment originally appeared in the Unix V6 kernel # source code, it could easily have applied to any of the original # AT&T code, which was a nightmare of in-line hand-optimizations # and micro hacks. package B::PerlReq; our $VERSION = '0.82'; use 5.006; use strict; use PerlReq::Utils qw(mod2path path2dep verf verf_perl sv_version); our @Skip = ( qr(^Makefile\b), # OS-specific qr(^machine/ansi\b), # gcc 3.3 stddef.h (FreeBSD 4) qr(^sys/_types\b), # gcc 3.3 stddef.h (FreeBSD 5) qr(^sys/systeminfo\b), # solaris qr(^Convert/EBCDIC\b), # os390 qr(^ExtUtils/XSSymSet\b), # VMS qr(\bOS2|OS2\b), qr(\bMacPerl|\bMac\b), qr(\bMacOS|MacOS\b), qr(\bMacOSX|MacOSX\b), qr(\bvmsish\b), qr(\bVMS|VMS\b), qr(\bWin32|Win32\b), qr(\bCygwin|Cygwin\b), # most common qr(^Carp\.pm$), qr(^Exporter\.pm$), qr(^strict\.pm$), qr(^vars\.pm$), qr(^warnings\.pm$), ); our ($Strict, $Relaxed, $Verbose, $Debug); use B::Walker qw(const_sv); sub RequiresPerl ($) { my $v = shift; my $dep = "perl-base >= " . verf_perl($v); my $msg = "$dep at line $B::Walker::Line (depth $B::Walker::Level)"; if (not $Strict and $v < 5.010) { print STDERR "# $msg old perl SKIP\n" if $Verbose; return; } print STDERR "# $msg REQ\n" if $Verbose; print "$dep\n"; } # XXX prevDepF is a hack to please t/01-B-PerlReq.t my $prevDepF; sub Requires ($;$) { my ($f, $v) = @_; my $dep = path2dep($f) . ($v ? " >= " . verf($v) : ""); my $msg = "$dep at line $B::Walker::Line (depth $B::Walker::Level)"; if ($f !~ m#^\w+(?:[/-]\w+)*[.]p[lmh]$#) { # bits/ioctl-types.ph print STDERR "# $msg invalid SKIP\n"; return; } if ($B::Walker::Sub eq "BEGIN" and not $INC{$f} and $B::Walker::Opname ne "autouse") { print STDERR "# $msg not loaded at BEGIN SKIP\n"; return; } if (not $Strict and grep { $f =~ $_ } @Skip) { print STDERR "# $msg builtin SKIP\n" if $Verbose; return; } if ($B::Walker::Sub eq "BEGIN" and $INC{$f}) { goto req; } if (not $Strict and $B::Walker::BlockData{Eval}) { print STDERR "# $msg inside eval SKIP\n"; return; } if ($Relaxed and $B::Walker::Level > 4) { print STDERR "# $msg deep SKIP\n"; return; } req: print STDERR "# $msg REQ\n" if $Verbose; if ($prevDepF and $prevDepF ne $f) { print path2dep($prevDepF) . "\n"; } undef $prevDepF; if ($v) { print "$dep\n"; } else { $prevDepF = $f; } } sub finalize { print path2dep($prevDepF) . "\n" if $prevDepF; } sub check_encoding ($) { my $enc = shift; eval { local $SIG{__DIE__}; require Encode; } or do { print STDERR "Encode.pm not available at $0 line $B::Walker::Line\n"; return; }; my $e = Encode::resolve_alias($enc) or do { print STDERR "invalid encoding $enc at $0 line $B::Walker::Line\n"; return; }; my $mod = $Encode::ExtModule{$e} || $Encode::ExtModule{lc($e)} or do { print STDERR "no module for encoding $enc at $0 line $B::Walker::Line\n"; return; }; Requires(mod2path($mod)); } sub check_perlio_string ($) { local $_ = shift; while (s/\b(\w+)[(](\S+?)[)]//g) { Requires("PerlIO.pm"); Requires("PerlIO/$1.pm"); if ($1 eq "encoding") { Requires("Encode.pm"); check_encoding($2); } } } sub grok_perlio ($) { my $op = shift; my $opname = $op->name; $op = $op->first; return unless $$op; # pushmark $op = $op->sibling; return unless $$op; # gv[*FH] -- arg1 $op = $op->sibling; return unless $$op and $op->name eq "const"; my $sv = const_sv($op); return unless $sv->can("PV"); local $B::Walker::Opname = $opname; my $arg2 = $sv->PV; $arg2 =~ s/\s//g; if ($opname eq "open") { return unless $arg2 =~ s/^[+]?[<>]+//; # validate arg2 $op = $op->sibling; return unless $$op; # arg3 required if ($op->name eq "srefgen") { # check arg3 Requires("PerlIO.pm"); Requires("PerlIO/scalar.pm"); } } check_perlio_string($arg2); } sub grok_require ($) { my $op = shift; return unless $op->first->name eq "const"; my $sv = const_sv($op->first); my $v = sv_version($sv); defined($v) ? RequiresPerl($v) : Requires($sv->PV) ; } sub grok_args ($) { my $op = shift; my @args; while ($$op and $op->name eq "const") { my $sv = const_sv($op); my $arg; if (ref($sv) eq "B::SPECIAL") { if ($$sv == ${B::sv_yes()}) { $arg = (1 == 1); } elsif ($$sv == ${B::sv_no()}) { $arg = (1 == 0); } } else { $arg = ${$sv->object_2svref}; } push @args, $arg; $op = $op->sibling; } return @args; } sub grok_import ($$$) { my ($class, undef, $op) = @_; my @args = grok_args($op) or return; local $B::Walker::Opname = $class; if ($class eq "base" or $class eq "parent") { foreach my $m (@args) { my $f = mod2path($m); # XXX Requires($f) if $INC{$f}; foreach (@INC) { if (-f "$_/$f") { Requires($f); last; } } } } elsif ($class eq "autouse") { my $f = mod2path($args[0]); Requires($f); } elsif ($class eq "encoding") { require Config; Requires("PerlIO/encoding.pm") if $Config::Config{useperlio}; check_encoding($args[0]) if $args[0] =~ /^[^:]/; Requires("Filter/Util/Call.pm") if grep { $_ eq "Filter" } @args; } elsif ($class eq "overload") { # avoid version check for << use overload "0+" => ... >> } elsif ($class eq "if") { my $f = mod2path($args[1]); Requires($f) if $args[0]; } elsif ($args[0] =~ /^\d/) { # the first import arg is possibly a version, see Exporter/Heavy.pm my $sv = const_sv($op); my $v = sv_version($sv); my $f = mod2path($class); Requires($f, $v) if $v; } } sub grok_version ($$$) { my ($class, undef, $op) = @_; return unless $op->name eq "const"; my $sv = const_sv($op); my $version = sv_version($sv); return unless $version; my $f = mod2path($class); local $B::Walker::Opname = "version"; Requires($f, $version); } sub grok_new { my ($class, undef, $op) = @_; if ($class eq "IO::File") { if ($op->name eq "srefgen") { Requires("PerlIO.pm"); Requires("PerlIO/scalar.pm"); } } } our %methods = ( 'import' => \&grok_import, 'VERSION' => \&grok_version, 'require_version' => \&grok_version, 'new' => \&grok_new, ); sub grok_with { return unless $INC{"Moose.pm"}; my (undef, $op) = @_; my @args = grok_args($op); for my $m (@args) { next unless $m =~ /^\w+(?:::\w+)+\z/; my $f = mod2path($m); Requires($f); } } my %TryCV; sub grok_try { return unless $INC{"Try/Tiny.pm"}; my (undef, $op) = @_; return unless $op->name eq "refgen"; $op = $op->first->first->sibling; return unless $op->name eq "anoncode"; my $cv = padval($op->targ); $TryCV{$$cv} = 1; } sub grok_catch { # suppress nested catch/finally deps &grok_try if $TryCV{$$B::Walker::CV}; } our %funcs = ( 'with' => \&grok_with, 'try' => \&grok_try, 'catch' => \&grok_catch, 'finally' => \&grok_catch, ); sub grok_entersub ($) { my $op = shift; $op = $op->first; $op = $op->first unless ${$op->sibling}; # die "not pushmark" unless $op->name eq "pushmark"; my $args = $op = $op->sibling; while (${$op->sibling}) { last if $op->name eq "method" or $op->name eq "method_named"; $op = $op->sibling; } if ($op->name eq "method_named") { my $method = const_sv($op)->PV; return unless $methods{$method}; return unless $args->name eq "const"; my $sv = const_sv($args); return unless $sv->can("PV"); my $class = $sv->PV; $args = $args->sibling; $methods{$method}->($class, $method, $args); } elsif ($op->first->name eq "gv") { $op = $op->first; use B::Walker qw(padval); my $func = padval($op->padix)->NAME; return unless $funcs{$func}; $funcs{$func}->($func, $args); } } sub grok_padsv { my $op = shift; use B qw(OPpLVAL_INTRO); return unless $op->private & OPpLVAL_INTRO; use B::Walker qw(padname); my $padsv = padname($op->targ); return unless $padsv->can('PV'); RequiresPerl(5.010) if $padsv->PV eq '$_'; use constant OPpPAD_STATE => defined &B::OPpPAD_STATE ? &B::OPpPAD_STATE : 0; RequiresPerl(5.010) if $op->private & OPpPAD_STATE; } my %filetests = map { $_ => 1 } qw(ftrread ftrwrite ftrexec fteread ftewrite fteexec ftis ftsize ftmtime ftatime ftctime ftrowned fteowned ftzero ftsock ftchr ftblk ftfile ftdir ftpipe ftsuid ftsgid ftsvtx ftlink fttty fttext ftbinary); sub grok_filetest { my $op = shift; return unless $filetests{$op->next->name}; return if $filetests{$op->first->name}; RequiresPerl(5.010); } %B::Walker::Ops = ( 'require' => \&grok_require, 'dofile' => \&grok_require, 'entersub' => \&grok_entersub, 'open' => \&grok_perlio, 'binmode' => \&grok_perlio, 'dbmopen' => sub { Requires("AnyDBM_File.pm") }, 'leavetry' => sub { $B::Walker::BlockData{Eval} = $B::Walker::Level }, 'leavesub' => sub { $B::Walker::BlockData{Eval} = $B::Walker::Level if $TryCV{$$B::Walker::CV} }, 'leave' => sub { $B::Walker::BlockData{Eval} = $B::Walker::Level if $TryCV{$$B::Walker::CV} }, 'dor' => sub { RequiresPerl(5.010) }, 'dorassign' => sub { RequiresPerl(5.010) }, 'leavegiven' => sub { RequiresPerl(5.010) }, 'leavewhen' => sub { RequiresPerl(5.010) }, 'smartmatch' => sub { RequiresPerl(5.010) }, 'say' => sub { RequiresPerl(5.010) }, 'padsv' => \&grok_padsv, map { $_ => \&grok_filetest } keys %filetests, ); sub compile { my $pkg = __PACKAGE__; for my $opt (@_) { $opt =~ /^-(?:s|-?strict)$/ and $Strict = 1 or $opt =~ /^-(?:r|-?relaxed)$/ and $Relaxed = 1 or $opt =~ /^-(?:v|-?verbose)$/ and $Verbose = 1 or $opt =~ /^-(?:d|-?debug)$/ and $Verbose = $Debug = 1 or die "$pkg: unknown option: $opt\n"; } die "$pkg: options -strict and -relaxed are mutually exclusive\n" if $Strict and $Relaxed; return sub { $| = 1; local $SIG{__DIE__} = sub { # checking $^S is unreliable because O.pm uses eval print STDERR "dying at $0 line $B::Walker::Line\n"; require Carp; Carp::cluck(); }; B::Walker::walk_blocks(); B::Walker::walk_main(); B::Walker::walk_subs() if not $Relaxed; finalize(); }; } END { print STDERR "# Eval=$B::Walker::BlockData{Eval}\n" if $B::Walker::BlockData{Eval}; } 1; __END__ =for comment We use C instead of C because we don't want to trigger C<$SIG{__WARN__}>, which affects files that use L. =head1 NAME B::PerlReq - Perl compiler backend to extract Perl dependencies =head1 SYNOPSIS B B<-MO=PerlReq>[B<,-strict>][B<,-relaxed>][B<,-v>][B<,-d>] I =head1 DESCRIPTION B::PerlReq is a backend module for the Perl compiler that extracts dependencies from Perl source code, based on the internal compiled structure that Perl itself creates after parsing a program. The output of B::PerlReq is suitable for automatic dependency tracking (e.g. for RPM packaging). =head1 OPTIONS =over =item B<-strict> Operate in strict mode. See L for details. =item B<-relaxed> Operate in relaxed mode. See L for details. =item B<-v>, B<--verbose> Output extra information about the work being done. =item B<-d>, B<--debug> Enable debugging output (implies --verbose option). =back =head1 AUTHOR Written by Alexey Tourbin . =head1 COPYING Copyright (c) 2004, 2006 Alexey Tourbin, ALT Linux Team. This 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 2 of the License, or (at your option) any later version. =head1 SEE ALSO L, L, L, L, L rpm-build-perl-0.82/lib/B/Clobbers.pm0000644000076400007640000000530211201656366015126 0ustar atatpackage B::Clobbers; our $VERSION = '0.01'; use strict; use B::Walker qw(padval walk); use B qw(ppname OPpLVAL_INTRO); our @vars = qw(_ / , \ "); our %vars = map { $_ => 1 } @vars; our $Verbose = 0; sub do_gvsv ($) { my $op = shift; my $var = padval($op->padix)->SAFENAME; return unless $vars{$var}; if ($op->private & OPpLVAL_INTRO) { $B::Walker::BlockData{$var} = 1; print STDERR "local \$$var at $0 line $B::Walker::Line\n" if $Verbose; } elsif ($op = $op->next and $$op and $op->name eq "sassign") { return if $B::Walker::BlockData{$var}; print "\t*** \$$var clobbered at $0 line $B::Walker::Line\n"; } } sub do_rv2gv ($) { my $op = shift; my $gv = $op->first; return unless $gv->name eq "gv"; my $var = padval($gv->padix)->SAFENAME; return unless $vars{$var}; if ($op->private & OPpLVAL_INTRO) { $B::Walker::BlockData{$var} = 1; print STDERR "local \*$var at $0 line $B::Walker::Line\n" if $Verbose; } elsif ($op = $op->next and $$op and $op->name eq "sassign") { return if $B::Walker::BlockData{$var}; print "\t*** \*$var clobbered at $0 line $B::Walker::Line\n"; } } sub do_readline ($) { my $op = shift; $op = $op->next; $op = $op->first while ref($op) eq "B::UNOP"; return unless $op->name eq "gvsv"; my $var = padval($op->padix)->SAFENAME; return unless $vars{$var}; return if $B::Walker::BlockData{$var}; print "\t*** \$$var clobbered at $0 line $B::Walker::Line\n"; } sub do_enteriter ($) { my $op = shift; my $op = $op->first->sibling->sibling; return unless $$op; $op = $op->first if $op->name eq "rv2gv"; return unless $op->name eq "gv"; my $gv = ref($op) eq "B::PADOP" ? padval($op->padix) : $op->gv; my $var = $gv->SAFENAME; return unless $vars{$var}; print STDERR "implicitly localized \$$var at $0 line $B::Walker::Line\n" if $Verbose; $B::Walker::BlockData{_} = 1; } %B::Walker::Ops = ( gvsv => \&do_gvsv, rv2gv => \&do_rv2gv, readline => \&do_readline, enteriter => \&do_enteriter, grepwhile => sub { $B::Walker::BlockData{_} = 1 }, mapwhile => sub { $B::Walker::BlockData{_} = 1 }, ); sub compile { my $pkg = __PACKAGE__; for my $opt (@_) { $opt =~ /^-(?:v|-?verbose)$/ and ++$Verbose or die "$pkg: unknown option: $opt\n"; } return sub { local $| = 1; local $SIG{__DIE__} = sub { print STDERR "Dying at $0 line $B::Walker::Line\n"; require Carp; Carp::cluck(); }; walk(); } } 1; __END__ =head1 NAME B::Clobbers - clobbering analyzer =head1 COPYING Copyright (c) 2007 Alexey Tourbin, ALT Linux Team. This 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 2 of the License, or (at your option) any later version. rpm-build-perl-0.82/lib/PerlReq/0000755000076400007640000000000012031433715014217 5ustar atatrpm-build-perl-0.82/lib/PerlReq/Utils.pm0000644000076400007640000001314011655100547015661 0ustar atatpackage PerlReq::Utils; =head1 NAME PerlReq::Utils - auxiliary routines for L, L and L =head1 DESCRIPTION This module provides the following convenience functions: =over =cut require Exporter; @ISA = qw(Exporter); @EXPORT = qw(argv explode inc path2mod mod2path path2dep mod2dep sv_version verf verf_perl); use strict; =item B Convert file path to module name, e.g. I -> I. =cut sub path2mod ($) { local $_ = shift; s/\//::/g; s/\.pm$//; return $_; } =item B Convert module name to file path, e.g. I -> I. =cut sub mod2path ($) { local $_ = shift; s/::/\//g; return $_ . ".pm"; } =item B Convert file path to conventional dependency name, e.g. I -> I. Note that this differs from RedHat conventional form I. =cut sub path2dep ($) { my $path = shift; return "perl($path)"; } =item B Convert module name to conventional dependency name, e.g. I -> I. Note that this differs from RedHat conventional form I. =cut sub mod2dep ($) { my $mod = shift; return path2dep(mod2path($mod)); } =item B Format module version number, e.g. I<2.12> -> I<2.120>. Currently truncated to 3 digits after decimal point, except for all zeroes, e.g. I<2.000> -> I<2.0>. Update. The algorithm has been amended in almost compatible way so that versions do not lose precision when truncated. Now we allow one more I<.ddd> series at the end, but I<.000> is still truncated by default, e.g. I<2.123> -> I<2.123>, I<2.123456> -> I<2.123.456>. =cut sub verf ($) { my $v = shift; $v = sprintf "%.6f", $v; $v =~ s/[.]000000$/.0/ || $v =~ s/000$// || $v =~ s/(\d\d\d)$/.$1/ && $v =~ s/[.]000[.]/.0./; return $v; } =item B Format Perl version number, e.g. I<5.005_03> -> I<1:5.5.30>. =cut sub verf_perl ($) { my $v = shift; my $major = int($v); my $minor = ($v * 1000) % ($major * 1000); my $micro = ($v * 1000 * 1000) % ($minor * 1000 + $major * 1000 * 1000); return "1:$major.$minor.$micro"; } =item B Extract version number from B::SV object. v-strings converted to floats according to Perl rules, e.g. I<1.2.3> -> I<1.002003>. =cut sub sv_version ($) { my $sv = shift; if ($$sv == ${B::sv_yes()}) { # very special case: (0==0) -> 1 return 1; } if ($sv->can("FLAGS")) { use B qw(SVf_IOK SVf_NOK); if ($sv->FLAGS & SVf_IOK) { return $sv->int_value; } if ($sv->FLAGS & SVf_NOK) { return $sv->NV; } } if ($sv->can("MAGIC")) { for (my $mg = $sv->MAGIC; $mg; $mg = $mg->MOREMAGIC) { next if $mg->TYPE ne "V"; my @v = $mg->PTR =~ /(\d+)/g; return $v[0] + $v[1] / 1000 + $v[2] / 1000 / 1000; } } # handle version objects my $vobj = ${$sv->object_2svref}; my $vnum; if (ref($vobj) eq "version") { $vnum = $vobj->numify; $vnum =~ s/_//g; return 0 + $vnum; } elsif ($sv->can("PV") and $sv->PV =~ /^[v.]?\d/) { # upgrade quoted-string version to version object require version; $vobj = eval { version->parse($sv->PV) }; if ($@) { warn $@; return undef; } $vnum = $vobj->numify; $vnum =~ s/_//g; return 0 + $vnum; } return undef; } =item B Obtain a list of files passed on the command line. When command line is empty, obtain a list of files from standard input, one file per line. Die when file list is empty. Check that each file exists, or die otherwise. Canonicalize each filename with C function (which makes no checks against the filesystem). =cut use File::Spec::Functions qw(rel2abs); sub argv { my @f = @ARGV ? @ARGV : grep length, map { chomp; $_ } <>; die "$0: no files\n" unless @f; return map { -f $_ ? rel2abs($_) : die "$0: $_: $!\n" } @f; } =item B Obtain a list of Perl library paths from C<@INC> variable, except for current directory. The RPM_PERL_LIB_PATH environment variable, if set, is treated as a list of paths, seprarated by colons; put these paths in front of the list. Canonicalize each path in the list. Finally, the RPM_BUILD_ROOT environment variable, if set, is treated as installation root directory; each element of the list is then prefixed with canonicalized RPM_BUILD_ROOT path and new values are put in front of the list. After all, only existent directories are returned. =cut my @inc; sub inc { return @inc if @inc; my $root = $ENV{RPM_BUILD_ROOT}; $root &&= rel2abs($root); unshift @inc, map rel2abs($_), grep $_ ne ".", @INC; unshift @inc, map rel2abs($_), $ENV{RPM_PERL_LIB_PATH} =~ /([^:\s]+)/g; unshift @inc, map "$root$_", @inc if $root; return @inc = grep -d, @inc; } =item B Split given filename into its prefix (which is a valid Perl library path, according to the inc() function above) and basename. Return empty list if filename does not match any prefix. =cut sub explode ($) { my $fname = shift; my ($prefix) = sort { length($b) <=> length($a) } grep { index($fname, $_) == 0 } inc(); return unless $prefix; my $delim = substr $fname, length($prefix), 1; return unless $delim eq "/"; my $basename = substr $fname, length($prefix) + 1; return unless $basename; return ($prefix, $basename); } 1; __END__ =back =head1 AUTHOR Written by Alexey Tourbin . =head1 COPYING Copyright (c) 2004 Alexey Tourbin, ALT Linux Team. This is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. =head1 SEE ALSO L, L, L rpm-build-perl-0.82/README.ALT0000644000076400007640000001307410762170527013413 0ustar atat$ perldoc -F README.ALT =head1 NAME F - notes on Perl packaging =head1 DESCRIPTION This document is an early attempt of Perl policy for ALT Linux Team. Most of the packages, modules and even files mentioned in this document have comprehensive documentation. Be sure to read it, too! Blind guess: what you are looking for is probably C<_perl_lib_path>. See below. =head1 Packages B is a part of basesystem. B is required to build Perl modules that have F. B is additionally required to build modules that have F. B is useful for finding modules that need updating. B is required to build RPM packages. B is required to build Perl RPM packages; it contains scripts for automatic dependency tracking, RPM macros for Perl, and this document. B has C script which automatically inserts/updates C clause in specfile. B is to check package acceptability for Sisyphus. B is a build system. =head1 Files and modules F, F - scripts for automatic dependency tracking. $ alias perl.req=/usr/lib/rpm/perl.req $ perl.req --verbose /usr/lib/perl5/perl5db.pl # perl(IO/Handle.pm) at line 492 # perl(strict.pm) at line 4582 (builtin SKIP) # perl(Config.pm) at line 1157 inside eval (SKIP) # perl(IO/Socket.pm) at line 1560 # perl(Carp.pm) at line 7338 (builtin SKIP) # perl(Term/ReadLine.pm) at line 5725 inside eval (SKIP) # perl(Config.pm) at line 7633 # perl(dumpvar.pl) at line 2222 # perl(PadWalker.pm) >= 0.080 at line 2409 inside eval (SKIP) # perl(dumpvar.pl) at line 2418 # perl(dumpvar.pl) at line 5316 # perl(Class/ISA.pm) at line 4576 inside eval (SKIP) # perl(Carp.pm) at line 7278 (builtin SKIP) # perl(Devel/Peek.pm) at line 7487 inside eval (SKIP) /usr/lib/perl5/perl5db.pl syntax OK perl(Config.pm) perl(dumpvar.pl) perl(IO/Handle.pm) perl(IO/Socket.pm) $ F - RPM macros for Perl. B - process Makefile.PL and build Perl module. $ cd libnet-1.19 $ perl Makefile.PL PRINT_PREREQ=1 Checking for Socket...ok Checking for IO::Socket...ok perl(IO::Socket)>=1.05 perl(Socket)>=1.3 $ B - process Build.PL and build Perl module. B - list modules than need updating: $ perl -MCPAN -e 'CPAN::Shell->r' Download and test a module: $ perl -MCPAN -e 'CPAN::Shell->test("Some::Module")' But don't you run CPAN as root! =head1 Directories C is used by default for RPM packages. See L for details. B<%perl_vendor_privlib> - standard RPM directory for architecture-independent perl modules. (Disclaimer: there's no ANSI standard so far.) B<%perl_vendor_privlib/auto> - standard RPM directory for architecture-independent autosplitted functions (used rarely). B<%perl_vendor_archlib> - standard RPM directory for architecture-dependent perl modules. B<%perl_vendor_autolib> - a shortcut for C<%perl_vendor_archlib/auto>, standard RPM directory for architecture-dependent autosplitted functions and compiled extensions. Typical %files sections: %files # noarch %perl_vendor_privlib/Module* %files # i586 %perl_vendor_archlib/Module* %perl_vendor_autolib/Module* Directory ownership!!! %files # WRONG, Module/ directory is not owned by any package %perl_vendor_privlib/Module/* %files # WRONG, auto/ directory is captured %perl_vendor_privlib/* B<_perl_lib_path> must be defined when non-standard library path for perl modules is used (which is discouraged). # from kdoc.spec %define _perl_lib_path %_datadir/%name %files # kdoc*.pm are under non-standard location %_datadir/%name =head1 Scriplets B<%perl_vendor_build> - basically equivalent to C. Typical %build sections: %build %perl_vendor_build [arguments for Makefile.PL] Sample arguments for Makefile.PL: INC=-I%_includedir/ncurses LIBS=-lncurses DEFINE=-DHAVE_STRING_H To disable C completely: # This package is broken but I think that it works. %def_without test To disable some tests: %__rm -fv t/bad-test-1.t t/bad-test-2.t To disable X-server dependent tests: # always run tests for maintainer $ echo '%_build_display :0' >> ~/.rpmmacros # don't run tests for others %ifndef _build_display %def_without test %endif To disable tests in BTE (hasher or sandman): %ifdef __BTE %def_without test %endif To disable tests when syslog is not available: %if "%(logger -d -u /dev/log -p user.debug test >/dev/null 2>&1 || echo no)" == "no" %def_without test %endif To skip tests when /dev/tty is not available: %if "%([ -c /dev/tty ] || echo no)" == "no" %def_without test %endif B<%perl_vendor_install> - basically equivalent to C. Typical %install section: %install %perl_vendor_install [arguments to make] =head1 Dependencies B<%add_findreq_skiplist> F<*/Some/Module.pm> -- don't run perl.req against files that match the given shell pattern. (Generally discouraged.) B<%add_findprov_skiplist> F<*/Some/Module.pm> don't run perl.prov against files that match the given shell pattern. (Generally discouraged.) There's no way to skip a particular dependency so far. =head1 AUTHOR Written by Alexey Tourbin . =head1 COPYING Copyright (c) 2004 Alexey Tourbin, ALT Linux Team. What is the best license for such a document, by the way? =head1 SEE ALSO Debian Perl Policy, L. =cut # vim:ft=pod tw=72 rpm-build-perl-0.82/ConstOptree/0000755000076400007640000000000012031433715014344 5ustar atatrpm-build-perl-0.82/ConstOptree/ConstOptree.xs0000644000076400007640000000414212031231645017164 0ustar atat#include #define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" static OP *convert_arg(pTHX_ OP *op) { OP *op1 = op; if (op1->op_type != OP_RV2SV) return op; SVOP *op2 = (SVOP *) cUNOPx(op)->op_first; if (op2->op_type != OP_GV) return op; GV *gv = cGVOPx_gv(op2); STRLEN len = GvNAMELEN(gv); if (len != 1) return op; const char *name = GvNAME(gv); SVOP *newop = NULL; if (*name == '\017') /* $^O */ newop = (SVOP *) newSVOP(OP_CONST, 0, newSVpvs_share(OSNAME)); if (*name == '\026') /* $^V */ newop = (SVOP *) newSVOP(OP_CONST, 0, new_version(PL_patchlevel)); if (*name == ']') /* $] */ newop = (SVOP *) newSVOP(OP_CONST, 0, vnumify(PL_patchlevel)); if (newop) { newop->op_sibling = op1->op_sibling; newop->op_next = (OP *) newop; op_free(op); return (OP *) newop; } return op; } static OP *my_ck_op(pTHX_ OP *op) { OP **argp = &cUNOPx(op)->op_first; while (*argp) { *argp = convert_arg(aTHX_ *argp); argp = &(*argp)->op_sibling; } return op; } #define doOPs() \ /* binops */ \ doOP(LT) /* numeric lt (<) */ \ doOP(GT) /* numeric gt (>) */ \ doOP(LE) /* numeric le (<=) */ \ doOP(GE) /* numeric ge (>=) */ \ doOP(EQ) /* numeric eq (==) */ \ doOP(NE) /* numeric ne (!=) */ \ doOP(NCMP) /* numeric comparison (<=>) */ \ doOP(SLT) /* string lt */ \ doOP(SGT) /* string gt */ \ doOP(SLE) /* string le */ \ doOP(SGE) /* string ge */ \ doOP(SEQ) /* string eq */ \ doOP(SNE) /* string ne */ \ doOP(SCMP) /* string comparison (cmp) */ /* make op handlers */ #define doOP(NAME) \ static Perl_check_t orig_ck_ ## NAME; \ static OP *my_ck_ ## NAME(pTHX_ OP *op) { \ return orig_ck_ ## NAME(aTHX_ my_ck_op(aTHX_ op)); \ } doOPs() #undef doOP /* install op handlers */ static void boot_ops() { #define doOP(NAME) \ orig_ck_ ## NAME = PL_check[OP_ ## NAME]; \ PL_check[OP_ ## NAME] = my_ck_ ## NAME; doOPs() #undef doOP } MODULE = B::ConstOptree PACKAGE = B::ConstOptree BOOT: boot_ops(); /* ex: set ts=8 sts=4 sw=4 noet: */ rpm-build-perl-0.82/ConstOptree/ConstOptree.pm0000644000076400007640000000225712031431271017150 0ustar atatpackage B::ConstOptree; our $VERSION = '0.01'; require XSLoader; XSLoader::load(__PACKAGE__, $VERSION); # Loadable via -MO=ConstOptree sub compile { sub {} } 1; __END__ =head1 NAME B::ConstOptree - Optree constant folding for $^O, $^V, and $] =head1 SYNOPSIS $ perl -MO=ConstOptree -MO=Deparse} -e \ 'require ($^O eq "MSWin32" ? "Win32.pm" : "POSIX.pm")' require 'POSIX.pm'; -e syntax OK =head1 DESCRIPTION This module propagates constant folding for $^O, $^V, and $] variables by installing custom PL_check handlers for numeric and string comparison opcodes. In the handlers, references to $^O, $^V, and $] arguments are replaced with constant terms like "linux", v5.16.1, and 5.016001, respectively. =head1 CAVEATS Since regexp matching is not subject to constant folding, expressions like C<$^O =~ /win32/i> will not be reduced. =head1 AUTHOR Written by Alexey Tourbin . =head1 COPYING Copyright (c) 2012 Alexey Tourbin This 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 2 of the License, or (at your option) any later version. =cut rpm-build-perl-0.82/ConstOptree/Makefile.PL0000644000076400007640000000032512031165152016313 0ustar atatuse ExtUtils::MakeMaker; WriteMakefile( NAME => 'B::ConstOptree', VERSION_FROM => 'ConstOptree.pm', AUTHOR => 'Alexey Tourbin ', ABSTRACT => 'Optree constant folding for $^O, $^V, and $]', ); rpm-build-perl-0.82/Makefile.PL0000644000076400007640000000133011660045356014055 0ustar atatuse 5.006; use strict; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'rpm-build-perl', VERSION_FROM => 'lib/B/PerlReq.pm', EXE_FILES => [ qw(perl.req perl.req.files perl.prov perl.prov.files perl.clean) ], PREREQ_PM => { B => 0, O => 0, Safe => 0, "Test::More" => 0, Encode => 0 }, AUTHOR => 'Alexey Tourbin ', ABSTRACT => 'Calculate dependencies for Perl sources', dist => { COMPRESS => 'gzip -9f' }, ); package MY; sub install { my $self = shift; return $self->SUPER::install(@_) . <<'EOF'; Changes: rpm-build-perl.spec rpmquery --specfile $< --changelog | $(PERL) -ne \ 's/\@altlinux[^>]*>/\@altlinux>/g; last if /^\* .+ 0\.3/; next if /^\Z/; print "\n" if /^\* / && $$.>1; print' >$@ EOF } rpm-build-perl-0.82/t/0000755000076400007640000000000012031433715012342 5ustar atatrpm-build-perl-0.82/t/02-perlreq.t0000644000076400007640000000147112031141260014412 0ustar atatuse Test::More qw(no_plan); use strict; use Fcntl qw(F_SETFD); sub spawn ($) { my $file = shift; use 5.007_001; # the list form of open() for pipes open my $pipe, "-|", $^X, qw(-Mblib perl.req) => $file or return (undef, undef); my $output = join '' => <$pipe>; return (close($pipe), $output); } sub grok ($) { my $file = shift; fcntl(STDERR, F_SETFD, 1); my ($ok, $output) = spawn($file); if (not $ok) { fcntl(STDERR, F_SETFD, 0); spawn($file); } chomp $output; $output =~ s/\s+/ /g; return $output; } sub Requires ($$) { my ($f, $expected) = @_; require $f; my $got = grok $INC{$f}; cmp_ok $got, "eq", $expected, "$f dependencies"; ok $? == 0, "$f zero exit status"; } # Valid for perl-5.8.0 - perl-5.16.1. Requires "AutoLoader.pm" => ""; Requires "Exporter.pm" => "perl(Exporter/Heavy.pm)"; rpm-build-perl-0.82/t/03-perlprov.t0000644000076400007640000000302312031141260014605 0ustar atatuse Test::More qw(no_plan); use strict; use Config qw(%Config); use Fcntl qw(F_SETFD); sub spawn ($) { my $file = shift; open my $pipe, "-|", $^X, qw(-Mblib perl.prov) => $file or return (undef, undef); my $output = join '' => <$pipe>; return (close($pipe), $output); } sub grok ($) { my $file = shift; fcntl(STDERR, F_SETFD, 1); my ($ok, $output) = spawn($file); if (not $ok) { fcntl(STDERR, F_SETFD, 0); spawn($file); } chomp $output; $output =~ s/\s+/ /g; return $output; } sub Provides ($$) { my ($f, $expected) = @_; require $f; my $got = grok $INC{$f}; like $got, qr/^\Q$expected\E(\d|$)/, "$f dependencies"; ok $? == 0, "$f zero exit status"; } my ($lib, $arch) = @Config{qw{installprivlib installarchlib}}; # Valid for perl-5.8.0 - perl-5.16.1. Provides "attributes.pm" => "perl(attributes.pm) = 0."; Provides "AutoLoader.pm" => "perl(AutoLoader.pm) = 5."; Provides "base.pm" => "perl(base.pm) = "; Provides "constant.pm" => "perl(constant.pm) = 1."; Provides "Exporter.pm" => "perl(Exporter.pm) = 5."; Provides "fields.pm" => "perl(fields.pm) = "; Provides "File/Basename.pm" => "perl(File/Basename.pm) = 2."; Provides "Getopt/Long.pm" => "perl(Getopt/Long.pm) = 2."; Provides "dumpvar.pl" => "perl(dumpvar.pl)"; Provides "Cwd.pm" => "perl(Cwd.pm) = "; Provides "Data/Dumper.pm" => "perl(Data/Dumper.pm) = 2."; Provides "IO/File.pm" => "perl(IO/File.pm) = 1."; Provides "File/Glob.pm" => "perl(File/Glob.pm) = "; Provides "Socket.pm" => "perl(Socket.pm) = "; Provides "POSIX.pm" => "perl(POSIX.pm) = 1."; rpm-build-perl-0.82/t/01-B-PerlReq.t0000644000076400007640000001472511661116625014515 0ustar atatuse Test::More qw(no_plan); use strict; use B::PerlReq; use PerlReq::Utils; use Fcntl qw(F_SETFD); sub spawn ($) { my $code = shift; open my $pipe, "-|", $^X, qw(-Mblib -MO=PerlReq -e) => $code or return (undef, undef); my $output = join '' => <$pipe>; return (close($pipe), $output); } sub grok ($) { my $code = shift; fcntl(STDERR, F_SETFD, 1); my ($ok, $output) = spawn($code); if (not $ok) { fcntl(STDERR, F_SETFD, 0); spawn($code); } chomp $output; return $output; } my $m = "Data::Dumper"; my $f = "Data/Dumper.pm"; my $d = "perl($f)"; my $m2 = "File::Basename"; my $f2 = "File/Basename.pm"; my $d2 = "perl($f2)"; my $m3 = "Tie::Hash"; my $f3 = "Tie/Hash.pm"; my $d3 = "perl($f3)"; cmp_ok $d, "eq", grok qq(use $m;); cmp_ok $d, "eq", grok qq(require $m;); cmp_ok $d, "eq", grok qq(require "$f";); cmp_ok $d, "eq", grok qq(BEGIN { use $m; }); cmp_ok $d, "eq", grok qq(BEGIN { require $m; }); cmp_ok $d, "eq", grok qq(INIT { require "$f"; }); cmp_ok $d, "eq", grok qq(sub x { require $m; }); cmp_ok $d, "eq", grok qq(sub x { my \$x = sub { require $m; }}); cmp_ok $d, "eq", grok qq(my \$x = sub { require $m; }); cmp_ok $d, "eq", grok qq(my \$x = sub { my \$x = sub { require $m; }}); cmp_ok $d, "eq", grok qq(sub x { local *x = sub { require $m; }}); cmp_ok $d, "eq", grok qq(local *x = sub { require $m; }); cmp_ok $d, "eq", grok qq(local *x = sub { local *x = sub { require $m; }}); cmp_ok '', 'eq', grok qq(eval { require $m; };); cmp_ok $d2, 'eq', grok qq(eval { require $m; }; require $m2; eval { require $m3 };); cmp_ok $d2, 'eq', grok qq({eval { require $m; };} require $m2; {eval { require $m3 };}); cmp_ok $d2, 'eq', grok qq(my \$x = sub { eval { require $m; }; require $m2; };); cmp_ok $d2, 'eq', grok qq(eval { eval { require $m; }; require $m; }; require $m2;); cmp_ok $d2, 'eq', grok qq(eval { require $m; } || eval { require $m3; }; require $m2;); cmp_ok $d2, 'eq', grok qq(require $m2; eval { $m2->VERSION(0.1); };); cmp_ok "$d >= 2.0", 'eq', grok qq(use $m 2;); cmp_ok "$d >= 2.0", 'eq', grok qq(use $m 2.0;); cmp_ok "$d >= 2.0", 'eq', grok qq(use $m 2.00;); cmp_ok "$d >= 2.0.998", 'eq', grok qq(use $m 2.000998;); cmp_ok "$d >= 2.001", 'eq', grok qq(use $m 2.0009999;); cmp_ok "$d >= 2.010", 'eq', grok qq(use $m 2.01;); cmp_ok "$d >= 2.010", 'eq', grok qq(use $m 2.01 qw(Dumper);); cmp_ok "$d >= 2.010", 'eq', grok qq(use $m 2.01 qw(Dumper Dumper);); cmp_ok "$d >= 2.010", 'eq', grok qq(use $m 2.01, qw(Dumper);); cmp_ok "$d >= 2.010", 'eq', grok qq(use $m 2.01, qw(Dumper Dumper);); cmp_ok "$d >= 2.012", 'eq', grok qq(use $m 2.012;); cmp_ok "$d >= 2.019.900", 'eq', grok qq(use $m 2.0199;); cmp_ok "$d >= 2.0", 'eq', grok qq(use $m v2;); cmp_ok "$d >= 2.0", 'eq', grok qq(use $m v2.0;); cmp_ok "$d >= 2.0.998", 'eq', grok qq(use $m v2.0.998;); cmp_ok "$d >= 2.0.999", 'eq', grok qq(use $m v2.0.999;); cmp_ok "$d >= 2.001.001", 'eq', grok qq(use $m 2.1.1;); cmp_ok "$d >= 2.001.001", 'eq', grok qq(use $m v2.1.1;); cmp_ok "perl(base.pm)\n$d", 'eq', grok qq(use base qw($m);); cmp_ok "perl(base.pm) >= 1.0\n$d", 'eq', grok qq(use base 1 qw($m);); cmp_ok "perl(base.pm)\n$d\n$d2", 'eq', grok qq(use base qw($m $m2);); cmp_ok "$d3\nperl(base.pm)", 'eq', grok qq(use $m3; use base "Tie::StdHash";); cmp_ok "perl(autouse.pm)\n$d", 'eq', grok qq(use autouse "$m";); cmp_ok "perl(autouse.pm)\n$d", 'eq', grok qq(use autouse $m => qw(Dumper);); cmp_ok "perl(autouse.pm)\n$d", 'eq', grok qq(use autouse $m => qw(Dumper Dumper);); cmp_ok "perl(Try/Tiny.pm)\nperl(Bar.pm)", 'eq', grok q(use Try::Tiny; try { require Foo } catch { require Bar }); cmp_ok "perl(Try/Tiny.pm)\nperl(Bar.pm)", 'eq', grok q(use Try::Tiny; sub x { try { require Foo } catch { require Bar } }); cmp_ok "perl(Try/Tiny.pm)\nperl(Baz.pm)", 'eq', grok q(use Try::Tiny; try { try { require Foo } catch { require Bar } } catch { require Baz }); cmp_ok '', 'eq', grok qq( \$path="$f"; require \$path;); cmp_ok '', 'eq', grok qq(my \$path="$f"; require \$path;); cmp_ok '', 'eq', grok qq(require "./Data/Dumper.pm";); cmp_ok "$d >= 2.0", 'eq', grok "require $m; $m->VERSION(2);"; cmp_ok "$d >= 2.0", 'eq', grok "require $m; $m->require_version(2);"; cmp_ok "perl(base.pm)\n$d", 'eq', grok "require base; base->import($m)"; cmp_ok "perl(base.pm) >= 1.0\n$d", 'eq', grok "require base; base->VERSION(1); base->import($m)"; cmp_ok "perl(base.pm)\n$d\nperl(base.pm) >= 1.0", 'eq', grok "require base; base->import($m); base->VERSION(1);"; cmp_ok "perl-base >= 1:5.10.0\n$d", 'eq', grok qq(require 5.010; *x = sub { require $m;};); cmp_ok "$d\n$d2", "eq", grok qq(require $m; *x = sub { require $m2; };); cmp_ok "$d\n$d2", "eq", grok qq(require $m; my \$x = sub { require $m2; };); cmp_ok "perl(PerlIO.pm)\nperl(PerlIO/scalar.pm)", "eq", grok q(open FH, "<", \$ref); cmp_ok "perl(PerlIO.pm)\nperl(PerlIO/scalar.pm)", "eq", grok q(open FH, "+<", \my $ref); cmp_ok "perl(PerlIO.pm)\nperl(PerlIO/scalar.pm)", "eq", grok q(open my $fh, "<", \$ref); cmp_ok "perl(PerlIO.pm)\nperl(PerlIO/scalar.pm)", "eq", grok q(open my $fh, "+>", \my $ref); cmp_ok "perl(PerlIO.pm)\nperl(PerlIO/scalar.pm)", "eq", grok q(open my $fh, ">>", \my $ref); cmp_ok "perl(PerlIO.pm)\nperl(PerlIO/encoding.pm)\nperl(Encode.pm)\nperl(Encode/Byte.pm)", "eq", grok q(open FH, "<:encoding(cp1251)", $0); # Byte cmp_ok "perl(PerlIO.pm)\nperl(PerlIO/encoding.pm)\nperl(Encode.pm)\nperl(Encode/KR.pm)", "eq", grok q(binmode STDOUT, ":encoding(cp949)"); # KR cmp_ok "perl(PerlIO.pm)\nperl(PerlIO/encoding.pm)\nperl(Encode.pm)\nperl(Encode/JP.pm)", "eq", grok q(open my $fh,">encoding(euc-jp)",$file); # JP cmp_ok "perl(PerlIO.pm)\nperl(PerlIO/encoding.pm)\nperl(Encode.pm)", "eq", grok q(open $fh,"via(PerlIO::via::QuotedPrint)", $tmp); cmp_ok "", "eq", grok q(open FH, "<:encoding(cp1251)"); cmp_ok "", "eq", grok q(open FH, ">:encoding(cp1251)"); cmp_ok "perl(AnyDBM_File.pm)", "eq", grok q(dbmopen %db, "db.$$", 0600); cmp_ok "perl(attributes.pm)", "eq", grok q(my $x : shared = 1); cmp_ok "perl(File/Glob.pm)", "eq", grok q(); cmp_ok "", "eq", grok q(PerlIO::encoding->VERSION >= 0.02); cmp_ok "perl(encoding.pm)\nperl(PerlIO/encoding.pm)\nperl(Encode/JP.pm)\nperl(Filter/Util/Call.pm)\nperl(utf8.pm)", "eq", grok <<'EOF'; # from Encode/t/jperl.t use encoding "euc-jp", Filter=>1; use utf8; our $ΏΝ = 2; EOF cmp_ok "perl(Cwd.pm) >= 1.0", "eq", grok q(use Cwd 0==0); #END { $? = 0; } rpm-build-perl-0.82/META.json0000644000076400007640000000174012031433716013523 0ustar atat{ "abstract" : "Calculate dependencies for Perl sources", "author" : [ "Alexey Tourbin " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120921", "license" : [ "unknown" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "rpm-build-perl", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "B" : "0", "Encode" : "0", "O" : "0", "Safe" : "0", "Test::More" : "0" } } }, "release_status" : "stable", "version" : "0.82" } rpm-build-perl-0.82/META.yml0000644000076400007640000000103612031433715013350 0ustar atat--- abstract: 'Calculate dependencies for Perl sources' author: - 'Alexey Tourbin ' build_requires: ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120921' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: rpm-build-perl no_index: directory: - t - inc requires: B: 0 Encode: 0 O: 0 Safe: 0 Test::More: 0 version: 0.82 rpm-build-perl-0.82/MANIFEST0000644000076400007640000000102112031433257013223 0ustar atatChanges ConstOptree/ConstOptree.pm ConstOptree/ConstOptree.xs ConstOptree/Makefile.PL MANIFEST META.json Module JSON meta-data (added by MakeMaker) META.yml Module meta-data (added by MakeMaker) Makefile.PL README README.ALT fake.pm lib/B/Walker.pm lib/B/PerlReq.pm lib/B/Clobbers.pm lib/PerlReq/Utils.pm perl.clean perl.prov perl.req perl.prov.files perl.req.files perl5-alt-rpm-macros macros.env rpm-build-perl.spec t/01-B-PerlReq.t t/02-perlreq.t t/03-perlprov.t rpm-build-perl-0.82/macros.env0000644000076400007640000000020210762170527014077 0ustar atat%{?_perl_lib_path:export RPM_PERL_LIB_PATH="%_perl_lib_path"} %{?_perl_req_method:export RPM_PERL_REQ_METHOD="%_perl_req_method"} rpm-build-perl-0.82/perl.req.files0000755000076400007640000000225511577223216014671 0ustar atat#!/bin/sh -efu # # Copyright (c) 2007 Alexey Tourbin, ALT Linux Team. # # 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 2 of the License, or # (at your option) any later version. # # This is /usr/lib/rpm/find-requires filter. It reads << file -NF$'\t' >> # output and decides which files should be processed with perl.req. # while IFS=$'\t' read -r f t; do case "$f" in */auto/share/dist/*) continue ;; */auto/share/module/*) continue ;; esac case "$t" in # shortcut check for perl scripts *"perl script text"*) echo "$f" continue ;; # symbolic links not needed here? *"symbolic link to "*) continue ;; esac case "$f" in *.pm | *.pl | *.ph ) ;; *) continue ;; esac case "$t" in *" text"*) echo "$f" ;; # file(1) check for text files is not quite reliable # I use perl for '-T $f' heuristic check (see perlfunc for details) *) if perl -e '$f=shift; exit( -T $f ? 0 : 1 )' "$f"; then echo "${0##*/}: $f: $t (PASS)" >&2 echo "$f" else echo "${0##*/}: $f: $t (IGNORE)" >&2 fi ;; esac done