Subject: | fixes for date, update for missing requires, ... |
Hi,
attached patch:
- fix for date in changelog
- adds Required packages to spec "Requires: .."
- cleanup __DATA__ __[spec}__
Kind Regards
Chris
P.S.: Would it be possible to have Sources on github ?
Contribution would be much more easier.
Subject: | CPANPLUS-Dist-RPM-0.0.8-locale_n_reqs.patch |
diff -ruN CPANPLUS-Dist-RPM-0.0.8-orig/lib/CPANPLUS/Dist/RPM.pm CPANPLUS-Dist-RPM-0.0.8/lib/CPANPLUS/Dist/RPM.pm
--- CPANPLUS-Dist-RPM-0.0.8-orig/lib/CPANPLUS/Dist/RPM.pm 2009-01-17 21:19:29.000000000 +0100
+++ CPANPLUS-Dist-RPM-0.0.8/lib/CPANPLUS/Dist/RPM.pm 2010-08-17 10:59:27.000000000 +0200
@@ -285,7 +285,8 @@
status => $self->status,
module => $self->parent,
buildreqs => $self->_buildreqs,
- date => strftime("%a %b %d %Y", localtime),
+ reqs => $self->_reqs,
+ date => do { my $d = scalar localtime; substr($d, 0, 11) . substr($d, 20) },
packager => $PACKAGER,
docfiles => join(' ', @{ $self->_docfiles }),
@@ -447,6 +448,16 @@
return $buildreqs;
}
+# generate our hashref of reqs
+sub _reqs {
+ my $self = shift @_;
+
+ # Handle build/test/requires
+ my $reqs = $self->parent->status->reqs;
+
+ return $reqs;
+}
+
sub _docfiles {
my $self = shift @_;
@@ -699,56 +710,88 @@
__DATA__
__[ spec ]__
-Name: [% status.rpmname %]
-Version: [% status.distvers %]
-Release: [% status.rpmvers %]%{?dist}
-[% status.license_comment -%]
-License: [% status.license %]
-Group: Development/Libraries
-Summary: [% status.summary %]
-Source: http://search.cpan.org/CPAN/[% module.path %]/[% status.distname %]-%{version}.[% module.package_extension %]
-Url: http://search.cpan.org/dist/[% status.distname %]
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
-[% IF status.is_noarch %]BuildArch: noarch[% END %]
+#
+# spec file for package [% status.rpmname %] (Version [% status.distvers %])
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+#
+Name: [% status.rpmname %]
+%define cpan_name [% status.distname %]
+Summary: [% status.summary %]
+Version: [% status.distvers %]
+Release: [% status.rpmvers %]%{?dist}
+[% status.license_comment -%]
+License: [% status.license %]
+Group: Development/Libraries
+Url: http://search.cpan.org/dist/[% status.distname %]
+Source: http://search.cpan.org/CPAN/[% module.path %]/[% status.distname %]-%{version}.[% module.package_extension %]
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+[% IF status.is_noarch %]BuildArch: noarch[% END %]
+BuildRequires: perl
[% brs = buildreqs; FOREACH br = brs.keys.sort -%]
-BuildRequires: perl([% br %])[% IF (brs.$br != 0) %] >= [% brs.$br %][% END %]
+BuildRequires: perl([% br %])[% IF (brs.$br != 0) %] >= [% brs.$br %][% END %]
+[% END -%]
+#
+Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+[% rs = reqs; FOREACH r = rs.keys.sort -%]
+Requires: perl([% r %])[% IF (rs.$r != 0) %] >= [% rs.$r %][% END %]
[% END -%]
-
%description
[% status.description -%]
-
%prep
-%setup -q -n [% status.distname %]-%{version}
+%setup -q -n %{cpan_name}-%{version}
%build
-[% IF (!status.is_noarch) -%]
-%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
-[% ELSE -%]
-%{__perl} Makefile.PL INSTALLDIRS=vendor
+if [ -f Build.PL ]; then
+ %{__perl} Build.PL --installdirs vendor
+else
+ [ -f Makefile.PL ] || exit 2
+ %{__perl} Makefile.PL INSTALLDIRS=vendor [% IF (!status.is_noarch) -%]OPTIMIZE="%{optflags}" [% END -%]
+
+fi
+if [ -f Build.PL ]; then
+ ./Build build flags=%{?_smp_mflags}
+else
+ %{__make} %{?_smp_mflags}
+fi
+
+[% IF (!skiptest) -%]
+%check
+if [ -f Build.PL ]; then
+ ./Build test
+else
+ %{__make} test
+fi
[% END -%]
-make %{?_smp_mflags}
%install
-rm -rf %{buildroot}
+if [ -f Build.PL ]; then
+ ./Build install --destdir %{buildroot} create_packlist=0
+else
+ %{__make} pure_install PERL_INSTALL_ROOT=%{buildroot}
+ # remove .packlist file
+ find %{buildroot} -type f -name .packlist -exec rm -f {} \;
+ find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null \;
+fi
-make pure_install PERL_INSTALL_ROOT=%{buildroot}
-find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
[% IF (!status.is_noarch) -%]
+# remove zero sized *.bs files
find %{buildroot} -type f -name '*.bs' -a -size 0 -exec rm -f {} ';'
[% END -%]
-find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null ';'
-
%{_fixperms} %{buildroot}/*
-%check
-make test
-
%clean
-rm -rf %{buildroot}
+%{__rm} -rf %{buildroot}
%files
%defattr(-,root,root,-)