summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/common.py13
-rwxr-xr-xscripts/update-gcc24
-rwxr-xr-xscripts/update-gdb19
3 files changed, 32 insertions, 24 deletions
diff --git a/scripts/common.py b/scripts/common.py
index 892834c..1ae5955 100644
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -1,4 +1,5 @@
#!/usr/bin/python
+# -*- coding:utf-8 -*-
"""Utility funcs"""
@@ -14,7 +15,10 @@ import re
import subprocess
import sys
import time
-import urlparse
+try:
+ import urlparse
+except ImportError:
+ import urllib.parse as urlparse
dry_run = False
@@ -46,7 +50,12 @@ def list_snaps(url, debug=False):
return nlst
-ver_sort = lambda x: sorted(x, key=lambda v: distutils.version.LooseVersion(v))
+# Newer python distutils modules are crap and crash when you try to compare
+# something like "gdb-3.8.1" and "gdb-3.8-r1". Filter out the -r# since we
+# don't need them for this code. Even python 2 is crap and returns the wrong
+# result.
+ver_filter = re.compile(r'(-r[0-9]+)?([.]ebuild)?$')
+ver_sort = lambda x: sorted(x, key=lambda v: distutils.version.LooseVersion(ver_filter.sub('', v)))
def run(cmd, **kwargs):
diff --git a/scripts/update-gcc b/scripts/update-gcc
index da82ec6..27f6f06 100755
--- a/scripts/update-gcc
+++ b/scripts/update-gcc
@@ -1,4 +1,5 @@
#!/usr/bin/python
+# -*- coding:utf-8 -*-
"""Update gcc snapshots"""
@@ -21,24 +22,23 @@ URL = 'ftp://gcc.gnu.org/pub/gcc/snapshots/'
def main(argv):
opts = common_main(argv, CATEGORY, PN)
+ ver_match = re.compile(r'([0-9.]+)-([0-9.]+)$')
- remote_list = ver_sort(
- x for x in list_snaps(URL, debug=opts.debug)
- if not x.startswith('LATEST-') and '-' in x)
+ all_snaps = list_snaps(URL, debug=opts.debug)
+ snaps = [x for x in all_snaps
+ if not x.startswith('LATEST-') and ver_match.match(x)]
+ remote_list = ver_sort(snaps)
# Create the lists of curr/new versions.
old_pkgs = set(glob.glob('%s-*.ebuild' % PN))
new_pkgs = set()
for snap in remote_list:
- m = re.match(r'([0-9.]+)-([0-9.]+)$', snap)
- if m:
- # Turn "5" into "5.0.0" and "4.3" into "4.3.0".
- dots = '.'.join((m.group(1).split('.') + (['0'] * 3))[0:3])
- ebuild = '%s-%s_alpha%s.ebuild' % (PN, dots, m.group(2))
- new_pkgs.add(ebuild)
- logging.debug('found remote %s', ebuild)
- else:
- logging.warning('skipping reomte %s', snap)
+ m = ver_match.match(snap)
+ # Turn "5" into "5.0.0" and "4.3" into "4.3.0".
+ dots = '.'.join((m.group(1).split('.') + (['0'] * 3))[0:3])
+ ebuild = '%s-%s_alpha%s.ebuild' % (PN, dots, m.group(2))
+ new_pkgs.add(ebuild)
+ logging.debug('found remote %s', ebuild)
# Create ebuilds for the new versions we found.
closest_ver = distutils.version.LooseVersion('0')
diff --git a/scripts/update-gdb b/scripts/update-gdb
index 5d11637..e5ca9e5 100755
--- a/scripts/update-gdb
+++ b/scripts/update-gdb
@@ -1,4 +1,5 @@
#!/usr/bin/python
+# -*- coding:utf-8 -*-
"""Update gdb snapshots"""
@@ -21,22 +22,20 @@ URL = 'ftp://sourceware.org/pub/gdb/snapshots/current/'
def main(argv):
opts = common_main(argv, CATEGORY, PN)
+ ver_match = re.compile(r'%s-weekly-([0-9.]+)\.tar' % PN)
- remote_list = ver_sort(
- x for x in list_snaps(URL, debug=opts.debug)
- if x.startswith('%s-weekly-' % PN) and '.tar' in x)
+ all_snaps = list_snaps(URL, debug=opts.debug)
+ snaps = [x for x in all_snaps if ver_match.match(x)]
+ remote_list = ver_sort(snaps)
# Create the lists of curr/new versions.
old_pkgs = set(glob.glob('%s-*.ebuild' % PN))
new_pkgs = set()
for snap in remote_list:
- m = re.match(r'%s-weekly-([0-9.]+)\.tar' % PN, snap)
- if m:
- ebuild = '%s-%s.ebuild' % (PN, m.group(1))
- new_pkgs.add(ebuild)
- logging.debug('found remote %s', ebuild)
- else:
- logging.warning('skipping reomte %s', snap)
+ m = ver_match.match(snap)
+ ebuild = '%s-%s.ebuild' % (PN, m.group(1))
+ new_pkgs.add(ebuild)
+ logging.debug('found remote %s', ebuild)
# Create ebuilds for the new versions we found.
closest_ver = distutils.version.LooseVersion('0')