From: Graham Knop Date: Tue, 4 Jun 2019 14:33:33 +0000 (+0200) Subject: allow LICENSE generation to fail during disttest phase X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7fec23eda18d67a91201fff45cfde1afcf61ae10;p=p5sagit%2FDistar.git allow LICENSE generation to fail during disttest phase --- diff --git a/helpers/generate-license b/helpers/generate-license index 1229056..0b3e9cc 100755 --- a/helpers/generate-license +++ b/helpers/generate-license @@ -3,11 +3,25 @@ use strict; use warnings; use Software::LicenseUtils; +use Getopt::Long qw(:config gnu_getopt); + +GetOptions( + "o|output=s" => \(my $output = '-'), +) or die("Error in command line arguments!\n"); my ($authors, @licenses) = @ARGV; +my $out; +if ($output eq '-') { + $out = \*STDOUT; +} +else { + open $out, '>', $output + or die "Unable to write to $output: $!\n"; +} + my %uniq; -print +print { $out } join "\n\n", map { $_->new({holder => $authors})->license } grep { !$uniq{$_}++ } diff --git a/lib/Distar.pm b/lib/Distar.pm index a3197e8..eebd340 100644 --- a/lib/Distar.pm +++ b/lib/Distar.pm @@ -248,6 +248,8 @@ check-cpan-upload: $(NOECHO) cpan-upload -h $(DEV_NULL_STDOUT) releasetest: $(MAKE) disttest RELEASE_TESTING=1 DISTTEST_MAKEFILE_PARAMS="PREREQ_FATAL=1" PASTHRU="$(PASTHRU) TEST_FILES=\"$(TEST_FILES)\"" + $(NOECHO) $(TEST_F) $(DISTVNAME)/LICENSE || $(ECHO) "Failed to generate $(DISTVNAME)/LICENSE!" >&2 + $(NOECHO) $(TEST_F) $(DISTVNAME)/LICENSE release: preflight $(MAKE) releasetest $(GET_CHANGELOG) -p"Release commit for $(VERSION)" | git commit -a -F - @@ -269,10 +271,10 @@ $(DISTVNAME)/README: $(VERSION_FROM) $(NOECHO) $(ABSPERLRUN) $(HELPERS)/add-to-manifest -d $(DISTVNAME) README distsignature: readmefile licensefile licensefile: create_distdir - $(NOECHO) $(TEST_F) $(DISTVNAME)/LICENSE || $(MAKE) $(DISTVNAME)/LICENSE + $(NOECHO) $(TEST_F) $(DISTVNAME)/LICENSE || $(MAKE) $(DISTVNAME)/LICENSE || $(TRUE) $(DISTVNAME)/LICENSE: Makefile.PL $(NOECHO) $(MKPATH) $(DISTVNAME) - $(ABSPERLRUN) $(HELPERS)/generate-license $(AUTHORS) $(LICENSES) >$(DISTVNAME)/LICENSE + $(ABSPERLRUN) $(HELPERS)/generate-license -o $(DISTVNAME)/LICENSE $(AUTHORS) $(LICENSES) $(NOECHO) $(ABSPERLRUN) $(HELPERS)/add-to-manifest -d $(DISTVNAME) LICENSE disttest: distmanicheck distmanicheck: create_distdir