Skip to content

Commit 39ffa7d

Browse files
committed
Revert "package: Expand "*" to empty if it matches CC"
This reverts commit 2e079dd. Signed-off-by: Matt Turner <mattst88@gentoo.org>
1 parent ce5c104 commit 39ffa7d

4 files changed

Lines changed: 14 additions & 46 deletions

File tree

nattka/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,7 @@ def sanity_check(self) -> int:
713713
if (('*' in b.atoms or '^' in b.atoms)
714714
and (arches_cced or cc_arches)):
715715
try:
716-
expanded_plist = expand_package_list(
717-
repo, b, cc_arches or b.cc)
716+
expanded_plist = expand_package_list(repo, b)
718717
except ExpandImpossible:
719718
pass
720719

nattka/package.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,21 +376,18 @@ def match_package_list(repo: UnconfiguredTree,
376376

377377
def expand_package_list(repo: UnconfiguredTree,
378378
bug: BugInfo,
379-
target_cc: typing.Iterable[str],
380379
) -> str:
381380
"""
382381
Expand `*` and `^` entries in package list
383382
384383
`repo` is the repository, `bug` is the original bug to work on.
385-
`target_cc` specifies expected CC list (to simplify "*"). Returns
386-
new package list contents.
384+
Returns new package list contents.
387385
388386
Note that this function assumes that match_package_list() has been
389387
called already, and did not raise any exceptions, i.e. that the bug
390388
is known to have a valid package list.
391389
"""
392390

393-
target_cc = frozenset(target_cc)
394391
ret = ''
395392
prev_kw = None
396393
for line in bug.atoms.splitlines(keepends=True):
@@ -418,13 +415,9 @@ def expand_package_list(repo: UnconfiguredTree,
418415
pkg = select_best_version(m)
419416
cur_kw = []
420417
elif w == '*':
421-
assert target_cc
422418
match_keywords = get_suggested_keywords(
423419
repo, pkg, bug.category == BugCategory.STABLEREQ)
424-
if target_cc == set(f'{x}@gentoo.org'
425-
for x in match_keywords):
426-
w = ''
427-
elif match_keywords:
420+
if match_keywords:
428421
w = ' '.join(
429422
sorted(match_keywords, key=keyword_sort_key))
430423
else:

test/test_integration.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,8 +1588,8 @@ def test_sanity_expand_plist_cc_arches(self, bugz):
15881588
bugz_inst.update_status.assert_called_with(
15891589
560322, True, None,
15901590
cc_add=['amd64@gentoo.org', 'hppa@gentoo.org', 'foo@example.com'],
1591-
new_package_list=['test/mixed-keywords-3 \r\n'
1592-
'test/amd64-testing-2 \r\n'])
1591+
new_package_list=['test/mixed-keywords-3 amd64 hppa\r\n'
1592+
'test/amd64-testing-2 amd64 hppa\r\n'])
15931593
self.post_verify()
15941594

15951595
@patch('nattka.__main__.NattkaBugzilla')
@@ -1633,8 +1633,8 @@ def test_sanity_expand_plist_after_cc(self, bugz):
16331633
bugz_inst.find_bugs.assert_called_with(bugs=[560322])
16341634
bugz_inst.update_status.assert_called_with(
16351635
560322, True, None,
1636-
new_package_list=['test/mixed-keywords-3 \r\n'
1637-
'test/amd64-testing-2 \r\n'])
1636+
new_package_list=['test/mixed-keywords-3 amd64 hppa\r\n'
1637+
'test/amd64-testing-2 amd64 hppa\r\n'])
16381638
self.post_verify()
16391639

16401640
@patch('nattka.__main__.NattkaBugzilla')

test/test_package.py

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,7 @@ def test_unmodified(self):
819819
'''
820820
self.assertEqual(
821821
expand_package_list(self.repo,
822-
BugInfo(BugCategory.STABLEREQ, data),
823-
['amd64@gentoo.org', 'hppa@gentoo.org']),
822+
BugInfo(BugCategory.STABLEREQ, data)),
824823
data)
825824

826825
def test_asterisk_streq(self):
@@ -836,8 +835,7 @@ def test_asterisk_streq(self):
836835
'''
837836
self.assertEqual(
838837
expand_package_list(self.repo,
839-
BugInfo(BugCategory.STABLEREQ, data),
840-
['hppa@gentoo.org']),
838+
BugInfo(BugCategory.STABLEREQ, data)),
841839
expect)
842840

843841
def test_asterisk_kwreq(self):
@@ -853,25 +851,7 @@ def test_asterisk_kwreq(self):
853851
'''
854852
self.assertEqual(
855853
expand_package_list(self.repo,
856-
BugInfo(BugCategory.KEYWORDREQ, data),
857-
['hppa@gentoo.org']),
858-
expect)
859-
860-
def test_asterisk_to_empty(self):
861-
data = '''
862-
test/mixed-keywords-3 *
863-
test/mixed-keywords-4 ^
864-
test/amd64-testing-1 ^
865-
'''
866-
expect = f'''
867-
test/mixed-keywords-3 {""}
868-
test/mixed-keywords-4 {""}
869-
test/amd64-testing-1 {""}
870-
'''
871-
self.assertEqual(
872-
expand_package_list(self.repo,
873-
BugInfo(BugCategory.STABLEREQ, data),
874-
['amd64@gentoo.org', 'hppa@gentoo.org']),
854+
BugInfo(BugCategory.KEYWORDREQ, data)),
875855
expect)
876856

877857
def test_above(self):
@@ -891,8 +871,7 @@ def test_above(self):
891871
'''
892872
self.assertEqual(
893873
expand_package_list(self.repo,
894-
BugInfo(BugCategory.STABLEREQ, data),
895-
['hppa@gentoo.org']),
874+
BugInfo(BugCategory.STABLEREQ, data)),
896875
expect)
897876

898877
def test_above_empty(self):
@@ -906,8 +885,7 @@ def test_above_empty(self):
906885
'''
907886
self.assertEqual(
908887
expand_package_list(self.repo,
909-
BugInfo(BugCategory.STABLEREQ, data),
910-
['hppa@gentoo.org']),
888+
BugInfo(BugCategory.STABLEREQ, data)),
911889
expect)
912890

913891
def test_above_empty_plus_keywords_left(self):
@@ -917,8 +895,7 @@ def test_above_empty_plus_keywords_left(self):
917895
'''
918896
with self.assertRaises(ExpandImpossible):
919897
expand_package_list(self.repo,
920-
BugInfo(BugCategory.STABLEREQ, data),
921-
['hppa@gentoo.org'])
898+
BugInfo(BugCategory.STABLEREQ, data))
922899

923900
def test_above_empty_plus_keywords_right(self):
924901
data = '''
@@ -927,8 +904,7 @@ def test_above_empty_plus_keywords_right(self):
927904
'''
928905
with self.assertRaises(ExpandImpossible):
929906
expand_package_list(self.repo,
930-
BugInfo(BugCategory.STABLEREQ, data),
931-
['hppa@gentoo.org'])
907+
BugInfo(BugCategory.STABLEREQ, data))
932908

933909

934910
class FakeEbuild(object):

0 commit comments

Comments
 (0)