Merge lp:~mabac/svammel/bug-749560-dont-hardcode-arch-tags into lp:svammel

Proposed by Mattias Backman
Status: Merged
Merged at revision: 81
Proposed branch: lp:~mabac/svammel/bug-749560-dont-hardcode-arch-tags
Merge into: lp:svammel
Diff against target: 159 lines (+32/-32)
5 files modified
bug_reporting.py (+3/-10)
config.py (+15/-0)
data_parsing.py (+1/-4)
file-failures.py (+10/-2)
tests/test_fail_filer.py (+3/-16)
To merge this branch: bzr merge lp:~mabac/svammel/bug-749560-dont-hardcode-arch-tags
Reviewer Review Type Date Requested Status
James Westby (community) Approve
Matthias Klose Pending
Review via email: mp+56535@code.launchpad.net

Description of the change

Hi,

This branch add the possibility to specify bug tags and architectures on the command line.

If none of these are specified it will default to the values in the original requirements. That is checking for failures on 'armel' that have succeded on 'i386' or 'amd64' and to set the tags 'ftbfs' and 'arm-porting-queue'.

It is possible to just specify the option for target-arch and leave reference-arch to the defaults, or the other way around.

Thanks,

Mattias

To post a comment you must log in.
86. By Mattias Backman

Fix long line.

Revision history for this message
James Westby (james-w) wrote :

Hi,

This looks good to me, thanks.

Two minor points. It's not possible to have no tags on the bugs with this
scheme, but I don't think that's a great loss.

Secondly, could you use a default argument to the Option creation, rather
than using the conditionals later?

Thanks,

James

review: Approve
Revision history for this message
Mattias Backman (mabac) wrote :

> Two minor points. It's not possible to have no tags on the bugs with this
> scheme, but I don't think that's a great loss.

Yeah, I thought that having the original tags as default would be less intrusive to Steve at the moment. To make the script really generic I think that there should be no default tags or architectures. Specifying no tags should mean to not set tags and the arch options should be required. As implemented now, it's still an arm bug filer with the option to override that.

> Secondly, could you use a default argument to the Option creation, rather
> than using the conditionals later?

I tried to do that. Having a default for an 'append' type option made the specified tag be appended to the default list. I would have wanted the default list only when no --bugtag was specified.

It would be possible for the --target-arch option though since that's not appending to a list, but then I'd have different handling of defaults for the two arch options.

Thanks,

Mattias

Revision history for this message
James Westby (james-w) wrote :

On Wed, 06 Apr 2011 12:46:37 -0000, Mattias Backman <email address hidden> wrote:
> Yeah, I thought that having the original tags as default would be less
> intrusive to Steve at the moment. To make the script really generic I
> think that there should be no default tags or
> architectures. Specifying no tags should mean to not set tags and the
> arch options should be required. As implemented now, it's still an arm
> bug filer with the option to override that.

Yeah, I think that's ok reasoning.

>
> > Secondly, could you use a default argument to the Option creation, rather
> > than using the conditionals later?
>
> I tried to do that. Having a default for an 'append' type option made
> the specified tag be appended to the default list. I would have wanted
> the default list only when no --bugtag was specified.

That's unexpected. I'm happy with what you've done then.

Thanks,

James

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bug_reporting.py'
2--- bug_reporting.py 2011-03-22 10:17:01 +0000
3+++ bug_reporting.py 2011-04-06 10:06:35 +0000
4@@ -46,16 +46,9 @@
5 return bug
6
7
8-def bug_already_filed(package_name, lp):
9- """ Check to see if this project already has an active bug."""
10- project_url = get_project_url(package_name, lp)
11- return bug_already_filed_by_url(project_url, lp)
12-
13-
14-def bug_already_filed_by_url(project_url, lp):
15- """ Check to see if this project already has an active bug."""
16-
17- dupe_tags = ['ftbfs', 'arm-porting-queue']
18+def bug_already_filed_by_url(project_url, dupe_tags, lp):
19+ """ Check to see if this project already has an active bug."""
20+
21 project = lp.load(project_url)
22
23 # Should tags_combinator be 'Any'? Assumption now is to determine
24
25=== modified file 'config.py'
26--- config.py 2011-03-22 10:17:01 +0000
27+++ config.py 2011-04-06 10:06:35 +0000
28@@ -120,6 +120,21 @@
29 parser.add_argument(
30 '--logfile', required=False,
31 help="Path to file where reported bugs are logged.")
32+ parser.add_argument(
33+ '--bugtag', required=False, action='append',
34+ help="Specify the tag or multiple tags to be set on all created " \
35+ "bugs. If this is not specified tags default to 'ftbfs', " \
36+ "'arm-porting-queue'.")
37+ parser.add_argument(
38+ '--target-arch', required=False, dest='targetarch',
39+ help="The target architecture to find build failures for. " \
40+ "Defaults to 'armel'.")
41+ parser.add_argument(
42+ '--reference-arch', required=False, action='append',
43+ dest='referencearch',
44+ help="One or more reference architectures. If successful builds " \
45+ "for any of these are found for a package, a bug will not be " \
46+ "filed against that package. Defaults to 'i386', 'amd64'.")
47
48 return parser
49
50
51=== modified file 'data_parsing.py'
52--- data_parsing.py 2011-03-18 10:14:36 +0000
53+++ data_parsing.py 2011-04-06 10:06:35 +0000
54@@ -43,13 +43,10 @@
55 def get_tags_for_fail(fail_data=''):
56 """ Determine cause of failure and tag accordingly. """
57
58- # These are default tags to be set on all bugs.
59- tags = ['ftbfs', 'arm-porting-queue']
60-
61+ tags = []
62 if fail_data != '':
63 # Process build log contents to determine extra tags
64 pass
65-
66 return tags
67
68
69
70=== modified file 'file-failures.py'
71--- file-failures.py 2011-03-23 08:25:30 +0000
72+++ file-failures.py 2011-04-06 10:06:35 +0000
73@@ -47,6 +47,9 @@
74 parser = get_args_parser()
75 args = parser.parse_args()
76 set_verbose_messages(args.verbose)
77+standard_bug_tags = ['ftbfs', 'arm-porting-queue']
78+if args.bugtag is not None:
79+ standard_bug_tags = args.bugtag
80
81 init(args.serviceroot, 'testing', '~/.launchpadlib/cache/')
82
83@@ -54,6 +57,10 @@
84 fail_platform = 'armel'
85 # unless there's a failed build for any of these:
86 ok_platforms = ['i386', 'amd64']
87+if args.targetarch is not None:
88+ fail_platform = args.targetarch
89+if args.referencearch is not None:
90+ ok_platforms = args.referencearch
91
92 try:
93 interesting_spph = get_build_status(args.archive, args.series,
94@@ -66,7 +73,7 @@
95 bug_log = Log(args.logfile)
96 for spph in interesting_spph:
97
98- if bug_already_filed_by_url(spph.url, get_launchpad()):
99+ if bug_already_filed_by_url(spph.url, standard_bug_tags, get_launchpad()):
100 print_message("There's already a bug report for %s version %s." % \
101 (spph.package_name, spph.version))
102 continue
103@@ -85,7 +92,8 @@
104 print "%s build log not available for %s version %s." % \
105 (fail_platform, spph.package_name, spph.version)
106 build_log = ''
107- bug_tags = get_tags_for_fail(build_log)
108+ bug_tags = standard_bug_tags
109+ bug_tags.extend(get_tags_for_fail(build_log))
110 interesting_log_part = get_interesting_part(build_log)
111
112 bug_title = '%s version %s failed to build on %s' % \
113
114=== modified file 'tests/test_fail_filer.py'
115--- tests/test_fail_filer.py 2011-03-01 11:50:47 +0000
116+++ tests/test_fail_filer.py 2011-04-06 10:06:35 +0000
117@@ -43,23 +43,10 @@
118 def setUp(self):
119 super(TestBugTags, self).setUp()
120
121- def test_default_tag_ftbfs(self):
122- """ All bugs should get this tag. """
123- tags = get_tags_for_fail("Dummy tag data")
124- self.assertIn('ftbfs', tags)
125-
126- def test_default_tag_arm_porting_queue(self):
127- """ All bugs should get this tag. """
128- tags = get_tags_for_fail("Dummy tag data")
129- self.assertIn('arm-porting-queue', tags)
130-
131 def test_no_match_no_extra_tag(self):
132 """ This will not match, so should only get default tags. """
133 tags = get_tags_for_fail("This will never trigger matcher.")
134- self.assertIn('ftbfs', tags)
135- self.assertIn('arm-porting-queue', tags)
136- self.assertFalse(len(tags) > 2,
137- msg='Got more than default tags without match.')
138+ self.assertEquals([], tags)
139
140
141 #class TestLaunchpadProject(TestCaseWithFixtures):
142@@ -91,7 +78,7 @@
143 return ['something here']
144 return MockProject()
145
146- self.assertTrue(bug_already_filed_by_url('https://dummy',
147+ self.assertTrue(bug_already_filed_by_url('https://dummy', [],
148 MockLaunchpad()))
149
150 def test_duplicate_does_not_exist(self):
151@@ -103,7 +90,7 @@
152 return []
153 return MockProject()
154
155- self.assertFalse(bug_already_filed_by_url('https://dummy',
156+ self.assertFalse(bug_already_filed_by_url('https://dummy', [],
157 MockLaunchpad()))
158
159 # def test_file_bug(self):

Subscribers

People subscribed via source and target branches