line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OS2::SoftInstaller; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
567
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION @ISA @EXPORT); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
106
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
9
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
10
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
11
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
12
|
|
|
|
|
|
|
@EXPORT = qw( |
13
|
|
|
|
|
|
|
make_pkg |
14
|
|
|
|
|
|
|
size_date_time_pkg |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
$VERSION = '0.09'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Preloaded methods go here. |
20
|
1
|
|
|
1
|
|
10
|
use Config '%Config'; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
40
|
|
21
|
1
|
|
|
1
|
|
4
|
use File::Find 'find'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
93
|
|
22
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
762
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub size_date_time_pkg { |
25
|
0
|
|
|
0
|
1
|
|
my $file = shift; |
26
|
0
|
|
|
|
|
|
my $time = $^T - 24 * 60 * 60 * (-M $file) ; |
27
|
0
|
|
|
|
|
|
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $time; |
28
|
0
|
|
|
|
|
|
my $yy = sprintf('%02d', $year%100); |
29
|
0
|
|
|
|
|
|
my $mm = sprintf('%02d', $mon + 1); |
30
|
0
|
|
|
|
|
|
my $dd = sprintf('%02d', $mday); |
31
|
0
|
|
|
|
|
|
my $hh = sprintf('%02d', $hour); |
32
|
0
|
|
|
|
|
|
my $mn = sprintf('%02d', $min); |
33
|
0
|
|
|
|
|
|
my $ss = sprintf('%02d', $sec); |
34
|
0
|
|
|
|
|
|
return (-s _, "$yy$mm$dd", "$hh$mn"); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub make_pkg { |
38
|
0
|
|
|
0
|
1
|
|
my %args = @_; |
39
|
0
|
|
|
|
|
|
my ($toplevel, $zipfile, $packid, $nozip, $exclude, $dirid, $strip) = |
40
|
|
|
|
|
|
|
@args{qw(toplevel zipfile packid nozip exclude dirid strip)}; |
41
|
0
|
|
0
|
|
|
|
$strip ||= ''; |
42
|
0
|
|
|
|
|
|
$toplevel =~ s,\\,/,g ; |
43
|
0
|
|
|
|
|
|
$toplevel =~ s,/$,, ; |
44
|
0
|
|
|
|
|
|
my $toplevelq = "\Q$toplevel/$strip"; |
45
|
0
|
|
|
|
|
|
my (%seen, %out, %duplicates, %seen_duplicates, $file); |
46
|
0
|
0
|
|
|
|
|
unless (defined $packid) { |
47
|
0
|
|
|
|
|
|
($packid) = ($zipfile =~ /([\w.]+)\./); |
48
|
0
|
|
|
|
|
|
$packid =~ s/\./_/g; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# SOURCE ID PACKID keywords do not take variable substitution: |
52
|
|
|
|
|
|
|
# print <
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#FILE |
55
|
|
|
|
|
|
|
# EXIT = 'setvar $packtoken=$packtoken' |
56
|
|
|
|
|
|
|
#EOPT |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# my $zipid = ($packtoken || "my") . "_zip"; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# print <#
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#FILE |
63
|
|
|
|
|
|
|
# EXIT = 'setvar $zipid=$zipfile' |
64
|
|
|
|
|
|
|
#EOPT |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# $zipfile = "%$zipid%"; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $wanted = sub { |
69
|
0
|
0
|
|
0
|
|
|
-f or return; |
70
|
0
|
|
|
|
|
|
my ($size, $date, $time) = size_date_time_pkg($_); |
71
|
0
|
|
|
|
|
|
my $relname = $File::Find::name; |
72
|
0
|
0
|
|
|
|
|
$relname =~ s/^$toplevelq// |
73
|
|
|
|
|
|
|
or die "Cannot find `^$toplevelq' in `$relname'"; # Top directory does not match, but is skipped by -f |
74
|
0
|
|
|
|
|
|
my ($shortname) = ($relname =~ m,([^/]+)$, ); |
75
|
0
|
|
|
|
|
|
$seen{ lc $shortname }++; |
76
|
0
|
0
|
|
|
|
|
$out{$relname} = ($relname =~ /\.(exe|dll)$/i) ? <
|
77
|
|
|
|
|
|
|
REPLACEINUSE = 'D I R U', |
78
|
|
|
|
|
|
|
EOI |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
$out{$relname} .= <
|
81
|
|
|
|
|
|
|
DATE = $date, |
82
|
|
|
|
|
|
|
TIME = $time, |
83
|
|
|
|
|
|
|
SIZE = $size, |
84
|
|
|
|
|
|
|
PWSPATH = '$dirid' |
85
|
|
|
|
|
|
|
EOO |
86
|
0
|
|
|
|
|
|
}; |
87
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
print <
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
PACKFILE |
91
|
|
|
|
|
|
|
ID = '$packid', |
92
|
|
|
|
|
|
|
SOURCE = 'DRIVE: $zipfile', |
93
|
|
|
|
|
|
|
* -j circumvents a limitation of SI |
94
|
|
|
|
|
|
|
UNPACK = '%UNZIP% %EPFICURUPS% %UNZIP_D% %EPFICURUPDIR%' |
95
|
|
|
|
|
|
|
EOP |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
find($wanted, $toplevel); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Dups: |
100
|
0
|
|
|
|
|
|
for $file (keys %out) { |
101
|
0
|
|
|
|
|
|
my ($shortname) = ($file =~ m,([^/]+)$, ); |
102
|
0
|
0
|
|
|
|
|
if ($seen{ lc $shortname } > 1) { |
103
|
0
|
|
|
|
|
|
$duplicates{$file}++; |
104
|
0
|
|
|
|
|
|
next Dups; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Bulk: |
109
|
0
|
|
|
|
|
|
for $file (sort keys %out) { |
110
|
0
|
0
|
0
|
|
|
|
next Bulk if defined $exclude and $file =~ /$exclude/; |
111
|
0
|
0
|
|
|
|
|
$seen_duplicates{$file}++, next Bulk if $duplicates{$file}; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Good for bulk replacement |
114
|
0
|
|
|
|
|
|
print <
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
FILE |
117
|
|
|
|
|
|
|
PWS = '$file', |
118
|
|
|
|
|
|
|
PACKID = '$packid', |
119
|
|
|
|
|
|
|
$out{$file} |
120
|
|
|
|
|
|
|
EOP |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
0
|
0
|
|
|
|
|
print <
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
* The following files need a special treatment since their names |
127
|
|
|
|
|
|
|
* would conflict with -j extraction from .zip. |
128
|
|
|
|
|
|
|
EOP |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
One_by_one: |
131
|
0
|
|
|
|
|
|
for $file (sort keys %seen_duplicates) { |
132
|
|
|
|
|
|
|
# Now do it one-by-one |
133
|
0
|
|
|
|
|
|
print <
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
FILE |
136
|
|
|
|
|
|
|
PWS = '$file', |
137
|
|
|
|
|
|
|
SOURCE = 'DRIVE: $zipfile', |
138
|
|
|
|
|
|
|
UNPACK = '%UNZIP% %EPFICURUPS% %UNZIP_D% %EPFICURUPDIR% $strip$file', |
139
|
|
|
|
|
|
|
$out{$file} |
140
|
|
|
|
|
|
|
EOP |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
1; |
148
|
|
|
|
|
|
|
__END__ |