Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: SkySymbol/perl-dist-zilla-plugin-rpm
base: 6a1b0ab0ce
...
head fork: SkySymbol/perl-dist-zilla-plugin-rpm
compare: 75de7c5c43
  • 5 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
4 Changes
@@ -1,4 +1,8 @@
{{$NEXT}}
+- Fix to sample spec file doc
+- Use zilla root as base for spec_file path
+- Fixed missing parameter to mk_spec
+- Added some basic unit tests
0.002 Wed Mar 14 2012 04:42:10 PM CDT
- Added ignore_build_deps option
View
38 corpus/dist/build/dist.spec
@@ -0,0 +1,38 @@
+Name: <% $zilla->name %>
+Version: <% (my $v = $zilla->version) =~ s/^v//; $v %>
+Release: 1
+
+Summary: <% $zilla->abstract %>
+License: GPL+ or Artistic
+Group: Applications/CPAN
+BuildArch: noarch
+URL: <% $zilla->license->url %>
+Vendor: <% $zilla->license->holder %>
+Source: <% $archive %>
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-BUILD
+
+%description
+<% $zilla->abstract %>
+
+%prep
+%setup -q
+
+%build
+perl Makefile.PL
+make test
+
+%install
+if [ "%{buildroot}" != "/" ] ; then
+ rm -rf %{buildroot}
+fi
+make install DESTDIR=%{buildroot}
+find %{buildroot} | sed -e 's#%{buildroot}##' > %{_tmppath}/filelist
+
+%clean
+if [ "%{buildroot}" != "/" ] ; then
+ rm -rf %{buildroot}
+fi
+
+%files -f %{_tmppath}/filelist
+%defattr(-,root,root)
View
10 corpus/dist/lib/DZ1.pm
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+package DZ1;
+# ABSTRACT: this is a sample package for testing Dist::Zilla;
+
+sub main {
+ return 1;
+}
+
+1;
View
5 dist.ini
@@ -39,3 +39,8 @@ Moose::Autobox = 0
namespace::autoclean = 0
Path::Class = 0
Text::Template = 0
+
+[Prereqs / TestRequires]
+Test::DZil = 0
+Test::More = 0.88
+Test::Differences = 0
View
12 lib/Dist/Zilla/Plugin/RPM.pm
@@ -47,7 +47,7 @@ sub release {
my($self,$archive) = @_;
my $tmp = File::Temp->new();
- $tmp->print($self->mk_spec);
+ $tmp->print($self->mk_spec($archive));
$tmp->flush;
my $sourcedir = qx/rpm --eval '%{_sourcedir}'/
@@ -62,7 +62,11 @@ sub release {
push @cmd, qw/--nodeps/ if $self->ignore_build_deps;
push @cmd, $tmp->filename;
- system(@cmd) && $self->log_fatal('rpmbuild failed');
+ if ($ENV{DZIL_PLUGIN_RPM_TEST}) {
+ $self->log("test: would have executed @cmd");
+ } else {
+ system(@cmd) && $self->log_fatal('rpmbuild failed');
+ }
return;
}
@@ -71,7 +75,7 @@ sub mk_spec {
my($self,$archive) = @_;
my $t = Text::Template->new(
TYPE => 'FILE',
- SOURCE => $self->spec_file,
+ SOURCE => $self->zilla->root->file($self->spec_file),
DELIMITERS => [ '<%', '%>' ],
) || $self->log_fatal($Text::Template::ERROR);
return $t->fill_in(
@@ -144,7 +148,7 @@ If set to a true value, rpmbuild will be called with the --nodeps option.
Release: 1
Summary: <% $zilla->abstract %>
- Copyright: <% $zilla->license->holder %>
+ License: GPL+ or Artistic
Group: Applications/CPAN
BuildArch: noarch
URL: <% $zilla->license->url %>
View
71 t/01mkspec.t
@@ -0,0 +1,71 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Test::DZil qw(Builder simple_ini);
+use Test::More 0.88;
+use Test::Differences;
+
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist' },
+ {
+ add_files => {
+ 'source/dist.ini' => simple_ini(
+ 'RPM'
+ ),
+ },
+ },
+ );
+
+ my $spec = $tzil->plugin_named('RPM')->mk_spec(
+ sprintf('%s-%s.tar.gz',$tzil->name,$tzil->version)
+ );
+
+ eq_or_diff $spec, <<'EOT', "verify spec file";
+Name: DZT-Sample
+Version: 0.001
+Release: 1
+
+Summary: Sample DZ Dist
+License: GPL+ or Artistic
+Group: Applications/CPAN
+BuildArch: noarch
+URL: http://dev.perl.org/licenses/
+Vendor: E. Xavier Ample
+Source: DZT-Sample-0.001.tar.gz
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-BUILD
+
+%description
+Sample DZ Dist
+
+%prep
+%setup -q
+
+%build
+perl Makefile.PL
+make test
+
+%install
+if [ "%{buildroot}" != "/" ] ; then
+ rm -rf %{buildroot}
+fi
+make install DESTDIR=%{buildroot}
+find %{buildroot} | sed -e 's#%{buildroot}##' > %{_tmppath}/filelist
+
+%clean
+if [ "%{buildroot}" != "/" ] ; then
+ rm -rf %{buildroot}
+fi
+
+%files -f %{_tmppath}/filelist
+%defattr(-,root,root)
+EOT
+}
+
+done_testing;
+
+__END__
+
View
73 t/02release.t
@@ -0,0 +1,73 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Test::DZil qw(Builder simple_ini);
+use Test::More 0.88;
+
+local $ENV{DZIL_PLUGIN_RPM_TEST} = 1;
+
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist' },
+ {
+ add_files => {
+ 'source/dist.ini' => simple_ini(
+ 'RPM'
+ ),
+ },
+ },
+ );
+ $tzil->release;
+
+ ok(
+ grep({ /test: would have executed rpmbuild -ba/ } @{ $tzil->log_messages }),
+ "basic rpmbuild execution",
+ );
+}
+
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist' },
+ {
+ add_files => {
+ 'source/dist.ini' => simple_ini(
+ ['RPM' => {
+ sign => 1
+ }],
+ ),
+ },
+ },
+ );
+ $tzil->release;
+
+ ok(
+ grep({ /test: would have executed rpmbuild -ba --sign/ } @{ $tzil->log_messages }),
+ "sign option",
+ );
+}
+
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist' },
+ {
+ add_files => {
+ 'source/dist.ini' => simple_ini(
+ ['RPM' => {
+ ignore_build_deps => 1
+ }],
+ ),
+ },
+ },
+ );
+ $tzil->release;
+
+ ok(
+ grep({ /test: would have executed rpmbuild -ba --nodeps/ } @{ $tzil->log_messages }),
+ "ignore_build_deps option",
+ );
+}
+
+done_testing;
+

No commit comments for this range

Something went wrong with that request. Please try again.