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

boxbackup-dev at boxbackup.org boxbackup-dev at boxbackup.org
Fri Mar 27 23:50:30 GMT 2009


Author: chris
Date: 2009-03-27 23:50:30 +0000 (Fri, 27 Mar 2009)
New Revision: 2470

Modified:
   box/trunk/infrastructure/makedistribution.pl.in
Log:
Allow substitutions and removing private sections for distribution in 
.in files. Simplify code a little and improve comments.


Modified: box/trunk/infrastructure/makedistribution.pl.in
===================================================================
--- box/trunk/infrastructure/makedistribution.pl.in	2009-03-27 23:44:17 UTC (rev 2469)
+++ box/trunk/infrastructure/makedistribution.pl.in	2009-03-27 23:50:30 UTC (rev 2470)
@@ -7,7 +7,9 @@
 my %comment_chars = ('cpp' => '// ', 'h' => '// ', 'pl' => '# ', 'pm' => '# ', '' => '# ');
 
 # other extensions which need text copying, just to remove the private stuff
-my %text_files = ('txt' => 1, 'spec' => 1);
+# .in is included here, as these could be any kind of source, but clearly
+# they have text substitutions run on them by autoconf, so we can too :)
+my %text_files = ('txt' => 1, 'spec' => 1, 'in' => 1);
 
 # files which don't get the license added
 my %no_license = (); # 'filename' => 1
@@ -189,9 +191,9 @@
 	# licensed or not?
 	if(exists $comment_chars{$ext} && !exists $no_license{$fn} && $license_in_dir)
 	{
-		my $b = $comment_chars{$ext};
+		# copy as text, inserting license
+		# print "source copy $fn to $base_name/$dst_fn\n";
 
-		# copy as text, inserting license
 		my $in = gensym;
 		open $in,$fn;
 		open OUT,">$base_name/$dst_fn";
@@ -204,6 +206,7 @@
 		}
 		
 		# write license
+		my $b = $comment_chars{$ext};
 		for(@license)
 		{
 			print OUT $b,$_,"\n"
@@ -225,32 +228,32 @@
 		close OUT;
 		close $in;
 	}
-	else
+	elsif(exists $text_files{$ext})
 	{
-		if(exists $text_files{$ext})
+		# copy this as text, to remove private stuff
+		# print "text copy $fn to $base_name/$dst_fn\n";
+
+		my $in = gensym;
+		open $in,$fn;
+		open OUT,">$base_name/$dst_fn";
+
+		while(<$in>)
 		{
-			# copy this as text, to remove private stuff
-			my $in = gensym;
-			open $in,$fn;
-			open OUT,">$base_name/$dst_fn";
-
-			while(<$in>)
+			unless(skip_non_applicable_section($_, $in, $fn))
 			{
-				unless(skip_non_applicable_section($_, $in, $fn))
-				{
-					print OUT
-				}
-			}	
+				print OUT
+			}
+		}	
 
-			close OUT;
-			close $in;
-		}
-		else
-		{
-			# copy as binary
-			system 'cp',$fn,"$base_name/$dst_fn"
-		}
+		close OUT;
+		close $in;
 	}
+	else
+	{
+		# copy as binary
+		# print "binary copy $fn to $base_name/$dst_fn\n";
+		system 'cp',$fn,"$base_name/$dst_fn"
+	}
 	
 	# copy executable bit from src
 	if(-x $fn)




More information about the Boxbackup-commit mailing list