Skip to content

Conversation

@romanz
Copy link
Contributor

@romanz romanz commented Nov 13, 2025

Following #152.

Can be tested with 2.9.1 release by running:

$ nix-shell --run 'python scripts/copy-firmware-jsons.py 2.9.1 -r ../trezor-suite-firmware-release/'

Also removed the old script and pyproject.toml (since dependencies can be installed via Nix).

@romanz romanz self-assigned this Nov 13, 2025
@romanz
Copy link
Contributor Author

romanz commented Nov 13, 2025

Pushed 663bbca to handle T1B1 JSONs correctly (since they don't have "translations" key).

Copy link
Contributor

@obrusvit obrusvit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to check, we don't touch the "big" releases.json at the moment, right?

@romanz
Copy link
Contributor Author

romanz commented Nov 14, 2025

Just to check, we don't touch the "big" releases.json at the moment, right?

Correct - following this PR, releases.json won't be updated.
Is it OK?

CC: @karliatto

@romanz
Copy link
Contributor Author

romanz commented Nov 14, 2025

It seems that some of this repository automation works only with releases.json:

.github/workflows/check_releases.yml
17:  releases-json-integrity-check:
18:    name: releases.json integrity check
23:      - name: Check releases.json files changes
24:        run: ./scripts/run-releases-json-for-all-devices.sh
26:        run: ./scripts/check-firmware-presence-in-releases-json-separated.sh
34:      - name: Check releases.json files changes
39:            releases-json:
40:              - 'firmware/t1b1/releases.json'
41:              - 'firmware/1/releases.json'
42:              - 'firmware/t2t1/releases.json'
43:              - 'firmware/2/releases.json'
44:        if: steps.changes.outputs.releases-json == 'true'
45:      - name: Check releases.json revisions

check_releases.py
52:    releases_file = os.path.join(model_dir, "releases.json")
56:        print(f"Skipped, no releases.json or firmware binaries found in the directory.")
60:    releases = json.load(open("firmware/%s/releases.json" % model, "r"))

firmware/README.md
13:File `releases.json` holds metadata related to all available firmware versions. Trezor Suite does not access it directly; instead, it includes a copy of this file with some changes in paths (dropping the `data/` prefix) and with the omission of some properties.

scripts/check-all-firmware-revisions.sh
6:#     Small adjustments are made because here we check releases.json here in data/firmware, not those in trezor-suite/connect-common.

scripts/check-firmware-presence-in-releases-json.sh
35:  # TEST 1: All files in releases.json exist
37:  files_in_releases_json=$(extract_file_paths_from_json "$json_file")
40:  for file in $files_in_releases_json; do
52:  # TEST 2: All files in directory are in releases.json
55:  full_path_actual_files=$(for i in $actual_files; do echo "data/firmware/${DEVICE}/${i}"; done) # Prefixed to match the expected format in releases.json
56:  extra_files=$(comm -13 <(echo "$files_in_releases_json") <(echo "$full_path_actual_files"))
66:json_file=$PARENT_PATH"/../firmware/"$DEVICE/"releases.json"
72:    echo "Skipped, no releases.json or firmware binaries found in the directory."

scripts/check-firmware-revisions.sh
6:#     Small adjustments are made because here we check releases.json here in data/firmware, not those in trezor-suite/connect-common.
57:# with new format, we only check it for legacy `releases.json`. For the rest we check it for both formats.
59:  DATA=$(jq -r '.[] | .version |= join(".") | .firmware_revision + "%" + .version' < "$RELEASES_FOLDER/$DEVICE"/releases.json)
62:    jq -r '.[] | .version |= join(".") | .firmware_revision + "%" + .version' < "$RELEASES_FOLDER/$DEVICE"/releases.json

scripts/run-releases-json-for-all-devices.sh
8:        if ! ./scripts/check-firmware-presence-in-releases-json.sh "$DEVICE_MODEL" ; then

@romanz
Copy link
Contributor Author

romanz commented Nov 14, 2025

It is also used by some scripts at https://github.com/trezor/trezor-firmware:

$ git grep releases.json
.github/workflows/release-emu.yml:      - name: Get models from releases.json
.github/workflows/release-emu.yml:            MODELS=$(jq -cr --arg version "$VERSION" '.firmware[$version]' ./common/releases.json)
.github/workflows/release-emu.yml:            MODELS=$(jq -cr --arg version "$VERSION" '.firmware[$version]' ./common/releases.json)
common/tools/coin_info.py:RELEASES_URL = "https://data.trezor.io/firmware/{}/releases.json"
docs/legacy/index.md:1. Pick version of firmware binary listed on https://data.trezor.io/firmware/1/releases.json
python/helper-scripts/bump-required-fw-versions.py:RELEASES_URL = "https://data.trezor.io/firmware/{}/releases.json"
python/src/trezorlib/cli/firmware.py:    url = f"https://data.trezor.io/firmware/{model.internal_name.lower()}/releases.json"

@karliatto
Copy link
Member

Just to check, we don't touch the "big" releases.json at the moment, right?

Correct - following this PR, releases.json won't be updated. Is it OK?

CC: @karliatto

Yes, we do not use releases.json anymore in new versions of Suite. So we just keep them as they are for old versions of Suite, but no necessary to update them from Suite side.

@romanz
Copy link
Contributor Author

romanz commented Nov 17, 2025

Let's keep the releases.json for now, since it's not too hard to update it (124b573).

@romanz romanz requested review from mmilata and obrusvit November 17, 2025 09:39
shell.nix Outdated
git
python39
nodePackages.prettier
python313Packages.click
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
python313Packages.click
python3Packages.click

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might even go as far as (python3.withPackages (p: [ p.click ])) but it can wait until we need second dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3556279, thanks :)

@romanz
Copy link
Contributor Author

romanz commented Nov 18, 2025

Rebasing over master.

@romanz romanz force-pushed the romanz/copy-script branch from 77043b3 to 9600731 Compare November 18, 2025 14:45
mmilata
mmilata previously approved these changes Nov 18, 2025
Copy link
Member

@mmilata mmilata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@romanz
Copy link
Contributor Author

romanz commented Nov 18, 2025

Tested by reproducing the last two releases using:

$ python scripts/copy-firmware-jsons.py 2.9.3
$ python scripts/copy-firmware-jsons.py 2.9.1

@romanz romanz force-pushed the romanz/copy-script branch from 3556279 to cdf7cf9 Compare November 18, 2025 17:39
@romanz
Copy link
Contributor Author

romanz commented Nov 18, 2025

@vdovhanych vdovhanych merged commit 30fb343 into master Nov 19, 2025
3 checks passed
@vdovhanych vdovhanych deleted the romanz/copy-script branch November 19, 2025 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants