From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Date: Tue, 16 Dec 2008 12:20:40 +0200 From: Michael Shigorin To: ALT Linux Team development discussions Message-ID: <20081216102040.GC10134@osdn.org.ua> Mail-Followup-To: ALT Linux Team development discussions References: <20081210034555.GG5156@mw.office.seiros.ru> <20081216071956.GC21286@altlinux.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Qrgsu6vtpU/OV/zm" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20081216071956.GC21286@altlinux.org> User-Agent: Mutt/1.4.2.1i Subject: Re: [devel] perl packages X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.10b3 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2008 10:20:42 -0000 Archived-At: List-Archive: List-Post: --Qrgsu6vtpU/OV/zm Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit On Tue, Dec 16, 2008 at 10:19:56AM +0300, Alexey Tourbin wrote: > > - в каком состоянии сейчас cpan2rpm (в курсе ли он про свежие > > изменения при упаковки перловых модулей)? > Не следует использовать cpan2rpm. 1) почему, или "вообще"? 2) а cpan2spec? -- ---- WBR, Michael Shigorin ------ Linux.Kiev http://www.linux.kiev.ua/ --Qrgsu6vtpU/OV/zm Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=cpan2spec #!/usr/bin/perl # $Id$ use Switch; use Cwd qw(realpath); use ExtUtils::MakeMaker; use File::Find qw(find); use File::Temp qw(tempdir); use sigtrap qw(die normal-signals); use strict; my %spec = ( Name => 'perl-%dist', Release => 'alt1', License => 'GPL or Artistic', Group => 'Development/Perl', URL => '%CPAN %dist', Source => '%dist-%version.tar.bz2', BuildArch => 'noarch', prep => '%setup -q -n %dist-%version', build => '%perl_vendor_build', install => '%perl_vendor_install', ); my @order = ( # name, type, optional [qw[ dist macro ]], [qw[ Name tag ]], [qw[ Version tag ]], [qw[ Release tag ]], [qw[ ]], [qw[ Summary tag ]], [qw[ License tag ]], [qw[ Group tag ]], [qw[ ]], [qw[ URL tag ]], [qw[ Source tag ]], [qw[ ]], [qw[ BuildArch tag 1 ]], [qw[ ]], [qw[ description section ]], [qw[ ]], [qw[ prep section ]], [qw[ ]], [qw[ build section ]], [qw[ ]], [qw[ install section ]], [qw[ ]], [qw[ files section ]], ); @ARGV == 1 or print STDERR <.tar.gz 3) $0 .tar.*z* > ~/RPM/SOURES/perl-.spec 4) vim ~/RPM/SOURES/perl-.spec 5) buildreq ~/RPM/SOURES/perl-.spec 6) add_changelog -e 'initial revision' ~/RPM/SOURES/perl-.spec 7) rpm -ba ~/RPM/SOURES/perl-.spec EOF { my $tarball = realpath $ARGV[0]; my $dir = tempdir "cpan2spec.XXXXXXXXXX", TMPDIR => 1, CLEANUP => 1; chdir $dir; my $z = $tarball =~ /\.tar.bz2$/ && 'j' || $tarball =~ /\.tar.gz$/ && 'z' || do { my $exhort = q(shpx gneonyy); $exhort =~ tr/A-Za-z/N-ZA-Mn-za-m/; die "$exhort $tarball\n"; }; system "tar", "xf$z", $tarball; chdir <*>; my $makefile; system $^X, qw(-pi -e s/\bexit\b/return/g Makefile.PL); *ExtUtils::MakeMaker::WriteMakefile = sub { $makefile = { @_ }; bless $makefile, 'MM' } and do './Makefile.PL'; $$makefile{DISTNAME} ||= $$makefile{NAME} and $$makefile{DISTNAME} =~ s/::/-/g; $spec{dist} ||= $$makefile{DISTNAME}; find { wanted => sub { $$makefile{VERSION_FROM} ||= $_ if /\.pm$/ } => no_chdir => 1 } => "."; $spec{Version} ||= $$makefile{VERSION} || $makefile->parse_version($$makefile{VERSION_FROM}); $spec{Summary} ||= $$makefile{ABSTRACT} || $makefile->parse_abstract($$makefile{ABSTRACT_FROM} || $$makefile{VERSION_FROM}); $spec{Summary} ||= do { open my $fh, ($$makefile{ABSTRACT_FROM} || $$makefile{VERSION_FROM}); my @lines = <$fh>; shift @lines while grep { /^=head1\s+name/i } @lines; shift @lines; local $_ = shift @lines; s/^[\w:-]+\s+[^\w\s]+\s+//; $_; }; $spec{description} ||= do { open my $fh, ($$makefile{ABSTRACT_FROM} || $$makefile{VERSION_FROM}); my @lines = <$fh>; shift @lines while grep { /^=head1\s+descr/i } @lines; shift @lines; local $_ = shift @lines; for my $line (@lines) { last unless $line =~ /\S/; $_ .= $line; } $_; }; my $xs; find sub { ++$xs if /\.(xs|c)$/ } => "."; delete $spec{BuildArch} if $xs; my @doc = (, ); $spec{files} .= "\%doc @doc\n" if @doc; my %glob; find sub { /\.pm$/ and do { open my $fh, $_; map { /^package\s+(\w+)/ && ++$glob{$1} } <$fh>; }} => "."; foreach my $glob (sort keys %glob) { $spec{files} .= $xs ? "\%perl_vendor_archlib/$glob*\n\%perl_vendor_autolib/$glob*\n" : "\%perl_vendor_privlib/$glob*\n"; $spec{files} .= "\%perl_vendor_man3dir/$glob*\n"; } } for (@order) { print "\n" and next unless @$_; next if not $spec{$$_[0]} and $$_[2]; switch ($$_[1]) { case 'macro' { print "\%define $$_[0] " } case 'tag' { print "$$_[0]: " } case 'section' { print "\%$$_[0]\n" } else { die "$$_[1] \n" } } print $spec{$$_[0]} . "\n"; } --Qrgsu6vtpU/OV/zm--