Solved ports-mgmt/fastest_sites fails with ValueError: too many values to unpack

LJackson

New Member

Reaction score: 2
Messages: 9

I recently decided to try to speed up synth using ports-mgmt/fastest_sites. It does test a number of sites but then fails:

Code:
 => Checking servers for MASTER_SITE_PORTS_JP (3 servers)
MASTER_SITE_PORTS_JP=\
ftp://ftp.ics.es.osaka-u.ac.jp/pub/mirrors/FreeBSD-jp/ports-jp/LOCAL_PORTS/%SUBDIR%/ \
ftp://ftp4.jp.FreeBSD.org/pub/FreeBSD-jp/ports-jp/LOCAL_PORTS/%SUBDIR%/ \
ftp://ports.jp.FreeBSD.org/pub/FreeBSD-jp/ports-jp/LOCAL_PORTS/%SUBDIR%/

 => Checking servers for MASTER_SITE_FEDORA_LINUX (6 servers)
Traceback (most recent call last):
  File "/usr/local/bin/fastest_sites", line 164, in <module>
    latency_list = FindFastest(varname, sitelist)
  File "/usr/local/bin/fastest_sites", line 110, in FindFastest
    AsyncConnect(url, callback)
  File "/usr/local/bin/fastest_sites", line 53, in __init__
    self.ParseURL()
  File "/usr/local/bin/fastest_sites", line 64, in ParseURL
    (scheme, remainder) = self._url.split(":", 2)
ValueError: too many values to unpack

I am running on Release 11.1.

Code:
uname -a
FreeBSD Dad 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

This also occurs on another system running Release 10.3.

Any thoughts on what may cause this?
 

tobik@

Daemon
Developer

Reaction score: 1,415
Messages: 1,909

This appears to be a bug in ports-mgmt/fastest_sites. It can't parse bsd.sites.mk entries with a second : like
Code:
https://archives.fedoraproject.org/pub/archive/fedora/linux/%SUBDIR%/:DEFAULT,SOURCE
The port hasn't seen an update in a while and the last maintainer timeout was 2 years. Not sure if it's abandoned. Try contacting the maintainer. EDIT: Nevermind. Filed a bug myself: PR 224854

Anyway applying this patch to the port seems to fix it:
Code:
diff --git a/ports-mgmt/fastest_sites/Makefile b/ports-mgmt/fastest_sites/Makefile
index d9e6149ccf18..0fdd0223de95 100644
--- a/ports-mgmt/fastest_sites/Makefile
+++ b/ports-mgmt/fastest_sites/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	fastest_sites
 PORTVERSION=	20110317
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	http://www.semicomplete.com/files/fastest_sites/
 EXTRACT_SUFX=	.py
diff --git a/ports-mgmt/fastest_sites/files/patch-fastest__sites-20110317.py b/ports-mgmt/fastest_sites/files/patch-fastest__sites-20110317.py
new file mode 100644
index 000000000000..bf96331e013b
--- /dev/null
+++ b/ports-mgmt/fastest_sites/files/patch-fastest__sites-20110317.py
@@ -0,0 +1,11 @@
+--- fastest_sites-20110317.py.orig	2018-01-03 06:06:26 UTC
++++ fastest_sites-20110317.py
+@@ -61,7 +61,7 @@ class AsyncConnect(asyncore.dispatcher):
+ 
+   def ParseURL(self):
+     #print "Url: %s" % self._url
+-    (scheme, remainder) = self._url.split(":", 2)
++    (scheme, remainder) = self._url.split(":", 1)
+     (host, unused_path) = urllib.splithost(remainder)
+     self._host = host
+     self._port = AsyncConnect.schemes[scheme.lower()]
or here: https://pastebin.com/raw/a4CqF5Q1
 

malcomvx

New Member


Messages: 2

ValueError: too many values to unpack

Python functions can return multiple variables . These variables can be stored in variables directly. This is a unique property of Python , other programming languages such as C++ or Java do not support this by default.

The valueerror: too many values to unpack occurs during a multiple-assignment where you either don't have enough objects to assign to the variables or you have more objects to assign than variables. If for example myfunction() returned an iterable with three items instead of the expected two then you would have more objects than variables necessary to assign to.
 
Top