Index: head/ports-mgmt/portscout/Makefile =================================================================== --- head/ports-mgmt/portscout/Makefile (revision 408016) +++ head/ports-mgmt/portscout/Makefile (revision 408017) @@ -1,117 +1,117 @@ # Created by: Shaun Amott # $FreeBSD$ 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/ \ http://www.inerd.com/software/${PORTNAME}/ MAINTAINER= koobs@FreeBSD.org COMMENT= Tool to scan for new versions of FreeBSD ports LICENSE= BSD2CLAUSE RUN_DEPENDS= p5-DBI>=0:${PORTSDIR}/databases/p5-DBI \ p5-Proc-Queue>=0:${PORTSDIR}/devel/p5-Proc-Queue \ p5-Net>=0:${PORTSDIR}/net/p5-Net \ p5-URI>=0:${PORTSDIR}/net/p5-URI \ p5-XML-XPath>=0:${PORTSDIR}/textproc/p5-XML-XPath \ p5-MIME-Lite>=0:${PORTSDIR}/mail/p5-MIME-Lite \ p5-libwww>=0:${PORTSDIR}/www/p5-libwww \ p5-JSON>0:${PORTSDIR}/converters/p5-JSON OPTIONS_DEFINE= DOCS HTTPS OPTIONS_DEFAULT= HTTPS PGSQL OPTIONS_MULTI= DATABASE OPTIONS_MULTI_DATABASE= SQLITE PGSQL DATABASE_DESC= Database Backends USES= perl5 shebangfix NO_BUILD= yes SHEBANG_FILES= ${WRKSRC}/portscout.pl 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 PGSQL_RUN_DEPENDS= p5-DBD-Pg>=0:${PORTSDIR}/databases/p5-DBD-Pg .include pre-everything:: .if ${PORT_OPTIONS:MSQLITE} @${ECHO_MSG} "+-------------------------------------------------------------+" @${ECHO_MSG} "| Warning! although SQLite is supported, portscout will only |" @${ECHO_MSG} "| operate in non-forking mode with this database backend. It |" @${ECHO_MSG} "| is therefore recommended only for use with light workloads. |" @${ECHO_MSG} "+-------------------------------------------------------------+" .endif 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 .endif @${REINPLACE_CMD} -e "s#^\(templates .*\)/etc#\1/share#" \ -e "s#^prefix\( *= *\).*#prefix\1${PREFIX}#" \ ${WRKSRC}/portscout.conf @${REINPLACE_CMD} -e "s#^\(.*PREFIX.*=> *\)'.*'#\1'${PREFIX}'#" \ ${WRKSRC}/Portscout/Const.pm @${MV} ${WRKSRC}/docs/*.* ${WRKSRC} do-install: @${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout @${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/DataSrc @${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/SiteHandler @${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/SQL ${INSTALL_SCRIPT} ${WRKSRC}/Portscout/*.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/ ${INSTALL_SCRIPT} ${WRKSRC}/Portscout/DataSrc/*.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/DataSrc/ ${INSTALL_SCRIPT} ${WRKSRC}/Portscout/SiteHandler/*.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/SiteHandler/ ${INSTALL_SCRIPT} ${WRKSRC}/Portscout/SQL/*.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout/SQL/ ${INSTALL_SCRIPT} ${WRKSRC}/Portscout.pm ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/Portscout.pm ${INSTALL_SCRIPT} ${WRKSRC}/portscout.pl ${STAGEDIR}${PREFIX}/bin/portscout ${INSTALL_DATA} ${WRKSRC}/portscout.pod ${STAGEDIR}${PREFIX}/${SITE_PERL_REL} pod2man ${WRKSRC}/portscout.pod ${WRKSRC}/portscout.1 ${INSTALL_MAN} ${WRKSRC}/portscout.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/ @${MKDIR} ${STAGEDIR}${DATADIR}/templates cd ${WRKSRC}/templates \ && ${INSTALL_DATA} * ${STAGEDIR}${DATADIR}/templates @${MKDIR} ${STAGEDIR}${DATADIR}/sql cd ${WRKSRC}/sql && ${INSTALL_DATA} *.sql ${STAGEDIR}${DATADIR}/sql ${INSTALL_DATA} ${WRKSRC}/portscout.conf ${STAGEDIR}${PREFIX}/etc/portscout.conf.sample .if ${PORT_OPTIONS:MDOCS} @${MKDIR} ${STAGEDIR}${DOCSDIR} . for f in ${PORTDOCS} ${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR} . endfor .endif test: ${PERL} ${WRKSRC}/t/00-use.t ${PERL} ${WRKSRC}/t/01-vercompare.t .if ${PORT_OPTIONS:MSQLITE} ${PERL} ${WRKSRC}/t/10-sqlite.t #.else # ${PERL} ${WRKSRC}/10-postgresql.t .endif .include Index: head/ports-mgmt/portscout/files/files-Portscout-SiteHandler-PyPI.pm =================================================================== --- head/ports-mgmt/portscout/files/files-Portscout-SiteHandler-PyPI.pm (revision 408016) +++ head/ports-mgmt/portscout/files/files-Portscout-SiteHandler-PyPI.pm (revision 408017) @@ -1,147 +1,146 @@ #------------------------------------------------------------------------------ # Copyright (C) 2015, Jasper Lievisse Adriaanse # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # #------------------------------------------------------------------------------ package Portscout::SiteHandler::PyPI; use JSON qw(decode_json); use LWP::UserAgent; use Portscout::Const; use Portscout::Config; use strict; require 5.006; #------------------------------------------------------------------------------ # Globals #------------------------------------------------------------------------------ push @Portscout::SiteHandler::sitehandlers, __PACKAGE__; our %settings; #------------------------------------------------------------------------------ # Func: new() # Desc: Constructor. # # Args: n/a # # Retn: $self #------------------------------------------------------------------------------ sub new { my $self = {}; my $class = shift; $self->{name} = 'PyPI'; bless ($self, $class); return $self; } #------------------------------------------------------------------------------ # Func: CanHandle() # Desc: Ask if this handler (package) can handle the given site. # # Args: $url - URL of site. # # Retn: $res - true/false. #------------------------------------------------------------------------------ sub CanHandle { my $self = shift; my ($url) = @_; return ($url =~ /https?:\/\/pypi\.python\.org\//); } #------------------------------------------------------------------------------ # Func: GetFiles() # Desc: Extract a list of files from the given URL. Simply query the API. # # Args: $url - URL we would normally fetch from. # \%port - Port hash fetched from database. # \@files - Array to put files into. # # Retn: $success - False if file list could not be constructed; else, true. #------------------------------------------------------------------------------ sub GetFiles { my $self = shift; my ($url, $port, $files) = @_; my ($pypi, $package, $resp, $query, $ua); $pypi = 'https://pypi.python.org/pypi/'; # Strip all the digits at the end to keep the stem of the module. if ($port->{distname} =~ /(.*?)-(\d+)/) { $package = $1; } $query = $pypi . $package . '/json'; _debug("GET $query"); $ua = LWP::UserAgent->new; $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; } return 1; } #------------------------------------------------------------------------------ # Func: _debug() # Desc: Print a debug message. # # Args: $msg - Message. # # Retn: n/a #------------------------------------------------------------------------------ sub _debug { my ($msg) = @_; $msg = '' if (!$msg); print STDERR "(" . __PACKAGE__ . ") $msg\n" if ($settings{debug}); } 1; Index: head/ports-mgmt/portscout/files/patch-Portscout_SiteHandler_PyPI.pm =================================================================== --- head/ports-mgmt/portscout/files/patch-Portscout_SiteHandler_PyPI.pm (revision 408016) +++ head/ports-mgmt/portscout/files/patch-Portscout_SiteHandler_PyPI.pm (revision 408017) @@ -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);