[interchange] Move version detection to its own routine

David Christensen interchange-cvs at icdevgroup.org
Fri Nov 3 13:41:16 UTC 2017


commit a41509c8dd71210373672cfe34018aef75dbb5e4
Author: David Christensen <david at endpoint.com>
Date:   Fri Nov 3 08:40:34 2017 -0500

    Move version detection to its own routine

 Makefile.PL |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/Makefile.PL b/Makefile.PL
index 1fe4bfc..4612706 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -709,20 +709,23 @@ EOF
 	# if we are building from a git checkout, then set the VERSION based on the
 	# closest git tag, otherwise use the last hard-coded version
 
-	if (-d "./.git") {
-		$X{VERSION} = qx(git describe --tags --dirty);
-		chomp $X{VERSION};
-		system(qq{echo '"$X{VERSION}"' > _ic_version});
-	}
-	else {
-		$X{VERSION} = $VERSION;
-	}
+	$X{VERSION} = get_dist_version();
+	system(qq{echo '"$X{VERSION}"' > _ic_version});
 
 	mk_initp(\%X);
 	delete $X{RPMBUILDDIR};
     return \%X;
 }
 
+sub get_dist_version {
+	my $vers = $VERSION;
+	if (-d "./.git") {
+		$vers = qx(git describe --tags --dirty);
+		chomp $vers;
+	}
+	$vers;
+}
+
 sub regularize {
 	for (@_) {
 		s/[\\]\n//g;



More information about the interchange-cvs mailing list