Ubuntu Pastebin

Paste from rbalint at Mon, 10 Apr 2017 21:40:11 +0000

Download as text
 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/python3

# autopkgtest rerun link generator considering extra dependencies
# usage:
# wget http://people.canonical.com/~ubuntu-archive/proposed-migration/zesty/update_excuses.yaml
# autopkgtest-triggers.py < update_excuses.yaml


import urllib.parse
import yaml
import sys


def url_quote(string):
    """URL-encode package/version string"""
    return urllib.parse.quote_plus(string).replace("/","%2F")

def rerun_link(package, arch, triggers):
    """Create linkk for restarting autopkgtest for a given package, architecture with the list of trigger packages"""
    link = "https://autopkgtest.ubuntu.com/request.cgi?release=zesty&arch=" + arch + "&package=" + url_quote(package)
    for trigger in triggers:
        link += "&trigger=" + url_quote(trigger)
    return link


def main():
    # extra dependencies to add for re-runs
    extra_deps = {'r-bioc-annotationhub/2.6.4-1' : ['r-bioc-genomeinfodb/1.10.3-1']}

    data_loaded = yaml.load(sys.stdin)
    for pkg in data_loaded['sources']:
        if not pkg['is-candidate'] and 'autopkgtest' in pkg['reason']:
            for rdep, results in pkg['policy_info']['autopkgtest'].items():
                regressions = [ arch for arch, arch_res in results.items() if arch_res[0] == 'REGRESSION']
                if len(regressions) > 0 and rdep in extra_deps.keys():
                    for arch in regressions:
                        print(rerun_link(rdep, arch, [pkg['source'] + "/" + pkg['new-version']] + extra_deps[rdep]))
                                                                        
if __name__ == "__main__":
    main()
Download as text