v30.3-roots.1 · Commit 66: [PATCH 66/68] fix(release): validate notices and reuse proven promotion CI
ci/test/test_runner_release_notices.py
Before: ci/test/test_runner_release_notices.py · After: ci/test/test_runner_release_notices.py
File metadata
index cc48d05fdda5d000038eaf2eeae62112603f8050..09d309554a1384a37a9a8ed2cee75d76bc0862a3 100755
Download original patch · Release notes
Diff rows 1–51 of 51. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
ci/test/test_runner_release_notices.py
CHANGED
|
@@ -52,6 +52,8 @@ class RunnerNoticeTest(unittest.TestCase):
|
|
| 52 |
def execute(*args):
|
| 53 |
if args[0] == 'git':
|
| 54 |
return 'a' * 40
|
|
|
|
|
|
|
| 55 |
return '\n'.join(x.removeprefix('print-') + '=' + values[x.removeprefix('print-')]
|
| 56 |
for x in args if x.startswith('print-'))
|
| 57 |
with patch.object(runner, 'run', side_effect=execute):
|
|
@@ -64,13 +66,40 @@ class RunnerNoticeTest(unittest.TestCase):
|
|
| 64 |
with self.assertRaises(FileNotFoundError):
|
| 65 |
runner.depends_notices(depends, 'aarch64-linux-gnu', self.work / 'missing')
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
def test_source_hash_and_unsafe_member_fail_closed(self):
|
| 68 |
source, checksum = self.archive()
|
| 69 |
with self.assertRaisesRegex(ValueError, 'hash mismatch'):
|
| 70 |
runner.source_notices(source, '0' * 64, self.work / 'bad')
|
| 71 |
-
source, checksum = self.archive('../LICENSE')
|
| 72 |
-
with self.assertRaisesRegex(ValueError, 'Unsafe'):
|
| 73 |
-
runner.source_notices(source, checksum, self.work / 'bad')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
def test_brew_retains_actual_receipt_matching_version_and_source(self):
|
| 76 |
source, checksum = self.archive()
|
|
|
|
| 52 |
def execute(*args):
|
| 53 |
if args[0] == 'git':
|
| 54 |
return 'a' * 40
|
| 55 |
+
if 'print-boost_download_path' in args:
|
| 56 |
+
self.assertIn('--eval=print-boost_download_path: package=boost', args)
|
| 57 |
return '\n'.join(x.removeprefix('print-') + '=' + values[x.removeprefix('print-')]
|
| 58 |
for x in args if x.startswith('print-'))
|
| 59 |
with patch.object(runner, 'run', side_effect=execute):
|
|
|
|
| 66 |
with self.assertRaises(FileNotFoundError):
|
| 67 |
runner.depends_notices(depends, 'aarch64-linux-gnu', self.work / 'missing')
|
| 68 |
|
| 69 |
+
def test_actual_depends_print_uses_selected_package_version(self):
|
| 70 |
+
output = runner.run('make', '--no-print-directory', '-C', str(ROOT / 'depends'),
|
| 71 |
+
'HOST=x86_64-linux-gnu',
|
| 72 |
+
'--eval=print-boost_download_path: package=boost',
|
| 73 |
+
'print-boost_version', 'print-boost_download_path')
|
| 74 |
+
values = dict(line.split('=', 1) for line in output.splitlines())
|
| 75 |
+
self.assertEqual(values['boost_download_path'],
|
| 76 |
+
'https://github.com/boostorg/boost/releases/download/boost-' + values['boost_version'])
|
| 77 |
+
|
| 78 |
def test_source_hash_and_unsafe_member_fail_closed(self):
|
| 79 |
source, checksum = self.archive()
|
| 80 |
with self.assertRaisesRegex(ValueError, 'hash mismatch'):
|
| 81 |
runner.source_notices(source, '0' * 64, self.work / 'bad')
|
| 82 |
+
for name in ('../LICENSE', '/LICENSE', 'source/C:/LICENSE', 'source\\LICENSE'):
|
| 83 |
+
source, checksum = self.archive(name)
|
| 84 |
+
with self.assertRaisesRegex(ValueError, 'Unsafe'):
|
| 85 |
+
runner.source_notices(source, checksum, self.work / 'bad')
|
| 86 |
+
|
| 87 |
+
def test_irrelevant_systemtap_manpage_names_are_not_written_or_followed(self):
|
| 88 |
+
source = self.work / 'systemtap.tar'
|
| 89 |
+
with tarfile.open(source, 'w') as out:
|
| 90 |
+
for name in ('systemtap-4.8/COPYING',
|
| 91 |
+
'systemtap-4.8/doc/man3/function::HZ.3stap',
|
| 92 |
+
'../irrelevant-test-data', '/absolute-test-data'):
|
| 93 |
+
entry = tarfile.TarInfo(name)
|
| 94 |
+
entry.size = 7
|
| 95 |
+
out.addfile(entry, io.BytesIO(b'license'))
|
| 96 |
+
link = tarfile.TarInfo('systemtap-4.8/LICENSE-link')
|
| 97 |
+
link.type = tarfile.SYMTYPE
|
| 98 |
+
link.linkname = '/outside/LICENSE'
|
| 99 |
+
out.addfile(link)
|
| 100 |
+
files = runner.source_notices(source, runner.sha256(source), self.work / 'selected')
|
| 101 |
+
self.assertEqual([p.relative_to(self.work / 'selected').as_posix() for p in files],
|
| 102 |
+
['systemtap-4.8/COPYING'])
|
| 103 |
|
| 104 |
def test_brew_retains_actual_receipt_matching_version_and_source(self):
|
| 105 |
source, checksum = self.archive()
|