Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 4 additions & 1 deletion docs/recipe-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ The following values are accepted:

Name | Meaning
--------|-------------------------------------------------------------------------
`rmall` | Packages which work on all reMarkable devices without modification.
`rmall` | Packages which work on all reMarkable devices without modification. These packages must be cpu architecture independent, which generally means that they do not contain binaries, only scripts and configuration files.
`rm1` | Packages requiring reMarkable 1-specific resources or compilation flags.
`rm2` | Packages requiring reMarkable 2-specific resources or compilation flags.
`rmpp` | Packages requiring reMarkable Paper Pro-specific resources or compilation flags.

For example, use `archs=(rm1)` for a package that only works on reMarkable 1, or `archs=(rm1 rm2)` for a package that works both on reMarkable 1 and reMarkable 2 but needs different dependencies or compilation flags for each of those.

Expand Down Expand Up @@ -230,6 +231,8 @@ Should match the upstream name as closely as possible.
The `build()` function runs in the context of a Docker container with the chosen `image`.
This function has access to all the metadata variables declared above, plus the `$arch` variable which contains the name of the architecture the recipe is currently being built for.
The working directory is `$srcdir`, which is populated with all the sources declared in `sources`.
If you are going to build aarch64 binaries, you must switch to suitable environment variables by sourcing `/opt/x-tools/switch-aarch64.sh`.
If you need to go back to ARMv7, you can source `/opt/x-tools/switch-arm.sh`.

### Package Section

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[project]
name = "toltecmk"
version = "0.3.7"
version = "0.4.0"
authors = [
{ name="Mattéo Delabre", email="[email protected]" },
{ name="Eeems", email="[email protected]" },
{ name="Noa Himesaka", email="[email protected]" },
]
description = "Build system used for the Toltec community repository"
requires-python = ">=3.11"
Expand Down
25 changes: 24 additions & 1 deletion tests/recipe_parsers/test_installdepends.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_installdepends(self) -> None:
with open(path.join(rec_path, "package"), "w") as rec_def_file:
rec_def_file.write(
"""
archs=(rmall rmallos2 rmallos3 rm1 rm1os2 rm1os3 rm2 rm2os2 rm2os3)
archs=(rmall rmallos2 rmallos3 rm1 rm1os2 rm1os3 rm2 rm2os2 rm2os3 rmpp rmppos3)
pkgnames=(toltec-base)
pkgdesc="Metapackage defining the base set of packages in a Toltec install"
url=https://toltec-dev.org/
Expand All @@ -49,6 +49,8 @@ def test_installdepends(self) -> None:
installdepends_rm1os3=(open-remarkable-shutdown)
installdepends_rm2os2=(rm2-suspend-fix)
installdepends_rm2os3=(rm2-suspend-fix)
installdepends_rmpp=(rmpp-make-root-rw)
installdepends_rmppos3=(rmpp-make-root-rw)

image=base:v2.1
source=("https://example.org/toltec/${pkgnames[0]}/release-${pkgver%-*}.zip")
Expand Down Expand Up @@ -80,6 +82,7 @@ def test_installdepends(self) -> None:
Dependency(DependencyKind.HOST, "open-remarkable-shutdown")
]
rm2_depends = [Dependency(DependencyKind.HOST, "rm2-suspend-fix")]
rmpp_depends = [Dependency(DependencyKind.HOST, "rmpp-make-root-rw")]

recipes = parse_recipe(rec_path)

Expand All @@ -95,6 +98,8 @@ def test_installdepends(self) -> None:
"rm2",
"rm2os2",
"rm2os3",
"rmpp",
"rmppos3",
],
)
recipe = recipes["rmall"]
Expand Down Expand Up @@ -177,3 +182,21 @@ def test_installdepends(self) -> None:
package.installdepends,
set(basic_depends + rm2_depends),
)

recipe = recipes["rmpp"]
self.assertIs(type(recipe), Recipe)
package = recipe.packages["toltec-base"]
self.assertEqual(list(recipe.packages.keys()), ["toltec-base"])
self.assertEqual(
package.installdepends,
set(basic_depends + rmpp_depends),
)

recipe = recipes["rmppos3"]
self.assertIs(type(recipe), Recipe)
package = recipe.packages["toltec-base"]
self.assertEqual(list(recipe.packages.keys()), ["toltec-base"])
self.assertEqual(
package.installdepends,
set(basic_depends + rmpp_depends),
)
19 changes: 14 additions & 5 deletions toltec/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,15 @@ def _build(self, recipe: Recipe, src_dir: str) -> None:
)

if host_deps:
opkg_conf_path = "$SYSROOT/etc/opkg/opkg.conf"
opkg_conf_path = "$SYSROOT_AARCH64/etc/opkg/opkg.conf" if recipe.arch.startswith('rmpp') else "$SYSROOT/etc/opkg/opkg.conf"
opkg_exec = "opkg-aarch64" if recipe.arch.startswith('rmpp') else "opkg"

pre_script.extend(
(
'echo -n "dest root /',
"arch all 100",
"arch armv7-3.2 160",
"src/gz entware https://bin.entware.net/armv7sf-k3.2",
f"arch {'aarch64-3.10' if recipe.arch.startswith('rmpp') else 'armv7-3.2'} 160",
f"src/gz entware https://bin.entware.net/{'aarch64-k3.10' if recipe.arch.startswith('rmpp') else 'armv7sf-k3.2'}",
"arch rmall 200",
"src/gz toltec-rmall file:///repo/rmall",
f'" > "{opkg_conf_path}"',
Expand All @@ -340,12 +342,19 @@ def _build(self, recipe: Recipe, src_dir: str) -> None:

pre_script.extend(
(
"opkg update --verbosity=0",
"opkg install --verbosity=0 --no-install-recommends"
f"{opkg_exec} update --verbosity=0",
f"{opkg_exec} install --verbosity=0 --no-install-recommends"
" -- " + " ".join(host_deps),
)
)

if recipe.arch.startswith('rmpp'):
pre_script.extend(
(
"source /opt/x-tools/switch-aarch64.sh"
)
)

logs = bash.run_script_in_container(
self.docker,
image=self.IMAGE_PREFIX + recipe.image,
Expand Down
Loading