update for precise
The layout has changed for precise. Just update this to support
precise and not oneiric. We don't need to continue build those
diff --git a/crawler.py b/crawler.py
index e939518..4498885 100755
--- a/crawler.py
+++ b/crawler.py
@@ -13,23 +13,14 @@
links = [] #return empty array
return links
-def list_hwpacks(url):
- hwpack_urls = []
+def list_hwpack(url):
+ ''' returns tuple of (buildate, url)
+ '''
urls = list_links(url, r'<a\s*href=[\'|"](hwpack.*?\.tar\.gz)[\'"].*?>')
for link in urls:
- hwpack_urls.append('%s/%s' % (url,link))
- return hwpack_urls
-
-def list_hwpack_builds(url, date):
- url = "%s/%s" % (url,date)
- links = list_links(url, r'<a\s*href=[\'|"](\d)\/[\'"].*?>')
- builds = []
- for link in sorted(links, reverse=True):
- hwurl = "%s/%s/images/hwpack/" % (url, link)
- hwpack = list_hwpacks(hwurl)
- if len(hwpack) is 1:
- builds.append(hwpack[0])
- return builds
+ build_date = re.compile('_(\d+)-').findall(link)
+ return (build_date[0], '%s/%s' % (url,link))
+ return None
def latest_hwpacks(url, limit=7):
'''returns an array of tuples (build-date, hwpack url) like:
@@ -39,28 +30,17 @@
links = list_links(url, r'<a\s*href=[\'|"](\d+)\/[\'"].*?>')[:limit]
hwpacks = []
for link in sorted(links, reverse=True):
- builds = list_hwpack_builds(url, link)
- if len(builds) > 0:
- hwpacks.append((link,builds[0]))
+ build = list_hwpack('%s/%s'% (url, link))
+ if build is not None:
+ hwpacks.append(build)
return hwpacks
def list_rfs(url):
- links = list_links(url, r'<a\s*href=[\'|"](linaro-.*?\.tar\.gz)[\'"].*?>')
+ links = list_links(url, r'<a\s*href=[\'|"](linaro-.*?\d+(?!config)\.tar\.gz)[\'"].*?>')
if len(links) is 1:
return "%s/%s" %(url,links[0])
return None
-def list_rfs_builds(url, date):
- url = "%s/%s" % (url,date)
- links = list_links(url, r'<a\s*href=[\'|"](\d)\/[\'"].*?>')
- builds = []
- for link in sorted(links, reverse=True):
- hwurl = "%s/%s/images/tar/" % (url, link)
- rfs = list_rfs(hwurl)
- if rfs is not None:
- builds.append(rfs)
- return builds
-
def latest_rfs(url, limit=7):
'''
Returns a tuple of (builddate, url)
@@ -68,9 +48,9 @@
# only analyze the last few builds
links = list_links(url, r'<a\s*href=[\'|"](\d+)\/[\'"].*?>')[:limit]
for link in sorted(links, reverse=True):
- builds = list_rfs_builds(url, link)
- if len(builds) > 0:
- return (link, builds[0])
+ build = list_rfs('%s/%s' %(url, link))
+ if build is not None:
+ return (link, build)
return None