SHA256
1
0
forked from pool/whohas
Files
whohas/improve-fetchdoc.patch
OBS User mrdocs 09e2b8af95 Accepting request 622912 from home:1Antoine1:branches:network
- Update to version 0.29.1:
  * Use less memory and improve threading (requires forks Perl
    module).
  * Update the documentation.
  * Fetch multiple suites at once for Debian/Ubuntu.
  * Improve options parsing.
  * Add a config file to set desired distros/releases.
  * Fix support for Gentoo, Slackware, OpenBSD, FreeBSD, Arch, AUR,
    Fedora, Fink, openSUSE, Mandriva and Cygwin.
- Add key to check signed tarball:
  * whohas.keyring (Paul Wise <pabs@debian.org>)
- Fix wrong permissions on installed files:
  * Add whohas-0.29.1-fix-permissions.patch.
- Rebase improve-fetchdoc.patch.
- Drop upstreamed patches:
  * archlinux-url-561536.patch
  * debian-versions.patch
  * dont-mask-vars-560891.patch
  * fedora-search-619873.patch
  * gentoo-result-url-516071.patch
  * help-param-513476.patch
  * manpage-0.23.patch
  * manpage-0.24.patch
  * openbsd-cache-results-557724.patch
  * opensuse.patch
  * strictness-510020-510524.patch
  * ubuntu-versions.patch
  * whohas-fix_install.patch
- Update information for OpenBSD and Fedora (picked from upstream):
  * Add whohas-0.29.1-update-fedora.patch.
  * Add whohas-0.29.1-update-openbsd.patch.

OBS-URL: https://build.opensuse.org/request/show/622912
OBS-URL: https://build.opensuse.org/package/show/network/whohas?expand=0&rev=10
2018-07-19 05:18:38 +00:00

53 lines
1.7 KiB
Diff

#! /bin/sh /usr/share/dpatch/dpatch-run
## 40-improve-fetchdoc.dpatch by Jonathan Wiltshire <debian@jwiltshire.org.uk>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Shift some of the burden in sub fetchdoc onto the LWP::UserAgent class
## DP: This also allows us to process XML files without breaking the first line
@DPATCH@
--- a/whohas
+++ b/whohas
@@ -1146,33 +1146,16 @@ sub fetchdoc {
my $ua = LWP::UserAgent->new;
$ua->env_proxy;
- my @firstline;
- my @response;
- for (my $count = 0; ; ++$count) { # termination condition inside loop
- my $req = HTTP::Request->new(GET => $url);
- my $res = $ua->request($req)->as_string;
- @response = split (/\n/, $res);
- @firstline = split (/ /, $response[0]);
- my $restest = 0;
- if (@firstline == 3) {
- $restest = $firstline[1];
- } elsif (@firstline > 3) {
- $restest = $firstline[0];
- }
- if ($restest == 200 || $response[0] =~ /200 OK/) { #NB the matching expression added specifically for NetBSD package page!
- # server response 200 is a stringent criterion, but should work
- last;
- } elsif ($count > 4) { # loop termination condition
- unless ($silent == 1) {
- warn ("Tried fetching \"$url\" five times. Giving up.\n");
- }
- return ();
- last;
+ my $response = $ua->get($url);
+ if($response->is_success) {
+ return $response->decoded_content;
+ } else {
+ unless ($silent == 1)
+ {
+ print("Couldn't fetch \"$url\". Giving up.\n");
}
+ return();
}
- my $end = @response - 1;
- my $finaldoc = join ("\n", @response[14..$end]);
- return ($finaldoc);
}
sub pretty_print {