159
159
## First download the RC bugs page
161
unless (system("command -v wget >/dev/null 2>&1") == 0) {
162
die "$progname: this program requires the wget package to be installed\n";
163
if (system("command -v wget >/dev/null 2>&1") == 0) {
164
$curl_or_wget = "wget";
165
$getcommand = "wget -q -O -";
166
} elsif (system("command -v curl >/dev/null 2>&1") == 0) {
167
$curl_or_wget = "curl";
168
$getcommand = "curl -qs";
170
die "$progname: this program requires either the wget or curl package to be installed\n";
171
179
if (-d $cachedir) {
172
180
chdir $cachedir or die "$progname: can't cd $cachedir: $!\n";
174
# Either use the cached version because the remote hasn't been updated
175
# (-N) or download a complete new copy (--no-continue)
176
if (system('wget', '-qN', '--no-continue', $url) != 0) {
177
die "$progname: wget failed!\n";
182
if ("$curl_or_wget" eq "wget") {
183
# Either use the cached version because the remote hasn't been
184
# updated (-N) or download a complete new copy (--no-continue)
185
if (system('wget', '-qN', '--no-continue', $url) != 0) {
186
die "$progname: wget failed!\n";
188
} elsif ("$curl_or_wget" eq "curl") {
189
if (system('curl', '-qsR', $url) != 0) {
190
die "$progname: curl failed!\n";
193
die "$progname: Unknown download program $curl_or_wget!\n";
179
195
open BUGS, $cachefile or die "$progname: could not read $cachefile: $!\n";
182
open BUGS, "wget -q -O - $url |" or
183
die "$progname: could not run wget: $!\n";
198
open BUGS, "$getcommand $url |" or
199
die "$progname: could not run $curl_or_wget: $!\n";
186
202
## Get list of installed packages (not source packages)
204
220
or die "$progname: Unable to access popcon data: $!";
205
221
$pc_regex = '(\d+)\s\d+\s(\S+)';
207
open POPCON, "wget -q -O - http://popcon.debian.org/by_$pc_by.gz | gunzip -c |"
223
open POPCON, "$getcommand http://popcon.debian.org/by_$pc_by.gz | gunzip -c |"
208
224
or die "$progname: Not able to receive remote popcon data!";
209
225
$pc_regex = '(\d+)\s+(\S+)\s+(\d+\s+){5}\(.*\)';