summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xutils/get_debian_mirrors.py10
-rwxr-xr-xutils/get_ubuntu_mirrors_from_lp.py7
2 files changed, 15 insertions, 2 deletions
diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py
index c1ec3be8..4d34f5b6 100755
--- a/utils/get_debian_mirrors.py
+++ b/utils/get_debian_mirrors.py
@@ -17,7 +17,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
+from __future__ import print_function
import collections
+import sys
import urllib2
from debian_bundle import deb822
@@ -36,6 +38,10 @@ for mirror in deb822.Deb822.iter_paragraphs(masterlist):
mirrors[country].add("%s://%s%s" % (proto, site,
mirror["Archive-%s" % proto]))
+if len(mirrors) == 0:
+ print("E: Could not read the mirror list due to some unknown issue",
+ file=sys.stderr)
+ sys.exit(1)
for country in sorted(mirrors):
- print "#LOC:%s" % country
- print "\n".join(sorted(mirrors[country]))
+ print("#LOC:%s" % country)
+ print("\n".join(sorted(mirrors[country])))
diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py
index 6ff2d885..8fc34c8d 100755
--- a/utils/get_ubuntu_mirrors_from_lp.py
+++ b/utils/get_ubuntu_mirrors_from_lp.py
@@ -24,6 +24,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
+import sys
import feedparser
d = feedparser.parse("https://launchpad.net/ubuntu/+archivemirrors-rss")
@@ -40,6 +41,12 @@ for entry in d.entries:
keys = sorted(countries)
+
+if len(keys) == 0:
+ print("E: Could not read the mirror list due to some issue"
+ " -- status code: %s" % d.status, file=sys.stderr)
+ sys.exit(1)
+
print("mirror://mirrors.ubuntu.com/mirrors.txt")
for country in keys:
print("#LOC:%s" % country)