Skip to content

Commit d1b1653

Browse files
authored
Add preparedepends (#65)
* Add preparedepends * Increment version * Formatting * Fix tests * Use correct image for build and prepare * Fix switch script * Test that preparedepends runs
1 parent 22ab926 commit d1b1653

8 files changed

Lines changed: 163 additions & 88 deletions

File tree

docs/recipe-format.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,29 @@ For example, `build:autotools` and `libvncserver>=0.9.13` are valid dependency s
209209

210210
**Dependencies declared in the `makedepends` field are only satisfied during the build process, not at install time** — see the [`installdepends`](#installdepends-field) below for declaring install-time dependencies.
211211

212+
#### `preparedepends` field
213+
214+
<table>
215+
<tr>
216+
<th>Required?</th>
217+
<td>No, defaults to <code>()</code></th>
218+
</tr>
219+
<tr>
220+
<th>Type</th>
221+
<td>Array of dependency specifications (strings)</td>
222+
</tr>
223+
</table>
224+
225+
The list of Debian, Toltec or Entware packages that are needed to prepare this package.
226+
Dependency specifications have the following format: `[host:|build:]package-name`.
227+
For example, `build:autotools` and `libvncserver>=0.9.13` are valid dependency specifications.
228+
229+
*Build-type dependencies* (prefixed with `build:`) are packages from Debian to install in the container’s root system before the recipe’s build script is executed.
230+
231+
*Host-type dependencies* (prefixed with `host:`) are packages from Toltec or Entware to install in the container’s `$SYSROOT` before the recipe’s build script is executed. The packages are offline-installed (i.e., none of their [install scripts](#install-section) are executed).
232+
233+
**Dependencies declared in the `preparedepends` field are only satisfied during the prepare process, not at install time** — see the [`installdepends`](#installdepends-field) below for declaring install-time dependencies.
234+
212235
#### `pkgnames` field
213236

214237
<table>

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "toltecmk"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
authors = [
55
{ name="Mattéo Delabre", email="git.matteo@delab.re" },
66
{ name="Eeems", email="eeems@eeems.email" },

tests/fixtures/rmkit/package

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ sha256sums=(
2424
SKIP
2525
SKIP
2626
)
27+
preparedepends=(build:rsync)
2728

2829
prepare() {
30+
rsync --help > /dev/null
2931
patch -p1 -d"$srcdir" < "$srcdir"/patch-remux-duplicate-xochitl.diff
3032
patch -p1 -d"$srcdir" < "$srcdir"/patch-remux-start-xochitl.diff
3133
rm "$srcdir"/*.diff

tests/recipe_parsers/test_parser.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def test_basic_recipe(self) -> None:
8080
},
8181
)
8282
self.assertEqual(recipe.makedepends, set())
83+
self.assertEqual(recipe.preparedepends, set())
8384
self.assertEqual(recipe.maintainer, "None <none@example.org>")
8485
self.assertEqual(recipe.image, "base:v2.1")
8586
self.assertEqual(recipe.arch, "rmall")
@@ -94,6 +95,7 @@ def test_basic_recipe(self) -> None:
9495
declare -a sha256sums=([0]=SKIP)
9596
declare -a noextract=()
9697
declare -a makedepends=()
98+
declare -a preparedepends=()
9799
declare -- maintainer='None <none@example.org>'
98100
declare -- image=base:v2.1
99101
declare -- arch=rmall
@@ -136,6 +138,7 @@ def test_basic_recipe(self) -> None:
136138
declare -a sha256sums=([0]=SKIP)
137139
declare -a noextract=()
138140
declare -a makedepends=()
141+
declare -a preparedepends=()
139142
declare -- maintainer='None <none@example.org>'
140143
declare -- image=base:v2.1
141144
declare -- arch=rmall
@@ -383,6 +386,7 @@ def test_split_packages(self):
383386

384387
self.assertEqual(recipe.path, rec_path)
385388
self.assertEqual(recipe.makedepends, set())
389+
self.assertEqual(recipe.preparedepends, set())
386390
self.assertEqual(recipe.maintainer, "None <none@example.org>")
387391
self.assertEqual(recipe.image, "base:v2.1")
388392
self.assertEqual(recipe.arch, "rmall")
@@ -396,6 +400,7 @@ def test_split_packages(self):
396400
declare -a sha256sums=([0]=SKIP)
397401
declare -a noextract=()
398402
declare -a makedepends=()
403+
declare -a preparedepends=()
399404
declare -- maintainer='None <none@example.org>'
400405
declare -- image=base:v2.1
401406
declare -- arch=rmall
@@ -417,6 +422,7 @@ def test_split_packages(self):
417422
declare -a sha256sums=([0]=SKIP)
418423
declare -a noextract=()
419424
declare -a makedepends=()
425+
declare -a preparedepends=()
420426
declare -- maintainer='None <none@example.org>'
421427
declare -- image=base:v2.1
422428
declare -- arch=rmall
@@ -457,6 +463,7 @@ def test_split_packages(self):
457463
declare -a sha256sums=([0]=SKIP)
458464
declare -a noextract=()
459465
declare -a makedepends=()
466+
declare -a preparedepends=()
460467
declare -- maintainer='None <none@example.org>'
461468
declare -- image=base:v2.1
462469
declare -- arch=rmall
@@ -505,6 +512,7 @@ def test_split_packages(self):
505512
declare -a sha256sums=([0]=SKIP)
506513
declare -a noextract=()
507514
declare -a makedepends=()
515+
declare -a preparedepends=()
508516
declare -- maintainer='None <none@example.org>'
509517
declare -- image=base:v2.1
510518
declare -- arch=rmall
@@ -554,6 +562,7 @@ def test_split_packages(self):
554562
declare -a sha256sums=([0]=SKIP)
555563
declare -a noextract=()
556564
declare -a makedepends=()
565+
declare -a preparedepends=()
557566
declare -- maintainer='None <none@example.org>'
558567
declare -- image=base:v2.1
559568
declare -- arch=rmall
@@ -664,6 +673,7 @@ def test_split_archs(self):
664673
declare -a sha256sums=()
665674
declare -a noextract=()
666675
declare -a makedepends=()
676+
declare -a preparedepends=()
667677
declare -- maintainer='Mattéo Delabre <spam@delab.re>'
668678
declare -- image=qt:v1.1
669679
declare -- arch=rm1
@@ -718,6 +728,7 @@ def test_split_archs(self):
718728
declare -a sha256sums=()
719729
declare -a noextract=()
720730
declare -a makedepends=()
731+
declare -a preparedepends=()
721732
declare -- maintainer='Mattéo Delabre <spam@delab.re>'
722733
declare -- image=qt:v1.1
723734
declare -- arch=rm1
@@ -753,6 +764,7 @@ def test_split_archs(self):
753764
declare -a sha256sums=()
754765
declare -a noextract=()
755766
declare -a makedepends=()
767+
declare -a preparedepends=()
756768
declare -- maintainer='Mattéo Delabre <spam@delab.re>'
757769
declare -- image=qt:v1.1
758770
declare -- arch=rm1
@@ -810,6 +822,7 @@ def test_split_archs(self):
810822
declare -a sha256sums=()
811823
declare -a noextract=()
812824
declare -a makedepends=()
825+
declare -a preparedepends=()
813826
declare -- maintainer='Mattéo Delabre <spam@delab.re>'
814827
declare -- image=qt:v1.1
815828
declare -- arch=rm1
@@ -845,6 +858,7 @@ def test_split_archs(self):
845858
declare -a sha256sums=()
846859
declare -a noextract=()
847860
declare -a makedepends=()
861+
declare -a preparedepends=()
848862
declare -- maintainer='Mattéo Delabre <spam@delab.re>'
849863
declare -- image=qt:v1.1
850864
declare -- arch=rm1
@@ -883,6 +897,7 @@ def test_split_archs(self):
883897
)
884898
self.assertEqual(rm2.sources, set())
885899
self.assertEqual(rm2.makedepends, set())
900+
self.assertEqual(rm2.preparedepends, set())
886901
self.assertEqual(rm2.maintainer, "None <none@example.com>")
887902
self.assertEqual(rm2.image, "qt:v1.3")
888903
self.assertEqual(rm2.arch, "rm2")
@@ -897,6 +912,7 @@ def test_split_archs(self):
897912
declare -a sha256sums=()
898913
declare -a noextract=()
899914
declare -a makedepends=()
915+
declare -a preparedepends=()
900916
declare -- maintainer='None <none@example.com>'
901917
declare -- image=qt:v1.3
902918
declare -- arch=rm2
@@ -954,6 +970,7 @@ def test_split_archs(self):
954970
declare -a sha256sums=()
955971
declare -a noextract=()
956972
declare -a makedepends=()
973+
declare -a preparedepends=()
957974
declare -- maintainer='None <none@example.com>'
958975
declare -- image=qt:v1.3
959976
declare -- arch=rm2
@@ -989,6 +1006,7 @@ def test_split_archs(self):
9891006
declare -a sha256sums=()
9901007
declare -a noextract=()
9911008
declare -a makedepends=()
1009+
declare -a preparedepends=()
9921010
declare -- maintainer='None <none@example.com>'
9931011
declare -- image=qt:v1.3
9941012
declare -- arch=rm2
@@ -1049,6 +1067,7 @@ def test_split_archs(self):
10491067
declare -a sha256sums=()
10501068
declare -a noextract=()
10511069
declare -a makedepends=()
1070+
declare -a preparedepends=()
10521071
declare -- maintainer='None <none@example.com>'
10531072
declare -- image=qt:v1.3
10541073
declare -- arch=rm2
@@ -1084,6 +1103,7 @@ def test_split_archs(self):
10841103
declare -a sha256sums=()
10851104
declare -a noextract=()
10861105
declare -a makedepends=()
1106+
declare -a preparedepends=()
10871107
declare -- maintainer='None <none@example.com>'
10881108
declare -- image=qt:v1.3
10891109
declare -- arch=rm2

tests/test_recipe.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def test_derived_fields(self) -> None:
2020
timestamp=datetime.now(),
2121
sources=set(),
2222
makedepends=set(),
23+
preparedepends=set(),
2324
maintainer="Test <test@example.com>",
2425
image="",
2526
arch="armv7-3.2",

0 commit comments

Comments
 (0)