~james-w/udd/storm-sqlite

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
#!/usr/bin/python

import optparse
import os
import sys

sys.path.insert(0, os.path.dirname(__file__))
import icommon

parser = optparse.OptionParser()
parser.add_option('--reset', help="Reset all other branches to None",
        action="store_true", dest="reset")
parser.add_option('--remove', help="Remove the official link",
        action="store_true", dest="remove")
options, args = parser.parse_args()

lp = icommon.get_lp()

bstore = icommon.BranchStore(args[0], lp, "")

distro = 'ubuntu'

if not options.remove:
    bstore._set_official_direct(distro,
            lp.distributions[distro].current_series.name, 'release',
            lp.branches.getByUrl(url=args[1]).self_link)
else:
    bstore._set_official_direct(distro,
            lp.distributions[distro].current_series.name, 'release', None)

if options.reset:
    for distro in ('ubuntu', 'debian'):
        releases = icommon.lp_distro_releases[distro]
        for release in releases:
            for pocket in icommon.distro_pockets[distro]:
                if (release == lp.distributions[distro].current_series.name
                        and pocket == "release"):
                    continue
                bstore._set_official_direct(distro, release, pocket,
                        None)