-
Notifications
You must be signed in to change notification settings - Fork 90
/
latest.pm
285 lines (259 loc) · 8.69 KB
/
latest.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#use strict;
package latest;
# only used when run in the site
our $wwwdir="/var/www/html/download";
# when used in cronjob
our $dldir="../download";
our $curl="curl";
# they are all hashed on 'type'
our %high;
our %file;
our %size;
our %version;
our %desc;
our $headver;
my $headnum;
sub storemax {
my ($filename, $version, $size, $which, $desc)=@_;
my $num=0;
if($version =~ /^(\d+)\.(\d+)\.(\d+)$/) {
$num = $1*10000+$2*100+$3;
}
elsif($version =~ /^(\d+)\.(\d+)$/) {
$num = $1*10000+$2*100;
}
else {
print "Illegal version string: $version\n";
return;
}
if($num > $high{$which}) {
$high{$which}=$num;
$file{$which}=$filename;
$size{$which}=$size;
$version{$which}=$version;
$desc{$which}=$desc;
}
if($num > $headnum) {
$headnum=$num;
$headver=$version;
}
}
# return Version, Short-Type, Description
sub gettype {
my ($file)=@_;
# curl-7.5.1-win32-nossl.zip
if($file =~ /^curl-([0-9.]*)(-([0-9]*)|)-win32-nossl.zip$/) {
return($1,
"win32-nossl",
"Windows, zip");
}
# curl-7.5.1-win64-nossl.zip
elsif($file =~ /^curl-([0-9.]*)(-([0-9]*)|)-win64-nossl.zip$/) {
return($1,
"win64-nossl",
"Windows 64bit, zip");
}
# curl-7.5.1-win64-ssl-sspi.zip
elsif($file =~ /^curl-([0-9.]*)-win64-ssl-sspi.zip$/) {
return($1,
"win64-ssl-sspi",
"Windows 64bit, zip, SSL-enabled, SSPI-enabled");
}
elsif($file =~ /^curl-([0-9.]*)(-([0-9]*)|)-win32-nossl-sspi.zip$/) {
return($1,
"win32-nossl-sspi",
"Windows, zip. SSPI-enabled");
}
elsif($file =~ /^curl-([0-9.]*)(-([0-9]*)|)-win32-ssl.zip$/) {
return($1, "win32-ssl",
"Windows, zip, SSL-enabled");
}
elsif($file =~ /^curl-([0-9.]*)(-([0-9]*)|)-win32-ssl-sspi.zip$/) {
return($1, "win32-ssl-sspi",
"Windows, zip, SSL-enabled, SSPI-enabled");
}
elsif($file =~ /^curl-([0-9.]*)(-([0-9]*)|)-win32-ssl-devel-mingw32.zip$/) {
return($1, "win32-ssl-devel-mingw",
"Windows mingw devel, zip, SSL-enabled");
}
# MSVC libcurl devel package: libcurl-7.13.1-win32-msvc.zip
elsif($file =~ /^libcurl-([0-9.]*)(-([0-9]*)|)-win32-msvc.zip$/) {
return($1, "win32-devel-msvc",
"Windows MSVC libcurl devel, zip");
}
# MSVC libcurl SSL devel package: libcurl-7.19.3-win32-ssl-msvc.zip
elsif($file =~ /^libcurl-([0-9.]*)(-([0-9]*)|)-win32-ssl-msvc.zip$/) {
return($1, "win32-ssl-devel-msvc",
"Windows MSVC libcurl devel, zip, SSL-enabled");
}
elsif($file =~ /^curl-([0-9.]*).tar.gz$/) {
return($1, "tar.gz",
"Generic source tar, gzip");
}
elsif($file =~ /^curl-([0-9.]*).tar.bz2$/) {
return($1, "tar.bz2",
"Generic source tar, bzip2");
}
elsif($file =~ /^curl-([0-9.]*).tar.xz$/) {
return($1, "tar.xz",
"Generic source tar, xz");
}
elsif($file =~ /^curl-([0-9.]*).zip$/) {
return($1, "zip",
"Generic source, zip");
}
# curl-7.4.1-1.i386.rpm
elsif($file =~ /^curl-([0-9.]*)-(\d*)(.*).i386.rpm$/) {
my $pkg="i386.rpm";
my $desc="Linux i386 RPM.";
return($1, $pkg, $desc);
}
# curl-7.4.1-1.ppc.rpm
elsif($file =~ /^curl-([0-9.]*)-(\d*).ppc.rpm$/) {
return($1, "ppc.rpm",
"Linux PPC RPM");
}
# curl-devel-7.4.1-1.ppc.rpm
elsif($file =~ /^curl-devel-([0-9.]*)-(\d*).ppc.rpm$/) {
return($1, "devel-ppc.rpm",
"Linux PPC devel RPM");
}
# curl-7.4.1-1.src.rpm
elsif($file =~ /^curl-([0-9.]*)-(\d*).src.rpm$/) {
return($1, "src.rpm",
"Linux source RPM");
}
# curl-ssl-7.4.1-1.ppc.rpm
elsif($file =~ /^curl-ssl-([0-9.]*)-(\d*).ppc.rpm$/) {
return($1, "ssl-ppc.rpm",
"Linux PPC RPM, SSL-enabled");
}
# curl-ssl-devel-7.4.1-1.ppc.rpm
elsif($file =~ /^curl-ssl-devel-([0-9.]*)-(\d*).ppc.rpm$/) {
return($1, "ssl-devel-ppc.rpm",
"Linux PPC devel RPM, SSL-enabled");
}
# curl-ssl-7.8.1-sparc-8-pkg.tar.gz
elsif($file =~ /^curl-ssl-([0-9.]*)-sparc-8.pkg.tar.gz/) {
return($1, "solaris8-sparc-ssl",
"Solaris 8 SPARC, gzip, SSL-enabled");
}
# curl-ssl-7.8.1-sparc-8-pkg.tar.gz
elsif($file =~ /^curl-ssl-([0-9.]*)-sparc-8.pkg.tar.bz2$/) {
return($1, "solaris8-sparc-ssl-bz2",
"Solaris 8 SPARC, bzip2, SSL-enabled");
}
# curl-ssl-7.9-sparc-2.6-pkg.tar.gz
elsif($file =~ /^curl-ssl-([0-9.]*)-sparc-2.6.pkg.tar.gz$/) {
return($1, "solaris26-sparc-ssl",
"Solaris 2.6 SPARC, SSL-enabled");
}
# curl-7.8.1-vms-vax.zip
elsif($file =~ /^curl-([0-9.]*)-vms-vax\.zip$/) {
return($1, "vms-vax-zip",
"OpenVMS VAX, zip");
}
# curl-7.8.1-vms-ia64.zip
elsif($file =~ /^curl-([0-9.]*)-vms-ia64\.zip$/) {
return($1, "vms-ia64-zip",
"OpenVMS ia64, zip");
}
# curl-7.8.1-vms-axp.zip
elsif($file =~ /^curl-([0-9.]*)-vms-axp\.zip$/) {
return($1, "vms-axp-zip",
"OpenVMS Alpha, zip");
}
elsif($file =~ /^curl-([0-9.]*)-arm\.tar\.gz$/) {
return($1, "linux-arm-nossl",
"Linux ARM, SSL disabled, tar+gz");
}
# curl-([0-9.]*)-(d*)-cygwin-nossl.tar.bz2
elsif($file =~ /^curl-([0-9.]*)-(\d*)-cygwin-nossl.tar.bz2$/) {
return($1, "cygwin-nossl",
"Windows cygwin, bzip2");
}
# ^curl-([0-9.]*)-(d*)-cygwin-src.tar.bz2
elsif($file =~ /^curl-([0-9.]*)-(\d*)-cygwin-src.tar.bz2$/) {
return($1, "cygwin-src",
"Windows cygwin source, bzip2, SSL-enabled");
}
# ^^curl-devel-([0-9.]*)-(d*)-cygwin.tar.bz2
elsif($file =~ /^curl-devel-([0-9.]*)-(\d*)-cygwin.tar.bz2$/) {
return($1, "cygwin-devel",
"Windows cygwin devel tar, bzip2");
}
# curl-7.8.1-2-cygwin.tar.bz2
elsif($file =~ /^curl-([0-9.]*)-(\d*)-cygwin.tar.bz2$/) {
return($1, "cygwin-ssl",
"Windows cygwin, bzip2, SSL-enabled");
}
# curl-7.9.3-sparc-whatever-linux.tar.gz
elsif($file =~ /^curl-([0-9.]*)-sparc-whatever-linux.tar.gz$/) {
return($1, "linux-sparc",
"Linux SPARC, tar gzip");
}
# Itanium packages
elsif($file =~ /^curl-ssl-([0-9.]*)-(\d*).ia64.rpm$/) {
return($1, "ssl-linux-ia64",
"Linux IA64, RPM, SSL-enabled");
}
elsif($file =~ /^curl-ssl-devel-([0-9.]*)-(\d*).ia64.rpm$/) {
return($1, "ssl-devel-linux-ia64",
"Linux IA64 devel, RPM, SSL-enabled");
}
elsif($file =~ /^curl-([0-9.]*)-(\d*).ia64.rpm$/) {
return($1, "linux-ia64",
"Linux IA64, RPM");
}
elsif($file =~ /^curl-devel-([0-9.]*)-(\d*).ia64.rpm$/) {
return($1, "devel-linux-ia64",
"Linux IA64 devel, RPM");
}
# libcurl3-7.12.2-1.i386.rpm
elsif($file =~ /^libcurl\d-([\d\.]*)-(\d*).i386.rpm$/) {
return($1, "i386-libcurl-rpm",
"Linux libcurl i386, RPM");
}
# libcurl3-devel-7.12.2-1.i386.rpm
elsif($file =~ /^libcurl\d-devel-([\d\.]*)-(\d*).i386.rpm$/) {
return($1, "devel-i386-libcurl-rpm",
"Linux libcurl devel i386, RPM");
}
# libcurl-7.15.0-win32-nossl-sspi.zip
elsif($file =~ /^libcurl-([0-9.]*)-win32-nossl-sspi.zip$/) {
return($1, "win32-devel-sspi",
"Windows libcurl devel SSPI-enabled");
}
# libcurl-7.15.0-win32-nossl.zip
elsif($file =~ /^libcurl-([0-9.]*)-win32-nossl.zip$/) {
return($1, "win32-devel",
"Windows libcurl devel");
}
# libcurl-7.15.0-win32-ssl-sspi.zip
elsif($file =~ /^libcurl-([0-9.]*)-win32-ssl-sspi.zip$/) {
return($1, "win32-devel-ssl-sspi",
"Windows libcurl devel SSPI-enabled SSL-enabled");
}
# libcurl-7.15.0-win32-ssl.zip
elsif($file =~ /^libcurl-([0-9.]*)-win32-ssl.zip$/) {
return($1, "win32-devel-ssl",
"Windows libcurl devel SSL-enabled");
}
}
sub scanstatus {
my ($dir)=@_;
opendir(DIR, $dir) || die "cannot opendir $dir: $!";
my @curls = grep { /^(lib|)curl/ && -f "$dir/$_" } readdir(DIR);
closedir DIR;
for(@curls) {
my $file = $_;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat("$dir/$_");
my ($version, $short, $full)=gettype($_);
if($version) {
storemax($file, $version, $size, $short, $full);
}
}
}
1;