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

Add sanity check #2

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
40 changes: 20 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
uses: arduino/setup-protoc@v3
with:
version: "25.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout the Git repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
uses: arduino/setup-protoc@v3
with:
version: "25.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout the Git repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -139,39 +141,31 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Build with nuitka
run: |
docker run \
--rm \
--platform=linux/arm/v7 \
-v "${src_path}":/src \
eeems/nuitka-arm-builder:bullseye-3.11 \
bash -ec "$script" \
set -e
./make_for_remarkable.sh portable \
| while read -r line; do
if [[ "$line" == 'Nuitka'*':ERROR:'* ]]; then
if [[ "$line" == 'Nuitka'*':ERROR:'* ]] || [[ "$line" == "ERROR:"* ]]; then
echo "::error file=${{ steps.args.outputs.main_file }},title=Nuitka Error::$line"
elif [[ "$line" == 'Nuitka'*':WARNING:'* ]]; then
elif [[ "$line" == 'Nuitka'*':WARNING:'* ]] || [[ "$line" == "WARNING:"* ]]; then
echo "::warning file=${{ steps.args.outputs.main_file }},title=Nuitka Warning::$line"
elif [[ "$line" == 'Nuitka:INFO:'* ]]; then
elif [[ "$line" == 'Nuitka:INFO:'* ]] || [[ "$line" == "INFO:"* ]]; then
echo "$line"
else
echo "::debug::$line"
fi
done
env:
src_path: ${{ github.workspace }}
script: |
apt update
apt install -y \
protobuf-compiler \
libfuse-dev
cp -a /opt/lib/nuitka .venv
source /opt/lib/nuitka/bin/activate
pip install --upgrade pip
make -C /src executable
working-directory: ${{ github.workspace }}
- uses: actions/upload-artifact@v4
with:
name: rmufuse-remarkable
path: dist
if-no-files-found: error
- name: Sanity check
uses: Eeems-Org/run-in-remarkable-action@v1
with:
fw_version: 2.15.1
run: ./rmufuse-portable --help
path: dist
build-wheel:
name: Build wheel with python ${{ matrix.python }}
needs: [test]
Expand All @@ -192,6 +186,7 @@ jobs:
uses: arduino/setup-protoc@v3
with:
version: "25.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install build tool
run: pip install build
- name: Building package
Expand All @@ -217,6 +212,7 @@ jobs:
uses: arduino/setup-protoc@v3
with:
version: "25.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install build tool
run: pip install build
- name: Building package
Expand Down Expand Up @@ -283,6 +279,10 @@ jobs:
name="rmufuse-${{ matrix.artifact }}"
mv rmufuse "$name"
gh release upload "$TAG" "$name" --clobber
elif [ -f rmufuse-portable ]; then
name="rmufuse-${{ matrix.artifact }}"
mv rmufuse-portable "$name"
gh release upload "$TAG" "$name" --clobber
else
find . -type f | xargs -rI {} gh release upload "$TAG" {} --clobber
fi
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,4 @@ cython_debug/
#.idea/
*.orig
.nuitka/
nuitka-crash-report.xml
37 changes: 33 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@ dist/${PACKAGE}-${VERSION}.tar.gz: dist $(OBJ)
dist/${PACKAGE}-${VERSION}-${ABI}-${ABI}-${PLATFORM}.whl: dist $(OBJ)
python -m build --wheel


dist/rmufuse: dist $(VENV_BIN_ACTIVATE) $(OBJ)
. $(VENV_BIN_ACTIVATE); \
python -m pip install --extra-index-url=https://wheels.eeems.codes/ nuitka; \
python -m pip install \
--extra-index-url=https://wheels.eeems.codes/ \
wheel \
nuitka; \
NUITKA_CACHE_DIR="$(realpath .)/.nuitka" \
python -m nuitka \
--enable-plugin=pylint-warnings \
Expand All @@ -97,11 +99,35 @@ dist/rmufuse: dist $(VENV_BIN_ACTIVATE) $(OBJ)
--noinclude-unittest-mode=allow \
--assume-yes-for-downloads \
--python-flag=-m \
--remove-output \
--output-dir=dist \
--remove-output \
--output-filename=rmufuse \
remarkable_update_fuse

dist/rmufuse-portable: dist $(VENV_BIN_ACTIVATE) $(OBJ)
. $(VENV_BIN_ACTIVATE); \
python -m pip install \
--extra-index-url=https://wheels.eeems.codes/ \
wheel \
nuitka; \
NUITKA_CACHE_DIR="$(realpath .)/.nuitka" \
python -m nuitka \
--enable-plugin=pylint-warnings \
--enable-plugin=upx \
--warn-implicit-exceptions \
--onefile \
--lto=yes \
--assume-yes-for-downloads \
--python-flag=-m \
--output-dir=dist \
--remove-output \
--output-filename=rmufuse-portable \
'--include-data-files=$(shell pkgconf --variable=libdir fuse)/libfuse.so=libfuse.so.2' \
'--include-data-files=$(shell pkgconf --variable=libdir libssl)/libssl.so=libssl.so.1' \
'--include-data-files=$(shell pkgconf --variable=libdir libcrypto)/libcrypto.so=libcrypto.so.3' \
remarkable_update_fuse
patchelf --print-needed dist/rmufuse-portable

$(VENV_BIN_ACTIVATE): requirements.txt
@echo "Setting up development virtual env in .venv"
python -m venv .venv
Expand Down Expand Up @@ -141,9 +167,11 @@ test: $(VENV_BIN_ACTIVATE) .venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed $(O
. $(VENV_BIN_ACTIVATE); \
python test.py

executable: $(VENV_BIN_ACTIVATE) dist/rmufuse
executable: dist/rmufuse
dist/rmufuse --help

portable: dist/rmufuse-portable

all: release

lint: $(VENV_BIN_ACTIVATE)
Expand All @@ -168,6 +196,7 @@ format-fix: $(VENV_BIN_ACTIVATE)
clean \
dev \
executable \
portable \
install \
release \
sdist \
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ make sdist # Build sdist package in dist/
make dev # Test mounting 2.15.1.1189 to .venv/mnt
make test # Run automated tests
make install # Build wheel and install it with pipx or pip install --user
make executable # Build a standalone executable
make portable # Build a standalone executable with some extra dependencies embedded
```

### Building for the reMarkable (Or really any linux/arm/v7 device)

The same as above, but use `./make_for_remarkable.sh` instead of `make`. This requires docker to be installed.
24 changes: 24 additions & 0 deletions make_for_remarkable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -e
qemu_arm_flags=$(grep flags: /proc/sys/fs/binfmt_misc/qemu-arm | cut -d' ' -f2)
if ! echo "$qemu_arm_flags" | grep -q F; then
echo "INFO: Enabling linux/arm/v7 docker builds with qmeu"
docker run --privileged --rm tonistiigi/binfmt --install linux/arm/v7
fi
script="
apt update
apt install -y \\
protobuf-compiler \\
libfuse-dev \\
pkgconf
cp -a /opt/lib/nuitka /src/.venv
source /src/.venv/bin/activate
pip install --upgrade pip build
make -C /src \"\$@\"
"
docker run \
--rm \
--platform=linux/arm/v7 \
-v "$(pwd)":/src \
eeems/nuitka-arm-builder:bullseye-3.11 \
bash -ec "$script" -- "$@"
Loading