build: generate UI before building distributions
What changed, and why it matters
This commit changes the build scripts for a Bitcoin hardware wallet interface tool. It makes sure graphical user interface (GUI) files are freshly generated before building installable packages, and adds a check that the generated package list stays consistent. There is no direct security bug being fixed here; it is a build-hygiene improvement meant to prevent packaging mistakes that could, in theory, lead to missing or inconsistent files in released software.
No urgent action is required. Treat this as a normal build-maintenance commit. Reviewers may optionally verify that the generated `setup.py` and `ui_*.py` files are deterministic and that the new CI check passes on all supported platforms.
Security signals we found
Build reproducibility / packaging consistency improvement
Stale generated UI artifacts are now removed before regeneration
CI check added to detect unstable generated setup.py
No direct vulnerability, exploit primitive, or weakness is present in the diff
Evidence from the diff
The patch modifies CI and build helper scripts. build_dist.sh now runs contrib/generate-ui.sh when building with GUI support. generate-ui.sh now deletes stale ui_*.py files before regenerating them from .ui files. generate_setup.sh also regenerates UI modules before building the source distribution, so Poetry can reliably detect hwilib.ui as a package. CI verifies that setup.py remains stable after regeneration. These are build reproducibility and packaging consistency fixes, not a patch for an exploitable runtime vulnerability.
Changed components
contrib/build_dist.shcontrib/generate-ui.shcontrib/generate_setup.sh.github/workflows/ci.ymlInspect captured patch +7 / −1
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 10e2c51..d4eb98d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -95,6 +95,9 @@ jobs:
git config --global --add safe.directory ${{ github.workspace }}
contrib/build_bin.sh
contrib/build_dist.sh
+ # Verify setup.py regeneration is stable after generating GUI artifacts.
+ contrib/generate_setup.sh
+ git diff --exit-code -- setup.py
find dist -type f -exec sha256sum {} \;
"
@@ -242,4 +245,3 @@ jobs:
with:
device: keepkey
runs-on: ubuntu-latest
-
diff --git a/contrib/build_dist.sh b/contrib/build_dist.sh
index e15b9e5..8b0b50c 100755
--- a/contrib/build_dist.sh
+++ b/contrib/build_dist.sh
@@ -14,6 +14,7 @@ gui_support="${1:---with-gui}";
# Setup poetry and install the dependencies
if [[ $gui_support == "--with-gui" ]]; then
poetry install -E qt
+ poetry run contrib/generate-ui.sh
else
poetry install
fi
diff --git a/contrib/generate-ui.sh b/contrib/generate-ui.sh
index 9fc982e..8b66096 100755
--- a/contrib/generate-ui.sh
+++ b/contrib/generate-ui.sh
@@ -3,6 +3,7 @@
set -ex
pushd hwilib/ui
+rm -f ui_*.py
for file in *.ui
do
gen_file=ui_`echo $file| cut -d. -f1`.py
diff --git a/contrib/generate_setup.sh b/contrib/generate_setup.sh
index 3e3424d..6046ffe 100755
--- a/contrib/generate_setup.sh
+++ b/contrib/generate_setup.sh
@@ -5,6 +5,8 @@ set -ex
# Setup poetry and install the dependencies
poetry install -E qt
+# Generate the Python modules so Poetry consistently detects hwilib.ui as a package.
+poetry run contrib/generate-ui.sh
# Build the source distribution
poetry build -f sdist
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.