sbsv1/abld/platform/lockit_info.pm
author kelvzhu
Wed, 14 Jul 2010 16:22:24 +0800
changeset 613 839712f5a78c
parent 599 fa7a3cc6effd
permissions -rw-r--r--
fixed defect 1412
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
package lockit_info;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
use File::Copy;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
use File::Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
use File::Basename;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
require Exporter;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
@ISA=qw(Exporter);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
@EXPORT=qw(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
	Check_Epocroot
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
	Setup_LockitPath
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
	Lockit_Releasables
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
	Copy_Files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
	WriteTo_Info
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
	LineExists
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
	Lockit_SrcFile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
	Open_InfoFile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
	Close_InfoFile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
use Pathutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
my $epocroot;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
my $epocPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
sub Check_Epocroot 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
	$epocroot = $ENV{EPOCROOT};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
	die "ERROR: Must set the EPOCROOT environment variable\n" if (!defined($epocroot));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
	$epocroot =~ s-/-\\-go;	# for those working with UNIX shells
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
	die "ERROR: EPOCROOT must not include a drive letter\n" if ($epocroot =~ /^.:/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
	die "ERROR: EPOCROOT must be an absolute path without a drive letter\n" if ($epocroot !~ /^\\/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
	die "ERROR: EPOCROOT must not be a UNC path\n" if ($epocroot =~ /^\\\\/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
	die "ERROR: EPOCROOT must end with a backslash\n" if ($epocroot !~ /\\$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
	die "ERROR: EPOCROOT must specify an existing directory\n" if (!-d $epocroot);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
	$epocroot=~ s-\\$--;		# chop trailing \\
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
	$epocPath = "$epocroot\\epoc32\\localisation";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
## main function which handles all lockit-related function
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
sub Lockit_SrcFile()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
	my ($ResrcFile, $RppFile,$Resrc_Options, $FileType, $Bitmaps, $RscTarget, $lang);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
	if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
		($ResrcFile, $RppFile,$Resrc_Options, $FileType, $Bitmaps, $RscTarget, $lang)= @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
		($ResrcFile, $RppFile,$Resrc_Options, $FileType, $Bitmaps, $RscTarget)= @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
	$RscTarget=Path_Split('File', $RscTarget);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
	my ($Tgtdir, $CWDir) = split(/:/, $Resrc_Options);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
	$Tgtdir =~s-^(.*)\\$-$1-o; # remove terminating backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
	$Tgtdir=~s-^\\--o; # remove leading backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
	Check_Epocroot();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
	my $FilePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
	if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
		$FilePath = Setup_LockitPath($CWDir, $ResrcFile, $FileType, $lang);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
		# update rppfile in epoc32\localisation if -l option specified and generating resource
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
		copy("$RppFile", "$FilePath\\");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
		$FilePath = Setup_LockitPath($CWDir, $ResrcFile, $FileType);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
		# update rppfile in epoc32\localisation if -l option specified and generating resource
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
		copy("$RppFile", "$FilePath\\$ResrcFile.rpp");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
	# update bitmaps in epoc32\localisation if -l option and bitmaps specified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
	if ($CWDir && ($Bitmaps ne ""))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
		my $BmpRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
		$Bitmaps =~ s/ +|\t/ /g; # replace tabs and more spaces with single space
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
		$Bitmaps =~s/^ //g; # remove leading space
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
		$Bitmaps =~s/ $//g; # remove trailing space
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
		my (@AifBitmaps) = split(/ /, $Bitmaps);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
		foreach $BmpRef (@AifBitmaps) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
			$BmpRef =~ /^([^\\]+)(\\.*)$/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
			my $CDepth = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
			my $bmp = $2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
			Copy_Files($bmp, $FilePath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
			my $file_base= basename($bmp);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
			chmod (0666,"$FilePath\\$file_base");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
	if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
		if (LineExists($ResrcFile.$lang, $RscTarget) == 0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
			Open_InfoFile($ResrcFile . $lang);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
			WriteTo_Info ( "\n\\$Tgtdir\\$RscTarget :" );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
			if($FileType =~ /RSC/i && $RppFile ne "") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
				WriteTo_Info (
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
					 " $ResrcFile$lang.rpp"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
				)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
			elsif ($RppFile ne "") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
				WriteTo_Info (
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
					 " $ResrcFile$lang.text $ResrcFile$lang.struct"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
				)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
			if($Bitmaps ne "")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
				my $BmpRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
				my (@AifBitmaps) = split(/ /, $Bitmaps);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
				foreach $BmpRef (@AifBitmaps) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
					$BmpRef =~ /^([^\\]+)(\\.*)$/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
					my $CDepth = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
					my $bmp = $2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
					my $file_base= basename($bmp);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
					WriteTo_Info (
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
						 " $CDepth\\$file_base"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
					);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
			Close_InfoFile($ResrcFile . $lang);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
		if (LineExists($ResrcFile, $RscTarget) == 0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
			Open_InfoFile($ResrcFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
			WriteTo_Info ( "\n\\$Tgtdir\\$RscTarget :" );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
			if($FileType =~ /RSC/i && $RppFile ne "") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
				WriteTo_Info (
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
					 " $ResrcFile.rpp"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
				)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
			elsif ($RppFile ne "") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
				WriteTo_Info (
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
					 " $ResrcFile.text $ResrcFile.struct"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
				)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
			if($Bitmaps ne "")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
				my $BmpRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
				my (@AifBitmaps) = split(/ /, $Bitmaps);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
				foreach $BmpRef (@AifBitmaps) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
					$BmpRef =~ /^([^\\]+)(\\.*)$/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
					my $CDepth = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
					my $bmp = $2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
					my $file_base= basename($bmp);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
					WriteTo_Info (
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
						 " $CDepth\\$file_base"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
					);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
			Close_InfoFile($ResrcFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
## copy source files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
sub Copy_Files ()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
	my ($SourceName, $TargetName) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
	copy($SourceName, $TargetName);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
## create necessary directories
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
sub Create_InfoFile ()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
	my ($CreateLockitPath, $CreateInfoFile, $Datadir) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
	if ( !-e "$CreateLockitPath") { mkpath($CreateLockitPath); }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
	if ( !-e "$epocPath\\group") { mkpath("$epocPath\\group"); }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
	if ( !-e "$epocPath\\group\\$CreateInfoFile.info") {	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
		open INFO,">$epocPath\\group\\$CreateInfoFile.info" or die "ERROR: Can not create file \"$CreateInfoFile\"\n"; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
		print INFO "DATADIR: $Datadir\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
		close INFO;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
## open INFO file to write source information
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
sub Open_InfoFile ($)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
	my $FileToOpen = $_[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
	open INFO,">>$epocPath\\group\\$FileToOpen.INFO" or die "ERROR: Can not open  \"$epocPath\\group\\$FileToOpen\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
## write source filename to INFO file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
sub WriteTo_Info ($) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
	my $Text = $_[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
	print INFO "$Text";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
## check whether source filename is written to INFO file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
sub LineExists ()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
	my $FileToOpen = $_[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
	my $LineCheck = $_[1];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   228
	my $exists = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   229
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
	open INFO,"$epocPath\\group\\$FileToOpen.info" or die "ERROR: Can not open \"$FileToOpen\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
		while(<INFO>) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
			if (/$LineCheck/i) { $exists = 1; return $exists; } 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
		close INFO;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
	return $exists;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
#determine Components pathname and create INFO files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
sub Setup_LockitPath
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
	my ($ComponentSrcPath, $Resrc, $FileType, $lang);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
	if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
		($ComponentSrcPath, $Resrc, $FileType, $lang) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
		($ComponentSrcPath, $Resrc, $FileType) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
	my ($temp, $CWDir) = split(/\\/, $ComponentSrcPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
	my $FilePath = $epocPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
	if($FileType =~ /RSS/i) { $FileType = "rsc"; }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
	if($FileType =~ /^acl|abw|aif|a[0-9]/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
		$FilePath .= "\\aif";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
## change added to support cnf file generation
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
	if ($FileType =~ /CNF/i) { 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
		$FilePath .= "\\cnf"; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
	my $WorkPath = ""; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
	if($Resrc !~ /^$CWDir$/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
		$WorkPath = "$Resrc"; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
	$FilePath .= "\\$WorkPath\\$FileType";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
	if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
		&Create_InfoFile("$FilePath", "$Resrc$lang", "\\$WorkPath");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
		&Create_InfoFile("$FilePath", "$Resrc", "\\$WorkPath");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
	return $FilePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
## accumulate list of Lockit releasables
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
sub Lockit_Releasables
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
	my ($ComponentSrcPath, $ResrcFile, $href, $Bitmaps, $lang);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
	my $Resrc;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
	my ($BaseResrc,$FileType);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
	my $LockitInfoPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
	my $LockitPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
	my %Files;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   291
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   292
	if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   293
		($ComponentSrcPath, $ResrcFile, $href, $Bitmaps, $lang) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
		$Resrc = basename($ResrcFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
		($BaseResrc,$FileType) = split(/\./, $Resrc);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
		Check_Epocroot();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
		$LockitInfoPath = "$epocPath\\group\\$BaseResrc$lang.info";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
		$LockitPath = Setup_LockitPath($ComponentSrcPath, $BaseResrc, $FileType, "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
		%Files = %$href;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
		if($FileType =~ /RSS|ACL|ABW|AIF|A[0-9]/i && $Bitmaps eq ""){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
			$LockitPath .= "\\$BaseResrc$lang.rpp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
			$LockitPath .= "\\$Bitmaps";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
		($ComponentSrcPath, $ResrcFile, $href, $Bitmaps) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
		$Resrc = basename($ResrcFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
		($BaseResrc,$FileType) = split(/\./, $Resrc);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
		Check_Epocroot();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
		$LockitInfoPath = "$epocPath\\group\\$BaseResrc.info";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
		$LockitPath = Setup_LockitPath($ComponentSrcPath, $BaseResrc, $FileType);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
		%Files = %$href;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
		if($FileType =~ /RSS|ACL|ABW|AIF|A[0-9]/i && $Bitmaps eq ""){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
			$LockitPath .= "\\$BaseResrc.rpp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
			$LockitPath .= "\\$Bitmaps";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
	my %loggedFiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
	$loggedFiles{lc($_)} = 1 foreach keys (%Files);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
	$Files{$LockitPath} = 1 if !($loggedFiles{lc($LockitPath)});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
	$Files{$LockitInfoPath} = 1 if !($loggedFiles{lc($LockitInfoPath)});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
	return %Files;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
sub Close_InfoFile ($)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
	my $FileToClose = $_[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
	close INFO;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
1;