deprecated/buildtools/buildsystemtools/genxml.pl
author lorewang
Wed, 01 Dec 2010 16:05:36 +0800
changeset 715 e0739b8406dd
parent 655 3f65fd25dfd4
permissions -rw-r--r--
Specify extenal tool with path
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
655
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     1
# Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     2
# All rights reserved.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     3
# This component and the accompanying materials are made available
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     5
# which accompanies this distribution, and is available
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     7
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     8
# Initial Contributors:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    10
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    11
# Contributors:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    12
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    13
# Description:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    14
# Script to Generate the XML command file from the xml files
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    15
# 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    16
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    17
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    18
use strict;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    19
use FindBin;		# for FindBin::Bin
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    20
use Getopt::Long;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    21
use File::Copy;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    22
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    23
use lib $FindBin::Bin;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    24
use lib "$FindBin::Bin/lib";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    25
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    26
# Process the commandline
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    27
my ($iDataSource, $iDataOutput, $iLogFile, $iSourceDir, $iReallyClean, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    28
    $iClean, $iXmlSource, $iConfName, $iMergedXml, $iValidate,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    29
    $iTextOutput, $iCBROutput, $iFilter, $iEffectiveDir) = ProcessCommandLine();
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    30
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    31
if (scalar(@$iXmlSource))
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    32
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    33
	use GenXml;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    34
	&GenXml::Start($iXmlSource, $iDataOutput, $iLogFile, $iSourceDir, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    35
	               $iConfName, $iMergedXml, $iValidate, $iTextOutput, $iCBROutput, $iFilter, $iEffectiveDir);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    36
} else {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    37
	use GenBuild;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    38
	# Start the generation of the XML
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    39
  print "Warning old .txt file input is being used\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    40
	&GenBuild::Start($iDataSource, $iDataOutput, $iLogFile, $iSourceDir, $iReallyClean, $iClean);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    41
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    42
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    43
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    44
# ProcessCommandLine
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    45
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    46
# Inputs
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    47
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    48
# Outputs
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    49
# @iDataSource array of multiple (txt file(s) to process)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    50
# $iDataOutput (XML file to generate)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    51
# $iLogFile (Log file to put processing errors)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    52
# $iSourceDir (Location of Source)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    53
# $iReallyClean (script to run the "abld reallyclean" command)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    54
# $iClean (script to run the "abld clean" command)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    55
# @iXmlSource array of multiple (XML file(s) to process)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    56
# $iConfName (Name of configuration to generate)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    57
# $iMergedXml - Hidden option to save the output of the merging xml process for debug use
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    58
# $iValidate (Just validate the input)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    59
# $iText (txt file to generate)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    60
# $iFilter (filter to apply before generating merged XML file)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    61
# $iEffectiveDir (location at which source will be used)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    62
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    63
# Description
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    64
# This function processes the commandline
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    65
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    66
sub ProcessCommandLine {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    67
  my ($iHelp, $iPort, @iDataSource, $iLogFile, $iSourceDir, $iReallyClean, $iClean, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    68
      @iXmlSource, $iConfName, $iMergedXml, $iValidate, $iTextOutput, $iCBROutput, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    69
      $iFilter, $iEffectiveDir);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    70
  GetOptions(
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    71
  	'h' => \$iHelp, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    72
  	'd=s@' =>\@iDataSource, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    73
  	'o=s' => \$iDataOutput, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    74
  	'l=s' => \$iLogFile, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    75
  	's=s' => \$iSourceDir, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    76
  	'e=s' => \$iEffectiveDir, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    77
  	'r=s' => \$iReallyClean, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    78
  	'c=s' => \$iClean, 	# or $iCBROutput in XML input mode
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    79
  	'x=s@' =>\@iXmlSource, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    80
  	'n=s' => \$iConfName, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    81
  	'm=s' => \$iMergedXml, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    82
  	'v' =>\$iValidate,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    83
  	't=s' => \$iTextOutput,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    84
  	'f=s' => \$iFilter);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    85
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    86
  Usage() if ($iHelp);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    87
  
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    88
  Usage("Must specify the root of the source tree with -s") if (!defined $iSourceDir);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    89
  Usage("Must specify at least one input file") if ((!@iDataSource) && (!@iXmlSource));
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    90
  Usage("$iSourceDir is not a directory") if (!-d $iSourceDir);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    91
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    92
  if (scalar @iXmlSource)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    93
  	{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    94
  	# Validation of options for XML input
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    95
  	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    96
  	Usage("Can't mix -d and -x") if (scalar @iDataSource);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    97
  	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    98
  	$iCBROutput = $iClean;	# deal with ambiguity in -c option
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    99
  	$iClean = "";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   100
  	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   101
  	if ((!defined $iMergedXml) && (!defined $iDataOutput) 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   102
  	     && (!defined $iTextOutput) && (!defined $iCBROutput))
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   103
  		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   104
  		Usage("Must specify at least one output file") if (!defined $iValidate);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   105
  		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   106
  	else
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   107
  		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   108
  		Usage("Can't specify output files with -v") if (defined $iValidate);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   109
  		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   110
  	if (defined $iDataOutput || defined $iTextOutput)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   111
  		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   112
  		Usage("Must specify configuration for XML or list output") if (!defined $iConfName);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   113
  		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   114
  	Usage("Can't specify reallyclean files with -x") if (defined $iReallyClean);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   115
  	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   116
  	$iEffectiveDir = $iSourceDir if (!defined $iEffectiveDir);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   117
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   118
  else
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   119
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   120
  	# Validation of options for component list input
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   121
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   122
    Usage("Must specify a logfile with -l") if (!defined $iLogFile);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   123
	Usage("Can't request validation on non-XML input") if (defined $iValidate);  	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   124
  	Usage("Can't specify merged or text output with -d") if (defined $iTextOutput || defined $iMergedXml);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   125
	Usage ("Can't specify a filter for non-XML input") if (defined $iFilter);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   126
	Usage ("Can't specify a configuration for non-XML input") if (defined $iConfName);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   127
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   128
  
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   129
  foreach my $iFile (@iDataSource)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   130
  {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   131
    if (! -e $iFile)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   132
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   133
      die "Cannot open $iFile";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   134
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   135
  }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   136
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   137
  foreach my $iFile (@iXmlSource)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   138
  {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   139
    if (! -e $iFile)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   140
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   141
      die "Cannot open $iFile";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   142
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   143
  }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   144
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   145
  # Backup existing files
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   146
  
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   147
  &backupFile($iLogFile);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   148
  &backupFile($iDataOutput);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   149
  &backupFile($iMergedXml);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   150
  &backupFile($iTextOutput);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   151
  &backupFile($iCBROutput);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   152
  &backupFile($iReallyClean);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   153
  &backupFile($iClean);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   154
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   155
  return(\@iDataSource, $iDataOutput, $iLogFile, $iSourceDir, $iReallyClean, $iClean, \@iXmlSource, $iConfName, $iMergedXml, $iValidate, $iTextOutput, $iCBROutput, $iFilter, $iEffectiveDir);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   156
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   157
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   158
# backupFile
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   159
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   160
# Inputs
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   161
# $iFile - filename to backup
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   162
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   163
# Outputs
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   164
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   165
# Description
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   166
# This function renames a file with the .baknn extension, if necessary
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   167
sub backupFile
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   168
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   169
	my ($iFile) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   170
	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   171
	return if (!$iFile || !-e $iFile);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   172
	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   173
	my ($iBak) = $iFile.".bak";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   174
	my ($i, $freefilename);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   175
	# Loop until you find a free file name by increamenting the number on the end of the .bak extension
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   176
	while (!$freefilename)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   177
	{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   178
		if (-e $iBak.$i)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   179
		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   180
			$i++;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   181
		} else {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   182
			$iBak .= $i;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   183
			$freefilename = 1;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   184
		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   185
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   186
	print "WARNING: $iFile already exists, creating backup of original with new name of $iBak\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   187
	move($iFile,$iBak) or die "Could not backup $iFile to $iBak because of: $!\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   188
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   189
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   190
# Usage
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   191
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   192
# Output Usage Information.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   193
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   194
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   195
sub Usage {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   196
  my ($reason) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   197
  
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   198
  print "ERROR: $reason\n" if ($reason);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   199
  print <<USAGE_EOF;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   200
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   201
  Usage: Genxml.pl [options]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   202
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   203
  options for XML input mode:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   204
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   205
  -h  help
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   206
  -s  Source Directory
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   207
  -x  XML Data Source (XML file) [Multiple -x options allowed]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   208
  -f  filter to apply to data source before main processing [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   209
  -m  Output merged & filtered XML file [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   210
  -n  Configuration name to use
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   211
  -l  Logfile [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   212
  -o  Output XML file [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   213
  -e  Effective source directory [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   214
  -t  Output TXT file corresponding to XML file [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   215
  -c  Output list of CBR components [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   216
  -v  Validate XML files only, Stop after merging and validating.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   217
      Turns on extra INFO messages for Validation [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   218
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   219
  options for backward compatibility mode:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   220
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   221
  -h  help
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   222
  -l  Logfile
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   223
  -s  Source Directory
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   224
  -d  Data Source (txt file) [Multiple -d options allowed]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   225
  -o  Output XML file
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   226
  -r  Filename for ReallyClean xml file [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   227
  -c  Filename for Clean xml file [optional]
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   228
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   229
  Description:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   230
  This program generates an XML file that is used by the Build
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   231
  Client-Server System. It expands the summarised configuration
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   232
  information stored in the input files to a detailed command by command
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   233
  instruction set for the Build System to use. This enabled the
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   234
  specified configuration to be built by the build system.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   235
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   236
USAGE_EOF
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   237
  exit 1;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   238
}