[Box Backup-commit] COMMIT r1736 - box/chris/general/infrastructure

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Thu, 26 Jul 2007 22:33:37 +0100


Author: chris
Date: 2007-07-26 22:33:37 +0100 (Thu, 26 Jul 2007)
New Revision: 1736

Modified:
   box/chris/general/infrastructure/makedistribution.pl.in
Log:
Handle USE_SVN_VERSION in distribution VERSION files. (refs #3,
merges [1702])


Modified: box/chris/general/infrastructure/makedistribution.pl.in
===================================================================
--- box/chris/general/infrastructure/makedistribution.pl.in	2007-07-26 21:33:04 UTC (rev 1735)
+++ box/chris/general/infrastructure/makedistribution.pl.in	2007-07-26 21:33:37 UTC (rev 1736)
@@ -1,3 +1,4 @@
+#!/usr/bin/perl
 #!@PERL@
 use strict;
 use Symbol;
@@ -36,6 +37,29 @@
 die "Archive name '$archive_name' is not equal to the distribution name '$distribution'"
 	unless $archive_name eq $distribution;
 
+my $svnversion = `svnversion .`;
+chomp $svnversion;
+$svnversion =~ tr/0-9A-Za-z/_/c;
+
+if($version =~ /USE_SVN_VERSION/)
+{
+	# for developers, use SVN version
+	open INFO,'svn info . |';
+	my $svnurl;
+	while(<INFO>)
+	{
+		if(m/^URL: (.+?)[\n\r]+/)
+		{
+			$svnurl = $1;
+		}
+	}
+	close INFO;
+	$svnurl =~ m'box/(.+)$';
+	my $svndir = $1;
+	$svndir =~ tr/0-9A-Za-z/_/c;
+	$version =~ s/USE_SVN_VERSION/$svndir.'_'.$svnversion/e;
+}
+
 # make initial directory
 my $base_name = "$archive_name-$version";
 system "rm -rf $base_name";
@@ -47,8 +71,6 @@
 my $license_f;
 read LICENSE,$license_f,100000;
 close LICENSE;
-my $svnversion = `svnversion .`;
-chomp $svnversion;
 my @license = ('distribution '.$base_name.' (svn version: '.$svnversion.')',split(/\n/,$license_f));
 
 # copy files, make a note of all the modules included