diff options
author | Wesley Shields <wxs@FreeBSD.org> | 2008-09-03 10:42:09 +0800 |
---|---|---|
committer | Wesley Shields <wxs@FreeBSD.org> | 2008-09-03 10:42:09 +0800 |
commit | 2b10ef984453cd8110e8a6ed925c972ebe35eee0 (patch) | |
tree | ecd7a83bc3c222195475f836165ebcadfcac6061 /ports-mgmt | |
parent | bd07455d55470425c64ce908290c609047491bb8 (diff) | |
download | freebsd-ports-gnome-2b10ef984453cd8110e8a6ed925c972ebe35eee0.tar.gz freebsd-ports-gnome-2b10ef984453cd8110e8a6ed925c972ebe35eee0.tar.zst freebsd-ports-gnome-2b10ef984453cd8110e8a6ed925c972ebe35eee0.zip |
Add a patch to workaround a bug noticed by Doug Barton.
The new code will silently ignore MASTER_SITE_GOOGLE_CODE and
MASTER_SITE_DEBIAN_POOL unless specifically asked to sort them, in which
case an error message is printed.
Most of the patch came from Ryan Steinmetz <rpsfa@rit.edu> with small
additions by me.
Diffstat (limited to 'ports-mgmt')
-rw-r--r-- | ports-mgmt/fastest_sites/Makefile | 1 | ||||
-rw-r--r-- | ports-mgmt/fastest_sites/files/patch-fastest_sites.py | 57 |
2 files changed, 58 insertions, 0 deletions
diff --git a/ports-mgmt/fastest_sites/Makefile b/ports-mgmt/fastest_sites/Makefile index b445fb63b803..f26a1c44efe7 100644 --- a/ports-mgmt/fastest_sites/Makefile +++ b/ports-mgmt/fastest_sites/Makefile @@ -7,6 +7,7 @@ PORTNAME= fastest_sites PORTVERSION= 20080320 +PORTREVISION= 1 CATEGORIES= ports-mgmt MASTER_SITES= http://www.semicomplete.com/files/fastest_sites/ \ http://www.atarininja.org/~wxs/distfiles/ diff --git a/ports-mgmt/fastest_sites/files/patch-fastest_sites.py b/ports-mgmt/fastest_sites/files/patch-fastest_sites.py new file mode 100644 index 000000000000..d5df2ae3494a --- /dev/null +++ b/ports-mgmt/fastest_sites/files/patch-fastest_sites.py @@ -0,0 +1,57 @@ +--- fastest_sites-20080320.py.orig 2008-09-01 20:34:56.000000000 -0400 ++++ fastest_sites-20080320.py 2008-09-02 22:20:46.000000000 -0400 +@@ -129,15 +129,29 @@ + var_re = re.compile(r"^(MASTER_SITE_[A-Z_]+)\+?=") + sites_mk = "%s/Mk/bsd.sites.mk" % (GetVariable("PORTSDIR")) + sites = {} ++bad_sites = {} + site_latency = {} + ++# This catches http://.foo (as is the case with MASTER_SITE_GOOGLE_CODE) ++# and foo.com// (as is the case with MASTER_SITE_DEBIAN_POOL) ++# It also catches http://www..com just in case that pops up in the future ++bad_site_regex = re.compile(r"(\/\/\.|\.\.|[a-zA-Z]\/\/)") ++ + fd = open(sites_mk, "r") + for line in fd: + match = var_re.search(line) + if match: + varname = match.group(1) + output = Run("make -V %s -f %s" % (varname, sites_mk)) +- sites[varname] = output.split() ++ # Some sites uses variables in them: ++ # MASTER_SITE_GOOGLE_CODE: http://${PORTNAME}.googlecode.com/files/ ++ # and MASTER_SITE_DEBIAN_POOL ++ # We don't have access to those variables so we skip them. ++ site_is_bad = bad_site_regex.search(output) ++ if site_is_bad: ++ bad_sites[varname] = output.split() ++ else: ++ sites[varname] = output.split() + + for (varname, sitelist) in sites.iteritems(): + if len(sys.argv) > 1 and varname not in sys.argv[1:]: +@@ -146,12 +160,22 @@ + " => Checking servers for %s (%d servers)" % (varname, len(sitelist)) + latency_list = FindFastest(varname, sitelist) + ++ # Don't print the trailing slash on the last line. + print "%s=\\" % varname +- for (url, duration) in latency_list: ++ for (url, duration) in latency_list[:-1]: + print "\t%s \\" % (url) ++ (url, duration) = latency_list[-1] ++ print "\t%s" % url + + print + sys.stdout.flush() + + # Let the network quiesce + #time.sleep(3) ++ ++# Walk the dict of sites that we know cause problems. ++# If explicitly asked to sort one of them be verbose about skipping it ++# otherwise be silent. ++for (varname, sitelist) in bad_sites.iteritems(): ++ if len(sys.argv) > 1 and varname in sys.argv[1:]: ++ print >>sys.stderr, "Unable to sort %s - skipping." % varname |