Hello community, here is the log from the commit of package cpanspec for openSUSE:Factory checked in at Mon Apr 11 11:06:57 CEST 2011.
-------- --- cpanspec/cpanspec.changes 2011-04-08 10:11:10.000000000 +0200 +++ /mounts/work_src_done/STABLE/cpanspec/cpanspec.changes 2011-04-10 21:12:01.000000000 +0200 @@ -1,0 +2,16 @@ +Sun Apr 10 19:11:08 UTC 2011 - [email protected] + +- use one Source line if not recompressed and + fix multi *.gz support + +------------------------------------------------------------------- +Sat Apr 9 11:43:36 UTC 2011 - [email protected] + +- don't fetch details if not already done + +------------------------------------------------------------------- +Fri Apr 8 16:32:40 UTC 2011 - [email protected] + +- more cases of license "under same terms" + +------------------------------------------------------------------- calling whatdependson for head-i586 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cpanspec.spec ++++++ --- /var/tmp/diff_new_pack.ANPOBa/_old 2011-04-11 11:05:00.000000000 +0200 +++ /var/tmp/diff_new_pack.ANPOBa/_new 2011-04-11 11:05:00.000000000 +0200 @@ -20,7 +20,7 @@ Name: cpanspec Version: 1.78 -Release: 25 +Release: 27 %define tar_version 1.78 Summary: Generate a SUSE spec file for a CPAN module License: GPL+ or Artistic ++++++ cpanspec.patch ++++++ --- /var/tmp/diff_new_pack.ANPOBa/_old 2011-04-11 11:05:00.000000000 +0200 +++ /var/tmp/diff_new_pack.ANPOBa/_new 2011-04-11 11:05:00.000000000 +0200 @@ -1,7 +1,7 @@ Index: cpanspec-1.78/cpanspec =================================================================== --- cpanspec-1.78.orig/cpanspec 2009-01-16 21:35:55.000000000 +0100 -+++ cpanspec-1.78/cpanspec 2011-04-08 10:10:43.221274504 +0200 ++++ cpanspec-1.78/cpanspec 2011-04-10 20:53:46.152551293 +0200 @@ -12,9 +12,6 @@ # # $Id: cpanspec,v 1.67 2009/01/16 20:35:17 stevenpritchard Exp $ @@ -46,16 +46,17 @@ our $cpan=$ENV{'CPAN'} || "http://www.cpan.org"; our $home=$ENV{'HOME'} || (getpwuid($<))[7]; -@@ -241,6 +241,8 @@ our @add_requires; +@@ -241,6 +241,9 @@ our @add_requires; our @add_provides; our @add_buildrequires; +our ($file,$name,$source,$version,$type); +our ($content,$summary,$description,$author,$license); ++ # env. vars and their macro analogues my @MACROS = ( -@@ -252,7 +254,7 @@ my @MACROS = ( +@@ -252,7 +255,7 @@ my @MACROS = ( # 1 is for the macros. { @@ -64,13 +65,22 @@ 'buildroot' => '%{buildroot}', }, ); -@@ -338,6 +340,62 @@ sub update_packages() { +@@ -304,6 +307,7 @@ sub fetch($$) { + $fh->close(); + + my $last_modified=$response->last_modified; ++ verbose("Set last modified to $last_modified"); + utime(time, $last_modified, $file) if ($last_modified); + } elsif ($response->code eq "304") { + verbose("$file is up to date."); +@@ -338,6 +342,65 @@ sub update_packages() { $updated=1; } +sub get_file($) { + $file=shift; + # Look up $file in 02packages.details.txt. ++ verbose("Get file $file"); + update_packages(); + $packages=Parse::CPAN::Packages->new($pkgdetails) + if (!defined($packages)); @@ -107,6 +117,7 @@ + # keep things happy if we get "Foo-Bar" instead of "Foo::Bar" + $file =~ s/-/::/g; + ++ verbose("Get source $file"); + # Look up $file in 02packages.details.txt. + update_packages(); + $packages=Parse::CPAN::Packages->new($pkgdetails) @@ -117,6 +128,7 @@ + if ($m=$packages->package($file) and $d=$m->distribution()) { + $source=$cpan . "/authors/id/" . $d->prefix(); + $source=~s/$version/\%{version}/; ++ $source=~s/$name/\%{cpan_name}/; + } else { + warn "Failed to parse '$file' or find a module by that name in $pkgdetails, skipping...\n"; + $source=''; @@ -127,7 +139,7 @@ sub build_rpm($) { my $spec=shift; my $dir=getcwd(); -@@ -387,10 +445,10 @@ sub extract($$$) { +@@ -387,10 +450,10 @@ sub extract($$$) { } } @@ -140,7 +152,7 @@ my $path=$args{module}; $path=~s,::,/,g; -@@ -415,60 +473,130 @@ sub get_description(%) { +@@ -415,60 +478,131 @@ sub get_description(%) { last if $pm; } @@ -198,7 +210,7 @@ + foreach my $item ($head1->content()) { + last if ($item->type() eq 'head2'); + $description .= $item->present('Pod::POM::View::Text'); - } ++ } + + # no limit + my @paragraphs = (split /\n\n/, $description); @@ -207,29 +219,10 @@ + + # autoformat and return... + return autoformat $description, { all => 1 }; - } ++ } + return $description=undef; +} - -- if (my $readme=(sort { -- length($a) <=> length($b) or $a cmp $b -- } (grep /README/i, @{$args{files}}))[0]) { -- verbose "Trying to fetch description from $readme..."; -- -- if (my $content=extract($args{archive}, $args{type}, -- "$args{path}/$readme")) { -- $content=~s/\r//g; # Why people use DOS text, I'll never understand. -- for my $string (split "\n\n", $content) { -- $string=~s/^\n+//; -- if ((my @tmp=split "\n", $string) > 2 -- and $string !~ /^[#\-=]/) { -- return($string, undef); -- } -- } -- } else { -- warn "Failed to read $readme from $args{filename}" -- . ($args{type} eq 'tar' -- ? (": " . $args{archive}->error()) : "") . "\n"; ++ +sub get_summary($$) { + my $cont = shift; + my $mod = shift; @@ -273,16 +266,35 @@ + next if $line eq ""; + $line =~ s/^/ /; + push(@lines, $line); -+ } + } + + $author = join "\n", @lines; + + # return... + return $author; -+ } + } + return $author='sorry, no author found'; +} -+ + +- if (my $readme=(sort { +- length($a) <=> length($b) or $a cmp $b +- } (grep /README/i, @{$args{files}}))[0]) { +- verbose "Trying to fetch description from $readme..."; +- +- if (my $content=extract($args{archive}, $args{type}, +- "$args{path}/$readme")) { +- $content=~s/\r//g; # Why people use DOS text, I'll never understand. +- for my $string (split "\n\n", $content) { +- $string=~s/^\n+//; +- if ((my @tmp=split "\n", $string) > 2 +- and $string !~ /^[#\-=]/) { +- return($string, undef); +- } +- } +- } else { +- warn "Failed to read $readme from $args{filename}" +- . ($args{type} eq 'tar' +- ? (": " . $args{archive}->error()) : "") . "\n"; +sub get_license($) { + my $cont = shift; + my @lines=(); @@ -294,7 +306,7 @@ + HEAD1: + foreach my $head1 ($pom->head1) { + -+ next HEAD1 unless $head1->title =~ /LICENSE/; ++ next HEAD1 unless $head1->title =~ /LICENSE/i || $head1->title =~ /COPYRIGHT/i ; + + my $pom = $head1->content; + $license = $pom->present('Pod::POM::View::Text'); @@ -307,18 +319,19 @@ + push(@lines, $line); } + -+ $license = join "\n", @lines; ++ $license = join " ", @lines; ++ $license =~ s,\s+, ,g; + + # return... + return $license; } -+ return $license='sorry, no license found'; ++ return $license=undef; - return(undef, undef); } sub check_rpm($) { -@@ -554,13 +682,6 @@ my $prefix=$noprefix ? "" : "perl-"; +@@ -554,13 +688,6 @@ my $prefix=$noprefix ? "" : "perl-"; $packager=$packager || `rpm --eval '\%packager'`; @@ -332,7 +345,7 @@ our %corelist; my $rpm=new FileHandle "rpm -q --provides perl|" -@@ -570,74 +691,56 @@ while (my $provides=<$rpm>) { +@@ -570,74 +697,59 @@ while (my $provides=<$rpm>) { chomp $provides; if ($provides=~/^perl\(([^\)]+)\)(?:\s+=\s+(\S+))\s*$/) { @@ -349,6 +362,9 @@ +for my $ofile (@args) { - if ($file =~ /^(?:.*\/)?(.*)-(?:v\.?)?([^-]+)\.(tar)\.(?:gz|bz2)$/) { ++ ($file,$name,$source,$version,$type) = (undef, undef, undef, undef, undef); ++ ($content,$summary,$description,$author,$license) = (undef, undef, undef, undef, undef); ++ + if ($ofile =~ /^(?:.*\/)?(.*)-(?:v\.?)?([^-]+)\.(tar)\.(?:gz|bz2)$/i) { + $file=$ofile; $name=$1; @@ -426,7 +442,7 @@ if ($@) { warn "Failed to load IO::Uncompress::Bunzip2: $@\n"; -@@ -650,12 +753,14 @@ for my $file (@args) { +@@ -650,12 +762,14 @@ for my $file (@args) { warn "IO::Uncompress::Bunzip2->new() failed on $file: $!\n"; next; } @@ -441,7 +457,7 @@ } my @files; -@@ -684,12 +789,9 @@ for my $file (@args) { +@@ -684,12 +798,9 @@ for my $file (@args) { my $url="http://search.cpan.org/dist/$name/"; @@ -449,14 +465,14 @@ - . ($module=~/::/ ? (split "::", $module)[0] : (split "-", $name)[0]) - . "/" . basename($file); - $source=~s/$version/\%{version}/; -+ get_source($name) if(!defined $source); ++ get_source($name) if(!defined $source && -d dirname($pkgdetails)); - my ($description,$summary)=get_description( + $content = get_content( archive => $archive, type => $type, filename => $file, -@@ -700,18 +802,13 @@ for my $file (@args) { +@@ -700,18 +811,13 @@ for my $file (@args) { path => $path, ); @@ -471,17 +487,17 @@ - $description="$module Perl module"; - } + get_description($content) if(!defined($description)); - -- $summary="$module Perl module" if (!defined($summary)); ++ + get_summary($content,$module) if (!defined($summary)); + + get_author($content) if (!defined($author)); -+ + +- $summary="$module Perl module" if (!defined($summary)); + my $authors="Authors:\n--------\n$author"; my @doc=sort { $a cmp $b } grep { !/\// -@@ -722,21 +819,29 @@ for my $file (@args) { +@@ -722,21 +828,29 @@ for my $file (@args) { and $_ ne "MANIFEST.SKIP" and $_ ne "INSTALL" and $_ ne "SIGNATURE" @@ -511,7 +527,7 @@ my $date=strftime("%a %b %d %Y", localtime); my $noarch=!grep /\.(c|h|xs|inl)$/i, @files; -@@ -806,10 +911,10 @@ for my $file (@args) { +@@ -806,10 +920,10 @@ for my $file (@args) { print $spec qq[\%{!?perl_$vendorlib: \%define perl_$vendorlib \%(eval "\`\%{__perl} -V:install$vendorlib\`"; echo \$install$vendorlib)}\n\n] if ($compat); @@ -524,23 +540,36 @@ my ($yml,$meta); if (grep /^META\.yml$/, @files and $yml=extract($archive, $type, "$path/META.yml")) { -@@ -821,8 +926,15 @@ for my $file (@args) { +@@ -821,14 +935,14 @@ for my $file (@args) { goto SKIP; } + if ($meta->{abstract}) { + my $abstract=$meta->{abstract}; + $summary=$abstract if (!defined($summary)); -+ $description=$summary if (!defined($description)); + } + %build_requires=%{$meta->{build_requires}} if ($meta->{build_requires}); %requires=%{$meta->{requires}} if ($meta->{requires}); +- if ($meta->{recommends}) { +- for my $dep (keys(%{$meta->{recommends}})) { +- $requires{$dep}=$requires{$dep} +- || $meta->{recommends}->{$dep}; +- } +- } + %recommends=%{$meta->{recommends}} if ($meta->{recommends}); - if ($meta->{recommends}) { - for my $dep (keys(%{$meta->{recommends}})) { - $requires{$dep}=$requires{$dep} -@@ -867,7 +979,7 @@ for my $file (@args) { + + # FIXME - I'm not sure this is sufficient... + if ($meta->{script_files} or $meta->{scripts}) { +@@ -859,29 +973,30 @@ for my $file (@args) { + $license="MPL"; + } elsif ($meta->{license} =~ /^open_source$/i) { + $license="OSI-Approved"; # rpmlint will complain +- } elsif ($meta->{license} =~ /^unrestricted$/i) { +- $license="Distributable"; + } elsif ($meta->{license} =~ /^restrictive$/i) { + $license="Non-distributable"; + warn "License is 'restrictive'." . " This package should not be redistributed.\n"; } else { warn "Unknown license '" . $meta->{license} . "'!\n"; @@ -549,22 +578,30 @@ } } SKIP: -@@ -880,6 +992,14 @@ for my $file (@args) { - $license.=", see @licenses"; - } } + +- if (my @licenses=grep /license|copyright|copying/i, @doc) { +- if (!$license) { +- $license="Distributable, see @licenses"; +- } elsif ($license=~/^(OSI-Approved|Distributable|Non-distributable)$/) { +- $license.=", see @licenses"; +- } + if (!defined($license)) { + get_license($content); -+ if ($license =~ /under the same terms as Perl itself/ || -+ $license =~ /under the terms of the Perl artistic license/) { ++ if ($license && ($license =~ /under the same terms as Perl itself/ || ++ $license =~ /under the terms of the Perl artistic license/)) { + $license = "GPL+ or Artistic"; + } -+ } + } + $license="CHECK(GPL+ or Artistic)" if (!$license); ++ $description=$summary if (!defined($description)); ++ my $usebuildpl=0; -@@ -947,45 +1067,63 @@ for my $file (@args) { + if (grep /^Build\.PL$/, @files) { + $build_requires{'Module::Build'}=0; +@@ -947,45 +1062,71 @@ for my $file (@args) { } print $spec <<END; @@ -607,18 +644,26 @@ +Summary: $summary +Url: $url +Group: Development/Libraries/Perl -+#Source: $source -+Source: \%{cpan_name}-\%{version}.tar$ext END - - printf $spec "%-16s%s\n", "BuildArch:", "noarch" if ($noarch); -+ print $spec "BuildRoot: \%{_tmppath}/\%{name}-\%{version}-build\n"; - +- printf $spec "%-16s%s\n", "BuildArch:", "noarch" if ($noarch); +- - if (defined($requires{perl})) { - $build_requires{perl}=$build_requires{perl} || $requires{perl}; - delete $requires{perl}; -- } -- ++ if ($source) { ++ if (basename($source) eq "%{cpan_name}-\%{version}.tar$ext") { ++ print $spec "Source: $source\n"; ++ } else { ++ print $spec "#Source: $source\n"; ++ print $spec "Source: \%{cpan_name}-\%{version}.tar$ext\n"; ++ } ++ } else { ++ print $spec "Source: \%{cpan_name}-\%{version}.tar$ext\n"; + } ++ printf $spec "%-16s%s\n", "BuildArch:", "noarch" if ($noarch); ++ print $spec "BuildRoot: \%{_tmppath}/\%{name}-\%{version}-build\n"; + - if (defined($build_requires{perl})) { - printf $spec "%-16s%s >= %s\n", "BuildRequires:", "perl", - (($build_requires{perl} lt "5.6.0" ? "0:" : "1:") @@ -645,7 +690,7 @@ if (check_dep($dep)) { verbose("$dep is available, skipping."); } else { -@@ -1000,11 +1138,12 @@ END +@@ -1000,11 +1141,12 @@ END print $spec "\n"; } @@ -660,7 +705,7 @@ next if (!$compat and exists($corelist{$dep})); printf $spec "%-16s%s", "Requires:", "perl($dep)"; print $spec (" >= " . $requires{$dep}) if ($requires{$dep}); -@@ -1015,15 +1154,19 @@ END +@@ -1015,15 +1157,19 @@ END printf $spec "%-16s%s\n", "Requires:", $dep; } @@ -685,7 +730,7 @@ if (@filter_requires) { print $spec <<END -@@ -1043,7 +1186,10 @@ Source99: $name-filter-provides.sh +@@ -1043,7 +1189,10 @@ Source99: $name-filter-provides.sh END } @@ -696,7 +741,7 @@ $buildpath=~s/$version/\%{version}/; print $spec <<END; -@@ -1085,7 +1231,8 @@ END +@@ -1085,7 +1234,8 @@ END if ($usebuildpl) { print $spec <<END; \%{__perl} Build.PL installdirs=vendor@{[$noarch ? '' : qq{ optimize="$macro{optimize}"} ]} @@ -706,35 +751,35 @@ END } else { print $spec <<END; -@@ -1097,15 +1244,24 @@ END +@@ -1097,15 +1247,24 @@ END if ($compat and !$noarch); print $spec <<END; -make \%{?_smp_mflags} +\%{__make} \%{?_smp_mflags} + -+END -+ } -+ -+ print $spec <<END; -+\%check@{[($compat ? ' || :' : '')]} END + } + + print $spec <<END; ++\%check@{[($compat ? ' || :' : '')]} ++END + if ($usebuildpl) { + print $spec "./Build test\n"; + } else { + print $spec "\%{__make} test\n"; - } - -+ - print $spec <<END; ++ } - \%install +-\%install -rm -rf $macro{buildroot} -- + ++ print $spec <<END; ++ ++\%install END if ($usebuildpl) { -@@ -1113,24 +1269,12 @@ END +@@ -1113,24 +1272,12 @@ END "./Build install destdir=$macro{buildroot} create_packlist=0\n"; } else { print $spec <<END; @@ -763,7 +808,7 @@ if ($addlicense and !grep /copying|artistic|copyright|license/i, @doc) { print $spec <<END; -@@ -1143,43 +1287,28 @@ END +@@ -1143,43 +1290,28 @@ END } print $spec <<END; @@ -814,7 +859,7 @@ END $spec->close(); -@@ -1187,6 +1316,16 @@ END +@@ -1187,6 +1319,16 @@ END build_rpm($specfile) if ($buildsrpm or $buildrpm); push(@processed, $module); @@ -822,11 +867,11 @@ + (my $basename = $specfile) =~ s{\.spec$}{}; + if (-f "$basename.changes") { + verbose "Updating $basename.changes"; -+ system("osc vc -m 'updated to $version'"); ++ system("osc vc -m 'updated to $version' $name.changes"); + } else { + verbose "Writing $basename.changes"; + system("osc vc -m 'initial package $version -+ * created by $NAME $VERSION' $basename"); ++ * created by $NAME $VERSION' $basename.changes"); + } } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
