Группа :: Разработка/Прочее
Пакет: cpan2rpm
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: cpan2rpm-2.027-alt.patch
--- cpan2rpm.orig 2005-02-07 20:25:27 +0300
+++ cpan2rpm 2005-06-06 12:53:55 +0400
@@ -3,6 +3,7 @@
#
# cpan2rpm - CPAN module RPM maker
# Copyright (C) 2001-2003 Erick Calder
+# Modified by Vitaly Lipatov <lav@etersoft.ru>, 2005
#
# 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
@@ -78,9 +79,10 @@
%info = (
url => "http://www.cpan.org",
packager => "Arix International <cpan2rpm\@arix.com>",
- group => "Applications/CPAN",
+ group => "Development/Perl",
license => "Artistic",
- release => 1,
+ author => "unknown",
+ release => "alt1",
buildroot => "%{_tmppath}/%{name}-%{version}-%(id -u -n)",defattr => "-,root,root",
description => "None.",
@@ -197,6 +199,7 @@
exit;
}
+
if (defined $info{"sign-setup"}) {sign_setup();
exit;
@@ -231,6 +234,9 @@
# deal with newer versions
chkupgrade();
+ # set packager
+ $info{packager} = getrpm_macdef("packager");+
# check directory permissions
$RPMDIR{BUILD} = getrpm_macdef("_builddir");@@ -242,7 +248,7 @@
chkdirs();
# sets empty string if not --buildarch and --spec-only
- $info{buildarch} ||= $info{"spec-only"} ? "" : $RPMDIR{ARCH};+ $info{BuildArch} ||= $info{"spec-only"} ? "" : $RPMDIR{ARCH};# set module download method
@@ -385,7 +391,7 @@
else {my $xs = 0;
find(sub { $xs = 1 if /\.(xs|c)$/i }, $info->{evaldir});- $info->{buildarch} = "noarch" if $xs == 0;+ $info->{BuildArch} = "noarch" if $xs == 0;}
chdir $info->{evaldir} || die "get_meta(): $!";@@ -579,7 +585,7 @@
chkdirs();
- $info->{spec} ||= "$RPMDIR{SPECS}/$info->{name}.spec";+ $info->{spec} ||= "$RPMDIR{SPECS}/perl-$info->{name}.spec"; ($info->{tardir} = $info->{evaldir}) =~ s|.*/||;# for directories, guess some of the needed values
@@ -624,7 +630,6 @@
$info->{description} = $meta{DESCRIPTION} if $meta{DESCRIPTION}; push @{$info->{source}}, $info->{tarball} unless $info->{source};- $info->{changelog} = changelog(); $info->{"find-provides"} &&= qq/%define __find_provides $info->{"find-provides"}/;@@ -636,9 +641,9 @@
# option lists
$info->{"opts-simple"} = [qw/- name summary version release epoch
- vendor packager distribution license group url
- buildroot buildarch
+ name version release , summary , epoch
+ license group url vendor , packager , distribution
+ BuildArch
/];
$info->{"opts-agg"} = [qw/@@ -743,6 +748,7 @@
sub mk_spec {my $info = shift || $_; local $_;
+ my $pkgname = $info->{name};print "Generating spec file\n";
@@ -757,15 +763,14 @@
$info->{$_} =~ s/\r//g for keys %info;# generalise whenever possible
-
- for (qw/tardir source/) {- $info->{$_} =~ s/$info->{name}/%{pkgname}/;- $info->{$_} =~ s/$info->{version}/%{version}/;+ for (qw/tardir source source-list/) {+ $info->{$_} =~ s/$pkgname/%m_distro/;+ $info->{$_} =~ s/$info->{version}/%version/;}
$info->{description} =~ s/\s+$//;- $info->{maketest} = $info->{"make-no-test"} ? 0 : 1;- $info->{vendor} = $info->{author};+ $info->{maketest} = $info->{"make-no-test"} ? "_disable_test 1" : "_enable_test 1";+ #$info->{vendor} = $info->{author}; if ($info->{name} eq "ExtUtils-MakeMaker") {# MakeMaker builds itself using itself
@@ -810,27 +815,26 @@
# prepend string to separate module from usual namespace
- my $pkgname = $info->{name}; $info->{name} = "perl-" . $info->{name} unless $info->{"no-prfx"};my $spec = <<ZZ;
#
# - $info->{module} -# This spec file was automatically generated by cpan2rpm [ver: $VERSION]
+ # (ALT Linux revision)
ZZ
my $me; ($me = $0) =~ s|.*/||;
$spec .= <<ZZ unless $info->{module} eq $me;# The following arguments were used:
# $ARGS
-ZZ
- $spec .= <<ZZ;
# For more information on cpan2rpm please visit: http://perl.arix.com/
#
- %define pkgname $pkgname
- %define filelist %{pkgname}-%{version}-filelist- %define NVR %{pkgname}-%{version}-%{release}- %define maketest $info->{maketest}+ %define module $pkgname
+ %define m_distro $pkgname
+ %define m_name $info->{module}+ %define m_author_id $info->{author}+ %define $info->{maketest}ZZ
$spec .= <<ZZ if $info->{"define-list"};# user definitions
@@ -849,11 +853,12 @@
$spec .= "\n";
for (@{$info->{"opts-simple"}}) {- $spec .= sprintf("%-*s %s\n", $SPECCOL, "$_:", $info->{$_})+ $spec .= "\n" if ($_ eq ",");
+ $spec .= sprintf("%-*s %s\n", $SPECCOL, ucfirst("$_:"), $info->{$_}) if $info->{$_};}
- $spec .= sprintf("%-*s %s\n", $SPECCOL, "prefix:", "%(echo %{_prefix})");+ #$spec .= sprintf("%-*s %s\n", $SPECCOL, "prefix:", "%(echo %{_prefix})");# add lists
@@ -866,133 +871,50 @@
$spec .= "\n" . q/%description/ . "\n$info->{description}\n";- $_ = <<ZZ;
-
- #
- # This package was generated automatically with the cpan2rpm
- # utility. To get this software or for more information
- # please visit: http://perl.arix.com/
- #
-ZZ
- s/^[^\S\n]+//mg; $spec .= $_;
-
# handle sections
$_ = "%setup -q -n $info->{tardir} $info->{create}"; $_ .= $/ . $info->{'patch-apply'} if $info->{"patch-apply"};- $_ .= $/ . "chmod -R u+w %{_builddir}/$info->{tardir}" . $/;+ #$_ .= $/ . "chmod -R u+w %{_builddir}/$info->{tardir}" . $/;+ $spec .= "\n";
$spec .= mksec($info, "prep" => $_);
- $_ = ($info->{PL} =~ /^Make/)- ? qq/
- $info->{fixin}- CFLAGS="\$RPM_OPT_FLAGS"
- %{__perl} Makefile.PL $info->{"make-maker"}- %{__make} $info->{"make"}- %if %maketest
- %{__make} test- %endif
- / : qq/
- $info->{fixin}- %{__perl} Build.PL- %{__perl} Build- %if %maketest
- %{__perl} Build test- %endif
- /;
- s/^\s+//mg;
- $spec .= mksec($info, "build" => $_);
-
- my $install = ($info->{PL} =~ /^Make/)- ? qq/%{makeinstall} /- : qq/%{__perl} Build install /- ;
- $install .= $info->{"make-install"};-
- $_ = <<ZZ;
- [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}- $info->{"no-requires"}{"install"}- $install
-
- cmd=/usr/share/spec-helper/compress_files
- [ -x \$cmd ] || cmd=/usr/lib/rpm/brp-compress
- [ -x \$cmd ] && \$cmd
-
- # SuSE Linux
- if [ -e /etc/SuSE-release -o -e /etc/UnitedLinux-release ]
- then
- %{__mkdir_p} %{buildroot}/var/adm/perl-modules- %{__cat} `find %{buildroot} -name "perllocal.pod"` \\- | %{__sed} -e s+%{buildroot}++g \\- > %{buildroot}/var/adm/perl-modules/%{name}- fi
-
- # remove special files
- find %{buildroot} -name "perllocal.pod" \\- -o -name ".packlist" \\
- -o -name "*.bs" \\
- |xargs -i rm -f {}-
- # no empty directories
- find %{buildroot}%{_prefix} \\- -type d -depth \\
- -exec rmdir {} \\; 2>/dev/null-
- %{__perl} -MFile::Find -le '- find({ wanted => \\&wanted, no_chdir => 1}, "%{buildroot}");- print "$info->{doc}";- for my \$x (sort \@dirs, \@files) {- push \@ret, \$x unless indirs(\$x);
- }
- print join "\\n", sort \@ret;
+ $spec .= <<ZZ;
- sub wanted {- return if /auto\$/;
+%build
+%perl_vendor_build
- local \$_ = \$File::Find::name;
- my \$f = \$_; s|^\\Q%{buildroot}\\E||;- return unless length;
- return \$files[\@files] = \$_ if -f \$f;
-
- \$d = \$_;
- /\\Q\$d\\E/ && return for reverse sort \@INC;
- \$d =~ /\\Q\$_\\E/ && return
- for qw|/etc %_prefix/man %_prefix/bin %_prefix/share|;
+%install
+%perl_vendor_install
- \$dirs[\@dirs] = \$_;
- }
-
- sub indirs {- my \$x = shift;
- \$x =~ /^\\Q\$_\\E\\// && \$x ne \$_ && return 1 for \@dirs;
- }
- ' > %filelist
-
- [ -z %filelist ] && {- echo "ERROR: empty %files listing"
- exit -1
- }
+%files
+%perl_vendor_privlib/*
+%perl_vendor_man3dir/*
ZZ
- s/^ {8}//mg;- $spec .= mksec($info, "install" => $_);
- $_ = qq|[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}\n|;- # $_ .= qq|rm -rf %_builddir/%name-%version\n|;
- $_ .= qq/$info->{"no-requires"}{"clean"}\n/- if $info->{"no-requires"}{"clean"};- $spec .= mksec($info, "clean" => $_);
-
- $spec .= qq|$/%files -f %filelist|;
- $spec .= qq|$/%defattr($info->{defattr})$/|;- $spec .= $info->{epilogue}{files};+ # where is the broken thing?
+ #$info->{changelog} = changelog();+ my @dow = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");+ my @mon = ("Jan", "Feb", "Mar", "Apr", "May", "Jun"+ , "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ );
+ $info->{changelog} = sprintf("%s %s %02d %d %s"+ , $dow[(localtime)[6]]
+ , $mon[(localtime)[4]]
+ , (localtime)[3]
+ , 1900 + (localtime)[5]
+ , sprintf("%s %s-%s", $info->{packager}, $info->{version}, $info->{release})+ );
$spec .= mksec($info, "changelog"
- => "* $info->{changelog}\n- Initial build."+ => "* $info->{changelog}\n- first build for ALT Linux Sisyphus");
writefile($info->{spec}, $spec); print("SPEC: $info->{spec}\n");+ system("cleanup_spec $info->{spec}");+ system("buildreq $info->{spec}"); exit if $info->{"spec-only"};}
@@ -1014,11 +936,11 @@
}
$info->{rpm} = sprintf("%s/%s-%s-%s.%s.rpm"- , "$RPMDIR{RPMS}/$info->{buildarch}"+ , "$RPMDIR{RPMS}/$info->{BuildArch}" , $info->{name} , $info->{version} , $info->{release}- , $info->{buildarch}+ , $info->{BuildArch});
$info->{srpm} = sprintf("%s/%s-%s-%s.src.rpm" , $RPMDIR{SRPMS}@@ -1478,7 +1400,7 @@
BUILD SOURCES SPECS SRPMS
RPMS RPMS/i386 RPMS/i686 RPMS/noarch
|;
- push @subdirs, "RPMS/$info{buildarch}" if $info{buildarch};+ push @subdirs, "RPMS/$info{BuildArch}" if $info{BuildArch}; for (map "$topdir/$_", "", @subdirs) {next if -e;
mkdir($_, 0755) || die "Cannot make $_: $!";
@@ -1553,7 +1475,7 @@
my $nm = shift || $_;
my @opt; push @opt, split /,/ for @{$info->{$nm}};my $ret = "";
- $ret .= sprintf("%-*s %s\n", $SPECCOL, "$nm:", $_) for @opt;+ $ret .= sprintf("%-*s %s\n", $SPECCOL, ucfirst("$nm:"), $_) for @opt;$ret;
}
@@ -1640,13 +1562,12 @@
my @mon = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
);
-
- return sprintf("%s %s %d %d %s"+ return sprintf("%s %s %02d %d %s", $dow[(localtime)[6]]
, $mon[(localtime)[4]]
, (localtime)[3]
, 1900 + (localtime)[5]
- , sprintf("%s\@%s", (getpwuid($<))[0], hostname())+ , sprintf("%s %s-%s", $info{packager}, $info{version}, $info{release}));
}
Patch from Sir Raorn
https://bugzilla.altlinux.org/show_bug.cgi?id=7636
--- /usr/bin/cpan2rpm 2005-06-07 18:13:07 +0400
+++ cpan2rpm 2005-08-10 13:12:42 +0400
@@ -86,6 +86,7 @@
buildroot => "%{_tmppath}/%{name}-%{version}-%(id -u -n)",defattr => "-,root,root",
description => "None.",
+ "rpm-args" => "",
);
my %desc = (
@@ -122,6 +123,7 @@
# -- build options
"spec-only" => "only generates spec file",
"spec=s" => "specifies the name of a spec file",
+ "rpm-args=s" => "additional rpm arguments",
"make-maker=s" => "arguments for makefile creation",
"make=s" => "arguments passed to make",
"make-no-test" => "suppress running test suite",
@@ -914,7 +916,7 @@
writefile($info->{spec}, $spec); print("SPEC: $info->{spec}\n"); system("cleanup_spec $info->{spec}");- system("buildreq $info->{spec}");+ system("buildreq --args=\"$info{'rpm-args'}\" $info->{spec}"); exit if $info->{"spec-only"};}
@@ -953,19 +955,19 @@
if (! -r $info->{rpm} || $info->{force}) {print "Generating package\n";
- my $bp = qx/$RPM -bp $info->{spec} 2>&1/;- warn("RPM test unpacking failed! [$RPM -bp $info->{spec}]\n$bp")+ my $bp = qx/$RPM $info{"rpm-args"} -bp $info->{spec} 2>&1/;+ warn("RPM test unpacking failed! [$RPM $info{'rpm-args'} -bp $info->{spec}]\n$bp")if $ret = $? >> 8;
if ($ret == 0) {- my @cmd = ($RPM, '-ba');
+ my @cmd = ($RPM, $info{"rpm-args"}, '-ba'); push @cmd, "--clean" unless $info->{"no-clean"}; push @cmd, $info->{sign} if $info->{sign}; push @cmd, $info->{spec};debug(join " ", @cmd);
print "Signing package (pass phrase required)\n"
if $info->{sign};- system(@cmd);
+ system(join(" ", @cmd));die "RPM build failed [$ret]" if $ret = $? >> 8;
}
}
@@ -1490,7 +1492,7 @@
sub getrpm_macdef($) {my $key = shift;
- chomp(local $_ = qx/rpm --eval \%{$key}/);+ chomp(local $_ = qx/rpm $info{"rpm-args"} --eval \%{$key}/);s/^\s+//; s/\s*\n+/ /gs; s/\s+$//;
$_;
}
@@ -1550,7 +1552,7 @@
}
my ($f) = $url =~ m|.*/(.*)|;
- my @ret = qx|$RPM -ta $TMPDIR/$f 2>&1|;
+ my @ret = qx|$RPM $info{"rpm-args"} -ta $TMPDIR/$f 2>&1|;die "upgrade(): $!" if $?;
/Wrote:\s+(.*)$/ && ($info{rpm} = $1) && last for reverse @ret;inst_rpm(\%info);
--- cpan2rpm.o 2005-08-18 11:03:35 +0400
+++ cpan2rpm 2005-09-04 01:33:36 +0400
@@ -628,7 +628,7 @@
# assemble other info
- $info->{summary} = "$info->{name} - " . ($meta{ABSTRACT} || "Perl module");+ $info->{summary} = ($meta{ABSTRACT} || "$info->{name} - " . "Perl module"); $info->{description} = $meta{DESCRIPTION} if $meta{DESCRIPTION}; push @{$info->{source}}, $info->{tarball} unless $info->{source};--- cpan2rpm.o 2005-09-04 01:38:48 +0400
+++ cpan2rpm 2005-09-04 01:39:06 +0400
@@ -643,8 +643,8 @@
# option lists
$info->{"opts-simple"} = [qw/- name version release , summary , epoch
- license group url vendor , packager , distribution
+ name version release = summary = epoch
+ license group url vendor = packager = distribution
BuildArch
/];
@@ -855,7 +855,7 @@
$spec .= "\n";
for (@{$info->{"opts-simple"}}) {- $spec .= "\n" if ($_ eq ",");
+ $spec .= "\n" if ($_ eq "=");
$spec .= sprintf("%-*s %s\n", $SPECCOL, ucfirst("$_:"), $info->{$_}) if $info->{$_};}
--- cpan2rpm.orig 2005-09-04 01:46:12 +0400
+++ cpan2rpm 2005-09-04 01:49:59 +0400
@@ -225,6 +225,10 @@
);
};
+ # Default behavior
+ $info{"spec-only"} = "1";+ $info{"no-upgrade-chk"} = "1";+
upgrade() if defined $info{upgrade}; unless ($info{"no-sign"}) {@@ -895,28 +899,12 @@
%perl_vendor_man3dir/*
ZZ
- # where is the broken thing?
- #$info->{changelog} = changelog();- my @dow = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");- my @mon = ("Jan", "Feb", "Mar", "Apr", "May", "Jun"- , "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- );
- $info->{changelog} = sprintf("%s %s %02d %d %s"- , $dow[(localtime)[6]]
- , $mon[(localtime)[4]]
- , (localtime)[3]
- , 1900 + (localtime)[5]
- , sprintf("%s %s-%s", $info->{packager}, $info->{version}, $info->{release})- );
-
- $spec .= mksec($info, "changelog"
- => "* $info->{changelog}\n- first build for ALT Linux Sisyphus"- );
-
writefile($info->{spec}, $spec);+
print("SPEC: $info->{spec}\n"); system("cleanup_spec $info->{spec}"); system("buildreq --args=\"$info{'rpm-args'}\" $info->{spec}");+ system("add_changelog -e '- first build for ALT Linux Sisyphus' $info->{spec}"); exit if $info->{"spec-only"};}
