author | Zheng Shen <zheng.shen@nokia.com> |
Wed, 13 Oct 2010 16:27:55 +0800 | |
changeset 647 | 53d1ab72f5bc |
parent 596 | 9f25be3da657 |
permissions | -rw-r--r-- |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
2 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
3 |
# All rights reserved. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
584 | 5 |
# under the terms of the License "Eclipse Public License v1.0" |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
584 | 7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
8 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
10 |
# Nokia Corporation - initial contribution. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
11 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
12 |
# Contributors: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
13 |
# |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
14 |
# Description: iMaker main Perl script & common routines |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
15 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
16 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
17 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
18 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
19 |
# |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
20 |
$(error |MAKE=$(MAKE)|MAKE_VERSION=$(MAKE_VERSION)|SHELL=$(SHELL)|MAKECMDGOALS=$(MAKECMDGOALS)|) |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
21 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
22 |
#!perl |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
23 |
#line 24 |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
24 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
25 |
use subs qw(CORE::GLOBAL::die); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
26 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
27 |
use strict; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
28 |
use warnings; |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
29 |
use Cwd; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
30 |
use Digest::MD5 qw(md5_hex); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
31 |
use File::Basename; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
32 |
use File::Copy; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
33 |
use File::Find; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
34 |
use File::Path; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
35 |
use File::Spec; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
36 |
use File::Temp qw(tempfile); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
37 |
use POSIX qw(strftime); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
38 |
use Text::ParseWords; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
39 |
use Time::Local; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
40 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
41 |
sub InitMkglobals(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
42 |
sub PrintEnv($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
43 |
sub Max(@); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
44 |
sub Min(@); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
45 |
sub Trim($;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
46 |
sub Quote($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
47 |
sub Unquote($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
48 |
sub Int2Hex($;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
49 |
sub Byte2Str($@); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
50 |
sub Str2Byte($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
51 |
sub Str2Xml($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
52 |
sub Ascii2Uni($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
53 |
sub Uni2Ascii($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
54 |
sub GetTimestamp(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
55 |
sub Sec2Min($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
56 |
sub Wcard2Restr($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
57 |
sub Wcard2Regex($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
58 |
sub ParseCmdWords($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
59 |
sub DPrint($@); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
60 |
sub Echo($$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
61 |
sub PathConv($;$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
62 |
sub ParseFiles($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
63 |
sub GlobFiles($;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
64 |
sub GetBasename($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
65 |
sub GetDirname($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
66 |
sub GetAbsDirname($;$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
67 |
sub GetAbsFname($;$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
68 |
sub GetRelFname($;$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
69 |
sub GetWriteFname($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
70 |
sub GetFreeDrive(;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
71 |
sub SubstDrive($$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
72 |
sub UnsubstDrive($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
73 |
sub Search($$$$$$\@\$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
74 |
sub Find($$$$$\$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
75 |
sub ChangeDir($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
76 |
sub DeleteDir($;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
77 |
sub FindDir($$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
78 |
sub MakeDir($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
79 |
sub MakeChangeDir($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
80 |
sub SetWorkdir($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
81 |
sub OpenFile(*$$;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
82 |
sub Test($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
83 |
sub CutFile($$$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
84 |
sub Copy($$;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
85 |
sub CopyIby($$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
86 |
sub DeleteFile($;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
87 |
sub FindFile($$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
88 |
sub HeadFile($$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
89 |
sub TailFile($$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
90 |
sub TypeFile($;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
91 |
sub ReadFile($$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
92 |
sub WriteFile($$$;$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
93 |
sub UnzipFile($$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
94 |
sub Zip($$$$@); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
95 |
sub Move($$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
96 |
sub Touch($@); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
97 |
sub SetLogfile($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
98 |
sub RunSystemCmd($;$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
99 |
sub ParseSystemCmd($$$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
100 |
sub GenExclfile($$$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
101 |
sub GenIbyfile($$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
102 |
sub GenObyfile($$$$@); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
103 |
sub GenMakefile($$$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
104 |
sub GenWidgetConf($$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
105 |
sub AddImageHeader($$$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
106 |
sub Sleep($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
107 |
sub FindSOSFiles($$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
108 |
sub CheckTool(@); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
109 |
sub OpCacheInstall($$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
110 |
sub SisInstall($$$$$$$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
111 |
sub GetIPar(;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
112 |
sub PEval($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
113 |
sub PeekICmd($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
114 |
sub SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
115 |
sub GetICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
116 |
sub EndICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
117 |
sub SplitStep($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
118 |
sub RunStep($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
119 |
sub RunIExtCmd($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
120 |
sub GetConfmkList(;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
121 |
sub GetFeatvarIncdir($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
122 |
sub SetVerbose($;$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
123 |
sub CloseLog(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
124 |
sub RunIMakerCmd($$$$$@); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
125 |
sub RunMakeCmd($$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
126 |
sub HandleCmdArg($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
127 |
sub HandleExtCmdArg($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
128 |
sub MenuRuncmd($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
129 |
sub Menu($); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
130 |
sub Install($$$); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
131 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
132 |
use constant READBUFSIZE => 2097152; # 2 MB |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
133 |
use constant STARTSTR => '>>>[START]=========8<==========8<==========8<==========8<==========8<=========='; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
134 |
use constant ENDSTR => '==========>8==========>8==========>8==========>8==========>8===========[END]<<<'; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
135 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
136 |
# device[VARID]==... !! |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
137 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
138 |
use constant BOOTBINARYSTATEMENT => qr/^\s*bootbinary\s*(?:=+|\s)\s*(?:"(.+?)"|(\S+))/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
139 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
140 |
use constant FILESPECSTATEMENT => |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
141 |
qr/^\s*(?:data|device|dll|extension|file|primary|secondary|variant)\S*?\s*(?:=+|\s)\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))(\s+.+?)?\s*$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
142 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
143 |
our ($gArgv, $gCmdcnt, @gCmdoutbuf, %gConfmkList, $gEpocdrive, $gEpocroot, $gError, $gErrwarn, $gEvalerr, |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
144 |
%gExportvar, $gFiltercmd, @gFindresult, $gICmd, @gIcmd, $gImakerext, $gImgtype, $gKeepgoing, @gLogbuf, |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
145 |
$gLogfile, %gLogfiles, $gMakecmd, @gMakeinfo, $gOutfilter, $gParamcnt, $gPrintcmd, @gReport, $gStartmk, |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
146 |
$gStarttime, $gStep, @gStepDur, %gStepIcmd, %gSubstdrv, $gTgterr, %gTool, $gVerbose, $gWinOS, $gWorkdir, |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
147 |
$gWorkdrive, @iVar); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
148 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
149 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
150 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
151 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
152 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
153 |
sub InitMkglobals() |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
154 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
155 |
$gCmdcnt = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
156 |
@gCmdoutbuf = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
157 |
$gFiltercmd = qr/\S/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
158 |
@gFindresult = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
159 |
$gICmd = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
160 |
@gIcmd = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
161 |
$gImgtype = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
162 |
$gOutfilter = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
163 |
$gParamcnt = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
164 |
$gPrintcmd = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
165 |
$gStep = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
166 |
@gStepDur = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
167 |
%gStepIcmd = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
168 |
@iVar = (); # General purpose variable to be used from $(call peval,...) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
169 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
170 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
171 |
BEGIN { |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
172 |
($gArgv, $gEvalerr, $gStarttime, $gWinOS) = (scalar(@ARGV), 0, time(), $^O =~ /MSWin/i); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
173 |
$_ = "default input and pattern-searching space"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
174 |
eval("use Archive::Zip qw(:ERROR_CODES)"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
175 |
eval("use constant AZ_OK => -1") if $@; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
176 |
eval("use Archive::Zip::Tree"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
177 |
if ($gWinOS) { eval(" |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
178 |
use Win32API::File qw(:DDD_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
179 |
use Win32::File; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
180 |
use constant WIN32_FILE_HIDDEN => Win32::File::HIDDEN"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
181 |
} else { eval(" |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
182 |
use constant DDD_REMOVE_DEFINITION => -1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
183 |
use constant WIN32_FILE_HIDDEN => -1"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
184 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
185 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
186 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
187 |
INIT { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
188 |
$gWorkdir = Cwd::cwd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
189 |
$gWorkdrive = ($gWorkdir =~ /^([a-z]:)/i ? uc($1) : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
190 |
$ENV{EPOCROOT} = ($gWinOS ? "\\" : "$gWorkdir/") if !$ENV{EPOCROOT}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
191 |
$ENV{IMAKER_CMDARG} = "" if !defined($ENV{IMAKER_CMDARG}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
192 |
$ENV{IMAKER_CYGWIN} = 0 if !$ENV{IMAKER_CYGWIN}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
193 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
194 |
InitMkglobals(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
195 |
%gConfmkList = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
196 |
$gEpocdrive = ($ENV{EPOCROOT} =~ /^([a-z]:)/i ? uc($1) : $gWorkdrive); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
197 |
($gEpocroot = GetAbsDirname($ENV{EPOCROOT})) =~ s/\/+$//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
198 |
$gError = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
199 |
$gErrwarn = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
200 |
%gExportvar = (); $gExportvar{""} = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
201 |
$gKeepgoing = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
202 |
@gLogbuf = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
203 |
$gLogfile = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
204 |
%gLogfiles = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
205 |
$gMakecmd = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
206 |
@gMakeinfo = ("?", "?", "?"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
207 |
@gReport = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
208 |
$gStartmk = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
209 |
%gSubstdrv = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
210 |
$gTgterr = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
211 |
%gTool = (); map{ $gTool{$_} => $_ } ("cpp", "elf2e32", "interpretsis", "opcache", "unzip"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
212 |
$gVerbose = 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
213 |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
214 |
select(STDERR); $|++; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
215 |
select(STDOUT); $|++; |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
216 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
217 |
# Overload die |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
218 |
*CORE::GLOBAL::die = sub { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
219 |
$gError = 1 if !$gEvalerr; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
220 |
return if (PeekICmd("iferror") && !$gEvalerr); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
221 |
CORE::die(@_) if ($gEvalerr || !$gKeepgoing); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
222 |
$gErrwarn = 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
223 |
warn(@_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
224 |
}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
225 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
226 |
# Handler for __DIE__ signal |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
227 |
$SIG{__DIE__} = sub { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
228 |
return if $gEvalerr; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
229 |
$gErrwarn = 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
230 |
warn(@_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
231 |
exit(1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
232 |
}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
233 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
234 |
# Handler for __WARN__ signal |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
235 |
$SIG{__WARN__} = sub { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
236 |
if (($gEvalerr != 1) && ($gKeepgoing < 3) && ($_[0] ne "\n")) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
237 |
select(STDERR); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
238 |
my $msg = ($gStep ? "($gStep): " : "") . $_[0]; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
239 |
if ($gErrwarn && ($gKeepgoing < 2)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
240 |
DPrint(0, "*** Error: $msg") } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
241 |
else { DPrint(127, "Warning: $msg") } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
242 |
select(STDOUT); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
243 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
244 |
$gErrwarn = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
245 |
}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
246 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
247 |
if (!$gArgv) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
248 |
warn("iMaker is running under Cygwin!\n") |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
249 |
if (!$ENV{IMAKER_CYGWIN} && $^O =~ /cygwin/i); |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
250 |
my $perlver = sprintf("%vd", $^V); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
251 |
warn("iMaker uses Perl version $perlver! Recommended versions are 5.6.1, 5.8.x and 5.10.x.\n") |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
252 |
if ($perlver !~ /^5\.(?:6\.1|(?:8|10)\.\d+)$/); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
253 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
254 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
255 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
256 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
257 |
############################################################################### |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
258 |
# Main program |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
259 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
260 |
{ |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
261 |
if ($gArgv) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
262 |
my $iopt = shift(@ARGV); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
263 |
print(map("$_\n", GetFeatvarIncdir("@ARGV"))), exit(0) if ($iopt eq "--incdir"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
264 |
print(map("$_\n", @ARGV)), exit(0) if ($iopt eq "--splitarg"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
265 |
die("Unknown internal imaker.pl option: `$iopt'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
266 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
267 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
268 |
delete($ENV{MAKE}) if $gWinOS; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
269 |
map { delete($ENV{$_}) } qw(MAKECMDGOALS MAKEFILES MAKEFLAGS MAKELEVEL MAKE_VERSION); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
270 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
271 |
$ENV{CONFIGROOT} = GetAbsDirname($ENV{CONFIGROOT} || "$gEpocroot/epoc32/rom/config"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
272 |
$ENV{ITOOL_DIR} = GetAbsDirname($ENV{ITOOL_DIR} || "$gEpocroot/epoc32/tools/rom"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
273 |
$ENV{IMAKER_DIR} = GetAbsDirname($ENV{IMAKER_DIR}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
274 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
275 |
$ENV{IMAKER_EXPORTMK} = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
276 |
$ENV{IMAKER_MAKE} = ($gWinOS ? "$ENV{IMAKER_DIR}/mingw_make.exe" : $ENV{MAKE} || "make") if !$ENV{IMAKER_MAKE}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
277 |
$ENV{IMAKER_MAKESHELL} = ($ENV{COMSPEC} || "cmd.exe") if (!$ENV{IMAKER_MAKESHELL} && $gWinOS); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
278 |
$ENV{IMAKER_MKCONF} = $ENV{CONFIGROOT} . ',image_conf_(.+?)\.mk$,_(?:ncp)?\d+\.mk$,1' if !$ENV{IMAKER_MKCONF}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
279 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
280 |
my $pathsep = ($gWinOS ? ";" : ":"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
281 |
$ENV{PATH} = join(";", grep(!/[\\\/]cygwin[\\\/]/i, split(/;+/, $ENV{PATH}))) if (!$ENV{IMAKER_CYGWIN} && $gWinOS); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
282 |
($ENV{PATH} = Trim($ENV{PATH})) =~ s/"$/";/ if $gWinOS; # http://savannah.gnu.org/bugs/index.php?25412 |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
283 |
$ENV{PATH} = PathConv("$ENV{ITOOL_DIR}", $gWinOS) . $pathsep . PathConv("$gEpocroot/epoc32/tools", $gWinOS) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
284 |
$pathsep . ($gWinOS ? PathConv("$gEpocroot/epoc32/gcc/bin", 1) . ";" : "") . $ENV{PATH}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
285 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
286 |
$ENV{PERL5LIB} = $ENV{IMAKER_DIR} . ($ENV{PERL5LIB} ? "$pathsep$ENV{PERL5LIB}" : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
287 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
288 |
die($@) if !defined($gImakerext = do("$ENV{IMAKER_DIR}/imaker_extension.pm")) && $@; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
289 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
290 |
my ($version, $verfile) = ("", "$ENV{IMAKER_DIR}/imaker_version.mk"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
291 |
open(FILE, "<$verfile") and map { $version = $1 if /^\s*IMAKER_VERSION\s*[+:?]?=\s*(.*?)\s*$/ } <FILE>; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
292 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
293 |
if ($version) { DPrint(1, "$version\n") } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
294 |
else { warn("Can't read iMaker version from `$verfile'.\n") } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
295 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
296 |
if ($ENV{IMAKER_CMDARG} =~ /^\s*--?(install|clean)=?(.*?)\s*$/i) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
297 |
Install(lc($1) eq "clean", "$ENV{IMAKER_DIR}/../group/bld.inf", $2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
298 |
exit(0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
299 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
300 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
301 |
$gMakecmd = "$ENV{IMAKER_MAKE} -R --no-print-directory" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
302 |
($ENV{IMAKER_MAKESHELL} ? " SHELL=\"$ENV{IMAKER_MAKESHELL}\"" : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
303 |
my $cmdout = qx($gMakecmd -f "$0" 2>&1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
304 |
($cmdout = (defined($cmdout) ? $cmdout : "")) =~ s/\n+$//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
305 |
die("Can't run Make properly: `$cmdout'\n") |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
306 |
if ($cmdout !~ /\|MAKE=(.*?)\|MAKE_VERSION=(.*?)\|SHELL=(.*?)\|/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
307 |
@gMakeinfo = ($1, $2, $3); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
308 |
warn(($gMakeinfo[1] eq "" ? "Can't resolve Make version" : "iMaker uses Make version $gMakeinfo[1]") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
309 |
", recommended version is 3.81.\n") if ($gMakeinfo[1] !~ /^\s*3\.81/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
310 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
311 |
RunIMakerCmd("$gMakecmd TIMESTAMP=" . GetTimestamp() . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
312 |
" -I \"$ENV{CONFIGROOT}\" -f \"$ENV{IMAKER_DIR}/imaker.mk\"", $ENV{IMAKER_CMDARG}, "", 0, 0, ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
313 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
314 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
315 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
316 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
317 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
318 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
319 |
sub PrintEnv($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
320 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
321 |
return if !@gMakeinfo; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
322 |
DPrint(shift(), "=" x 79 . "\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
323 |
"User : " . (getlogin() || "?") . "@" . ($ENV{HOSTNAME} || $ENV{COMPUTERNAME} || "?") . " on $^O\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
324 |
"Time : " . localtime() . "\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
325 |
"Current dir : `$gWorkdir'\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
326 |
"iMaker tool : `$ENV{IMAKER_TOOL}' -> `$0'\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
327 |
"Cmdline args: `$ENV{IMAKER_CMDARG}'\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
328 |
"Perl : `$^X' version " . sprintf("%vd\n", $^V) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
329 |
"PERL5LIB : `$ENV{PERL5LIB}'\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
330 |
"PERL5OPT : `" . (defined($ENV{PERL5OPT}) ? "$ENV{PERL5OPT}'\n" : "'\n") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
331 |
"Make : `$gMakeinfo[0]' version $gMakeinfo[1]\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
332 |
"Make shell : `$gMakeinfo[2]'\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
333 |
"EPOCROOT : `$ENV{EPOCROOT}'\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
334 |
"CONFIGROOT : `$ENV{CONFIGROOT}'\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
335 |
"PATH : `$ENV{PATH}'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
336 |
@gMakeinfo = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
337 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
338 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
339 |
sub Max(@) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
340 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
341 |
my $max = (shift() || 0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
342 |
map { $max = $_ if $_ > $max } @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
343 |
return($max); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
344 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
345 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
346 |
sub Min(@) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
347 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
348 |
my $min = (shift() || 0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
349 |
map { $min = $_ if $_ < $min } @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
350 |
return($min); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
351 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
352 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
353 |
sub Trim($;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
354 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
355 |
(my $str = shift()) =~ s/^\s+|\s+$//g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
356 |
$str =~ s/\s+(?=\s)//g if shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
357 |
return($str); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
358 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
359 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
360 |
sub Quote($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
361 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
362 |
local $_ = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
363 |
return("") if !defined(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
364 |
s/\\( |n|t)/\\\\$1/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
365 |
return($_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
366 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
367 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
368 |
sub Unquote($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
369 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
370 |
local $_ = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
371 |
return("") if !defined(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
372 |
s/(?<!\\)(?<=\\n)\s+(\\n)?//g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
373 |
s/(?<!\\)\s+(?=\\n)//g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
374 |
s/(?<!\\)\\ / /g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
375 |
s/(?<!\\)\\n/\n/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
376 |
s/(?<!\\)\\t/\t/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
377 |
s/\\\\( |n|t)/\\$1/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
378 |
s/\x00//g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
379 |
return($_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
380 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
381 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
382 |
sub Int2Hex($;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
383 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
384 |
my ($int, $len) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
385 |
return((defined($len) ? $len : ($len = ($int < 4294967296 ? 8 : 16))) < 9 ? sprintf("%0${len}X", $int) : |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
386 |
sprintf("%0" . ($len - 8) . "X%08X", int($int / 4294967296), $int % 4294967296)); # 4294967296 = 4 G |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
387 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
388 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
389 |
sub Byte2Str($@) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
390 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
391 |
my ($base, @byte) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
392 |
return(join("", map(($_ % 16 ? "" : sprintf("%04X:", $base + $_)) . sprintf(" %02X", $byte[$_]) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
393 |
(!(($_ + 1) % 16) || ($_ == (@byte - 1)) ? "\n" : ""), (0 .. (@byte - 1))))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
394 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
395 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
396 |
sub Str2Byte($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
397 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
398 |
my ($str, $ind, @byte) = (shift(), 0, ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
399 |
$str =~ s/,$/, /; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
400 |
map { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
401 |
$ind++; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
402 |
s/^\s+|\s+$//g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
403 |
if (/^\d+$/ && $_ < 256) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
404 |
push(@byte, $_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
405 |
} elsif (/^0x[0-9A-F]+$/i && hex() < 256) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
406 |
push(@byte, hex()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
407 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
408 |
die("Invalid $ind. byte: `$_'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
409 |
return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
410 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
411 |
} split(/,/, $str); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
412 |
return(@byte); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
413 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
414 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
415 |
sub Str2Xml($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
416 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
417 |
my $str = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
418 |
$str =~ s/(.)/{'"'=>'"', '&'=>'&', "'"=>''', '<'=>'<', '>'=>'>'}->{$1} || $1/ge; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
419 |
return($str); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
420 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
421 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
422 |
sub Ascii2Uni($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
423 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
424 |
(local $_ = shift()) =~ s/(?<!\r)\n/\r\n/g; # Use CR+LF newlines |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
425 |
s/(.)/$1\x00/gs; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
426 |
return("\xFF\xFE$_"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
427 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
428 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
429 |
sub Uni2Ascii($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
430 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
431 |
(local $_ = shift()) =~ s/(.)\x00/$1/gs; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
432 |
s/\r\n/\n/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
433 |
return(substr($_, 2)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
434 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
435 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
436 |
sub GetTimestamp() |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
437 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
438 |
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = localtime(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
439 |
return(sprintf("%04d%02d%02d%02d%02d%02d%02d", |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
440 |
$year + 1900, $mon + 1, $mday, $hour, $min, $sec, int(($yday + ($year == 109 ? 3 : -3)) / 7) + 1)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
441 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
442 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
443 |
sub Sec2Min($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
444 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
445 |
my $sec = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
446 |
return(sprintf("%02d:%02d", $sec / 60, $sec % 60)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
447 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
448 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
449 |
sub Wcard2Restr($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
450 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
451 |
(my $wcard = shift()) =~ s/(.)/{"*"=>".*", "?"=>"."}->{$1} || "\Q$1\E"/ge; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
452 |
return($wcard); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
453 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
454 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
455 |
sub Wcard2Regex($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
456 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
457 |
my $restr = Wcard2Restr(shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
458 |
return(qr/$restr/i); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
459 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
460 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
461 |
sub ParseCmdWords($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
462 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
463 |
my $line = Trim(shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
464 |
$line =~ s/\\/\\\\/g if $gWinOS; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
465 |
return(Text::ParseWords::parse_line('\s+', 0, $line)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
466 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
467 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
468 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
469 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
470 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
471 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
472 |
sub DPrint($@) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
473 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
474 |
my ($verbose, @outlist) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
475 |
map { tr/\x00\x1F/#/ } @outlist; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
476 |
print(@outlist) if !$verbose || ($verbose & $gVerbose); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
477 |
push(@gLogbuf, @outlist) if ($verbose < 32) || ($verbose & $gVerbose); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
478 |
return if ($gLogfile eq "" || !@gLogbuf); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
479 |
print(LOG @gLogbuf); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
480 |
@gLogbuf = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
481 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
482 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
483 |
sub Echo($$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
484 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
485 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
486 |
my ($verbose, $str) = (shift(), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
487 |
DPrint($verbose, shift() ? "$str\n" : Unquote($str)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
488 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
489 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
490 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
491 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
492 |
# File operations |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
493 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
494 |
sub PathConv($;$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
495 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
496 |
my $path = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
497 |
if (shift()) { $path =~ tr-\/-\\- } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
498 |
else { $path =~ tr-\\-\/- } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
499 |
return($path) if (!$gWinOS || $path =~ /^(?:\/\/|\\\\)/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
500 |
my $drive = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
501 |
return(ucfirst(($path =~ /^[a-z]:/i ? "" : ($_[0] ? $_[0] : $gWorkdrive)) . $path)) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
502 |
if !$drive; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
503 |
$drive = $gWorkdrive if !($drive = shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
504 |
$path =~ s/^$drive//i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
505 |
return($path); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
506 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
507 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
508 |
sub ParseFiles($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
509 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
510 |
my ($file, @files) = (" " . shift() . " ", ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
511 |
push(@files, defined($1) ? $1 : (defined($2) ? $2 : ())) while ($file =~ /\s(?:"\s*"|"+(.+?)"+|((\\\s|\S)+))(?=\s)/g); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
512 |
return(@files); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
513 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
514 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
515 |
sub GlobFiles($;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
516 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
517 |
return(@gFindresult) if (my $file = shift()) =~ /^__find__$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
518 |
return(map(/[\*\?]/ ? sort({lc($a) cmp lc($b)} grep(!/[\/\\]\.\.?$/, |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
519 |
glob(scalar(s/\*/\{\.\*\,\*\}/g, /\s/) ? "\"$_\"" : $_))) : $_, (shift() ? $file : ParseFiles($file)))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
520 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
521 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
522 |
sub GetBasename($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
523 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
524 |
return((File::Basename::fileparse(shift()))[0]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
525 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
526 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
527 |
sub GetDirname($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
528 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
529 |
(my $dir = shift()) =~ s/^>>?(?!>)//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
530 |
return((File::Basename::fileparse($dir))[1]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
531 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
532 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
533 |
sub GetAbsDirname($;$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
534 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
535 |
(my $dir = shift()) =~ s/^>>?(?!>)//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
536 |
$dir = "." if ($dir eq ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
537 |
my $absdir = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
538 |
eval { local $gEvalerr = 1; $absdir = Cwd::abs_path($dir) }; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
539 |
return(PathConv($absdir || File::Spec->rel2abs($dir, |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
540 |
$dir !~ /^$gWorkdrive/i && $dir =~ /^([a-z]:)/i ? "$1/" : ""), shift(), shift(), shift())); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
541 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
542 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
543 |
sub GetAbsFname($;$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
544 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
545 |
my $file = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
546 |
return($file) if ($file eq "" || $file =~ /STD(IN|OUT|ERR)$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
547 |
my $append = ($file =~ s/^>>(?!>)// ? ">>" : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
548 |
return($append . PathConv(File::Spec->catpath("", GetAbsDirname(GetDirname($file)), GetBasename($file)), shift(), shift(), shift())); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
549 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
550 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
551 |
sub GetRelFname($;$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
552 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
553 |
my ($file, $base) = (shift(), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
554 |
my $append = ($file =~ s/^>>(?!>)// ? ">>" : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
555 |
($file = PathConv(File::Spec->abs2rel($file, GetAbsDirname(defined($base) && ($base ne "") ? $base : ".")), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
556 |
shift(), 1, "[a-z]:")) =~ s/^[\/\\]+//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
557 |
return("$append$file"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
558 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
559 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
560 |
sub GetWriteFname($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
561 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
562 |
(my $file = shift()) =~ s/^>?/>/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
563 |
return($file); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
564 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
565 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
566 |
sub GetFreeDrive(;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
567 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
568 |
my $drives = Win32API::File::GetLogicalDrives(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
569 |
for my $drive ("F".."Z", "A".."E") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
570 |
return("$drive:") if !($drives & (2 ** (ord($drive) - ord("A")))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
571 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
572 |
return("") if shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
573 |
die("GetFreeDrive: No free drive available.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
574 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
575 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
576 |
sub SubstDrive($$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
577 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
578 |
my ($drive, $path) = (uc(shift()), GetAbsDirname(shift())); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
579 |
DPrint(16, "SubstDrive: `$drive' => `$path'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
580 |
$gSubstdrv{$drive} = 1, return if !(Win32API::File::GetLogicalDrives() & (2 ** (ord($drive) - ord("A")))) && |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
581 |
Win32API::File::DefineDosDevice(0, $drive, $path); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
582 |
die("Can't substitute `$drive' => `$path'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
583 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
584 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
585 |
sub UnsubstDrive($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
586 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
587 |
return if (my $drive = uc(shift())) eq ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
588 |
DPrint(16, "UnsubstDrive: `$drive'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
589 |
delete($gSubstdrv{$drive}), return if Win32API::File::DefineDosDevice(DDD_REMOVE_DEFINITION, $drive, []) && |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
590 |
!(Win32API::File::GetLogicalDrives() & (2 ** (ord($drive) - ord("A")))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
591 |
warn("Can't remove substituted drive `$drive'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
592 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
593 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
594 |
sub Search($$$$$$\@\$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
595 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
596 |
my ($dir, $basere, $inclre, $exclre, $subdir, $finddir, $files, $total) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
597 |
my @dir = my @file = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
598 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
599 |
opendir(SDIR, $dir) or warn("Can't open directory `$dir'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
600 |
while (local $_ = readdir(SDIR)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
601 |
next if ($_ eq ".") || ($_ eq ".."); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
602 |
push(@dir, $_) if ((my $isdir = !(my $isfile = -f($_ = "$dir/$_")) && -d()) && $subdir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
603 |
next if ($finddir ? $isfile : $isdir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
604 |
++$$total; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
605 |
(my $fname = $_) =~ s/$basere//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
606 |
push(@file, $_) if ($fname =~ /$inclre/) && ($fname !~ /$exclre/) && |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
607 |
(($finddir != 2) || !@{[glob((/\s/ ? "\"$_\"" : $_) . "/{[^.],.[^.],.??*,*}")]}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
608 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
609 |
closedir(SDIR); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
610 |
push(@$files, sort({lc($a) cmp lc($b)} @file)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
611 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
612 |
foreach (sort({lc($a) cmp lc($b)} @dir)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
613 |
Search($_, $basere, $inclre, $exclre, 1, $finddir, @$files, $$total); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
614 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
615 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
616 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
617 |
sub Find($$$$$\$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
618 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
619 |
my ($dur, $dir, $inclpat, $exclpat, $subdir, $finddir, $total) = (time(), @_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
620 |
($dir, $$total) = (GetAbsDirname($dir), 0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
621 |
my ($inclre, $exclre, @files) = ("", "", ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
622 |
if ($inclpat =~ /^\//) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
623 |
$inclre = eval("qr$inclpat"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
624 |
$inclpat = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
625 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
626 |
$inclre = join("|", map(Wcard2Restr($_), split(/\s+/, $inclpat))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
627 |
$inclre = qr/\/(?:$inclre)$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
628 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
629 |
if ($exclpat =~ /^\//) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
630 |
$exclre = eval("qr$exclpat"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
631 |
$exclpat = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
632 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
633 |
$exclre = join("|", map(Wcard2Restr($_), split(/\s+/, $exclpat))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
634 |
$exclre = qr/\/(?:$exclre)$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
635 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
636 |
DPrint(16, "Find" . ($finddir == 2 ? "EmptyDir" : ($finddir ? "Dir" : "File")) . ": Directory `$dir'" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
637 |
($subdir ? " and subdirectories" : "") . ", pattern `" . ($inclpat ne "" ? "$inclpat' $inclre" : "$inclre'") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
638 |
($exclre eq qr/\/(?:)$/i ? "" : " excluding `" . ($exclpat ne "" ? "$exclpat' $exclre" : "$exclre'"))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
639 |
foreach (GlobFiles($dir, 1)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
640 |
Search($_, qr/^$_/i, $inclre, $exclre, $subdir, $finddir, @files, $$total) if -d(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
641 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
642 |
DPrint(16, ", found " . @files . "/$$total " . ($finddir ? "directories" : "files") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
643 |
", duration: " . Sec2Min(time() - $dur) . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
644 |
return(@files); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
645 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
646 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
647 |
sub ChangeDir($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
648 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
649 |
if ((my $dir = GetAbsDirname(shift())) ne GetAbsDirname(".")) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
650 |
DPrint(16, "ChangeDir: `$dir'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
651 |
chdir($dir) or die("Can't change to directory `$dir'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
652 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
653 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
654 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
655 |
sub DeleteDir($;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
656 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
657 |
return if !-d(my $dir = GetAbsDirname(shift())); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
658 |
DPrint(16, "DeleteDir: `$dir'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
659 |
for my $sec (0, 2, 5) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
660 |
warn("Can't delete directory `$dir', retrying in $sec seconds...\n"), sleep($sec) if $sec; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
661 |
eval { local $gEvalerr = 1; File::Path::rmtree($dir) }; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
662 |
return if !-d($dir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
663 |
RunSystemCmd($gWinOS ? 'rmdir /q /s "' . PathConv($dir, 1) . '"' : |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
664 |
"rm -fr '$dir'", 2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
665 |
sleep(1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
666 |
return if !-d($dir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
667 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
668 |
$dir = "Can't delete directory `$dir'.\n"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
669 |
shift() ? warn($dir) : die($dir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
670 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
671 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
672 |
sub FindDir($$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
673 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
674 |
my ($dir, $inclpat, $exclpat, $opt) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
675 |
$opt = "" if !defined($opt); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
676 |
push(@gFindresult, Find($dir, $inclpat, $exclpat, $opt =~ /r/, 1, local $_)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
677 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
678 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
679 |
sub MakeDir($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
680 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
681 |
return if -d(my $dir = shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
682 |
eval { local $gEvalerr = 1; File::Path::mkpath($dir = GetAbsDirname($dir)) }; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
683 |
if (-d($dir)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
684 |
DPrint(16, "MakeDir: `" . GetAbsDirname($dir) ."'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
685 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
686 |
DPrint(16, "MakeDir: `$dir'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
687 |
die("Can't create directory `$dir'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
688 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
689 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
690 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
691 |
sub MakeChangeDir($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
692 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
693 |
MakeDir(my $dir = shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
694 |
ChangeDir($dir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
695 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
696 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
697 |
sub SetWorkdir($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
698 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
699 |
MakeChangeDir(shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
700 |
$gWorkdrive = (Cwd::cwd() =~ /^([a-z]:)/i ? uc($1) : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
701 |
$gWorkdir = GetAbsDirname("."); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
702 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
703 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
704 |
sub OpenFile(*$$;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
705 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
706 |
my ($fhandle, $file, $binmode, $print) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
707 |
MakeDir(GetDirname($file)) if $file =~ /^>/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
708 |
DPrint(16, defined($print) ? $print : ($file =~ /^>/ ? "Write" : "Read") . "File: `$file'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
709 |
return(open($fhandle, $file)) if !$binmode; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
710 |
return(open($fhandle, $file) and binmode($fhandle)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
711 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
712 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
713 |
sub Test($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
714 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
715 |
if (-d(my $file = shift())) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
716 |
DPrint(16, "TestDir: `" . GetAbsDirname($file) . "'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
717 |
} elsif (-f($file)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
718 |
DPrint(16, "TestFile: `" . GetAbsFname($file) . "'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
719 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
720 |
DPrint(16, "Test: `$file'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
721 |
die("File or directory `$file' doesn't exist.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
722 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
723 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
724 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
725 |
sub CutFile($$$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
726 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
727 |
my ($msg, $src, $dest, $head, $len) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
728 |
my ($buf, $srctmp) = (undef, "$src.tmp"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
729 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
730 |
OpenFile(*INFILE, $src, 1, $msg) or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
731 |
die("Can't read file `$src'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
732 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
733 |
my $out = GetWriteFname($head ? $dest : $srctmp); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
734 |
OpenFile(*OUTFILE, $out, 1) or die("Can't write to `$out'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
735 |
while ($len > 0) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
736 |
read(INFILE, $buf, $len < READBUFSIZE ? $len : READBUFSIZE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
737 |
print(OUTFILE $buf); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
738 |
$len -= READBUFSIZE; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
739 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
740 |
close(OUTFILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
741 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
742 |
$out = GetWriteFname($head ? $srctmp : $dest); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
743 |
OpenFile(*OUTFILE, $out, 1) or die("Can't write to `$out'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
744 |
print(OUTFILE $buf) while read(INFILE, $buf, READBUFSIZE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
745 |
close(OUTFILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
746 |
close(INFILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
747 |
Move($srctmp, $src); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
748 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
749 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
750 |
sub Copy($$;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
751 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
752 |
my ($src, $dest, $dir) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
753 |
$dir = defined($dir) && $dir; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
754 |
my $file = !($dir || -d($src)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
755 |
$src = ($file ? GetAbsFname($src) : GetAbsDirname($src)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
756 |
$dest = ($file ? GetAbsFname(-d($dest) ? "$dest/" . GetBasename($src) : $dest) : |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
757 |
GetAbsDirname($dir ? $dest : "$dest/" . GetBasename($src))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
758 |
if ($file && ($dest =~ /^>>[^>]/)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
759 |
OpenFile(*FILE, $dest, 1, "AppendFile: `$src' => `$dest'\n") |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
760 |
or die("Can't append to `$dest'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
761 |
File::Copy::copy($src, *FILE) and |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
762 |
close(FILE) and return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
763 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
764 |
elsif ($file) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
765 |
MakeDir(GetDirname($dest)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
766 |
DPrint(16, "CopyFile: `$src' => `$dest'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
767 |
warn("CopyFile: Destination file `$dest' already exists\n") if -f($dest); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
768 |
File::Copy::copy($src, $dest) and return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
769 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
770 |
DPrint(16, "CopyDir: `$src' => `$dest'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
771 |
return if !RunSystemCmd(!$gWinOS ? "cp \"$src\"/* \"$dest\" -frv" : |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
772 |
'xcopy "' . PathConv($src, 1) . '" "' . PathConv($dest, 1) . '" /e /h /i /q /y /z', 2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
773 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
774 |
die("Can't copy `$src' to `$dest'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
775 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
776 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
777 |
sub CopyIby($$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
778 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
779 |
my ($file, $dir) = (GetAbsFname(shift()), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
780 |
OpenFile(*FILE, $file, 0) or die("Can't read file `$file'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
781 |
map { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
782 |
Copy(defined($1) ? $1 : $2, "$dir/" . (defined($3) ? $3 : $4)) if $_ =~ FILESPECSTATEMENT; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
783 |
} <FILE>; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
784 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
785 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
786 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
787 |
sub DeleteFile($;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
788 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
789 |
return if !-f(my $file = GetAbsFname(shift())); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
790 |
DPrint(16, "DeleteFile: `$file'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
791 |
for my $sec (0, 1, 2) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
792 |
warn("Can't delete file `$file', retrying in $sec second(s)...\n"), sleep($sec) if $sec; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
793 |
unlink($file); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
794 |
return if !-f($file); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
795 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
796 |
$file = "Can't delete file `$file'.\n"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
797 |
shift() ? warn($file) : die($file); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
798 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
799 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
800 |
sub FindFile($$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
801 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
802 |
my ($dir, $inclpat, $exclpat, $opt) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
803 |
$opt = "" if !defined($opt); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
804 |
my @find = Find($opt !~ /f/ ? $dir : GetDirname($dir), $opt !~ /f/ ? $inclpat : GetBasename($dir), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
805 |
$exclpat, $opt =~ /r/, 0, local $_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
806 |
push(@gFindresult, $opt !~ /f/ ? @find : map("|$_|$inclpat", @find)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
807 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
808 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
809 |
sub HeadFile($$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
810 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
811 |
my ($src, $dest, $len) = (GetAbsFname(shift()), GetAbsFname(shift()), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
812 |
$len = hex($len) if $len =~ /^0x/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
813 |
CutFile("HeadFile: Cut first $len bytes from `$src' => `$dest'\n", $src, $dest, 1, $len); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
814 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
815 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
816 |
sub TailFile($$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
817 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
818 |
my ($src, $dest, $len) = (GetAbsFname(shift()), GetAbsFname(shift()), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
819 |
$len = hex($len) if $len =~ /^0x/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
820 |
CutFile("TailFile: Cut last $len bytes from `$src' => `$dest'\n", $src, $dest, 0, (-s($src) ? -s($src) : 0) - $len); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
821 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
822 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
823 |
sub TypeFile($;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
824 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
825 |
my ($file, $str, $mode) = (GetAbsFname(shift()), "", shift() || ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
826 |
OpenFile(*FILE, $file, $mode, "TypeFile: `$file'" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
827 |
($gOutfilter && ($mode ne "b") ? ", filter: `/$gOutfilter/i'" : "") . "\n") or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
828 |
die("Can't read file `$file'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
829 |
DPrint(8, STARTSTR . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
830 |
read(FILE, $str, -s($file)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
831 |
if ($mode eq "b") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
832 |
DPrint(1, Byte2Str(0, map(ord(), split(//, $str)))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
833 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
834 |
$str = Uni2Ascii($str) if $mode eq "u"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
835 |
DPrint(1, map("$_\n", grep(!$gOutfilter || /$gOutfilter/i, split(/\n/, $str)))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
836 |
$gOutfilter = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
837 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
838 |
DPrint(8, ENDSTR . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
839 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
840 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
841 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
842 |
sub ReadFile($$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
843 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
844 |
my ($file, $warn) = (GetAbsFname(shift()), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
845 |
OpenFile(*RFILE, $file, 0) or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
846 |
($warn ? (warn("Can't read file `$file'.\n"), return(())) : die("Can't read file `$file'.\n")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
847 |
my @file = map(chomp() ? $_ : $_, grep(!/^\s*$/, <RFILE>)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
848 |
close(RFILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
849 |
return(@file); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
850 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
851 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
852 |
sub WriteFile($$$;$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
853 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
854 |
my ($file, $str, $mode, $opt) = (GetAbsFname(shift()), shift(), shift() || "", shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
855 |
OpenFile(*WFILE, GetWriteFname($file), $mode) or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
856 |
die("Can't write to `$file'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
857 |
if ($mode eq "b") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
858 |
my @byte = Str2Byte($str); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
859 |
DPrint(64, Byte2Str($file =~ s/^>>(?!>)// ? -s($file) : 0, @byte)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
860 |
print(WFILE map(chr(), @byte)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
861 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
862 |
$opt = "" if !defined($opt); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
863 |
$str = Unquote($str) if ($opt !~ /q/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
864 |
$str =~ s/(?<=\S)\/\//\//g if ($opt =~ /c/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
865 |
DPrint(16, $str) if shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
866 |
$str = Ascii2Uni($str) if ($mode eq "u"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
867 |
print(WFILE $str); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
868 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
869 |
close(WFILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
870 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
871 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
872 |
sub UnzipFile($$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
873 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
874 |
my ($zipfile, $dir) = (GetAbsFname(shift()), GetAbsDirname(shift())); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
875 |
DPrint(16, "UnzipFile: `$zipfile'"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
876 |
Archive::Zip::setErrorHandler(sub{}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
877 |
my ($error, $zip) = (0, Archive::Zip->new()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
878 |
if ($zip->read($zipfile) != AZ_OK) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
879 |
DPrint(16, " to directory `$dir'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
880 |
die("Can't read zip archive `$zipfile'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
881 |
return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
882 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
883 |
my @files = map($_->fileName(), grep(!$_->isDirectory(), $zip->members())); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
884 |
DPrint(16, ", " . @files . " files to directory `$dir'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
885 |
foreach my $file (@files) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
886 |
DPrint(16, "ExtractFile: `$dir/$file'"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
887 |
eval { local $gEvalerr = 1; $error = ($zip->extractMember($file, "$dir/$file") != AZ_OK) }; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
888 |
DPrint(16, $error ? " Failed\n" : "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
889 |
die("Can't extract file `$file' to directory `$dir'.\n") if $error; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
890 |
$error = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
891 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
892 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
893 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
894 |
sub Zip($$$$@) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
895 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
896 |
my ($zipfile, $dir, $opt, $prefix) = (GetAbsFname(shift()), shift(), shift(), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
897 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
898 |
$opt = (defined($opt) ? ", options: `$opt'" : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
899 |
$prefix = GetAbsDirname($prefix) if $prefix ne ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
900 |
my %files = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
901 |
foreach my $file (@_) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
902 |
my $zname = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
903 |
($file, $zname) = ($1, $2) if ($file =~ /^\|(.*)\|(.*)$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
904 |
next if !($file = (!$dir ? (-f($file) ? GetAbsFname($file) : "") : (-d($file) ? GetAbsDirname($file) : ""))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
905 |
($zname = ($zname eq "" ? $file : (!$dir ? |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
906 |
GetAbsFname($zname) : GetAbsDirname($zname)))) =~ s/^(?:$gEpocroot|[a-z]:)?\/+//i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
907 |
if ($opt !~ /j/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
908 |
$zname =~ s/^.*?\/+/$prefix\// if ($prefix ne ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
909 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
910 |
$zname = ($dir ? "" : GetBasename($file)) if ($prefix eq "") || !s/^$prefix//; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
911 |
} |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
912 |
$files{lc($zname)} = [$file, $zname]; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
913 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
914 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
915 |
DPrint(16, ($dir ? "ZipDir: `$zipfile'$opt, " . keys(%files) . " directories" : |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
916 |
"ZipFile: `$zipfile'$opt, " . keys(%files) . " files") . ($prefix ? ", prefix: $prefix\n" : "\n")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
917 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
918 |
Archive::Zip::setErrorHandler(sub{}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
919 |
my ($error, $zip) = (0, Archive::Zip->new()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
920 |
$zip->read($zipfile) if (my $ziptmp = ($zipfile =~ s/^>>(?!>)// ? "$zipfile.tmp" : "")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
921 |
$zip->zipfileComment("iMaker-generated zip archive `$zipfile'$opt."); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
922 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
923 |
foreach my $file (sort({lc($$a[0]) cmp lc($$b[0])} values(%files))) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
924 |
DPrint(16, "Add" . ($dir ? "Dir" : "File") . ": `$$file[0]' => `$$file[1]'") if ($opt !~ /q/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
925 |
eval { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
926 |
my $warn = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
927 |
local $gEvalerr = 1; local $SIG{__WARN__} = sub{ $warn = 1 }; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
928 |
$error = ($dir ? $zip->addTree($$file[0], $$file[1]) != AZ_OK : |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
929 |
!$zip->addFile($$file[0], $$file[1])) || $warn; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
930 |
}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
931 |
DPrint(16, $error ? " Failed\n" : "\n") if ($opt !~ /q/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
932 |
warn("Can't add " . ($dir ? "directory tree" : "file") . "`$$file[0]' to zip archive `$zipfile'.\n") if $error; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
933 |
$error = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
934 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
935 |
($zip->writeToFileNamed($ziptmp ? $ziptmp : $zipfile) == AZ_OK) or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
936 |
die("Can't create zip archive `$zipfile'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
937 |
Move($ziptmp, $zipfile) if $ziptmp; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
938 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
939 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
940 |
sub Move($$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
941 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
942 |
my ($src, $dest) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
943 |
my $dir = -d($src); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
944 |
$src = ($dir ? GetAbsDirname($src) : GetAbsFname($src)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
945 |
MakeDir(GetDirname($dest)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
946 |
$dest = ($dir ? GetAbsDirname($dest) : GetAbsFname($dest)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
947 |
DPrint(16, "Move" . ($dir ? "Dir" : "File") . ": `$src' => `$dest'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
948 |
File::Copy::move($src, $dest) or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
949 |
die("Can't move `$src' to `$dest'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
950 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
951 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
952 |
sub Touch($@) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
953 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
954 |
my $time = (shift() =~ /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/ ? |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
955 |
Time::Local::timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900) : time); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
956 |
if (@_ != 1) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
957 |
DPrint(16, "Touch: " . scalar(@_) . " files/dirs, " . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
958 |
POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime($time)) . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
959 |
utime($time, $time, @_) == @_ or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
960 |
die("Can't touch all the " . scalar(@_) . " files/dirs.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
961 |
return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
962 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
963 |
my $file = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
964 |
my $dir = -d($file); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
965 |
$file = ($dir ? GetAbsDirname($file) : GetAbsFname($file)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
966 |
DPrint(16, "Touch" . ($dir ? "Dir" : "File") . ": `$file', " . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
967 |
POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime($time)) . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
968 |
utime($time, $time, $file) == 1 or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
969 |
die("Can't touch " . ($dir ? "directory" : "file") . " `$file'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
970 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
971 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
972 |
sub SetLogfile($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
973 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
974 |
return if !(my $file = GetAbsFname(shift())); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
975 |
my $append = (($file =~ s/^>>(?!>)//) || exists($gLogfiles{$file}) ? ">>" : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
976 |
CloseLog(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
977 |
OpenFile(*LOG, GetWriteFname($file = "$append$file"), 0) or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
978 |
warn("Can't log to file `$file'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
979 |
$gLogfiles{$gLogfiles{__prev__} = $gLogfile = $file} = 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
980 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
981 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
982 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
983 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
984 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
985 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
986 |
sub RunSystemCmd($;$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
987 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
988 |
return if ($gICmd !~ $gFiltercmd); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
989 |
my ($cmd, $keepgoing, $null, $file) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
990 |
DPrint(1, "$cmd\n"), return if $gPrintcmd; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
991 |
local $gError = 0 if ($keepgoing = (defined($keepgoing) && ($keepgoing =~ /^[123]$/) ? $keepgoing : 0)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
992 |
local $gKeepgoing = Max($gKeepgoing, $keepgoing) if $keepgoing; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
993 |
$file = (defined($file) ? GetAbsFname($file) : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
994 |
@gCmdoutbuf = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
995 |
DPrint(4, local $_ = "RunSystemCmd(" . GetAbsDirname(".") . "): `$cmd'" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
996 |
($keepgoing ? ", keep going" . ($keepgoing > 1 ? "($keepgoing)" : "") : "") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
997 |
($file ? ", redirect to `$file'" : "") . ($null ? ", redirect stdout to null" : "") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
998 |
($gOutfilter ? ", filter: `/$gOutfilter/i'" : "") . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
999 |
OpenFile(*CMDFILE, GetWriteFname($file), 0) or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1000 |
(die("Can't write to `$file'.\n"), $file = "") if $file; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1001 |
print(CMDFILE $_) if $file; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1002 |
my $dur = time(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1003 |
open(CMD, "$cmd 2>&1 |"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1004 |
DPrint(8, STARTSTR . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1005 |
while ($_ = <CMD>) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1006 |
chomp(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1007 |
push(@gCmdoutbuf, $_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1008 |
next if ($gOutfilter && !/$gOutfilter/i); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1009 |
DPrint(8, "$_\n") if !$null; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1010 |
print(CMDFILE "$_\n") if $file; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1011 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1012 |
close(CMD); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1013 |
my $error = ($? >> 8); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1014 |
close(CMDFILE) if $file; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1015 |
push(@gStepDur, $dur = time() - $dur); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1016 |
$gOutfilter = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1017 |
print(map("$_\n", @gCmdoutbuf)) if ($error && !$gKeepgoing && !$null && $gVerbose && !($gVerbose & 8)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1018 |
$dur = Sec2Min($dur); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1019 |
DPrint(8, substr(ENDSTR, 0, -16) . $dur . substr(ENDSTR, length($dur) - 16) . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1020 |
die("Command `$cmd' failed ($error) in `" . GetAbsDirname(".") . "'.\n") if $error; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1021 |
return($error); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1022 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1023 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1024 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1025 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1026 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1027 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1028 |
sub ParseSystemCmd($$$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1029 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1030 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1031 |
my ($title, $inclre, $exclre, $file, $lines) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1032 |
($inclre, $exclre) = (eval("qr$inclre"), $exclre ne "" ? eval("qr$exclre") : qr/^$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1033 |
$lines = ($lines ? $lines - 1 : 0); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1034 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1035 |
my @parse = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1036 |
for (my $i = 0; $i < @gCmdoutbuf; $i++) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1037 |
next if ($gCmdoutbuf[$i] !~ $inclre); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1038 |
push(@parse, join(" | ", @gCmdoutbuf[$i .. $i + $lines])) if ($gCmdoutbuf[$i] !~ $exclre); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1039 |
$i += $lines; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1040 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1041 |
return if !@parse; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1042 |
if (!$file) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1043 |
DPrint(1, "$title\n", map(sprintf("%" . length(@parse) . "s", $_) . ") $parse[$_ - 1]\n", 1 .. @parse)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1044 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1045 |
WriteFile($title, join("\n", @parse), "", "q"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1046 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1047 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1048 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1049 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1050 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1051 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1052 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1053 |
sub GenExclfile($$$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1054 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1055 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1056 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1057 |
my ($exclfile, $base, $prefix, $exclfiles, @exclfiles) = (shift(), GetAbsDirname(shift()), shift(), "", ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1058 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1059 |
if (!-f($exclfile)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1060 |
WriteFile($exclfile, "", ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1061 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1062 |
OpenFile(*FILE, $exclfile, 1) or die("Can't read file `$exclfile'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1063 |
read(FILE, $exclfiles, -s($exclfile)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1064 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1065 |
@exclfiles = split(/\n/, Uni2Ascii($exclfiles)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1066 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1067 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1068 |
my $findfiles = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1069 |
my @addfiles = map($_ ne "**" ? $_ : "*", grep(!(($_ eq "*") && ++$findfiles), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1070 |
map(Trim(Unquote(Trim($_))), grep(!/^\s*(?:#.*)?$/, split(/(?<!\\)\\n/, shift()))))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1071 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1072 |
if ($findfiles) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1073 |
$exclfiles = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1074 |
foreach (@exclfiles, @addfiles, map(Trim(Unquote(Trim($_))), grep(!/^\s*(?:#.*)?$/, split(/(?<!\\)\\n/, shift())))) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1075 |
(my $file = $_) =~ tr/\\/\//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1076 |
$file =~ s/^(?:[a-z]:)?\/*//i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1077 |
$exclfiles .= ($exclfiles ne "" ? "|" : "") . Wcard2Restr($file); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1078 |
} |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1079 |
push(@addfiles, map(GetRelFname($_, $base), Find($base, "*", "/^\\/(?:$exclfiles)\$/i", 1, 0, local $_))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1080 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1081 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1082 |
$prefix =~ s/[\/\\]+$//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1083 |
WriteFile($exclfile, join("", map("$_\n", @exclfiles, |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1084 |
map(s/^(?:[a-z]:)?\\*/$prefix\\/i ? $_ : $_, map(tr/\//\\/ ? $_ : $_, @addfiles)))), "u", "q"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1085 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1086 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1087 |
sub GenIbyfile($$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1088 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1089 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1090 |
my ($ibyfile, $ibystr, $oride, $prevoride) = (shift(), "", "", ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1091 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1092 |
map { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1093 |
die("GenIbyfile: Invalid file list configuration: `$_'\n"), return |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1094 |
if !/^\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))\s*$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1095 |
$_ = [defined($1) ? $1 : $2, defined($3) ? $3 : $4]; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1096 |
} (my @files = map(Unquote($_), grep(!/^\s*(?:#.*)?$/, split(/(?<!\\)\\n/, shift())))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1097 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1098 |
my @ibyconf = map(Unquote($_), grep(!/^\s*(?:#.*)?$/, split(/(?<!\\)\\n/, shift()))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1099 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1100 |
foreach (@ibyconf) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1101 |
die("GenIbyfile: Invalid configuration: `$_'\n"), return |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1102 |
if !/^\s*(?:"(.+?)"|(\S+))\s+(hide|remove|(?:replace|udeb|urel)(?:-add)?)\s+(\*|core|rofs[2-6])\s*$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1103 |
next if ($4 ne "*") && (uc($4) ne $gImgtype); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1104 |
my $action = lc($3); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1105 |
my $file = Wcard2Restr(defined($1) ? $1 : $2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1106 |
$file = qr/(?:^|\\|\/)$file$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1107 |
foreach (@files) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1108 |
next if (@$_[1] !~ $file); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1109 |
$oride = ($action =~ /add$/ ? "ADD" : ($action eq "hide" ? "" : "SKIP")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1110 |
my $src = ($action eq "remove" ? "empty" : @$_[0]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1111 |
if ($action =~ /^udeb/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1112 |
$src =~ s/(?<=[\/\\])urel(?=[\/\\])/udeb/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1113 |
} elsif ($action =~ /^urel/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1114 |
$src =~ s/(?<=[\/\\])udeb(?=[\/\\])/urel/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1115 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1116 |
$ibystr .= ($prevoride && ($oride ne $prevoride) ? "OVERRIDE_END\n" : "") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1117 |
($oride && ($oride ne $prevoride) ? "OVERRIDE_REPLACE/$oride\n" : "") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1118 |
($oride ? "override=\"$src\" " : "hide=") . "\"@$_[1]\"\n"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1119 |
$prevoride = $oride; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1120 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1121 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1122 |
WriteFile($ibyfile, ($ibyfile =~ /^>>([^>].*)$/ && -f($1) ? "" : "// Generated `$ibyfile'") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1123 |
"\n\n/* Custom override configuration\n" . join("\n", @ibyconf) . "\n*/\n$ibystr" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1124 |
($oride ? "OVERRIDE_END\n" : ""), "", "q"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1125 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1126 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1127 |
sub GenObyfile($$$$@) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1128 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1129 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1130 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1131 |
my ($ibyfile, $srcdir, $subdir, $finddir) = (GetAbsFname(shift()), shift(), shift(), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1132 |
my ($header, $footer, $body, %files) = ("", "", "", ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1133 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1134 |
foreach my $dir (split(/\s+/, $srcdir)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1135 |
$dir = GetAbsDirname($dir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1136 |
my ($found, $total, $lines) = (0, 0, ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1137 |
my @param = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1138 |
while (@param) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1139 |
my ($filepat, $format, @lines) = (shift(@param), shift(@param), ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1140 |
$header = $format, next if $filepat =~ /^__header__$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1141 |
$footer = $format, next if $filepat =~ /^__footer__$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1142 |
foreach my $src (Find($dir, $filepat, "", $subdir, $finddir, $total)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1143 |
next if $files{$src}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1144 |
$files{$src} = 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1145 |
(my $line = $format) =~ s/%1/$src/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1146 |
$line =~ s/%2/GetRelFname($src, $dir, 1)/ge; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1147 |
$line =~ s/%3/GetAbsFname($src)/ge; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1148 |
if ($line =~ /%4/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1149 |
my $attrib = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1150 |
if ($gWinOS) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1151 |
Win32::File::GetAttributes($src, $attrib); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1152 |
$attrib = (($attrib & WIN32_FILE_HIDDEN) ? "attrib=H" : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1153 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1154 |
$line =~ s/%4/$attrib/ge; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1155 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1156 |
push(@lines, Trim($line)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1157 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1158 |
$found += @lines; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1159 |
$lines .= "//\n// Format: `$format', " . @lines . ($finddir ? " empty directories" : " files") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1160 |
": `$filepat'\n" . (@lines ? "//\n" . join("\n", @lines) . "\n" : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1161 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1162 |
$body .= "\n// Collected entries $found/$total from directory `$dir'" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1163 |
($subdir ? " and subdirectories" : "") . "\n$lines"; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1164 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1165 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1166 |
my $append = ($ibyfile =~ s/^>>(?!>)// && -f($ibyfile) && ">>" || ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1167 |
(my $fname = "__" . uc(GetBasename($ibyfile)) . "__") =~ s/\W/_/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1168 |
my @previby = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1169 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1170 |
if ($append) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1171 |
OpenFile(*FILE, $ibyfile, 0) or die("Can't read file `$ibyfile'.\n"), return; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1172 |
@previby = <FILE>; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1173 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1174 |
$previby[0] =~ s/(, collected )(\d+)( entries)$/$1.($2 + keys(%files)).$3/e; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1175 |
$previby[@previby - 1] = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1176 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1177 |
WriteFile($ibyfile, join("", @previby) . ($append ? "// Appended" : "// Generated") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1178 |
" `$append$ibyfile', collected " . keys(%files) . " entries\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1179 |
($append ? "" : "\n#ifndef $fname\n#define $fname\n") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1180 |
($header ? Unquote("\\n$header\\n") : "") . $body . ($footer ? Unquote("\\n$footer\\n") : "") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1181 |
"\n#endif // $fname\n", "", "q"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1182 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1183 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1184 |
sub GenWidgetConf($$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1185 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1186 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1187 |
my ($wgzini, $ini, $dir) = (shift(), GetAbsFname(shift()), GetAbsDirname(shift())); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1188 |
my @ini = ($ini eq "" ? () : ReadFile($ini, 0)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1189 |
my $files = ($dir eq "" ? "" : join("\n", Find($dir, "*", '/\/(?:' . join("|", |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1190 |
map(GetBasename($_), ($ini, map(!/^\s*[#[]/ && /^\s*(?:"(.+?)"|(\S+))/ && |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1191 |
-e(local $_ = (defined($1) ? $1 : $2)) ? $_ : (), @ini)))) . ')$/i', 0, 0, local $_))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1192 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1193 |
WriteFile($wgzini, Unquote(shift()) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1194 |
(@ini ? "# Copied lines from `$ini':\n" . join("\n", @ini) : "") . "\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1195 |
($files ? (@ini ? "\n" : "") . "# Collected files from `$dir':\n$files\n" : ""), "", "q"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1196 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1197 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1198 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1199 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1200 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1201 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1202 |
sub GenMakefile($$$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1203 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1204 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1205 |
my ($hdrfile, $mkfile, $filter, $prepros, $assignop) = |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1206 |
(GetAbsFname(shift()), GetAbsFname(shift()), shift(), shift(), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1207 |
ChangeDir(GetDirname($hdrfile)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1208 |
RunSystemCmd("$prepros " . GetBasename($hdrfile)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1209 |
my $maxdef = Max(map(/^\s*\#define\s+($filter)/ && length($1), @gCmdoutbuf)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1210 |
WriteFile($mkfile, join('\n', |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1211 |
map(/^\s*\#define\s+($filter)\s*(.*?)\s*$/ ? sprintf("%-${maxdef}s $assignop %s", $1, $2 eq "" ? 1 : $2) : (), sort(@gCmdoutbuf))) . '\n', ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1212 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1213 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1214 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1215 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1216 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1217 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1218 |
sub AddImageHeader($$$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1219 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1220 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1221 |
my ($file, $hdrfile, $hdrstr, $hdrsize, $align) = |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1222 |
(GetAbsFname(shift()), GetAbsFname(shift()), shift(), shift(), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1223 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1224 |
$hdrstr =~ s/\/\*.*?\*\///g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1225 |
$hdrstr =~ s/,\s*$//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1226 |
WriteFile($hdrfile, $hdrstr, "b"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1227 |
die("Invalid image header size: " . sprintf("0x%X", -s($hdrfile)) . " (!=$hdrsize).\n"), return |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1228 |
if -s($hdrfile) ne hex($hdrsize); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1229 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1230 |
$align = Max(hex($align), hex($hdrsize)) - hex($hdrsize); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1231 |
WriteFile(">>$hdrfile", ("0," x ($align - 1)) . "0", "b") if $align; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1232 |
Copy($file, ">>$hdrfile") if $file ne ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1233 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1234 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1235 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1236 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1237 |
# |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1238 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1239 |
sub Sleep($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1240 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1241 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1242 |
sleep(shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1243 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1244 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1245 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1246 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1247 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1248 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1249 |
sub FindSOSFiles($$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1250 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1251 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1252 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1253 |
my ($dirs, $imgoby, $pluglog, $opt) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1254 |
my ($file, %files) = ("", ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1255 |
local $_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1256 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1257 |
foreach my $dir (GlobFiles($dirs)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1258 |
my ($featvar, @pluglog) = ("", Find($dir = GetAbsDirname($dir), $pluglog, "", 1, 0, $_)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1259 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1260 |
foreach $file (@pluglog) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1261 |
OpenFile(*FILE, $file, 0) or warn("Can't read file `$file'.\n"), last; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1262 |
while (<FILE>) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1263 |
last if !/^.+?\.pm: Initializing; /; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1264 |
$featvar = $1, last if / feature variant = `(.+)'$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1265 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1266 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1267 |
last if ($featvar ne ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1268 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1269 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1270 |
foreach $file (Find($dir, $imgoby, "", 1, 0, $_)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1271 |
OpenFile(*FILE, $file, 0) or warn("Can't read file `$file'.\n"), last; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1272 |
while (<FILE>) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1273 |
next if ($_ !~ FILESPECSTATEMENT) && ($_ !~ BOOTBINARYSTATEMENT); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1274 |
$file = GetAbsFname(defined($1) ? $1 : $2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1275 |
$files{lc($file)} = $file if !exists($files{lc($file)}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1276 |
next if ($file !~ s/\.[0-9a-f]{32}\./\./i); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1277 |
$file .= (-f("$file.$featvar.vmap") ? ".$featvar.vmap" : ".vmap"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1278 |
$files{lc($file)} = $file if !exists($files{lc($file)}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1279 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1280 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1281 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1282 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1283 |
my ($incfile, $spifile, $plugfile, $patchfile) = (0, 0, 0, 0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1284 |
foreach $file (@pluglog) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1285 |
OpenFile(*FILE, $file, 0) or warn("Can't read file `$file'.\n"), last; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1286 |
while (<FILE>) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1287 |
$incfile = 1, next if /^Finding include hierarchy from /; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1288 |
$incfile = 0, next if ($incfile && /^Found \d+ different include files$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1289 |
$spifile = 1, next if /^Finding SPI input files from /; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1290 |
$spifile = 0, next if ($spifile && /^Found \d+ SPI input files$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1291 |
$plugfile = 1, next if /^Reading (ROM|ROFS1|UDEB|UREL) files from /; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1292 |
$plugfile = 0, next if ($plugfile && /^Found \d+ entries$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1293 |
$patchfile = 1, next if /^Finding ROM-patched components$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1294 |
$patchfile = 0, next if ($patchfile && /^Found \d+ ROM-patched components$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1295 |
$files{lc($file)} = $file, next |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1296 |
if (($incfile || $spifile || $plugfile) && /`(.+)'$/ && !exists($files{lc($file = GetAbsFname($1))})); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1297 |
next if (!$patchfile || !/^`(.+)'$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1298 |
$file = GetAbsFname($1) . ".map"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1299 |
$files{lc($file)} = $file, next if -f($file); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1300 |
$file =~ s/(\..*?\.map)$/\.\*$1/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1301 |
foreach (glob($file =~ /\s/ ? "\"$file\"" : $file)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1302 |
($file = lc()) =~ s/\.map$//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1303 |
$files{lc()} = $_, last if exists($files{$file}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1304 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1305 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1306 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1307 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1308 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1309 |
$dir .= "/" if $dir !~ /\/$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1310 |
foreach $file (keys(%files)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1311 |
delete($files{$file}) if ($file =~ /^$dir/i); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1312 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1313 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1314 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1315 |
@gFindresult = () if (!defined($opt) || $opt !~ /a/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1316 |
push(@gFindresult, values(%files)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1317 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1318 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1319 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1320 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1321 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1322 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1323 |
sub CheckTool(@) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1324 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1325 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1326 |
my ($maxtlen, $maxvlen, @tools) = (4, 9, ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1327 |
while (@_) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1328 |
my ($tool, $vquery, $getver, $version, $md5sum) = (shift(), shift(), shift(), " -", " ?"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1329 |
if (length($vquery) > 1) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1330 |
RunSystemCmd($vquery, 3, 1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1331 |
$version = (join("\n", @gCmdoutbuf) =~ eval($getver =~ /^\// ? "qr$getver" : "qr/$getver/ims") ? |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1332 |
(defined($1) && defined($2) && "`$1 $2'" || defined($1) && "`$1'" || " ?") : " ?"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1333 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1334 |
OpenFile(*FILE, $tool, 1) and $md5sum = "`" . md5_hex(<FILE>) . "'"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1335 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1336 |
$maxtlen = Max($maxtlen, length($tool)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1337 |
$maxvlen = Max($maxvlen, length($version)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1338 |
push(@tools, "`$tool'", $version, $md5sum); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1339 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1340 |
$maxtlen += 2; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1341 |
@_ = (" Tool", " Version", " MD5 Checksum", "-" x $maxtlen, "-" x $maxvlen, "-" x 34, @tools); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1342 |
DPrint(1, sprintf("%-${maxtlen}s %-${maxvlen}s ", shift(), shift()) . shift() . "\n") while(@_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1343 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1344 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1345 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1346 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1347 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1348 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1349 |
sub OpCacheInstall($$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1350 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1351 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1352 |
my ($ini, $conf, $tmpdir) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1353 |
my %opt = (-e => "", -i => "", -m => "", -o => "", -u => ""); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1354 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1355 |
foreach $conf ("opcache_config=$conf", ($ini ne "" ? grep(!/^\s*#/, ReadFile($ini, 0)) : ())) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1356 |
(local $_, my $error, my %tmpopt) = ($conf, 0, %opt); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1357 |
if (!($error = !(s/^\s*opcache_config\s*[=\s]//i || s/^\s*opcache_content\s*[=\s]/-i /i))) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1358 |
my @opt = ParseCmdWords($_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1359 |
while (@opt) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1360 |
last if ($error = ((($_ = shift(@opt)) !~ /^-[eimou]$/i) || |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1361 |
!defined($tmpopt{$_} = shift(@opt)))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1362 |
$tmpopt{$_} =~ s/EPOCROOT/$gEpocroot/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1363 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1364 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1365 |
die("OpCacheInstall: Invalid configuration entry: `$conf'\n"), next if $error; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1366 |
%opt = %tmpopt; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1367 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1368 |
if (-d($opt{-i})) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1369 |
$opt{-i} = GetAbsDirname($opt{-i}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1370 |
} elsif (-f($opt{-i})) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1371 |
DeleteDir($tmpdir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1372 |
MakeDir($tmpdir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1373 |
RunSystemCmd("$gTool{unzip} x -y \"" . GetAbsFname($opt{-i}) . "\"" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1374 |
" -o\"" . ($tmpdir = GetAbsDirname($tmpdir)) . "\"", 0, 1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1375 |
$opt{-i} = $tmpdir; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1376 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1377 |
RunSystemCmd("$gTool{opcache} -u \"$opt{-u}\" -e \"$opt{-e}\" -m \"" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1378 |
GetAbsFname($opt{-m}) . "\" -i \"$opt{-i}\" -o \"" . GetAbsDirname($opt{-o}) . "\""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1379 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1380 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1381 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1382 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1383 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1384 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1385 |
sub SisInstall($$$$$$$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1386 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1387 |
return if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1388 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1389 |
my ($ini, $intini, $conf, $hda, $hdata, $idata, $outdir, $log) = |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1390 |
(GetAbsFname(shift()), GetAbsFname(shift()), shift(), GetAbsFname(shift()), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1391 |
shift(), shift(), GetAbsDirname(shift()), shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1392 |
my %gopt = (-d => "C", -k => "5.4", -w => "info", '--ignore-err' => 0); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1393 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1394 |
my %haldata = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1395 |
map { $haldata{uc($1)} = $2 if /^\s*(\S+)\s+(\S+)\s*$/ } split(/(?<!\\)\\n/, $hdata); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1396 |
$gOutfilter = '\S'; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1397 |
RunSystemCmd("$gTool{cpp} -nostdinc -undef \"$hda\"", 1, 1, $log) if ($hda ne ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1398 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1399 |
local @_ = (map(!/^\s*E(\S+)\s*=\s*(\S+)\s*$/ ? () : (uc($1) . " = " . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1400 |
(exists($haldata{uc($2)}) ? $haldata{uc($2)} : (exists($haldata{uc("E$1_$2")}) ? |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1401 |
$haldata{uc("E$1_$2")} : $2)) . "\n"), @gCmdoutbuf), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1402 |
map(/^\s*$/ ? () : Trim($_) . "\n", split(/(?<!\\)\\n/, $idata))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1403 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1404 |
WriteFile($intini, join("", @_), "", "q"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1405 |
RunSystemCmd("$gTool{interpretsis} -i \"$intini\"", 3, 1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1406 |
map { $_[$1 - 1] = undef if /Unsupported keyword.+?(\d+)/i } @gCmdoutbuf; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1407 |
WriteFile($intini, join("", grep(defined(), @_)), "", "q"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1408 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1409 |
my ($clean, @dir) = (0, Find($outdir, "*", "", 1, 1, $_)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1410 |
@_ = ("sis_config=$conf", ($ini ne "" ? grep(!/^\s*#/, ReadFile($ini, 0)) : ()), "sis_content="); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1411 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1412 |
for (my $i = 0; $i < @_; $i++) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1413 |
local $_ = $_[$i]; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1414 |
my ($error, $global, $runtool, %opt) = (0, 0, 0, %gopt); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1415 |
if (!($error = !(s/^\s*sis_(config)\s*[=\s]//i || s/^\s*sis_(content)\s*[=\s]/-s /i))) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1416 |
$global = ($1 =~ /config/i); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1417 |
my @opt = ParseCmdWords($_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1418 |
while (@opt) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1419 |
$_ = shift(@opt); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1420 |
shift(@opt) if ((my $next = (@opt ? ($opt[0] !~ /^!?[-+]/ ? $opt[0] : "") : "")) ne ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1421 |
next if /^!?-[cilwx]$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1422 |
if (s/^!//) { delete($opt{$_}) } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1423 |
else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1424 |
$_[$#_] .= "\"$next\"", next if (!$i && /^-s$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1425 |
($opt{$_} = $next) =~ s/EPOCROOT/$gEpocroot/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1426 |
$runtool = ($next !~ /^\s*$/) if /^-s$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1427 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1428 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1429 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1430 |
die("SisInstall: Invalid configuration entry: `$_[$i]'\n"), next if $error; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1431 |
%gopt = %opt if $global; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1432 |
next if !$runtool; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1433 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1434 |
foreach (-d($opt{-s}) ? Find($opt{-s}, '/\.sisx?$/i', "", 0, 0, $_) : (GetAbsFname($opt{-s}))) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1435 |
($opt{-s}, my $puid) = ($_, "?"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1436 |
OpenFile(*SISFILE, $_, 1, "") and sysread(SISFILE, $puid, 3 * 4) and |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1437 |
$puid = sprintf("%08X", unpack("V", substr($puid, 8, 4))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1438 |
close(SISFILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1439 |
DPrint(16, "SisInstall: `$_', pUID: $puid" . ($opt{'--ignore-err'} ? ", ignore errors\n" : "\n")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1440 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1441 |
my $icmd = $gTool{interpretsis} . (join("", map(($opt{$_} ne "" ? " $_ \"$opt{$_}\"" : " $_"), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1442 |
sort({lc($a) cmp lc($b)} grep(/^-[^s]/ && !/^--ignore-err$/, keys(%opt)))))) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1443 |
" -c \"" . (GetAbsDirname($outdir)) . "\" -i \"" . (GetAbsFname($intini)) . "\""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1444 |
$error = RunSystemCmd("$icmd -s \"$opt{-s}\"" . join("", map(" $_", |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1445 |
sort({lc($a) cmp lc($b)} grep(/^\+/, keys(%opt))))), 1, 1, ">>$log"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1446 |
my $errmsg = join(" | ", grep(s/^ERR\s*:\s*//, @gCmdoutbuf)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1447 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1448 |
$_ = join(", ", map(/^INFO:\s+Installing file:\s+\w:\\sys\\bin\\(.+?.exe)\s*$/io && |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1449 |
($_ = $1) && (qx($gTool{elf2e32} --dump=h --e32input "$outdir/sys/bin/$_") =~ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1450 |
/^Uids:\s+.+?\s+([0-9a-f]+)\s+\(/imo) ? "$_: " . uc($1) : (), @gCmdoutbuf)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1451 |
DPrint(16, "SisInstall: `" . GetBasename($opt{-s}) . "', exe UIDs: $_\n") |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1452 |
if ($_ && (!($error ||= $errmsg) || $opt{'--ignore-err'})); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1453 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1454 |
warn("Installation of SIS file `$opt{-s}' failed" . ($errmsg ? ": `$errmsg'.\n" : ".\n")) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1455 |
if ($gErrwarn = $error); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1456 |
next if (!$error || $opt{'--ignore-err'}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1457 |
$clean = 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1458 |
warn("Removing installation of SIS file `$opt{-s}'.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1459 |
RunSystemCmd("$icmd -x $puid", 3, 1, ">>$log"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1460 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1461 |
} |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1462 |
return if !$clean; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1463 |
my $i = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1464 |
foreach (Find($outdir, "*", "", 1, 1, $_)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1465 |
if (($i <= $#dir) && ($_ eq $dir[$i])) { $i++ } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1466 |
else { DeleteDir($_) } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1467 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1468 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1469 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1470 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1471 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1472 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1473 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1474 |
sub GetIPar(;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1475 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1476 |
my $par = shift(@gIcmd); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1477 |
$par = ((my $empty = !defined($par)) ? "<UNDEFINED>" : PEval($par)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1478 |
$gParamcnt = 0 if shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1479 |
DPrint(32, "iPar: $gParamcnt. `$par'\n") if $gParamcnt && ($gICmd =~ $gFiltercmd); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1480 |
$gParamcnt++; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1481 |
return($empty ? undef : $par); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1482 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1483 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1484 |
sub PEval($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1485 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1486 |
local $_ = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1487 |
while (/\@PEVAL{.*}LAVEP\@/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1488 |
my $start = rindex($_, '@PEVAL{', my $end = index($_, '}LAVEP@') + 7); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1489 |
my ($expr, $eval, $evalerr) = (substr($_, $start + 7, $end - $start - 14), undef, ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1490 |
eval { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1491 |
local $_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1492 |
local $gEvalerr = (SkipICmd() ? 1 : 2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1493 |
$eval = eval($expr); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1494 |
($evalerr = $@) =~ s/^(.+?) at .*/$1/s; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1495 |
}; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1496 |
# DPrint(64, "PEval: Evaluate `$expr' = `" . (defined($eval) ? $eval : "") . "'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1497 |
if (!defined($eval)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1498 |
$eval = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1499 |
warn("PEval: Evaluation of `$expr' failed: $evalerr.\n") if !SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1500 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1501 |
substr($_, $start, $end - $start) = $eval; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1502 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1503 |
return($_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1504 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1505 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1506 |
sub PeekICmd($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1507 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1508 |
return(defined($gIcmd[0]) && $gIcmd[0] =~ /^$_[0]$/i); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1509 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1510 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1511 |
sub SkipICmd() |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1512 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1513 |
return($gPrintcmd || defined($gICmd) && ($gICmd !~ $gFiltercmd)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1514 |
} |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1515 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1516 |
sub GetICmd() |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1517 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1518 |
$gICmd = GetIPar(1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1519 |
DPrint(32, "iCmd: " . ++$gCmdcnt . ". `$gICmd'\n") if defined($gICmd) && ($gICmd ne "") && ($gICmd =~ $gFiltercmd); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1520 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1521 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1522 |
sub EndICmd() |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1523 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1524 |
GetICmd(), return(1) if !defined($gIcmd[0]) || PeekICmd("end"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1525 |
return(0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1526 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1527 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1528 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1529 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1530 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1531 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1532 |
sub SplitStep($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1533 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1534 |
(my $step = shift()) =~ s/(?<!(\\|\s))\|/ \|/g; # ??? |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1535 |
return(map((s/^\s+|(?<!\\)\s+$//g, s/\\\|/\|/g) ? $_ : $_, split(/(?<!\\)\|/, "$step "))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1536 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1537 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1538 |
sub RunStep($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1539 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1540 |
($gStep, my $dur, @gStepDur) = (shift(), time(), ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1541 |
ChangeDir($gWorkdir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1542 |
DPrint(2, "=" x 79 . "\nENTER: `$gStep'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1543 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1544 |
push(@gReport, $gLogfile ? ("iMaker log", $gLogfile =~ /^>>?([^>].*)$/ ? $1 : $gLogfile, "f") : (), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1545 |
SplitStep($gStepIcmd{"REPORT_$gStep"})) if exists($gStepIcmd{"REPORT_$gStep"}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1546 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1547 |
foreach my $step ("INIT_$gStep", "CLEAN_$gStep", "BUILD_$gStep") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1548 |
next if (!exists($gStepIcmd{$step}) || $gStepIcmd{$step} =~ /^\s*$/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1549 |
DPrint(64, "$step = `$gStepIcmd{$step}'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1550 |
@gIcmd = SplitStep($gStepIcmd{$step}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1551 |
my ($file, $iferror, @iffi) = ("", 0, ()); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1552 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1553 |
while (GetICmd(), defined($gICmd)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1554 |
next if (local $_ = lc($gICmd)) eq ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1555 |
if (/^if$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1556 |
push(@iffi, (my $if = GetIPar()), $gFiltercmd); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1557 |
$gFiltercmd = qr/^X$/ if !$if; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1558 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1559 |
elsif (/^else$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1560 |
$gFiltercmd = ($iffi[$#iffi - 1] ? qr/^X$/ : $iffi[$#iffi]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1561 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1562 |
elsif (/^fi$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1563 |
$gFiltercmd = pop(@iffi); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1564 |
pop(@iffi); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1565 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1566 |
elsif (/^(error|warning)$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1567 |
my ($errwarn, $msg) = (GetIPar(), GetIPar() . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1568 |
next if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1569 |
die($msg) if $errwarn && /e/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1570 |
warn($msg) if $errwarn && /w/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1571 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1572 |
elsif (/^echo(\d+)?(-q)?$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1573 |
Echo((defined($1) && ($1 < 128) ? $1 : 1), GetIPar(), defined($2)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1574 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1575 |
elsif (/^filter$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1576 |
$gOutfilter = GetIPar(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1577 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1578 |
elsif (/^cmd(tee)?(-(k[0123]?|n)+)?$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1579 |
RunSystemCmd(GetIPar(), (/k(\d)/ ? int($1) : (/k/ ? 1 : 0)), /n/, /tee/ ? GetIPar() : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1580 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1581 |
elsif (/^parse(f)?(?:-(\d+))?$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1582 |
ParseSystemCmd(GetIPar(), GetIPar(), GetIPar(), $1, $2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1583 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1584 |
elsif (/^(cd|copy(dir|iby)?|del(dir)?|find(dir)?(-[afr]+)?|headb|logfile|mkcd|mkdir|move|tailb|test|touch|type[bu]?|unzip|workdir|write[bu]?(-[cq]+)?|zip(dir)?(-[jq]+)?)$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1585 |
my @files = GlobFiles(GetIPar()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1586 |
my $par1 = GetIPar() if /^(?:copy|find|head|move|tail|touch|(un)?zip|write)/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1587 |
my $par2 = GetIPar() if /^(?:find|head|tail|zip)/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1588 |
next if SkipICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1589 |
@gFindresult = () if /find(?:dir)?(-[afr]+)?/ && (!defined($1) || ($1 !~ /a/)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1590 |
Touch($par1, @files), next if /touch/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1591 |
foreach $file (@files) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1592 |
ChangeDir($file) if /^cd/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1593 |
DeleteDir($file) if /deldir/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1594 |
FindDir($file, $par1, $par2, $1) if /finddir(-[ar]+)?/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1595 |
MakeDir($file) if /mkdir/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1596 |
MakeChangeDir($file) if /mkcd/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1597 |
SetWorkdir($file) if /workdir/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1598 |
Zip($file, 1, $1, $par2, GlobFiles($par1)) if /zipdir(-[jq]+)?/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1599 |
DeleteFile($file) if /del/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1600 |
FindFile($file, $par1, $par2, $1) if /find(-[afr]+)?$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1601 |
HeadFile($file, $par1, $par2) if /headb/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1602 |
SetLogfile($file) if /logfile/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1603 |
TailFile($file, $par1, $par2) if /tailb/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1604 |
TypeFile($file, $1) if /type(b|u)?/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1605 |
UnzipFile($file, $par1) if /unzip/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1606 |
WriteFile($file, $par1, $1, $2) if /write(b|u)?(-[cq]+)?/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1607 |
Zip($file, 0, $1, $par2, GlobFiles($par1)) if /^zip(-[jq]+)?$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1608 |
Copy($file, $par1, $1) if /copy(dir)?$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1609 |
CopyIby($file, $par1) if /copyiby/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1610 |
Move($file, $par1) if /move/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1611 |
Test($file) if /test/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1612 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1613 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1614 |
elsif (/^filtercmd$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1615 |
$gFiltercmd = GetIPar(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1616 |
$gFiltercmd = ($gFiltercmd eq "" ? qr/\S/ : qr/$gFiltercmd/i); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1617 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1618 |
elsif (/^genexclst$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1619 |
GenExclfile(GetIPar(), GetIPar(), GetIPar(), GetIPar(), GetIPar()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1620 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1621 |
elsif (/^geniby(-[dr]+)?$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1622 |
my ($opt, $iby, $dir, @par) = ($1 || "", GetIPar(), GetIPar(), ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1623 |
push(@par, GetIPar(), GetIPar()) while !EndICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1624 |
GenObyfile($iby, $dir, $opt =~ /r/, $opt =~ /d/ ? 2 : 0, @par); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1625 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1626 |
elsif (/^genorideiby$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1627 |
GenIbyfile(GetIPar(), GetIPar(), GetIPar()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1628 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1629 |
elsif (/^genmk$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1630 |
GenMakefile(GetIPar(), GetIPar(), GetIPar(), GetIPar(), GetIPar()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1631 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1632 |
elsif (/^genwgzcfg$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1633 |
GenWidgetConf(GetIPar(), GetIPar(), GetIPar(), GetIPar()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1634 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1635 |
elsif (/^iferror$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1636 |
$iferror++; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1637 |
$gError = 0, next if $gError; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1638 |
while (defined($gIcmd[0])) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1639 |
GetICmd(), last if PeekICmd("endif") && !--$iferror; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1640 |
$iferror++ if shift(@gIcmd) =~ /^iferror$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1641 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1642 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1643 |
elsif (/^endif$/ && $iferror--) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1644 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1645 |
elsif (/^imghdr$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1646 |
AddImageHeader(GetIPar(), GetIPar(), GetIPar(), GetIPar(), GetIPar()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1647 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1648 |
elsif (/^pause$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1649 |
DPrint(0, "Press Enter to continue...\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1650 |
getc(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1651 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1652 |
elsif (/^sleep$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1653 |
Sleep(GetIPar()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1654 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1655 |
elsif (/^sosfind(-a)?$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1656 |
my $opt = $1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1657 |
FindSOSFiles(GetIPar(), GetIPar(), GetIPar(), $opt); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1658 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1659 |
elsif (/^tool-(\w+)$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1660 |
$gTool{$1} = GetIPar(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1661 |
# DPrint(2, "SetTool: $1: `$gTool{$1}'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1662 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1663 |
elsif (/^toolchk$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1664 |
my @tools = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1665 |
push(@tools, GetIPar(), GetIPar(), GetIPar()) while !EndICmd(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1666 |
CheckTool(@tools); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1667 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1668 |
elsif (/^opcache$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1669 |
OpCacheInstall(GetIPar(), GetIPar(), GetIPar()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1670 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1671 |
elsif (/^sisinst$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1672 |
SisInstall(GetIPar(), GetIPar(), GetIPar(), GetIPar(), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1673 |
GetIPar(), GetIPar(), GetIPar(), GetIPar()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1674 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1675 |
elsif (!$gImakerext || !RunIExtCmd($_)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1676 |
die("Unknown iMaker command `$gICmd'.\n"); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1677 |
} |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1678 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1679 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1680 |
DPrint(2, "EXIT: `$gStep', duration: " . Sec2Min($dur = time() - $dur) . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1681 |
push(@gStepDur, $dur); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1682 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1683 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1684 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1685 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1686 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1687 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1688 |
sub GetConfmkList(;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1689 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1690 |
if (!%gConfmkList) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1691 |
my ($dir, $incl, $excl, $depth) = split(/,/, $ENV{IMAKER_MKCONF}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1692 |
$dir = GetAbsDirname($dir, 0, 1, $gEpocdrive); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1693 |
($incl, $excl) = (qr/$incl/, qr/$excl/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1694 |
local $_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1695 |
DPrint(16, "FindFile: GetConfmkList: `$ENV{IMAKER_MKCONF}'"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1696 |
find(sub { $gConfmkList{$1} = $File::Find::name |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1697 |
if (/$incl/ && !/$excl/ && (($File::Find::name =~ tr/\///) > (($dir =~ tr/\///) + $depth))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1698 |
}, $dir); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1699 |
DPrint(16, ", found " . keys(%gConfmkList) . " files\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1700 |
$gConfmkList{""} = "" if !%gConfmkList; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1701 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1702 |
return(sort({lc($a) cmp lc($b)} grep($_ ne "", values(%gConfmkList)))) if shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1703 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1704 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1705 |
sub GetFeatvarIncdir($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1706 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1707 |
open(FILE, "$gEpocroot/epoc32/tools/variant/" . shift() . ".var") or |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1708 |
return("Invalid SBV feature variant"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1709 |
my @featdata = <FILE>; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1710 |
close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1711 |
my @incdir = ("@featdata" =~ /^\s*EXTENDS\s+(.+?)\s*$/m ? GetFeatvarIncdir($1) : ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1712 |
@incdir = () if ("@incdir" =~ /^Invalid/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1713 |
foreach (@featdata) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1714 |
next if !/^\s*ROM_INCLUDE\s+(\S+)\s+(.+?)\s*$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1715 |
if ($1 eq "set") { @incdir = ($2) } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1716 |
elsif ($1 eq "prepend") { unshift(@incdir, $2) } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1717 |
elsif ($1 eq "append") { push(@incdir, $2) } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1718 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1719 |
return(map("$_/" =~ /^$gEpocroot\// ? $_ : $gEpocroot . PathConv($_, 0, 1, $gEpocdrive), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1720 |
map(PathConv($_, 0, 0, $gEpocdrive), @incdir))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1721 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1722 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1723 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1724 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1725 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1726 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1727 |
sub SetVerbose($;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1728 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1729 |
my $verbose = Trim(shift()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1730 |
$verbose = 127 if $verbose =~ /^debug$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1731 |
$gVerbose = int($1), return if ($verbose =~ /^(\d+)$/) && ($1 < 128); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1732 |
$gVerbose = 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1733 |
warn("Verbose level `$verbose' is not integer between 0 - 127\n") if !shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1734 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1735 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1736 |
sub CloseLog() |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1737 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1738 |
close(LOG) if $gLogfile; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1739 |
$gLogfile = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1740 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1741 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1742 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1743 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1744 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1745 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1746 |
sub RunIMakerCmd($$$$$@) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1747 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1748 |
my ($makecmd, $cmdarg, $tgtext, $mklevel, $skipsteps, %prevtgt) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1749 |
$ENV{IMAKER_MKLEVEL} = $mklevel; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1750 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1751 |
($cmdarg, my $hptgt, my @targets) = HandleCmdArg($cmdarg); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1752 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1753 |
foreach my $tgt (@targets) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1754 |
my $skipstep = ($tgt =~ s/#$//) || $skipsteps; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1755 |
(my $target = "$tgt$tgtext") =~ s/(\[\d+\])(.+)$/$2$1/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1756 |
if ($target eq "menu") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1757 |
($cmdarg, $target) = Menu($cmdarg); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1758 |
next if ($target eq "menu"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1759 |
($cmdarg) = HandleCmdArg($cmdarg); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1760 |
} |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1761 |
$prevtgt{$target =~ /^([^-]+)/ ? $1 : $target} = 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1762 |
push(@gReport, Trim((($target !~ /^(.+)\[\d+\]$/) || ($gVerbose & 64) ? $target : $1) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1763 |
($skipstep ? "#" : "") . " $hptgt"), -1, -$mklevel - 1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1764 |
my $tgtind = $#gReport; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1765 |
my @targets = RunMakeCmd("$makecmd $cmdarg" . ($target eq "defaultgoals" ? "" : " \"$target\"") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1766 |
join("", map(" \"$_\"", split(/\s+/, $hptgt))), $skipstep); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1767 |
$gReport[$tgtind - 2] .= " (intermediate)" if @targets; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1768 |
$gReport[$tgtind - 1] = pop(@gStepDur); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1769 |
$gReport[$tgtind] = $mklevel + 1 if !$gError; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1770 |
delete(@gReport[$tgtind - 2 .. $tgtind]) if (@targets && !$gError && !($gVerbose & 64)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1771 |
map { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1772 |
RunIMakerCmd($makecmd, "$cmdarg $_ $hptgt", $target =~ /(-.*)$/ ? $1 : "", $mklevel + 1, $skipstep, %prevtgt) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1773 |
if !exists($prevtgt{$_}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1774 |
} @targets; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1775 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1776 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1777 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1778 |
sub RunMakeCmd($$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1779 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1780 |
($gStartmk, $gMakecmd, $gError) = (time(), Trim(shift()), 0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1781 |
my ($skipstep, $mkstart, $start, $restart, $cwd, %env) = (shift(), 0, 0, 0, Cwd::cwd(), %ENV); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1782 |
my @stepdur = my @targets = (); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1783 |
$ENV{IMAKER_MKRESTARTS} = -1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1784 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1785 |
do { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1786 |
InitMkglobals(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1787 |
($gTgterr, my $printvar, my @steps) = (1, "", ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1788 |
$ENV{IMAKER_MKRESTARTS}++; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1789 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1790 |
if ($gExportvar{""}) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1791 |
if (!$ENV{IMAKER_EXPORTMK}) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1792 |
(my $tmpfh, $ENV{IMAKER_EXPORTMK}) = File::Temp::tempfile( |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1793 |
File::Spec->tmpdir() . "/imaker_temp_XXXXXXXX", SUFFIX => ".mk", UNLINK => 1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1794 |
close($tmpfh); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1795 |
$ENV{IMAKER_EXPORTMK} =~ tr-\\-\/-; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1796 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1797 |
WriteFile($ENV{IMAKER_EXPORTMK}, "# Generated temporary makefile `$ENV{IMAKER_EXPORTMK}'\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1798 |
"ifndef __IMAKER_EXPORTMK__\n__IMAKER_EXPORTMK__ := 1\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1799 |
join("", map(/^([^:]+)(?:\:(.+))?$/ && !defined($2) ? "$1=$gExportvar{$_}\n" : |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1800 |
"ifeq (\$(filter $1,\$(TARGETNAME)),)\n$2=$gExportvar{$_}\nendif\n", |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1801 |
sort({($a =~ /([^:]+)$/ && uc($1)) cmp ($b =~ /([^:]+)$/ && uc($1))} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1802 |
grep(!/^(?:|.*[+:?])$/, keys(%gExportvar))))) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1803 |
"else\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1804 |
join("", map(/^\d{3}(.+[+:?])$/ ? "$1=$gExportvar{$_}\n" : (), sort({$a cmp $b} keys(%gExportvar)))) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1805 |
"endif # __IMAKER_EXPORTMK__\n", "", "q", 1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1806 |
$gExportvar{""} = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1807 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1808 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1809 |
open(MCMD, "$gMakecmd 2>&1 |"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1810 |
while (local $_ = <MCMD>) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1811 |
chomp(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1812 |
DPrint(1, "$_\n"), next if !s/^#iMaker\x1E//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1813 |
# DPrint(64, "#iMaker#$_\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1814 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1815 |
if (/^BEGIN$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1816 |
$mkstart = time(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1817 |
$start = $mkstart if !$start; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1818 |
next; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1819 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1820 |
if (/^STEPS=(.*)$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1821 |
my $steps = $1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1822 |
@steps = split(/\s+/, $steps), next if ($steps !~ s/^target://); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1823 |
@targets = grep($_ ne "", map(Trim($_), split(/(?<!\\)\|/, $steps))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1824 |
next; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1825 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1826 |
$gImgtype = $1, next if /^IMAGE_TYPE=(.*)$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1827 |
$gKeepgoing = $1, next if /^KEEPGOING=(.*)$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1828 |
$gPrintcmd = $1, next if /^PRINTCMD=(.*)$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1829 |
SetVerbose($1), next if /^VERBOSE=(.*)$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1830 |
$gStepIcmd{$1} = $2, next if /^((?:BUILD|CLEAN|INIT|REPORT)_\S+?)=(.*)$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1831 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1832 |
if (/^env (\S+?)=(.*)$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1833 |
DPrint(64, "$1 = `" . ($ENV{$1} = $2) . "'\n") |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1834 |
if (!defined($ENV{$1}) || ($ENV{$1} ne $2)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1835 |
next; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1836 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1837 |
if (/^var (\S+?)=(.*)$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1838 |
my ($var, $val) = ($1, $2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1839 |
my $upd = ($var !~ s/\?$//); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1840 |
$gExportvar{$var} = $val, $gExportvar{""}++ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1841 |
if (!exists($gExportvar{$var}) || ($upd && $gExportvar{$var} ne $val)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1842 |
next; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1843 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1844 |
if (/^print (\d+) (\S+?)=(.*)$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1845 |
$printvar = ("=" x 79) . sprintf("\n%-$1s = `$gMakecmd'\n", "Make command") if ($printvar eq ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1846 |
$printvar .= sprintf("%-$1s = `$3'\n", $2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1847 |
next; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1848 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1849 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1850 |
push(@stepdur, [$restart ? "ReMake" : "Make", Sec2Min(time() - $mkstart)]) if /^END$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1851 |
PrintEnv(2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1852 |
DPrint(2, $printvar); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1853 |
die("Unknown iMaker entry: `$_'\n"), next if !/^END$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1854 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1855 |
pop(@steps) if ($restart = (@steps && $steps[$#steps] eq "RESTART")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1856 |
my $durstr = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1857 |
foreach my $step (@steps) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1858 |
next if $skipstep; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1859 |
RunStep($step); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1860 |
my ($cmddur, $stepdur) = (0, pop(@gStepDur)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1861 |
$durstr = Sec2Min($stepdur); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1862 |
if (@gStepDur) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1863 |
$durstr .= " ("; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1864 |
foreach my $dur (@gStepDur) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1865 |
$cmddur += $dur; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1866 |
$durstr .= Sec2Min($dur) . " + "; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1867 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1868 |
$durstr .= Sec2Min($stepdur - $cmddur) . ")"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1869 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1870 |
push(@stepdur, [$step, $durstr]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1871 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1872 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1873 |
$printvar = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1874 |
my @env = ($ENV{IMAKER_EXPORTMK}, $ENV{IMAKER_MKRESTARTS}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1875 |
%ENV = %env; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1876 |
($ENV{IMAKER_EXPORTMK}, $ENV{IMAKER_MKRESTARTS}) = @env; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1877 |
InitMkglobals(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1878 |
ChangeDir($cwd); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1879 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1880 |
last if $restart; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1881 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1882 |
my ($maxilen, $maxslen, $maxdlen) = (length(@stepdur . ""), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1883 |
Max(map(length(@$_[0]), @stepdur)), Max(8, map(length(@$_[1]), @stepdur))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1884 |
DPrint(2, "=" x 79 . "\nStep" . " " x ($maxilen + $maxslen - 1) . "Duration\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1885 |
"=" x ($maxilen + $maxslen + 2) . " " . "=" x $maxdlen . "\n", |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1886 |
map(sprintf("%${maxilen}s. %-${maxslen}s", $_ + 1, $stepdur[$_][0]) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1887 |
" $stepdur[$_][1]\n", 0 .. $#stepdur), |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1888 |
"-" x ($maxilen + $maxslen + 2) . " " . "-" x $maxdlen . "\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1889 |
"Total" . " " x ($maxilen + $maxslen - 2) . Sec2Min(time() - $start) . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1890 |
($start, @stepdur) = (time(), ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1891 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1892 |
close(MCMD); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1893 |
die("\n") if ($? >> 8); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1894 |
die("Command `$gMakecmd' failed in `" . GetAbsDirname(".") . "'.\n") if ($gTgterr = $gError); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1895 |
CloseLog(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1896 |
} until !$restart; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1897 |
push(@gStepDur, time() - $gStartmk); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1898 |
return(@targets); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1899 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1900 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1901 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1902 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1903 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1904 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1905 |
sub HandleCmdArg($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1906 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1907 |
my $cmdarg = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1908 |
my $origarg = $cmdarg = (defined($cmdarg) ? $cmdarg : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1909 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1910 |
my @cmdout = qx($ENV{PERL} -x $0 --splitarg $cmdarg); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1911 |
die("Can't parse Make arguments: `$cmdarg'.\n") if $?; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1912 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1913 |
map { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1914 |
chomp(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1915 |
s/ /\x1E/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1916 |
s/\"/\\\"/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1917 |
s/(\\+)$/$1$1/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1918 |
} @cmdout; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1919 |
$cmdarg = " " . join(" ", @cmdout) . " "; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1920 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1921 |
if ($cmdarg =~ /^.* VERBOSE\x1E*=(\S*) /) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1922 |
(my $verbose = $1) =~ s/\x1E/ /g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1923 |
SetVerbose($verbose, 1); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1924 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1925 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1926 |
if ($cmdarg =~ /\s+--?conf=(\S*)\s+/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1927 |
(my $prj = $1) =~ /(.*?)(?:;(.*))?$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1928 |
($prj, my $conf) = ($1, defined($2) ? $2 : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1929 |
$cmdarg =~ s/\s+--?conf=\S*\s+/ USE_CONE=mk CONE_PRJ=$prj CONE_CONF=$conf cone-pre defaultgoals /; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1930 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1931 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1932 |
$cmdarg = " " . HandleExtCmdArg($cmdarg) . " " if $gImakerext; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1933 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1934 |
$gMakecmd = "$ENV{IMAKER_MAKE} -f $0" . join("", map(" \"$_\"", split(/\s+/, Trim($cmdarg)))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1935 |
warn("Can't parse Make targets.\n") |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1936 |
if (!(my $targets = (qx($gMakecmd 2>&1) =~ /\|MAKECMDGOALS=(.*?)\|/ ? " $1 " : "")) && |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1937 |
($cmdarg !~ /\s-(?:-?v(?:ersion?|ersi?|er?)?|versio\S+)\s/)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1938 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1939 |
GetConfmkList() if |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1940 |
grep(!/^(help(-.+)?|print-.+)$/ || /^help-config$/, my @targets = split(/\s+/, Trim($targets))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1941 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1942 |
my ($mkfile, $mkfiles, $hptgt) = ("", "", ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1943 |
map { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1944 |
$cmdarg =~ s/\s+\Q$_\E\s+/ /; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1945 |
if (exists($gConfmkList{$_})) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1946 |
($mkfile = $gConfmkList{$_}) =~ s/ /\x1E/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1947 |
$mkfiles .= " -f $mkfile"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1948 |
$targets =~ s/\s+\Q$_\E\s+/ /; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1949 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1950 |
} @targets; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1951 |
$cmdarg = "$mkfiles$cmdarg"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1952 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1953 |
map { $targets =~ s/\s\Q$_\E\s/ /; $hptgt .= " $_" } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1954 |
grep(/^help-.+$/ && !/^help-config$/, @targets); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1955 |
map { $targets =~ s/\s\Q$_\E\s/ /; $hptgt .= " $_" } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1956 |
grep(/^print-.+$/, @targets); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1957 |
$hptgt = Trim($hptgt); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1958 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1959 |
if ($targets =~ s/ default(?= )//g) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1960 |
($targets = Trim($targets)) =~ s/ /\x1E/g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1961 |
$cmdarg .= "TARGET_DEFAULT=$targets" if ($targets ne ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1962 |
$targets = "default"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1963 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1964 |
@targets = ("defaultgoals@targets") if |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1965 |
!(@targets = map(s/\x1E/ /g ? $_ : $_, split(/\s+/, Trim($targets)))) || ("@targets" eq "#"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1966 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1967 |
$mkfiles = ""; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1968 |
while ($cmdarg =~ s/\s+(-f\s?|--(?:file?|fi?|makefile?|makefi?|make?)[=\s]|IMAKER_CONFMK\x1E*=)(\S+)\s+/ /) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1969 |
$mkfile = $2; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1970 |
($mkfile = GetAbsFname(scalar($mkfile =~ s/\x1E/ /g, $mkfile))) =~ s/ /\\\x1E/g |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1971 |
if ($1 !~ /^IMAKER_CONFMK/); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1972 |
$mkfiles .= ($mkfiles eq "" ? "" : chr(0x1E)) . $mkfile; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1973 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1974 |
while ($cmdarg =~ s/\s+(\S+?)\x1E*([+:?])=\x1E*(\S+?)\s+/ /) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1975 |
($gExportvar{sprintf("%03s", ++$gExportvar{""}) . "$1$2"} = $3) =~ s/\x1E/ /g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1976 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1977 |
$cmdarg = join(" ", map(scalar(s/\x1E/ /g, "\"$_\""), split(/\s+/, Trim($cmdarg . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1978 |
($mkfiles eq "" && ($ENV{IMAKER_MKLEVEL} || grep(/^default$/, @targets)) ? "" : " IMAKER_CONFMK=$mkfiles"))))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1979 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1980 |
DPrint(2, "HandleCmdArg: `$origarg' => `$cmdarg', `" . join(" ", @targets) . "', `$hptgt'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1981 |
return($cmdarg, $hptgt, @targets); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1982 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1983 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1984 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1985 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1986 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1987 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1988 |
sub MenuRuncmd($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1989 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1990 |
$ENV{IMAKER_CMDARG} = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1991 |
return(map(chomp() ? $_ : $_, qx($ENV{PERL} -x $0 2>&1))); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1992 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1993 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1994 |
sub Menu($) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1995 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1996 |
(my $cmdarg = " " . shift() . " ") =~ s/\s+"IMAKER_CONFMK="\s+/ /; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1997 |
my ($prodind, $product, @product) = (0, "", ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1998 |
my ($tgtind, $target, $tgtcols, $tgtrows, @target) = (0, "", 4, 0, ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
1999 |
my ($vartype, $varudeb, $varsym); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2000 |
my $cfgfile = "./imaker_menu.cfg"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2001 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2002 |
$cmdarg = ($cmdarg =~ /^\s*$/ ? "" : " " . Trim($cmdarg)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2003 |
open(FILE, "<$cfgfile") and |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2004 |
(($prodind, $tgtind, $vartype, $varudeb, $varsym) = map(chomp() ? $_ : $_, <FILE>)) and close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2005 |
($prodind, $tgtind, $vartype, $varudeb, $varsym) = |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2006 |
($prodind || 0, $tgtind || 0, $vartype || "rnd", $varudeb || 0, $varsym || 0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2007 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2008 |
while (1) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2009 |
print("\nPRODUCTS\n--------\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2010 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2011 |
if (!@product) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2012 |
@product = sort({lc($a) cmp lc($b)} grep($_ ne "", keys(%gConfmkList))); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2013 |
$prodind = 0 if ($prodind > @product); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2014 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2015 |
$product = ($prodind ? " $product[$prodind - 1]" : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2016 |
my $maxlen = Max(map(length($_), @product)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2017 |
map { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2018 |
printf(" %" . (length(@product)) . "s) %-${maxlen}s %s\n", $_ + 1, $product[$_], $gConfmkList{$product[$_]}); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2019 |
} (0 .. $#product); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2020 |
print(" NO PRODUCTS FOUND!\n") if !@product; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2021 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2022 |
print("\nTARGETS\n-------\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2023 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2024 |
if (!@target) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2025 |
@target = grep(s/^== (.+) ==$/$1/, MenuRuncmd("$product PRINTCMD=0 VERBOSE=1 help-target-*-wiki")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2026 |
$tgtind = 0 if ($tgtind > @target); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2027 |
$tgtrows = int($#target / $tgtcols + 1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2028 |
my $maxind = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2029 |
map { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2030 |
if (!($_ % $tgtrows)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2031 |
$maxind = length(Min($_ + $tgtrows, $#target + 1)) + 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2032 |
$maxlen = Max(map(length(), @target[$_ .. Min($_ + $tgtrows - 1, $#target)])); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2033 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2034 |
$target[$_] = sprintf("%${maxind}s) %-${maxlen}s", "t" . ($_ + 1), $target[$_]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2035 |
} (0 .. $#target); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2036 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2037 |
($target = ($tgtind ? $target[$tgtind - 1] : "")) =~ s/^.+?(\S+)\s*$/$1/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2038 |
foreach my $row (1 .. $tgtrows) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2039 |
foreach my $col (1 .. $tgtcols) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2040 |
my $ind = ($col - 1) * $tgtrows + $row - 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2041 |
print(($ind < @target ? " $target[$ind]" : "") . ($col != $tgtcols ? " " : "\n")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2042 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2043 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2044 |
print(" NO TARGETS FOUND!\n") if !@target; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2045 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2046 |
print("\nCONFIGURATION\n-------------\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2047 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2048 |
print( |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2049 |
" Product: " . ($prodind ? $product[$prodind - 1] : "NOT SELECTED!") . "\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2050 |
" Target : " . ($tgtind ? $target : "NOT SELECTED!") . "\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2051 |
" Type : " . ucfirst($vartype) . "\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2052 |
" Debug : " . ($varudeb ? ($varudeb =~ /full/i ? "Full debug" : "Enabled") : "Disabled") . "\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2053 |
" Symbols: " . ($varsym ? "Created\n" : "Not created\n")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2054 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2055 |
print("\nOPTIONS\n-------\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2056 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2057 |
print( |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2058 |
" t) Toggle type between rnd/prd/subcon\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2059 |
" u) Toggle debug between urel/udeb/udeb full\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2060 |
" s) Toggle symbol creation on/off\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2061 |
" r) Reset configuration\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2062 |
" h) Print usage information\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2063 |
" x) Exit\n\n" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2064 |
"Hit Enter to run: imaker$product$cmdarg TYPE=$vartype USE_UDEB=$varudeb USE_SYMGEN=$varsym $target\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2065 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2066 |
print("\nSelection: "); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2067 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2068 |
my $input = <STDIN>; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2069 |
($input = (defined($input) ? $input : "?")) =~ s/^\s*(.*?)\s*$/\L$1\E/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2070 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2071 |
if ($input =~ /^(\d+)$/ && ($1 > 0) && ($1 <= @product) && ($1 != $prodind)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2072 |
$prodind = $1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2073 |
($tgtind, @target) = (0, ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2074 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2075 |
elsif ($input =~ /^t(\d+)$/ && ($1 > 0) && ($1 <= @target) && ($1 != $tgtind)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2076 |
$tgtind = $1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2077 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2078 |
elsif ($input eq "t") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2079 |
$vartype = ($vartype =~ /rnd/i ? "prd" : ($vartype =~ /prd/i ? "subcon" : "rnd")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2080 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2081 |
elsif ($input eq "u") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2082 |
$varudeb = (!$varudeb ? 1 : ($varudeb !~ /full/i ? "full" : 0)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2083 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2084 |
elsif ($input eq "s") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2085 |
$varsym = ($varsym ? 0 : 1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2086 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2087 |
elsif ($input eq "r") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2088 |
($prodind, @product) = (0, ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2089 |
($tgtind, @target) = (0, ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2090 |
($vartype, $varudeb, $varsym) = ("rnd", 0, 0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2091 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2092 |
elsif ($input eq "h") { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2093 |
print("\nTODO: Help"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2094 |
sleep(2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2095 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2096 |
elsif ($input =~ /^(x|)$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2097 |
open(FILE, ">$cfgfile") and |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2098 |
print(FILE map("$_\n", ($prodind, $tgtind, $vartype, $varudeb, $varsym))) and close(FILE); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2099 |
return(("", "menu")) if ($input eq "x"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2100 |
$cmdarg = "$product$cmdarg TYPE=$vartype USE_UDEB=$varudeb USE_SYMGEN=$varsym"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2101 |
$ENV{IMAKER_CMDARG} = Trim("$cmdarg $target"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2102 |
return(($cmdarg, $target eq "" ? "defaultgoals" : $target)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2103 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2104 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2105 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2106 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2107 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2108 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2109 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2110 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2111 |
sub Install($$$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2112 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2113 |
my ($clean, $bldinf, $destdir) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2114 |
my $srcdir = GetDirname($bldinf = GetAbsFname($bldinf)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2115 |
$destdir = GetAbsDirname($destdir) if $destdir; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2116 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2117 |
print(($clean ? "\nCleaning" : "\nInstalling") . " `$bldinf'" . ($destdir ? " to `$destdir'\n" : "\n")); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2118 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2119 |
my $export = 0; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2120 |
foreach (grep(!/^\s*\/\//, ReadFile($bldinf, 0))) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2121 |
$export = 1, next if /^\s*PRJ_EXPORTS\s*$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2122 |
next if !$export; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2123 |
Install($clean, "$srcdir$1", $destdir), next if /^\s*#include\s+"(.+)"\s*$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2124 |
die("Unknown line `$_'.\n") if !/^\s*(\S+)\s+(.+?)\s*$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2125 |
my ($src, $dest) = ("$srcdir$1", $2); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2126 |
$dest = "$gEpocroot/epoc32$dest" if ($dest =~ s/^\+//); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2127 |
$dest .= GetBasename($src) if ($dest =~ s/\s+\/\/$//); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2128 |
($src, $dest) = (GetAbsFname($src), GetAbsFname($dest)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2129 |
next if ($destdir && ($dest !~ /^$gEpocroot\/epoc32\/tools\//i)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2130 |
$dest = "$destdir/" . GetBasename($dest) if $destdir; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2131 |
print(($clean ? "Delete" : "Copy `$src' =>") . " `$dest'\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2132 |
unlink($dest); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2133 |
die("Deletion failed.\n") if ($clean && -e($dest)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2134 |
next if $clean; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2135 |
File::Path::mkpath(GetDirname($dest)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2136 |
File::Copy::copy($src, $dest) or die("Copying failed.\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2137 |
chmod(0777, $dest); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2138 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2139 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2140 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2141 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2142 |
############################################################################### |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2143 |
# |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2144 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2145 |
END { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2146 |
if (!$gArgv) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2147 |
(my $keepgoing, $gStartmk) = ($gKeepgoing, time() - $gStartmk); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2148 |
$gKeepgoing = 1; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2149 |
SetLogfile($gLogfiles{__prev__}) if %gLogfiles; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2150 |
PrintEnv(0) if $gError; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2151 |
die("Command `$gMakecmd' failed in `" . GetAbsDirname(".") . "'.\n") |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2152 |
if ($gTgterr && !$keepgoing); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2153 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2154 |
map { UnsubstDrive($_) } sort({$a cmp $b} keys(%gSubstdrv)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2155 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2156 |
@gIcmd = @gReport; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2157 |
(my $report, @gReport) = (2, ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2158 |
my ($maxtlen, $maxvlen, %uniq) = (0, 0, ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2159 |
while (@gIcmd) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2160 |
my ($tgtvar, $durval, $type) = (GetIPar(1), GetIPar(1), GetIPar(1)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2161 |
if ($type =~ /^-?\d+$/) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2162 |
push(@gReport, [$tgtvar, $durval, $type]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2163 |
($maxtlen, %uniq) = (Max($maxtlen, length($tgtvar)), ()); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2164 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2165 |
$report = 1, push(@gReport, [$tgtvar, $durval, $type]) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2166 |
if ($tgtvar ne "") && !($uniq{"$tgtvar|$durval"}++); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2167 |
$maxvlen = Max($maxvlen, length($tgtvar)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2168 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2169 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2170 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2171 |
my ($tgtcnt, $warn) = (0, 0); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2172 |
DPrint($report, "=" x 79 . "\n" . join("\n", map(@$_[2] =~ /^-?\d+$/ ? |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2173 |
($tgtcnt++ ? "-" x 79 . "\n" : "") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2174 |
"Target: " . sprintf("%-${maxtlen}s", @$_[0]) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2175 |
" Duration: " . Sec2Min(@$_[1] < 0 ? $gStartmk : @$_[1]) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2176 |
" Status: " . (@$_[2] < 0 ? ($warn = "FAILED") : "OK") |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2177 |
: sprintf("%-${maxvlen}s", @$_[0]) . " = `@$_[1]'" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2178 |
((@$_[2] =~ /^[fd]$/i) && !-e(@$_[1]) ? " - DOESN'T EXIST" : ""), @gReport)) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2179 |
(@gReport ? "\n" . "-" x 79 . "\n" : "") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2180 |
"Total duration: " . Sec2Min(time() - $gStarttime) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2181 |
" Status: " . ($gError && !$keepgoing ? "FAILED" : "OK" . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2182 |
($warn ? " (with keep-going)" : "")) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2183 |
"\n" . "=" x 79 . "\n"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2184 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2185 |
warn("\$_ has been changed in an uncontrolled manner!\n") |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2186 |
if !/^default input and pattern-searching space$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2187 |
CloseLog(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2188 |
exit(1) if ($gError && !$keepgoing); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2189 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2190 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2191 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
2192 |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
2193 |
__END__ # OF IMAKER.PL |