aboutsummaryrefslogtreecommitdiff
path: root/ports-mgmt/portscout
diff options
context:
space:
mode:
authorKubilay Kocak <koobs@FreeBSD.org>2016-02-04 08:48:40 +0000
committerKubilay Kocak <koobs@FreeBSD.org>2016-02-04 08:48:40 +0000
commit585f894f1c9cc1d4e7b52faf0f55d9f49dec692a (patch)
tree2b64627a501eb525ffd2e7b98b69ba951a5372ac /ports-mgmt/portscout
parentbaba90094d6e70cb1fa5dea72997d5384921b160 (diff)
downloadports-585f894f1c9cc1d4e7b52faf0f55d9f49dec692a.tar.gz
ports-585f894f1c9cc1d4e7b52faf0f55d9f49dec692a.zip
ports-mgmt/portscout: Loop through all PyPI files
While processing Issue 206746 [1] for a security update to security/py-rsa (For versions < 3.3), it was noticed that Portscout had not identified the the newer version, released on 2016-01-13. Investigation revealed that the PyPI SiteHandler in Portscout only processed the first url/filename returned by PyPI, which in many cases is not a tar.gz, the default EXTRACT_SUFFIX for source distribution (sdist) files: [py-rsa] VersionCheck() [py-rsa] Checking site: https://pypi.python.org/packages/source/r/rsa/ Does site handler exist ... Yes (Portscout::SiteHandler::PyPI) GET https://pypi.python.org/pypi/rsa/json (Portscout::SiteHandler::PyPI) GET success: 200 Filename: rsa-3.3-py2.py3-none-any.whl FindNewest: Checking rsa-3.3-py2.py3-none-any.whl ... against port DISTFILES. FindNewest: Checking DISTFILE ... rsa-3.1.4.tar.gz (ver: 3.1.4, sufx: .tar.gz) [py-rsa] Done This change backports a commit [1] made to Portroach which adds a loop to enumerate all URLs/filenames in the PyPI JSON response, not just the first. [1] https://github.com/jasperla/portroach/commit/e93b8331f6e5f850bbb5faca866efcbf73de756c PR: 206746 [1] Obtained from: https://github.com/jasperla/portroach
Notes
Notes: svn path=/head/; revision=408017
Diffstat (limited to 'ports-mgmt/portscout')
-rw-r--r--ports-mgmt/portscout/Makefile6
-rw-r--r--ports-mgmt/portscout/files/files-Portscout-SiteHandler-PyPI.pm13
-rw-r--r--ports-mgmt/portscout/files/patch-Portscout_SiteHandler_PyPI.pm23
3 files changed, 23 insertions, 19 deletions
diff --git a/ports-mgmt/portscout/Makefile b/ports-mgmt/portscout/Makefile
index 15f0863ebea9..ee6e9c8ad215 100644
--- a/ports-mgmt/portscout/Makefile
+++ b/ports-mgmt/portscout/Makefile
@@ -3,7 +3,7 @@
PORTNAME= portscout
PORTVERSION= 0.8.1
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= ports-mgmt
MASTER_SITES= http://mirror.inerd.com/FreeBSD/distfiles/${PORTNAME}/ \
http://www.atarininja.org/~wxs/distfiles/ \
@@ -39,7 +39,7 @@ PORTDOCS= UPDATING portscout-portconfig.txt xml-datasrc-example.xml
HTTPS_RUN_DEPENDS= p5-LWP-Protocol-https>=0:${PORTSDIR}/www/p5-LWP-Protocol-https
-SQLITE_USE= SQLITE=3
+SQLITE_USES= sqlite
SQLITE_RUN_DEPENDS= p5-DBD-SQLite>=0:${PORTSDIR}/databases/p5-DBD-SQLite
PGSQL_USES= pgsql
@@ -60,7 +60,7 @@ post-extract:
@${CP} ${FILESDIR}/files-Portscout-SiteHandler-GitHub.pm ${WRKSRC}/Portscout/SiteHandler/GitHub.pm
@${CP} ${FILESDIR}/files-Portscout-SiteHandler-PyPI.pm ${WRKSRC}/Portscout/SiteHandler/PyPI.pm
-post-patch:
+pre-install:
.if ${PORT_OPTIONS:MSQLITE}
@${REINPLACE_CMD} 's/^\([^#]*DBI:Pg.*\)$$/#\1/g' ${WRKSRC}/portscout.conf
@${REINPLACE_CMD} 's/^#\(.*DBI:SQLite.*\)$$/\1/g' ${WRKSRC}/portscout.conf
diff --git a/ports-mgmt/portscout/files/files-Portscout-SiteHandler-PyPI.pm b/ports-mgmt/portscout/files/files-Portscout-SiteHandler-PyPI.pm
index c63b8ca6f68e..071a8fabb27d 100644
--- a/ports-mgmt/portscout/files/files-Portscout-SiteHandler-PyPI.pm
+++ b/ports-mgmt/portscout/files/files-Portscout-SiteHandler-PyPI.pm
@@ -109,14 +109,13 @@ sub GetFiles
$ua->agent(USER_AGENT);
$resp = $ua->request(HTTP::Request->new(GET => $query));
if ($resp->is_success) {
- my ($json, $info, $version);
+ my ($json, $urls);
- $json = decode_json($resp->decoded_content);
- $info = $json->{info};
- $version = $info->{version};
- next unless $version;
-
- push(@$files, $json->{releases}{$version}[0]{filename});
+ $json = decode_json($resp->decoded_content);
+ $urls = $json->{urls};
+ foreach my $url (@$urls) {
+ push(@$files, $url->{filename});
+ }
} else {
_debug("GET failed: " . $resp->code);
return 0;
diff --git a/ports-mgmt/portscout/files/patch-Portscout_SiteHandler_PyPI.pm b/ports-mgmt/portscout/files/patch-Portscout_SiteHandler_PyPI.pm
index 8070381f231a..bd8bd6212b82 100644
--- a/ports-mgmt/portscout/files/patch-Portscout_SiteHandler_PyPI.pm
+++ b/ports-mgmt/portscout/files/patch-Portscout_SiteHandler_PyPI.pm
@@ -1,11 +1,16 @@
---- Portscout/SiteHandler/PyPI.pm.orig 2015-10-25 05:00:48 UTC
+--- Portscout/SiteHandler/PyPI.pm.orig 2016-02-04 08:23:53 UTC
+++ Portscout/SiteHandler/PyPI.pm
-@@ -115,7 +115,7 @@ sub GetFiles
- $info = $json->{info};
- $version = $info->{version};
- next unless $version;
--
-+ _debug("GET success: " . $resp->code . " Filename: " . $json->{releases}{$version}[0]{filename});
- push(@$files, $json->{releases}{$version}[0]{filename});
+@@ -109,11 +109,13 @@ sub GetFiles
+ $ua->agent(USER_AGENT);
+ $resp = $ua->request(HTTP::Request->new(GET => $query));
+ if ($resp->is_success) {
++ _debug("GET success: " . $resp->code);
+ my ($json, $urls);
+
+ $json = decode_json($resp->decoded_content);
+ $urls = $json->{urls};
+ foreach my $url (@$urls) {
++ _debug("PyPi File: " . $url->{filename});
+ push(@$files, $url->{filename});
+ }
} else {
- _debug("GET failed: " . $resp->code);