Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/download emulators #243

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ src/binaries/firmware/repo/
src/binaries/trezord-go/repo/
docker/Dockerfile
docker/compose.yml
tests
docs
.git
.github
.dockerignore
.gitignore
.vscode
.editorconfig
**/__pycache__
**/.mypy_cache
**/.pytest_cache
Makefile
README.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __pycache__
src/binaries/firmware/bin/*
!src/binaries/firmware/bin/download.sh
!src/binaries/firmware/bin/download_latest_gh.py
!src/binaries/firmware/bin/patch_emulators.sh
!src/binaries/firmware/bin/arm
!src/binaries/trezord-go/bin/download.sh
emulator.img
Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ WORKDIR ./trezor-user-env

RUN nix-shell --run "poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR" \
&& nix-shell --run "./src/binaries/firmware/bin/download.sh" \
&& nix-shell --run "./patch_emulators.sh src/binaries/firmware/bin" \
&& nix-shell --run "./src/binaries/trezord-go/bin/download.sh"

CMD nix-shell --run "./run-nix.sh"
2 changes: 1 addition & 1 deletion src/binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,5 @@ def patch_emulators_for_nix(dir_to_patch: str = "") -> None:
That is on purpose, because it might be run in a non-Nix
environment.
"""
cmd = ["./patch_emulators.sh", dir_to_patch]
cmd = ["./src/binaries/firmware/bin/patch_emulators.sh", dir_to_patch]
subprocess.run(cmd, cwd=ROOT_DIR)
12 changes: 9 additions & 3 deletions src/binaries/firmware/bin/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ set -e -o pipefail

SYSTEM_ARCH=$(uname -m)

cd "$(dirname "${BASH_SOURCE[0]}")"
BIN_DIR=$(pwd)
ROOT_DIR=$(pwd)
BIN_DIR=$(dirname $(realpath -s $0))

cd "$BIN_DIR"

# WARNING: this will download the emulators from the latest SUCCESSFULLY run pipeline from trezor-firmware.
# If the pipeline fails, it will download from the previous successful run.
Expand All @@ -29,7 +31,7 @@ else
exit 1
fi

if ! wget --no-config -e robots=off --no-verbose --no-clobber --no-parent --cut-dirs=$CUT_DIRS --no-host-directories --recursive --reject "index.html*" "$SITE"; then
if ! wget --no-config -e robots=off --no-verbose --no-clobber --no-parent --cut-dirs=$CUT_DIRS --no-host-directories --reject "index.html*" "$SITE"; then
echo "Unable to fetch released emulators from $SITE"
echo "You will have only available latest builds from CI"
echo
Expand Down Expand Up @@ -96,3 +98,7 @@ strip trezor-emu-*

# no need for Mac builds
rm -rf macos

cd "$ROOT_DIR"

sh "$BIN_DIR"/patch_emulators.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -e -o pipefail

FILE_DIR="$(dirname "${0}")"
cd ${FILE_DIR}

DIR_TO_PATCH="${1:-src/binaries/firmware/bin}"
DIR_TO_PATCH="${1:-$FILE_DIR}"

echo "Patching ${DIR_TO_PATCH}"

Expand Down
Loading