1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#!/usr/bin/python
# -*- coding:utf-8 -*-
"""Update gdb snapshots"""
from __future__ import print_function
import distutils.version
import glob
import logging
import re
import shutil
import sys
from common import * # pylint: disable=wildcard-import,unused-wildcard-import
CATEGORY = 'sys-devel'
PN = 'gdb'
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)
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 = 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')
for pkg in new_pkgs - old_pkgs:
logging.info('adding %s', pkg)
ver = get_ver(pkg)
for opkg in old_pkgs:
if '.50.' not in opkg:
continue
over = get_ver(opkg)
if over < ver and over > closest_ver:
closest_ver = over
logging.info(' copying from %s', closest_ver)
ebuild = '%s-%s.ebuild' % (PN, closest_ver)
shutil.copy(ebuild, pkg)
git(['add', pkg])
run_ebuild(pkg, 'fetch')
#run_ebuild(pkg, 'manifest')
# Clean out the old snapshots.
for pkg in ver_sort(old_pkgs - new_pkgs):
if '.50.' not in pkg:
continue
logging.info('cleaning old %s', pkg)
git(['rm', '-f', pkg])
run(['repoman', 'manifest'])
git(['add', 'Manifest'])
if __name__ == '__main__':
main(sys.argv[1:])
|