* [devel] cpan2spec
@ 2004-04-28 20:37 Alexey Tourbin
2004-04-28 21:20 ` [devel] cpan2spec Michael Shigorin
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Alexey Tourbin @ 2004-04-28 20:37 UTC (permalink / raw)
To: devel
[-- Attachment #1.1: Type: text/plain, Size: 1185 bytes --]
Здравствуйте.
У кого-нибудь есть любимые перловые модули, которых нет в сизифе?
Нарисовал скрипт для упрощенной генерации spec-файла (наподобие
cpan2rpm, но окончательно джина из бутылки выпускать нельзя:)).
$ 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.
This module implements a simple Bloom filter with configurable capacity
and false positive rate. Bloom filters were first described in a 1970
paper by Burton Bloom, see http://portal.acm.org/citation.cfm?id=362692&dl=ACM&coll=portal.
%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*
$
[-- Attachment #1.2: cpan2spec --]
[-- Type: text/plain, Size: 3847 bytes --]
#!/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 <<EOF and exit(1);
Usage:
1) go get your module at http://search.cpan.org/
2) zme <module>.tar.gz
3) $0 <module>.tar.*z* > ~/RPM/SOURES/perl-<module>.spec
4) vim ~/RPM/SOURES/perl-<module>.spec
5) buildreq ~/RPM/SOURES/perl-<module>.spec
6) add_changelog -e 'initial revision' ~/RPM/SOURES/perl-<module>.spec
7) rpm -ba ~/RPM/SOURES/perl-<module>.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 = (<README*>, <Change*>);
$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";
}
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [devel] Re: cpan2spec
2004-04-28 20:37 [devel] cpan2spec Alexey Tourbin
@ 2004-04-28 21:20 ` Michael Shigorin
2004-04-29 3:59 ` [devel] cpan2spec Alexey I. Froloff
2004-04-29 9:00 ` [devel] cpan2spec Artem Pastukhov
2 siblings, 0 replies; 7+ messages in thread
From: Michael Shigorin @ 2004-04-28 21:20 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 267 bytes --]
On Thu, Apr 29, 2004 at 12:37:40AM +0400, Alexey Tourbin wrote:
> У кого-нибудь есть любимые перловые модули, которых нет в сизифе?
Кажется, их теперь не останется. :)
--
---- WBR, Michael Shigorin <mike@altlinux.ru>
------ Linux.Kiev http://www.linux.kiev.ua/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [devel] cpan2spec
2004-04-28 20:37 [devel] cpan2spec Alexey Tourbin
2004-04-28 21:20 ` [devel] cpan2spec Michael Shigorin
@ 2004-04-29 3:59 ` Alexey I. Froloff
2004-04-29 8:10 ` [devel] cpan2spec Alexey Tourbin
2004-04-29 9:00 ` [devel] cpan2spec Artem Pastukhov
2 siblings, 1 reply; 7+ messages in thread
From: Alexey I. Froloff @ 2004-04-29 3:59 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 275 bytes --]
* Alexey Tourbin <at@> [040429 01:15]:
> $ cpan2spec ~/RPM/SOURCES/Bloom-Filter-0.02.tar.bz2
А можно cpan2spec Bloom::Filter ?
--
Regards, Sir Raorn.
-------------------
Грамотное и безопасное программирование как-то плохо сочетается
с C/C++.
-- vsl in devel@
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [devel] Re: cpan2spec
2004-04-29 3:59 ` [devel] cpan2spec Alexey I. Froloff
@ 2004-04-29 8:10 ` Alexey Tourbin
0 siblings, 0 replies; 7+ messages in thread
From: Alexey Tourbin @ 2004-04-29 8:10 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]
On Thu, Apr 29, 2004 at 07:59:15AM +0400, Alexey I. Froloff wrote:
> * Alexey Tourbin <at@> [040429 01:15]:
> > $ cpan2spec ~/RPM/SOURCES/Bloom-Filter-0.02.tar.bz2
> А можно cpan2spec Bloom::Filter ?
Да можно... только вот бездумно пакеты собирать нельзя...
$ perl -MData::Dumper -MCPAN -le 'print Dumper(CPAN::Shell->expand("Module", "Bloom::Filter"))'
CPAN: Storable loaded ok
Going to read /home/at/.cpan/Metadata
Database was generated on Wed, 28 Apr 2004 23:52:47 GMT
$VAR1 = bless( {
'ID' => 'Bloom::Filter',
'RO' => {
'CPAN_FILE' => 'M/MC/MCEGLOWS/Bloom-Filter-0.02.tar.gz',
'CPAN_USERID' => 'MCEGLOWS',
'CPAN_VERSION' => '0.02'
}
}, 'CPAN::Module' );
$
> --
> Regards, Sir Raorn.
--
А теперь такие грабли. Пиво только у пользователя устанавливаются
при продавливании патча в BTS.
-- Markov chain after fortunes-ALT
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [devel] cpan2spec
2004-04-28 20:37 [devel] cpan2spec Alexey Tourbin
2004-04-28 21:20 ` [devel] cpan2spec Michael Shigorin
2004-04-29 3:59 ` [devel] cpan2spec Alexey I. Froloff
@ 2004-04-29 9:00 ` Artem Pastukhov
2004-04-29 9:47 ` [devel] cpan2spec Alexey Tourbin
2 siblings, 1 reply; 7+ messages in thread
From: Artem Pastukhov @ 2004-04-29 9:00 UTC (permalink / raw)
To: ALT Devel discussion list
В сообщении от Четверг 29 Апрель 2004 00:37 Alexey Tourbin написал(a):
> Здравствуйте.
> У кого-нибудь есть любимые перловые модули, которых нет в сизифе?
> Нарисовал скрипт для упрощенной генерации spec-файла (наподобие
> cpan2rpm, но окончательно джина из бутылки выпускать нельзя:)).
>
У меня не работает :
cpan2spec ~/RPM/SOURCES/Zoidberg-0.51.tar.bz2
Can't call method "parse_version" on unblessed reference at
/home/past/bin/cpan2spec line 87.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [devel] Re: cpan2spec
2004-04-29 9:00 ` [devel] cpan2spec Artem Pastukhov
@ 2004-04-29 9:47 ` Alexey Tourbin
2004-04-29 12:40 ` Alexey Tourbin
0 siblings, 1 reply; 7+ messages in thread
From: Alexey Tourbin @ 2004-04-29 9:47 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
On Thu, Apr 29, 2004 at 01:00:59PM +0400, Artem Pastukhov wrote:
> У меня не работает :
>
> cpan2spec ~/RPM/SOURCES/Zoidberg-0.51.tar.bz2
> Can't call method "parse_version" on unblessed reference at
> /home/past/bin/cpan2spec line 87.
Понятно. Там для сборки пспользуется Module::Build, а не
ExtUtils::MakeMaker. Сейчас соберу Module::Build.
--
Открою страшную тайну -- alt1 будет работоспособное решение.
-- Markov chain after fortunes-ALT
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [devel] Re: cpan2spec
2004-04-29 9:47 ` [devel] cpan2spec Alexey Tourbin
@ 2004-04-29 12:40 ` Alexey Tourbin
0 siblings, 0 replies; 7+ messages in thread
From: Alexey Tourbin @ 2004-04-29 12:40 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 797 bytes --]
On Thu, Apr 29, 2004 at 01:47:09PM +0400, Alexey Tourbin wrote:
> On Thu, Apr 29, 2004 at 01:00:59PM +0400, Artem Pastukhov wrote:
> > У меня не работает :
> >
> > cpan2spec ~/RPM/SOURCES/Zoidberg-0.51.tar.bz2
> > Can't call method "parse_version" on unblessed reference at
> > /home/past/bin/cpan2spec line 87.
>
> Понятно. Там для сборки пспользуется Module::Build, а не
> ExtUtils::MakeMaker. Сейчас соберу Module::Build.
Добавил поддержку Module::Build в /etc/rpm/macros.d/perl5
для сбрки по существующей схеме, собрал Module::Build (он,
в лучших традициях UNIX, сам себя собирает).
Только ведь фриз намечается, сейчас этого всего лучше не торгать...
--
Господа, только карму свою испортите. Правда, что это явление временное.
-- Markov chain after fortunes-ALT
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-04-29 12:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-28 20:37 [devel] cpan2spec Alexey Tourbin
2004-04-28 21:20 ` [devel] cpan2spec Michael Shigorin
2004-04-29 3:59 ` [devel] cpan2spec Alexey I. Froloff
2004-04-29 8:10 ` [devel] cpan2spec Alexey Tourbin
2004-04-29 9:00 ` [devel] cpan2spec Artem Pastukhov
2004-04-29 9:47 ` [devel] cpan2spec Alexey Tourbin
2004-04-29 12:40 ` Alexey Tourbin
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git