From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 29 Apr 2004 00:37:40 +0400 From: Alexey Tourbin To: devel@altlinux.ru Message-ID: <20040428203740.GK1895@solemn.turbinal.org> Mail-Followup-To: devel@altlinux.ru Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="smEuXhZLKnMjT4Ht" Content-Disposition: inline Subject: [devel] cpan2spec X-BeenThere: devel@altlinux.ru X-Mailman-Version: 2.1.4 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Apr 2004 20:39:41 -0000 Archived-At: List-Archive: List-Post: --smEuXhZLKnMjT4Ht Content-Type: multipart/mixed; boundary="2XUWoe1nmt7t49kG" Content-Disposition: inline --2XUWoe1nmt7t49kG Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =FA=C4=D2=C1=D7=D3=D4=D7=D5=CA=D4=C5. =F5 =CB=CF=C7=CF-=CE=C9=C2=D5=C4=D8 =C5=D3=D4=D8 =CC=C0=C2=C9=CD=D9=C5 =D0= =C5=D2=CC=CF=D7=D9=C5 =CD=CF=C4=D5=CC=C9, =CB=CF=D4=CF=D2=D9=C8 =CE=C5=D4 = =D7 =D3=C9=DA=C9=C6=C5? =EE=C1=D2=C9=D3=CF=D7=C1=CC =D3=CB=D2=C9=D0=D4 =C4=CC=D1 =D5=D0=D2=CF=DD=C5= =CE=CE=CF=CA =C7=C5=CE=C5=D2=C1=C3=C9=C9 spec-=C6=C1=CA=CC=C1 (=CE=C1=D0=CF= =C4=CF=C2=C9=C5 cpan2rpm, =CE=CF =CF=CB=CF=CE=DE=C1=D4=C5=CC=D8=CE=CF =C4=D6=C9=CE=C1 =C9= =DA =C2=D5=D4=D9=CC=CB=C9 =D7=D9=D0=D5=D3=CB=C1=D4=D8 =CE=C5=CC=D8=DA=D1:)). $ cpan2spec ~/RPM/SOURCES/Bloom-Filter-0.02.tar.bz2 %define dist Bloom-Filter Name: perl-%dist Version: 0.02 Release: alt1 Summary: Sample Perl Bloom filter implementation License: GPL or Artistic Group: Development/Perl URL: %CPAN %dist Source: %dist-%version.tar.bz2 BuildArch: noarch %description A Bloom filter is a probabilistic algorithm for doing existence tests in less memory than a full list of keys would require. The tradeoff to using Bloom filters is a certain configurable risk of false positives.=20 This module implements a simple Bloom filter with configurable capacity and false positive rate. Bloom filters were first described in a 1970=20 paper by Burton Bloom, see http://portal.acm.org/citation.cfm?id=3D362692&d= l=3DACM&coll=3Dportal. %prep %setup -q -n %dist-%version %build %perl_vendor_build %install %perl_vendor_install %files %doc README Changes %perl_vendor_privlib/Bloom* %perl_vendor_man3dir/Bloom* $ --2XUWoe1nmt7t49kG Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=cpan2spec Content-Transfer-Encoding: quoted-printable #!/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 =3D ( Name =3D> 'perl-%dist', Release =3D> 'alt1', License =3D> 'GPL or Artistic', Group =3D> 'Development/Perl', URL =3D> '%CPAN %dist', Source =3D> '%dist-%version.tar.bz2', BuildArch =3D> 'noarch', prep =3D> '%setup -q -n %dist-%version', build =3D> '%perl_vendor_build', install =3D> '%perl_vendor_install', ); my @order =3D ( # 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 =3D=3D 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 =3D realpath $ARGV[0]; my $dir =3D tempdir "cpan2spec.XXXXXXXXXX", TMPDIR =3D> 1, CLEANUP =3D> 1; chdir $dir; my $z =3D $tarball =3D~ /\.tar.bz2$/ && 'j' || $tarball =3D~ /\.tar.gz$/ && 'z' || do { my $exhort =3D q(shpx gneonyy); $exhort =3D~ 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 =3D=20 sub { $makefile =3D { @_ }; bless $makefile, 'MM' } and do './Makefile.PL'; $$makefile{DISTNAME} ||=3D $$makefile{NAME} and $$makefile{DISTNAME} =3D~ = s/::/-/g; $spec{dist} ||=3D $$makefile{DISTNAME}; find { wanted =3D> sub { $$makefile{VERSION_FROM} ||=3D $_ if /\.pm$/ }=20 =3D> no_chdir =3D> 1 } =3D> "."; =09 $spec{Version} ||=3D $$makefile{VERSION} || $makefile->parse_version($$makefile{VERSION_FROM}); $spec{Summary} ||=3D $$makefile{ABSTRACT} ||=20 $makefile->parse_abstract($$makefile{ABSTRACT_FROM} || $$makefile{VERSION= _FROM}); $spec{Summary} ||=3D do { open my $fh, ($$makefile{ABSTRACT_FROM} || $$makefile{VERSION_FROM}); my @lines =3D <$fh>; shift @lines while grep { /^=3Dhead1\s+name/i } @lines; shift @lines; local $_ =3D shift @lines; s/^[\w:-]+\s+[^\w\s]+\s+//; $_; }; $spec{description} ||=3D do { open my $fh, ($$makefile{ABSTRACT_FROM} || $$makefile{VERSION_FROM}); my @lines =3D <$fh>; shift @lines while grep { /^=3Dhead1\s+descr/i } @lines; shift @lines; local $_ =3D shift @lines; for my $line (@lines) { last unless $line =3D~ /\S/; $_ .=3D $line; } $_; }; =09 my $xs; find sub { ++$xs if /\.(xs|c)$/ } =3D> "."; delete $spec{BuildArch} if $xs; =09 my @doc =3D (, ); $spec{files} .=3D "\%doc @doc\n" if @doc; =09 my %glob; find sub { /\.pm$/ and do { open my $fh, $_;=20 map { /^package\s+(\w+)/ && ++$glob{$1} } <$fh>;=20 }} =3D> "."; foreach my $glob (sort keys %glob) { $spec{files} .=3D $xs ? "\%perl_vendor_archlib/$glob*\n\%perl_vendor_autolib/$glob*\n" : "\%perl_vendor_privlib/$glob*\n"; $spec{files} .=3D "\%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"; } --2XUWoe1nmt7t49kG-- --smEuXhZLKnMjT4Ht Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAkBYUfBKgtDjnu0YRAoFfAJ4+WnoMgTTRuOMZwgTi2bApCxMAgQCfdvft RGQ2MXaTrsufTWofmq14Cvc= =gpGb -----END PGP SIGNATURE----- --smEuXhZLKnMjT4Ht--