Mailing List Archive

svn commit: r1675578 - /perl/Apache-Reload/trunk/Makefile.PL
Author: stevehay
Date: Thu Apr 23 12:08:13 2015
New Revision: 1675578

URL: http://svn.apache.org/r1675578
Log:
Borrow the set_version() trick from Apache-Test so that the 'dist' target makes a distribution whose version number is constructed from this lib/Apache/Reload.pm file's $VERSION plus the -dev or -rcX suffix from the Changes file. (Otherwise, when making a release candidate the package will just have the final release number without the -rcX suffix because we're no longer putting the -dev or -rcX suffix in the *.pm files' $VERSIONs; see r1675431.)

Modified:
perl/Apache-Reload/trunk/Makefile.PL

Modified: perl/Apache-Reload/trunk/Makefile.PL
URL: http://svn.apache.org/viewvc/perl/Apache-Reload/trunk/Makefile.PL?rev=1675578&r1=1675577&r2=1675578&view=diff
==============================================================================
--- perl/Apache-Reload/trunk/Makefile.PL (original)
+++ perl/Apache-Reload/trunk/Makefile.PL Thu Apr 23 12:08:13 2015
@@ -1,5 +1,6 @@
use strict;

+use lib qw(lib);
use Config;

my %prereqs = ();
@@ -22,7 +23,11 @@ else {

my $HAS_APACHE_TEST = check_for_apache_test();

+my $VERSION;
+set_version();
+
my %common_opts = (
+ VERSION => $VERSION,
PREREQ_PM => \%prereqs,
dist => {
COMPRESS => 'gzip -9f', SUFFIX => 'gz',
@@ -43,7 +48,6 @@ if ($mp_gen == 1 || $ENV{MAINTAINER_BUIL
require ExtUtils::MakeMaker;
ExtUtils::MakeMaker::WriteMakefile(
%common_opts,
- VERSION_FROM => "lib/Apache/Reload.pm",
NAME => "Apache::Reload",
ABSTRACT_FROM => 'lib/Apache/Reload.pm',
);
@@ -53,7 +57,6 @@ else {
require ModPerl::MM;
ModPerl::MM::WriteMakefile(
%common_opts,
- VERSION_FROM => "lib/Apache2/Reload.pm",
NAME => "Apache2::Reload",
ABSTRACT_FROM => 'lib/Apache2/Reload.pm',
);
@@ -81,6 +84,22 @@ sub check_for_apache_test {
return 1;
}

+sub set_version {
+ require Apache::Reload;
+ $VERSION = $Apache::Reload::VERSION;
+
+ my $fh = Symbol::gensym();
+ open $fh, 'Changes' or die "Can't open Changes: $!";
+ while (<$fh>) {
+ if(/^=item.*-(dev|rc\d+)/) {
+ $VERSION .= "-$1";
+ last;
+ }
+ last if /^=item/;
+ }
+ close $fh;
+}
+
# If a specific generation was passed as an argument,
# if satisfied
# return the same generation