diff options
author | Simon Lipp <simon.lipp@scilab.org> | 2008-06-26 14:47:42 +0000 |
---|---|---|
committer | Simon Lipp <simon.lipp@scilab.org> | 2008-06-26 14:47:42 +0000 |
commit | 53148a8fc3e3c41ee8c901becedc12a2b539604e (patch) | |
tree | 15c7b47ddf4dd9d33079266409b0dd28b5d2ff88 /atoms_cc/buildtoolbox.pl | |
parent | 73c2de4596eb5270a84ef4f9aad5d38e84dc6acd (diff) | |
download | scilab-53148a8fc3e3c41ee8c901becedc12a2b539604e.zip scilab-53148a8fc3e3c41ee8c901becedc12a2b539604e.tar.gz |
atoms_cc/buildtoolbox.pl: cosmetics + get it working on windows (if it looks like hacks, sounds like hacks and smells like hacks, then it's hacks...)
Diffstat (limited to 'atoms_cc/buildtoolbox.pl')
-rwxr-xr-x | atoms_cc/buildtoolbox.pl | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/atoms_cc/buildtoolbox.pl b/atoms_cc/buildtoolbox.pl index fa5d36d..c2453dd 100755 --- a/atoms_cc/buildtoolbox.pl +++ b/atoms_cc/buildtoolbox.pl | |||
@@ -8,7 +8,7 @@ use Cwd; | |||
8 | 8 | ||
9 | my ($TOOLBOXFILE, # Toolbox archive to compile | 9 | my ($TOOLBOXFILE, # Toolbox archive to compile |
10 | $TOOLBOXNAME, # Name of the toolbox | 10 | $TOOLBOXNAME, # Name of the toolbox |
11 | $STAGE); # Current stage | 11 | $STAGE); # Current stage |
12 | 12 | ||
13 | # common_log: | 13 | # common_log: |
14 | # Print a log message. Seconf argument is the type of the | 14 | # Print a log message. Seconf argument is the type of the |
@@ -104,7 +104,7 @@ sub is_zip { | |||
104 | sub get_tree_from_tgz { | 104 | sub get_tree_from_tgz { |
105 | my %files; | 105 | my %files; |
106 | 106 | ||
107 | my $fd = common_exec("tar -tzf ${TOOLBOXFILE}"); | 107 | my $fd = common_exec("zcat ${TOOLBOXFILE} | tar -t"); |
108 | 108 | ||
109 | while(<$fd>) { | 109 | while(<$fd>) { |
110 | chomp; | 110 | chomp; |
@@ -121,13 +121,15 @@ sub get_tree_from_zip { | |||
121 | my (%files, $line); | 121 | my (%files, $line); |
122 | 122 | ||
123 | # tail & head are here to skip header & footer | 123 | # tail & head are here to skip header & footer |
124 | my $fd = common_exec("unzip -l ${TOOLBOXFILE} | tail -n +4 | head -n -2"); | 124 | my $fd = common_exec("unzip -l ${TOOLBOXFILE}"); |
125 | 125 | ||
126 | while(<$fd>) { | 126 | while(<$fd>) { |
127 | # zip output format: size date time filename | 127 | if(((/^\s*-+/)...(/^\s*-+/)) && !/^\s*-+/) { # Delete header & footer |
128 | /\s*\d+\s+\d+-\d+-\d+\s+\d+:\d+\s+(.+)/ or common_die "Bad output of unzip"; | 128 | # zip output format: size date time filename |
129 | chomp $1; | 129 | /\s*\d+\s+\d+-\d+-\d+\s+\d+:\d+\s+(.+)/ or common_die "Bad output of unzip"; |
130 | $files{$1} = 1; | 130 | chomp $1; |
131 | $files{$1} = 1; | ||
132 | } | ||
131 | } | 133 | } |
132 | 134 | ||
133 | close $fd; | 135 | close $fd; |
@@ -150,14 +152,14 @@ sub get_tree { | |||
150 | # Extract given file from the .zip archive | 152 | # Extract given file from the .zip archive |
151 | sub read_file_from_tgz { | 153 | sub read_file_from_tgz { |
152 | my $filename = shift; | 154 | my $filename = shift; |
153 | return common_exec("tar -xOzf ${TOOLBOXFILE} ${TOOLBOXNAME}/$filename"); | 155 | return common_exec("zcat ${TOOLBOXFILE} | tar -xO ${TOOLBOXNAME}/$filename"); |
154 | } | 156 | } |
155 | 157 | ||
156 | # read_file_from_tgz: | 158 | # read_file_from_tgz: |
157 | # Extract given file from the .tar.gz archive | 159 | # Extract given file from the .tar.gz archive |
158 | sub read_file_from_zip { | 160 | sub read_file_from_zip { |
159 | my $filename = shift; | 161 | my $filename = shift; |
160 | return common_exec("unzip -c ${TOOLBOXFILE} ${TOOLBOXNAME}/$filename | tail -n +3 | head -n -1"); | 162 | return common_exec("unzip -p ${TOOLBOXFILE} ${TOOLBOXNAME}/$filename"); |
161 | } | 163 | } |
162 | 164 | ||
163 | # read_file_from_archive: | 165 | # read_file_from_archive: |