[Box Backup-commit] COMMIT r2328 - box/trunk/infrastructure

boxbackup-dev at boxbackup.org boxbackup-dev at boxbackup.org
Sun Oct 5 16:14:25 BST 2008


Author: chris
Date: 2008-10-05 16:14:24 +0100 (Sun, 05 Oct 2008)
New Revision: 2328

Added:
   box/trunk/infrastructure/parcelpath.pl
Modified:
   box/trunk/infrastructure/BoxPlatform.pm.in
   box/trunk/infrastructure/makeparcels.pl.in
Log:
Move parcel_* functions into BoxPlatform package to share them with
other scripts.

Add a script to print the path to the current parcel directory, for
use in configure.ac to allow this to be placed in substitutions
(contrib/windows/installer/boxbackup.mpi in particular).


Modified: box/trunk/infrastructure/BoxPlatform.pm.in
===================================================================
--- box/trunk/infrastructure/BoxPlatform.pm.in	2008-10-05 13:20:21 UTC (rev 2327)
+++ box/trunk/infrastructure/BoxPlatform.pm.in	2008-10-05 15:14:24 UTC (rev 2328)
@@ -5,7 +5,6 @@
 
 BEGIN
 {
-
 	# which OS are we building under?
 	$target_os = '@target_os@';
 	$target_windows = 0;
@@ -38,20 +37,17 @@
 	$platform_exe_ext = '@EXEEXT@';
 
 	# get version
-	if (! -r "VERSION.txt" and -r "../../VERSION.txt")
-	{
-		open VERSION,"../../VERSION.txt" or die "../../VERSION.txt: $!";
-	}
-	else
-	{
-		open VERSION,"VERSION.txt" or die "VERSION.txt: $!";
-	}
+	my $version_file = "VERSION.txt";
+	if (not -r $version_file) { $version_file = "../../$version_file" }
+	die "missing version file: $version_file" unless $version_file;
 
+	open VERSION, $version_file or die "$version_file: $!";
 	$product_version = <VERSION>;
 	chomp $product_version;
 	$product_name = <VERSION>;
 	chomp $product_name;
 	close VERSION;
+
 	if($product_version =~ /USE_SVN_VERSION/)
 	{
 		# for developers, use SVN version
@@ -116,5 +112,21 @@
 	return $_[0].'=1';
 }
 
+sub parcel_root
+{
+	my $tos = $_[1] || $target_os;
+	return $product_name.'-'.$product_version.'-'.$_[0].'-'.$tos;
+}
+
+sub parcel_dir
+{
+	'parcels/'.parcel_root($_[0], $_[1])
+}
+
+sub parcel_target
+{
+	parcel_dir($_[0]).'.tgz'
+}
+
 1;
 

Modified: box/trunk/infrastructure/makeparcels.pl.in
===================================================================
--- box/trunk/infrastructure/makeparcels.pl.in	2008-10-05 13:20:21 UTC (rev 2327)
+++ box/trunk/infrastructure/makeparcels.pl.in	2008-10-05 15:14:24 UTC (rev 2328)
@@ -98,8 +98,8 @@
 print MAKE "clean:\n";
 for my $parcel (@parcels)
 {
-	print MAKE "\trm -rf ",parcel_dir($parcel),"\n";
-	print MAKE "\trm -f ",parcel_target($parcel),"\n";
+	print MAKE "\trm -rf ", BoxPlatform::parcel_dir($parcel),    "\n";
+	print MAKE "\trm -f ",  BoxPlatform::parcel_target($parcel), "\n";
 }
 print MAKE "\tif [ `uname -o` = 'Cygwin' ]; then find release debug -type f | xargs -r rm -f; else find release debug -type f -exec rm -f {} \\;; fi\n";
 print MAKE "\n";
@@ -110,8 +110,8 @@
 
 for my $parcel (@parcels)
 {
-	my $target = parcel_target($parcel);
-	my $dir = parcel_dir($parcel);
+	my $target = BoxPlatform::parcel_target($parcel);
+	my $dir    = BoxPlatform::parcel_dir($parcel);
 	my @parcel_deps;
 
 	unless ($target_windows)
@@ -215,7 +215,7 @@
 		chmod 0755,"parcels/scripts/install-$parcel";
 	}
 	
-	my $root = parcel_root($parcel);
+	my $root = BoxPlatform::parcel_root($parcel);
 
 	unless ($target_windows)
 	{
@@ -256,17 +256,3 @@
 
 close INSTALLMSG;
 
-sub parcel_root
-{
-	$product_name.'-'.$product_version.'-'.$_[0].'-'.$target_os
-}
-
-sub parcel_dir
-{
-	'parcels/'.parcel_root($_[0])
-}
-
-sub parcel_target
-{
-	parcel_dir($_[0]).'.tgz'
-}

Copied: box/trunk/infrastructure/parcelpath.pl (from rev 2324, box/trunk/infrastructure/msvc/getversion.pl)
===================================================================
--- box/trunk/infrastructure/parcelpath.pl	                        (rev 0)
+++ box/trunk/infrastructure/parcelpath.pl	2008-10-05 15:14:24 UTC (rev 2328)
@@ -0,0 +1,17 @@
+#!perl
+
+unless (@ARGV == 2)
+{
+	die "Usage: $0 <parcel-name> <target-os>\n";
+}
+
+$basedir = $0;
+$basedir =~ s|/.*||;
+$basedir .= "/..";
+-d $basedir or die "$basedir: $!";
+chdir $basedir or die "$basedir: $!";
+require "infrastructure/BoxPlatform.pm.in";
+
+print BoxPlatform::parcel_dir(@ARGV) . "\n";
+
+exit 0;




More information about the Boxbackup-commit mailing list