From: Graham Knop Date: Thu, 12 Nov 2015 09:48:21 +0000 (-0500) Subject: allow option to release from a different branch X-Git-Tag: v0.003000~42 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=190976f855f320799d09028bf06b940297ff61c6;p=p5sagit%2FDistar.git allow option to release from a different branch --- diff --git a/helpers/preflight b/helpers/preflight index 186285e..a923c9d 100755 --- a/helpers/preflight +++ b/helpers/preflight @@ -5,8 +5,13 @@ use Config; use File::Spec; use File::Find; use ExtUtils::MakeMaker (); +use Getopt::Long qw(:config gnu_getopt); -my $version = $ARGV[0] or die "version required!"; +GetOptions( + "branch=s" => \(my $branch = 'master'), +) or die("Error in command line arguments\n"); + +my $version = shift or die "version required!"; my $make = $Config{make}; my $null = File::Spec->devnull; @@ -29,7 +34,7 @@ for (scalar `"$make" manifest 2>&1 >$null`) { } for (scalar `git status`) { - /^(?:# )?On branch master/ || die "Not on master. EEEK"; + /^(?:# )?On branch \Q$branch\E/ || die "Not on $branch. EEEK"; /Your branch is behind|Your branch and .*? have diverged/ && die "Not synced with upstream"; } diff --git a/lib/Distar.pm b/lib/Distar.pm index 62f39c0..5948741 100644 --- a/lib/Distar.pm +++ b/lib/Distar.pm @@ -129,6 +129,7 @@ sub write_manifest_skip { my %vars = ( REMAKE => join(' ', '$(PERLRUN)', 'Makefile.PL', map { $self->quote_literal($_) } @ARGV), + BRANCH => $self->{BRANCH} ||= 'master', ); join('', @@ -138,7 +139,7 @@ sub write_manifest_skip { <<'END', preflight: - $(ABSPERLRUN) Distar/helpers/preflight $(VERSION) + $(ABSPERLRUN) Distar/helpers/preflight $(VERSION) --branch=$(BRANCH) releasetest: $(MAKE) disttest RELEASE_TESTING=1 PASTHRU="$(PASTHRU) TEST_FILES=\"$(TEST_FILES)\"" release: preflight releasetest