Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 67: [PATCH 67/68] fix(release): defer expanded dependency notice coverage

ci/test/test_prepare_release.py

Before: ci/test/test_prepare_release.py · After: ci/test/test_prepare_release.py

File metadata
index 5291ba5e9172891476f960294528c670a765daf6..5ed09a1fd970db7e5329d7c4ad7d02c9167c30eb 100755

Download original patch · Release notes

Diff rows 1–75 of 75. 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_prepare_release.py CHANGED
@@ -57,31 +57,18 @@ class PrepareReleaseTest(unittest.TestCase):
57
  for name, data in notice_members.items():
58
  package.writestr(name, data)
59
 
60
- def test_final_gate_rejects_missing_faulty_or_wrong_platform_notices(self):
61
- for fault in ("missing", "faulty-index", "wrong-platform"):
62
- with self.subTest(fault=fault), tempfile.TemporaryDirectory() as temporary_dir:
63
- downloads = Path(temporary_dir) / "downloads"
64
- downloads.mkdir()
65
- archive = downloads / "bitcoin-roots-darwin-arm64.zip"
66
- root = "bitcoin-roots-30.3-roots.1"
67
- self.write_package(archive, root, b"binary", notices=False)
68
- if fault != "missing":
69
- work = Path(temporary_dir)
70
- platform = "darwin-x86_64" if fault == "wrong-platform" else "darwin-arm64"
71
- descriptor = notice_fixtures.ReleaseNoticesTest().descriptor(work, platform)
72
- notice_fixtures.NOTICES.collect(platform, descriptor, work / "collected")
73
- with zipfile.ZipFile(archive, "a") as package:
74
- for file in (work / "collected").rglob("*"):
75
- if file.is_file():
76
- content = b'{}' if fault == "faulty-index" and file.name == "index.json" else file.read_bytes()
77
- package.writestr(f"{root}/notices/{file.relative_to(work / 'collected').as_posix()}", content)
78
- (downloads / "series.patch").write_text("patch\n")
79
- output = Path(temporary_dir) / "output"
80
- result = subprocess.run([SCRIPT, downloads, output, PUBLIC_KEY, "v30.3-roots.1", "1"],
81
- capture_output=True, text=True)
82
- self.assertNotEqual(result.returncode, 0)
83
- self.assertFalse((output / "SHA512SUMS").exists())
84
- self.assertFalse((output / archive.name).exists())
85
 
86
  def test_explicit_assembly_rejects_intermediate_package(self):
87
  with tempfile.TemporaryDirectory() as temporary_dir:
@@ -89,7 +76,7 @@ class PrepareReleaseTest(unittest.TestCase):
89
  downloads = work / "downloaded-artifacts"
90
  downloads.mkdir()
91
  self.write_package(downloads / "bitcoin-roots-linux-x86_64.tar.gz",
92
- "bitcoin-roots-30.3-roots.1", b"binary", notices=False)
93
  (downloads / "series.patch").write_text("patch\n")
94
  result = subprocess.run([SCRIPT, downloads, work / "release-assets", PUBLIC_KEY,
95
  "v30.3-roots.1", "1"], capture_output=True, text=True)
@@ -120,7 +107,7 @@ class PrepareReleaseTest(unittest.TestCase):
120
  subprocess.run(["python3", ARCHIVE_TOOL, "validate", archive, root.name,
121
  "--copying", ROOT / "COPYING"], check=True)
122
 
123
- def test_actual_unix_workflow_stages_notices_and_prepares(self):
124
  lines = (ROOT / ".github/workflows/release.yml").read_text().splitlines()
125
  def packaging_block(name):
126
  start = lines.index(f" - name: {name}")
@@ -149,8 +136,6 @@ class PrepareReleaseTest(unittest.TestCase):
149
  with zipfile.ZipFile(deploy / "Bitcoin-Roots.zip", mode="w") as package:
150
  package.writestr("Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt", b"binary fixture")
151
  block = packaging_block("Stage release package")
152
- descriptor = notice_fixtures.ReleaseNoticesTest().descriptor(work, platform)
153
- notice_fixtures.NOTICES.collect(platform, descriptor, work / "runner/release-notices/notices")
154
  subprocess.run(["bash", "-c", block], cwd=ROOT, env=environment, check=True)
155
  archive = next((work / "runner/release-packages").iterdir())
156
  member = "bitcoin-roots-30.3-roots.1/COPYING"
@@ -163,8 +148,6 @@ class PrepareReleaseTest(unittest.TestCase):
163
  notice = package.read(member)
164
  self.assertEqual(package.read("bitcoin-roots-30.3-roots.1/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt"), b"binary fixture")
165
  self.assertEqual(notice, (ROOT / "COPYING").read_bytes())
166
- subprocess.run(["python3", ROOT / "ci/release/notices.py", "validate", archive,
167
- "bitcoin-roots-30.3-roots.1", platform], check=True)
168
  downloads = work / "assembled-downloads"
169
  downloads.mkdir()
170
  assembled = downloads / archive.name
 
57
  for name, data in notice_members.items():
58
  package.writestr(name, data)
59
 
60
+ def test_final_gate_accepts_canonical_copying_without_dependency_index(self):
61
+ with tempfile.TemporaryDirectory() as temporary_dir:
62
+ downloads = Path(temporary_dir) / "downloads"
63
+ downloads.mkdir()
64
+ archive = downloads / "bitcoin-roots-darwin-arm64.zip"
65
+ self.write_package(archive, "bitcoin-roots-30.3-roots.1", b"binary", notices=False)
66
+ (downloads / "series.patch").write_text("patch\n")
67
+ output = Path(temporary_dir) / "output"
68
+ result = subprocess.run([SCRIPT, downloads, output, PUBLIC_KEY, "v30.3-roots.1", "1"],
69
+ capture_output=True, text=True)
70
+ self.assertEqual(result.returncode, 0, result.stderr)
71
+ self.assertTrue((output / "SHA512SUMS").exists())
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
  def test_explicit_assembly_rejects_intermediate_package(self):
74
  with tempfile.TemporaryDirectory() as temporary_dir:
 
76
  downloads = work / "downloaded-artifacts"
77
  downloads.mkdir()
78
  self.write_package(downloads / "bitcoin-roots-linux-x86_64.tar.gz",
79
+ "bitcoin-roots-30.3-roots.1", b"binary", copying=b"", notices=False)
80
  (downloads / "series.patch").write_text("patch\n")
81
  result = subprocess.run([SCRIPT, downloads, work / "release-assets", PUBLIC_KEY,
82
  "v30.3-roots.1", "1"], capture_output=True, text=True)
 
107
  subprocess.run(["python3", ARCHIVE_TOOL, "validate", archive, root.name,
108
  "--copying", ROOT / "COPYING"], check=True)
109
 
110
+ def test_actual_unix_workflow_stages_copying_without_dependency_index_and_prepares(self):
111
  lines = (ROOT / ".github/workflows/release.yml").read_text().splitlines()
112
  def packaging_block(name):
113
  start = lines.index(f" - name: {name}")
 
136
  with zipfile.ZipFile(deploy / "Bitcoin-Roots.zip", mode="w") as package:
137
  package.writestr("Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt", b"binary fixture")
138
  block = packaging_block("Stage release package")
 
 
139
  subprocess.run(["bash", "-c", block], cwd=ROOT, env=environment, check=True)
140
  archive = next((work / "runner/release-packages").iterdir())
141
  member = "bitcoin-roots-30.3-roots.1/COPYING"
 
148
  notice = package.read(member)
149
  self.assertEqual(package.read("bitcoin-roots-30.3-roots.1/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt"), b"binary fixture")
150
  self.assertEqual(notice, (ROOT / "COPYING").read_bytes())
 
 
151
  downloads = work / "assembled-downloads"
152
  downloads.mkdir()
153
  assembled = downloads / archive.name