mirrored from git://git.rockbox.org/www.git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dl.cgi
executable file
·194 lines (162 loc) · 5.36 KB
/
dl.cgi
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
#!/usr/bin/perl
require "CGI.pm";
require "./rockbox.pm";
my $req = new CGI;
my $bin = $req->param('bin');
# Bots gonna bot. Explcitly return an error.
if ($bin =~ /^\// ||
$bin =~ /^\./) {
print $req->header('type text/html', '400 Bad Request');
exit(0);
}
my $fine=0;
my $pic = playerpic($bin);
my $basedir = "/home/rockbox/download";
my $baseurl = "//download.rockbox.org";
my $desc = $builds{$bin}{name};
header("Rockbox $desc Daily Builds");
sub showother {
my ($c)=@_;
print "<a href=\"/daily.shtml\">daily build page</a><p>";
print "<table class=\"rockbox\"><tr>\n";
for(sort keys %model) {
if($_ ne $c) {
printf "<td><img src=\"%s\"><br><a href=\"dl.cgi?bin=%s\">%s</a></td> ",
$model{$_}, $_, $_;
}
}
print "</tr></table>\n";
}
if(!$pic) {
print "$bin is not a fine binary name, try one of these:<p>\n";
open(FILE, "dailymod.html");
while (<FILE>) {
print;
}
close FILE;
exit;
}
print <<MOO
<p>
These are automated daily builds of the latest code. They contain all the
latest features, but may also contain bugs and/or undocumented changes.
The top line is the latest.
<p>
For other players, see the <a href="daily.shtml">daily builds</a> page.
<p>
MOO
;
my %date;
my $dir = $bin;
opendir(DIR, "$basedir/daily/$dir");
for(grep { /^rockbox/ } readdir(DIR)) {
/(\d{8})/;
$date{$1}=$1;
}
closedir DIR;
print "<img src=\"$pic\" border=\"0\" align=\"left\">",
"<table class=rockbox>\n";
$color1 = 0xc6;
$color2 = 0xd6;
$color3 = 0xf5;
print "<tr>";
for(('Date', 'Commit ID', 'Binary Package', 'Source Code', 'Fonts', 'Changes', 'Voice', 'Manual')) { # 'Maps'
print "<th>$_</th>";
}
print "</tr>";
for(reverse sort keys %date) {
my $d = $_;
my $nice = $d;
if($d =~ /(\d\d\d\d)(\d\d)(\d\d)/) {
$nice = "$1-$2-$3";
}
$col = sprintf("style=\"background-color: #%02x%02x%02x\"",
$color1, $color2, $color3);
print "<tr><td>$nice</td>";
$color1 -= 0x18;
$color2 -= 0x18;
$color3 -= 0x18;
$rev="";
if( -f "$basedir/daily/build-info-${d}") {
open(R, "<$basedir/daily/build-info-${d}");
while(<R>) {
if(/^rev\s?=\s?"?(\w+)"?/) {
$rev = $1;
last;
}
}
close(R);
}
print "<td title=\"The build done $nice has rev $rev\"><a href=\"//git.rockbox.org/cgit/rockbox.git/commit/?id=$rev\">$rev</a></td>";
{
my $n=0;
my $m = $bin;
my $size;
# new-style full zip:
if( -f "$basedir/daily/$m/rockbox-${m}-${d}.zip") {
$size = (stat("$basedir/daily/$m/rockbox-${m}-${d}.zip"))[7];
printf("<td><a title=\"Rockbox zip package for ${desc} built $nice\" href=\"$baseurl/daily/$bin/rockbox-${m}-${d}.zip\">Rockbox</a> %d KB</td>",
$size/1024);
} else {
print "<td>nbsp;</td>";
}
# maps!
# $map="";
# if( -f "maps/$m/maps-rockbox-${m}-${d}.zip") {
# $map = sprintf "<a href=\"//www.rockbox.org/maps/$bin/maps-rockbox-${m}-${d}.zip\" title=\"map file for $desc built $nice\">maps</a>",
# }
# print "<td>$map</td>";
if (-f "$basedir/daily/source/rockbox-source-$d.tar.xz") {
$size = int((stat("$basedir/daily/source/rockbox-source-$d.tar.xz"))[7] / 1024);
print "<td><a title=\"Rockbox source code for $d\" href=\"$baseurl/daily/source/rockbox-source-$d.tar.xz\">tar.xz source</a> $size KB</td>";
}
if (-f "$basedir/daily/fonts/rockbox-fonts-$d.zip") {
$size = int((stat("$basedir/daily/fonts/rockbox-fonts-$d.zip"))[7] / 1024);
print "<td><a title=\"Rockbox fonts for $d\" href=\"$baseurl/daily/fonts/rockbox-fonts-$d.zip\">fonts zip</a> $size KB</td>";
}
if ( -f "$basedir/daily/changelogs/changes-$d.html") {
print "<td><a href=\"$baseurl/daily/changelogs/changes-$d.html\" title=\"changelog for Rockbox $nice\">changelog</a></td>";
}
else {
print "<td>(no changes)</td>";
}
# Voices
my $voicemod = voicename($m);
print "<td>";
for my $v (&allvoices) {
my $fi = "$basedir/daily/$voicemod/voice-$voicemod-$d-$v.zip";
if ( -f $fi) {
my $size = (stat($fi))[7];
printf("<a href=\"//download.rockbox.org/daily/$voicemod/voice-$voicemod-$d-$v.zip\" title=\"voice file for Rockbox $desc dated $nice\">$voices{$v}->{short}</a> %d KB<br>",
$size/1024);
}
}
print "</td>\n";
# Manual!
print "<td>";
my $fi = "$basedir/daily/manual/rockbox-${m}-${d}.pdf";
if (-f $fi) {
my $size = (stat($fi))[7];
printf("<br/><a href=\"$fi\">pdf</a> %d KB", $size/1024);
}
$fi = "$basedir/daily/manual/rockbox-${m}-${d}-html.zip";
if (-f $fi) {
my $size = (stat($fi))[7];
printf("<br/><a href=\"$fi\">html-zip</a> %d KB", $size/1024);
}
print "</td>\n";
}
print "</tr>\n";
$font1 = $font2 = "";
}
if (scalar keys %date == 0) {
print "<tr><td>(No $bin daily builds available)</td></tr>\n";
}
print "</table>\n";
print "<br clear=all><p>\n";
#open(FILE, "dailymod.html");
#while (<FILE>) {
# print;
#}
#close FILE;
footer();