~brian-murray/ubuntu-archive-tools/add-release-tasks

« back to all changes in this revision

Viewing changes to retry-autopkgtest-regressions

  • Committer: Martin Pitt
  • Date: 2016-03-04 07:00:06 UTC
  • Revision ID: martin.pitt@canonical.com-20160304070006-e7l33fmm9ai2pnl7
retry-autopkgtest-regressions: Use argparse

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
23
23
# USA
24
24
 
25
 
import os
26
25
import urllib.request
 
26
import argparse
27
27
import yaml
28
28
 
29
 
release = 'xenial'
30
 
excuses_url = 'http://people.canonical.com/~ubuntu-archive/proposed-migration/%s/update_excuses.yaml' % release
31
 
 
32
 
 
33
 
def get_regressions():
 
29
default_series = 'xenial'
 
30
args = None
 
31
 
 
32
 
 
33
def parse_args():
 
34
    parser = argparse.ArgumentParser('Generate run-autopkgtest commands to re-run regressions')
 
35
    parser.add_argument('-s', '--series', default=default_series,
 
36
                        help='Ubuntu series (default: %(default)s')
 
37
    parser.add_argument('--all-proposed', action='store_true',
 
38
                        help='generate run-autopkgtest commands with '
 
39
                        '--all-proposed, i. e. with disabling apt pinning')
 
40
    return parser.parse_args()
 
41
 
 
42
 
 
43
def get_regressions(excuses_url, release):
34
44
    '''Return dictionary with regressions
35
45
 
36
46
    Return dict: release → arch → pkg → [trigger, ...]
51
61
    return regressions
52
62
 
53
63
 
54
 
def get_rerun_map(regressions):
 
64
def get_rerun_map(regressions, release):
55
65
    '''Return dictionary with tests to re-run
56
66
 
57
67
    Return dict: release → arch →  trigger_args → pkgs
78
88
    return rerun_map
79
89
 
80
90
 
 
91
args = parse_args()
 
92
 
81
93
extra_opts = ''
82
 
if 'ALL_PROPOSED' in os.environ:
 
94
if args.all_proposed:
83
95
    extra_opts += '--all-proposed '
84
96
 
85
 
regressions = get_regressions()
86
 
rerun_map = get_rerun_map(regressions)
 
97
excuses_url = 'http://people.canonical.com/~ubuntu-archive/proposed-migration/%s/update_excuses.yaml' % args.series
 
98
regressions = get_regressions(excuses_url, args.series)
 
99
rerun_map = get_rerun_map(regressions, args.series)
87
100
for release, archmap in rerun_map.items():
88
101
    for arch, trigmap in archmap.items():
89
102
        for trigger_args, pkgs in trigmap.items():