FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 10-08-2012, 11:40 PM
Regid Ichira
 
Default devscripts:rc-alert: A patch for on the fly selection of curl or wget

package: devscripts
Version: 2.12.4
Tags: patch
Files: /usr/bin/rc-alert
/usr/share/doc/devscripts/README.gz

Many devscripts choose on the fly whether to use curl or wget,
depending on what is installed. So far rc-alert was using solely
wget. The following patches tries to rectify this.

1. rc-alert is a Perl script. Can you verify that the patch is
correct, and reasonbly written, As far as Perl is concerned?
2. Are the following pairs equivalent?
2.1 curl -qsR -C - $url
wget -qN --no-continue $url
2.2 curl -qs $url
wget -q -O - $url


--- a/usr/bin/rc-alert 2012-09-25 01:45:59.000000000 +0200
+++ n/usr/bin/rc-alert 2012-10-09 01:26:26.000000000 +0200
@@ -158,8 +158,13 @@ $excludedists = remove_duplicate_values(

## First download the RC bugs page

-unless (system("command -v wget >/dev/null 2>&1") == 0) {
- die "$progname: this program requires the wget package to be installed
";
+my $curl_or_wget;
+if (system("command -v curl >/dev/null 2>&1") == 0) {
+ $curl_or_wget = "curl";
+} elsif (system("command -v wget >/dev/null 2>&1") == 0) {
+ $curl_or_wget = "wget";
+} else {
+ die "$progname: this program requires either the curl or the wget package to be installed
";
}


@@ -171,16 +176,33 @@ if (! -d $cachedir and $forcecache) {
if (-d $cachedir) {
chdir $cachedir or die "$progname: can't cd $cachedir: $!
";

- # Either use the cached version because the remote hasn't been updated
- # (-N) or download a complete new copy (--no-continue)
- if (system('wget', '-qN', '--no-continue', $url) != 0) {
+ # Is
+ # curl -qsR -C - $url
+ # equivalent to
+ # wget -qN --no-continue $url
+ # ?
+ if ("$curl_or_wget" eq "curl") {
+ if (system('curl', '-qsR', '-C', '-', $url) != 0) {
+ die "$progname: curl failed!
";
+ }
+ } elsif (system('wget', '-qN', '--no-continue', $url) != 0) {
+ # $curl_or_wget" eq "wget"
+ # Either use the cached version because the remote hasn't
+ # been updated (-N) or download a complete new copy
+ # (--no-continue)
die "$progname: wget failed!
";
}
open BUGS, $cachefile or die "$progname: could not read $cachefile: $!
";
}
else {
- open BUGS, "wget -q -O - $url |" or
- die "$progname: could not run wget: $!
";
+ if ("$curl_or_wget" eq "curl") {
+ open BUGS, "curl -qs $url |" or
+ die "$progname: could not run curl: $!
";
+ } else {
+ # $curl_or_wget" eq "wget"
+ open BUGS, "wget -q -O - $url |" or
+ die "$progname: could not run wget: $!
";
+ }
}

## Get list of installed packages (not source packages)
@@ -204,8 +226,13 @@ if ($popcon) {
or die "$progname: Unable to access popcon data: $!";
$pc_regex = '(d+)sd+s(S+)';
} else {
- open POPCON, "wget -q -O - http://popcon.debian.org/by_$pc_by.gz | gunzip -c |"
- or die "$progname: Not able to receive remote popcon data!";
+ if ("$curl_or_wget" eq "curl") {
+ open POPCON, "curl -qs http://popcon.debian.org/by_$pc_by.gz | gunzip -c |"
+ } else {
+ # $curl_or_wget" eq "wget"
+ open POPCON, "wget -q -O - http://popcon.debian.org/by_$pc_by.gz | gunzip -c |"
+ }
+ or die "$progname: Not able to receive remote popcon data!";
$pc_regex = '(d+)s+(S+)s+(d+s+){5}(.*)';
}


--- a/README 2012-10-09 00:35:19.512134230 +0200
+++ b/README 2012-10-09 00:34:37.000000000 +0200
@@ -197,7 +197,8 @@ And now, in mostly alphabetical order, t
- pts-subscribe: subscribe to the PTS (Package Tracking System) for a
limited period of time. [bsd-mailx | mailx, at]

-- rc-alert: list installed packages which have release-critical bugs [wget]
+- rc-alert: list installed packages which have release-critical bugs
+ [curl | wget]

- rmadison: Remotely query the Debian archive database about packages.
[liburi-perl, wget | curl]


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20121008234003.GB2461@nt1.in">http://lists.debian.org/20121008234003.GB2461@nt1.in
 
Old 10-09-2012, 01:01 PM
Jon Dowland
 
Default devscripts:rc-alert: A patch for on the fly selection of curl or wget

Cool - you should probably send this to the devscripts devel team, though:
devscripts-devel@lists.alioth.debian.org


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/20121009130115.GB17431@debian
 

Thread Tools




All times are GMT. The time now is 12:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org