summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock716
-rw-r--r--Cargo.toml1
-rw-r--r--crates/common/src/types.rs2
-rw-r--r--crates/driver/Cargo.toml12
-rw-r--r--crates/driver/src/args.rs4
-rw-r--r--crates/driver/src/context.rs74
-rw-r--r--crates/driver/src/driver.rs225
-rw-r--r--crates/driver/src/main.rs18
-rw-r--r--crates/driver/src/parse.rs139
-rw-r--r--crates/driver/src/recipe.rs155
-rw-r--r--crates/driver/src/resolve.rs64
-rw-r--r--crates/driver/src/task.rs22
-rw-r--r--crates/driver/src/template.rs26
-rw-r--r--crates/runner/Cargo.toml10
-rw-r--r--crates/runner/src/jobserver.rs40
-rw-r--r--crates/runner/src/lib.rs49
-rw-r--r--crates/runner/src/ns.rs4
-rw-r--r--crates/runner/src/paths.rs2
-rw-r--r--crates/runner/src/tar.rs2
-rw-r--r--crates/runner/src/task.rs50
-rw-r--r--crates/runner/src/util/clone.rs2
-rw-r--r--crates/runner/src/util/fs.rs2
-rw-r--r--crates/runner/src/util/unix.rs34
-rw-r--r--examples/pins.yml.example10
-rw-r--r--examples/recipes/bar/build.yml (renamed from examples/recipes/bar.yml)0
-rw-r--r--examples/recipes/binutils/build.yml (renamed from examples/recipes/binutils@2.37.yml)24
-rw-r--r--examples/recipes/busybox/build.yml (renamed from examples/recipes/busybox@1.34.0.yml)30
-rw-r--r--examples/recipes/e2fsprogs/build.yml (renamed from examples/recipes/e2fsprogs@1.46.4.yml)24
-rw-r--r--examples/recipes/foo/build.yml (renamed from examples/recipes/foo.yml)0
-rw-r--r--examples/recipes/gcc/build.libgcc-initial.yml (renamed from examples/recipes/libgcc-initial@11.2.0.yml)16
-rw-r--r--examples/recipes/gcc/build.libgcc.yml (renamed from examples/recipes/libgcc@11.2.0.yml)10
-rw-r--r--examples/recipes/gcc/build.libs.yml (renamed from examples/recipes/gcc-libs@11.2.0.yml)12
-rw-r--r--examples/recipes/gcc/build.yml (renamed from examples/recipes/gcc@11.2.0.yml)28
-rw-r--r--examples/recipes/glibc/build.yml (renamed from examples/recipes/glibc@2.34.yml)38
-rw-r--r--examples/recipes/gmp/build.yml (renamed from examples/recipes/gmp@6.2.1.yml)24
-rw-r--r--examples/recipes/image/build.yml (renamed from examples/recipes/rootfs.yml)28
-rw-r--r--examples/recipes/linux/build.uapi-headers.yml (renamed from examples/recipes/linux-uapi-headers@5.10.66.yml)12
-rw-r--r--examples/recipes/linux/build.yml (renamed from examples/recipes/linux@5.10.66.yml)24
-rw-r--r--examples/recipes/ls/build.yml (renamed from examples/recipes/ls.yml)0
-rw-r--r--examples/recipes/make_ext4fs/build.yml (renamed from examples/recipes/make_ext4fs@2020-01-05.yml)12
-rw-r--r--examples/recipes/mpc/build.yml (renamed from examples/recipes/mpc@1.2.1.yml)24
-rw-r--r--examples/recipes/mpfr/build.yml (renamed from examples/recipes/mpfr@4.1.0.yml)24
-rw-r--r--examples/recipes/toolchain/build.yml (renamed from examples/recipes/toolchain.yml)4
-rw-r--r--examples/recipes/zlib/build.yml (renamed from examples/recipes/zlib@1.2.11.yml)24
44 files changed, 1149 insertions, 872 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 656f425..6a6062c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3,33 +3,64 @@
version = 3
[[package]]
-name = "arrayref"
-version = "0.3.6"
+name = "anstream"
+version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
+checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "utf8parse",
+]
[[package]]
-name = "arrayvec"
-version = "0.7.2"
+name = "anstyle"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
+checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
[[package]]
-name = "atty"
-version = "0.2.14"
+name = "anstyle-parse"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
+checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c"
dependencies = [
- "hermit-abi",
- "libc",
- "winapi",
+ "utf8parse",
]
[[package]]
-name = "autocfg"
-version = "1.0.1"
+name = "anstyle-query"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
+checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
+dependencies = [
+ "anstyle",
+ "windows-sys",
+]
+
+[[package]]
+name = "arrayref"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545"
+
+[[package]]
+name = "arrayvec"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "bincode"
@@ -47,68 +78,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
+name = "bitflags"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
+
+[[package]]
name = "blake3"
-version = "1.2.0"
+version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "526c210b4520e416420759af363083471656e819a75e831b8d2c9d5a584f2413"
+checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52"
dependencies = [
"arrayref",
"arrayvec",
"cc",
"cfg-if",
"constant_time_eq",
- "crypto-mac",
- "digest 0.9.0",
+ "digest",
]
[[package]]
name = "block-buffer"
-version = "0.7.3"
+version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
- "block-padding",
- "byte-tools",
- "byteorder",
- "generic-array 0.12.4",
+ "generic-array",
]
[[package]]
-name = "block-padding"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
-dependencies = [
- "byte-tools",
-]
-
-[[package]]
-name = "byte-tools"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
-
-[[package]]
-name = "byteorder"
-version = "1.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
-
-[[package]]
name = "capctl"
-version = "0.2.0"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eea0d91a34c56f0a0779e1cc2ec7040fa7f672819c4d3fe7d9dd4af3d2e78aca"
+checksum = "4a6e71767585f51c2a33fed6d67147ec0343725fc3c03bf4b89fe67fede56aa5"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
+ "cfg-if",
"libc",
]
[[package]]
name = "cc"
-version = "1.0.72"
+version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
+checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7"
[[package]]
name = "cfg-if"
@@ -117,81 +130,98 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
+name = "cfg_aliases"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
+
+[[package]]
name = "clap"
-version = "3.0.0-beta.5"
+version = "4.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "feff3878564edb93745d58cf63e17b63f24142506e7a20c87a5521ed7bfb1d63"
+checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
dependencies = [
- "atty",
- "bitflags",
+ "clap_builder",
"clap_derive",
- "indexmap",
- "lazy_static",
- "os_str_bytes",
+]
+
+[[package]]
+name = "clap_builder"
+version = "4.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "clap_lex",
"strsim",
- "termcolor",
- "textwrap",
- "unicase",
]
[[package]]
name = "clap_derive"
-version = "3.0.0-beta.5"
+version = "4.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b15c6b4f786ffb6192ffe65a36855bc1fc2444bcd0945ae16748dcd6ed7d0d3"
+checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
dependencies = [
"heck",
- "proc-macro-error",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.58",
]
[[package]]
-name = "constant_time_eq"
-version = "0.1.5"
+name = "clap_lex"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
+checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
[[package]]
-name = "crypto-mac"
-version = "0.11.1"
+name = "colorchoice"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714"
-dependencies = [
- "generic-array 0.14.4",
- "subtle",
-]
+checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
-name = "deb-version"
-version = "0.1.1"
+name = "constant_time_eq"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b390250ca2b6862735ef39a7b37b0266a8d5cd9d1e579260c95b1dc27761d6ad"
+checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2"
[[package]]
-name = "digest"
-version = "0.8.1"
+name = "cpufeatures"
+version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
+checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
dependencies = [
- "generic-array 0.12.4",
+ "libc",
]
[[package]]
-name = "digest"
-version = "0.9.0"
+name = "crypto-common"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
- "generic-array 0.14.4",
+ "generic-array",
+ "typenum",
]
[[package]]
-name = "dtoa"
-version = "0.4.8"
+name = "deb-version"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
+checksum = "b390250ca2b6862735ef39a7b37b0266a8d5cd9d1e579260c95b1dc27761d6ad"
+
+[[package]]
+name = "digest"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+dependencies = [
+ "block-buffer",
+ "crypto-common",
+ "subtle",
+]
[[package]]
name = "enum-kinds"
@@ -201,41 +231,42 @@ checksum = "4e40a16955681d469ab3da85aaa6b42ff656b3c67b52e1d8d3dd36afe97fd462"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 1.0.109",
]
[[package]]
-name = "fake-simd"
-version = "0.1.2"
+name = "equivalent"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
-name = "filetime"
-version = "0.2.15"
+name = "errno"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98"
+checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
- "cfg-if",
"libc",
- "redox_syscall",
- "winapi",
+ "windows-sys",
]
[[package]]
-name = "generic-array"
-version = "0.12.4"
+name = "filetime"
+version = "0.2.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
+checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd"
dependencies = [
- "typenum",
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "windows-sys",
]
[[package]]
name = "generic-array"
-version = "0.14.4"
+version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
@@ -243,41 +274,29 @@ dependencies = [
[[package]]
name = "handlebars"
-version = "4.1.4"
+version = "5.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1874024f4a29f47d609014caec0b1c866f1c1eb0661a09c9733ecc4757f5f88"
+checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b"
dependencies = [
"log",
"pest",
"pest_derive",
- "quick-error",
"serde",
"serde_json",
+ "thiserror",
]
[[package]]
name = "hashbrown"
-version = "0.11.2"
+version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
+checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "heck"
-version = "0.3.3"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
-dependencies = [
- "unicode-segmentation",
-]
-
-[[package]]
-name = "hermit-abi"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
-dependencies = [
- "libc",
-]
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hex"
@@ -290,28 +309,25 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "1.7.0"
+version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
+checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [
- "autocfg",
+ "equivalent",
"hashbrown",
]
[[package]]
name = "indoc"
-version = "1.0.3"
+version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5a75aeaaef0ce18b58056d306c27b07436fbb34b8816c53094b76dd81803136"
-dependencies = [
- "unindent",
-]
+checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
[[package]]
name = "itoa"
-version = "0.4.8"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
+checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "lazy_static"
@@ -321,81 +337,45 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.107"
+version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
+checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
-name = "linked-hash-map"
-version = "0.5.4"
+name = "linux-raw-sys"
+version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
+checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "log"
-version = "0.4.14"
+version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "maplit"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
+checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
name = "memchr"
-version = "2.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
-
-[[package]]
-name = "memoffset"
-version = "0.6.4"
+version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
-name = "minimal-lexical"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "nix"
-version = "0.23.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188"
+checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
- "bitflags",
- "cc",
+ "bitflags 2.5.0",
"cfg-if",
+ "cfg_aliases",
"libc",
- "memoffset",
-]
-
-[[package]]
-name = "nom"
-version = "7.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109"
-dependencies = [
- "memchr",
- "minimal-lexical",
- "version_check",
]
[[package]]
name = "olpc-cjson"
-version = "0.1.1"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72ca49fe685014bbf124ee547da94ed7bb65a6eb9dc9c4711773c081af96a39c"
+checksum = "d637c9c15b639ccff597da8f4fa968300651ad2f1e968aefc3b4927a6fb2027a"
dependencies = [
"serde",
"serde_json",
@@ -403,34 +383,54 @@ dependencies = [
]
[[package]]
-name = "opaque-debug"
-version = "0.2.3"
+name = "once_cell"
+version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
-name = "os_str_bytes"
-version = "4.2.0"
+name = "peg"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "addaa943333a514159c80c97ff4a93306530d965d27e139188283cd13e06a799"
+checksum = "400bcab7d219c38abf8bd7cc2054eb9bbbd4312d66f6a5557d572a203f646f61"
dependencies = [
- "memchr",
+ "peg-macros",
+ "peg-runtime",
+]
+
+[[package]]
+name = "peg-macros"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46e61cce859b76d19090f62da50a9fe92bab7c2a5f09e183763559a2ac392c90"
+dependencies = [
+ "peg-runtime",
+ "proc-macro2",
+ "quote",
]
[[package]]
+name = "peg-runtime"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36bae92c60fa2398ce4678b98b2c4b5a7c61099961ca1fa305aec04a9ad28922"
+
+[[package]]
name = "pest"
-version = "2.1.3"
+version = "2.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
+checksum = "311fb059dee1a7b802f036316d790138c613a4e8b180c822e3925a662e9f0c95"
dependencies = [
+ "memchr",
+ "thiserror",
"ucd-trie",
]
[[package]]
name = "pest_derive"
-version = "2.1.0"
+version = "2.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0"
+checksum = "f73541b156d32197eecda1a4014d7f868fd2bcb3c550d5386087cfba442bf69c"
dependencies = [
"pest",
"pest_generator",
@@ -438,72 +438,42 @@ dependencies = [
[[package]]
name = "pest_generator"
-version = "2.1.3"
+version = "2.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
+checksum = "c35eeed0a3fab112f75165fdc026b3913f4183133f19b49be773ac9ea966e8bd"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.58",
]
[[package]]
name = "pest_meta"
-version = "2.1.3"
+version = "2.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d"
+checksum = "2adbf29bb9776f28caece835398781ab24435585fe0d4dc1374a61db5accedca"
dependencies = [
- "maplit",
+ "once_cell",
"pest",
- "sha-1",
-]
-
-[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
+ "sha2",
]
[[package]]
name = "proc-macro2"
-version = "1.0.32"
+version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
+checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [
- "unicode-xid",
+ "unicode-ident",
]
[[package]]
-name = "quick-error"
-version = "2.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
-
-[[package]]
name = "quote"
-version = "1.0.10"
+version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
+checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
@@ -519,7 +489,7 @@ dependencies = [
"indoc",
"lazy_static",
"nix",
- "nom",
+ "peg",
"rebel-common",
"rebel-runner",
"scoped-tls-hkt",
@@ -543,7 +513,7 @@ dependencies = [
"bincode",
"blake3",
"capctl",
- "digest 0.9.0",
+ "digest",
"libc",
"nix",
"olpc-cjson",
@@ -558,18 +528,31 @@ dependencies = [
[[package]]
name = "redox_syscall"
-version = "0.2.10"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
+checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
+]
+
+[[package]]
+name = "rustix"
+version = "0.38.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89"
+dependencies = [
+ "bitflags 2.5.0",
+ "errno",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys",
]
[[package]]
name = "ryu"
-version = "1.0.5"
+version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
+checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
[[package]]
name = "same-file"
@@ -582,35 +565,35 @@ dependencies = [
[[package]]
name = "scoped-tls-hkt"
-version = "0.1.2"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63"
+checksum = "3ddc765d3410d9f6c6ca071bf0b67f6b01e3ec4595dc3892f02677e75819dddc"
[[package]]
name = "serde"
-version = "1.0.130"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
+checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.130"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
+checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.58",
]
[[package]]
name = "serde_json"
-version = "1.0.70"
+version = "1.0.115"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e277c495ac6cd1a01a58d0a0c574568b4d1ddf14f59965c6a58b8d96400b54f3"
+checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd"
dependencies = [
"itoa",
"ryu",
@@ -619,56 +602,67 @@ dependencies = [
[[package]]
name = "serde_yaml"
-version = "0.8.21"
+version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af"
+checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
- "dtoa",
"indexmap",
+ "itoa",
+ "ryu",
"serde",
- "yaml-rust",
+ "unsafe-libyaml",
]
[[package]]
-name = "sha-1"
-version = "0.8.2"
+name = "sha2"
+version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
+checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
- "block-buffer",
- "digest 0.8.1",
- "fake-simd",
- "opaque-debug",
+ "cfg-if",
+ "cpufeatures",
+ "digest",
]
[[package]]
name = "strsim"
-version = "0.10.0"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "subtle"
-version = "2.4.1"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
+checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "syn"
-version = "1.0.81"
+version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
- "unicode-xid",
+ "unicode-ident",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.58"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
]
[[package]]
name = "tar"
-version = "0.4.37"
+version = "0.4.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6f5515d3add52e0bbdcad7b83c388bb36ba7b754dda3b5f5bc2d38640cdba5c"
+checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb"
dependencies = [
"filetime",
"libc",
@@ -677,120 +671,106 @@ dependencies = [
[[package]]
name = "tee_readwrite"
-version = "0.1.0"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0642ac8a287350e5bd14ac50e7a137d49432ae625a1ae83668323ef3ca466af8"
+checksum = "57d3e5629bb07f004134a87a2d3cb6272f0a455942401f35776e3f17ecc8d955"
[[package]]
-name = "termcolor"
-version = "1.1.2"
+name = "thiserror"
+version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
+checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
dependencies = [
- "winapi-util",
+ "thiserror-impl",
]
[[package]]
-name = "textwrap"
-version = "0.14.2"
+name = "thiserror-impl"
+version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
+checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [
- "unicode-width",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.58",
]
[[package]]
name = "tinyvec"
-version = "1.5.1"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
+checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
-version = "0.1.0"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "typenum"
-version = "1.14.0"
+version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"
+checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "ucd-trie"
-version = "0.1.3"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
+checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "uds"
-version = "0.2.6"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "343758ccc8a17c1663182d780f68b52021d68b9a43d4b912b0a01f48b526e4f0"
+checksum = "885c31f06fce836457fe3ef09a59f83fe8db95d270b11cd78f40a4666c4d1661"
dependencies = [
"libc",
]
[[package]]
-name = "unicase"
-version = "2.6.0"
+name = "unicode-ident"
+version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
-dependencies = [
- "version_check",
-]
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-normalization"
-version = "0.1.19"
+version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
+checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
dependencies = [
"tinyvec",
]
[[package]]
-name = "unicode-segmentation"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
-
-[[package]]
-name = "unicode-width"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
-
-[[package]]
-name = "unicode-xid"
-version = "0.2.2"
+name = "unsafe-libyaml"
+version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
+checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]]
-name = "unindent"
-version = "0.1.7"
+name = "utf8parse"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7"
+checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "version_check"
-version = "0.9.3"
+version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "walkdir"
-version = "2.3.2"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
dependencies = [
"same-file",
- "winapi",
"winapi-util",
]
@@ -812,9 +792,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
-version = "0.1.5"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
dependencies = [
"winapi",
]
@@ -826,19 +806,85 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
-name = "xattr"
-version = "0.2.2"
+name = "windows-sys"
+version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
- "libc",
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
]
[[package]]
-name = "yaml-rust"
-version = "0.4.5"
+name = "windows_aarch64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
+checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
+
+[[package]]
+name = "xattr"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f"
dependencies = [
- "linked-hash-map",
+ "libc",
+ "linux-raw-sys",
+ "rustix",
]
diff --git a/Cargo.toml b/Cargo.toml
index a16584b..5182ff3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,6 @@
[workspace]
members = ["crates/*"]
+resolver = "2"
[profile.dev.package."*"]
opt-level = 2
diff --git a/crates/common/src/types.rs b/crates/common/src/types.rs
index 32b9182..a5d6678 100644
--- a/crates/common/src/types.rs
+++ b/crates/common/src/types.rs
@@ -39,7 +39,7 @@ pub struct Task {
pub command: String,
pub workdir: String,
pub rootfs: ArchiveHash,
- pub inherit: Vec<LayerHash>,
+ pub ancestors: Vec<LayerHash>,
pub depends: HashSet<Dependency>,
pub outputs: HashMap<String, String>,
pub pins: HashMap<ArchiveHash, String>,
diff --git a/crates/driver/Cargo.toml b/crates/driver/Cargo.toml
index 9913a83..df1fb19 100644
--- a/crates/driver/Cargo.toml
+++ b/crates/driver/Cargo.toml
@@ -11,15 +11,15 @@ edition = "2021"
common = { path = "../common", package = "rebel-common" }
runner = { path = "../runner", package = "rebel-runner" }
-clap = "3.0.0-beta.2"
+clap = { version = "4.0.0", features = ["derive"] }
deb-version = "0.1.1"
enum-kinds = "0.5.1"
-handlebars = "4.1.3"
-indoc = "1.0.3"
+handlebars = "5.1.2"
+indoc = "2.0.4"
lazy_static = "1.4.0"
-nix = "0.23.0"
-nom = "7.1.0"
+nix = { version = "0.28.0", features = ["poll", "signal"] }
scoped-tls-hkt = "0.1.2"
serde = { version = "1", features = ["derive", "rc"] }
-serde_yaml = "0.8"
+serde_yaml = "0.9"
walkdir = "2"
+peg = "0.8.2"
diff --git a/crates/driver/src/args.rs b/crates/driver/src/args.rs
index 510a156..805646a 100644
--- a/crates/driver/src/args.rs
+++ b/crates/driver/src/args.rs
@@ -100,7 +100,7 @@ impl<'a> IntoIterator for &'a TaskArgs {
}
}
-#[allow(clippy::derive_hash_xor_eq)]
+#[allow(clippy::derived_hash_with_manual_eq)]
impl hash::Hash for TaskArgs {
fn hash<H: hash::Hasher>(&self, _state: &mut H) {
// Don't do anything: Properly hashing the task args is likely to cost
@@ -116,7 +116,7 @@ pub fn arg<A: Into<Arg>>(key: &str, value: A) -> (String, Arg) {
#[derive(Clone, Debug, Deserialize, Default, PartialEq, Eq)]
pub struct ArgMapping(pub HashMap<String, String>);
-#[allow(clippy::derive_hash_xor_eq)]
+#[allow(clippy::derived_hash_with_manual_eq)]
impl hash::Hash for ArgMapping {
fn hash<H: hash::Hasher>(&self, _state: &mut H) {}
}
diff --git a/crates/driver/src/context.rs b/crates/driver/src/context.rs
index 2f29aed..3bf4bf5 100644
--- a/crates/driver/src/context.rs
+++ b/crates/driver/src/context.rs
@@ -24,19 +24,19 @@ use crate::{
};
#[derive(Debug, Clone, Copy)]
-pub enum ErrorKind<'ctx> {
+pub enum ErrorKind<'a> {
TaskNotFound,
- InvalidArgument(&'ctx str),
- InvalidArgRef(&'ctx str),
+ InvalidArgument(&'a str),
+ InvalidArgRef(&'a str),
}
#[derive(Debug, Clone, Copy)]
-pub struct Error<'ctx> {
- pub task: &'ctx TaskID,
- pub kind: ErrorKind<'ctx>,
+pub struct Error<'a> {
+ pub task: &'a TaskID,
+ pub kind: ErrorKind<'a>,
}
-impl<'ctx> Display for Error<'ctx> {
+impl<'a> Display for Error<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let Error { task, kind } = self;
match kind {
@@ -55,13 +55,13 @@ impl<'ctx> Display for Error<'ctx> {
}
}
-impl<'ctx> From<Error<'ctx>> for error::Error {
+impl<'a> From<Error<'a>> for error::Error {
fn from(err: Error) -> Self {
error::Error::new(err)
}
}
-pub type Result<'ctx, T> = result::Result<T, Error<'ctx>>;
+pub type Result<'a, T> = result::Result<T, Error<'a>>;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct TaskRef<'ctx> {
@@ -75,7 +75,7 @@ impl<'ctx> Display for TaskRef<'ctx> {
return self.id.fmt(f);
}
- let pv_arg = match self.args.get("pv") {
+ let version_arg = match self.args.get("version") {
Some(Arg::String(s)) => Some(s),
_ => None,
};
@@ -89,13 +89,13 @@ impl<'ctx> Display for TaskRef<'ctx> {
};
write!(f, "{}", self.id.recipe)?;
- if let Some(pv) = pv_arg {
- write!(f, "@{}", pv)?;
+ if let Some(version) = version_arg {
+ write!(f, "#{}", version)?;
}
write!(f, ":{}", self.id.task)?;
if host_arg.is_some() || target_arg.is_some() {
- write!(f, "/")?;
+ write!(f, "@")?;
}
if let Some(host) = host_arg {
@@ -293,7 +293,7 @@ impl Context {
.max_by(|task1, task2| Self::compare_tasks(task1, task2))
}
- fn get_with_args<'ctx>(&'ctx self, id: &'ctx TaskID, args: &TaskArgs) -> Result<&TaskDef> {
+ fn get_with_args<'a>(&self, id: &'a TaskID, args: &TaskArgs) -> Result<'a, &TaskDef> {
self.tasks
.get(id)
.and_then(|tasks| Self::select_task(tasks, args))
@@ -303,7 +303,7 @@ impl Context {
})
}
- pub fn get<'ctx>(&'ctx self, task: &TaskRef<'ctx>) -> Result<&TaskDef> {
+ pub fn get<'a>(&self, task: &TaskRef<'a>) -> Result<'a, &TaskDef> {
self.get_with_args(task.id, task.args.as_ref())
}
@@ -345,8 +345,11 @@ impl Context {
new_args.set("cross_compile", cross_compile);
- new_args.set("pn", Some(task_def.meta.name.clone()));
- new_args.set("pv", task_def.meta.version.clone());
+ new_args.set("basename", Some(task_def.meta.basename.clone()));
+ new_args.set("recipename", Some(task_def.meta.recipename.clone()));
+ new_args.set("recipe", Some(task_def.meta.recipe.clone()));
+ new_args.set("name", Some(task_def.meta.name.clone()));
+ new_args.set("version", task_def.meta.version.clone());
Ok(TaskRef {
id,
@@ -354,11 +357,13 @@ impl Context {
})
}
- pub fn parse<'ctx>(&'ctx self, s: &str) -> error::Result<(TaskRef, TaskFlags)> {
- let (parsed, flags) = parse::parse_task_with_flags(s).context("Invalid task syntax")?;
+ pub fn parse(&self, s: &str) -> error::Result<(TaskRef, TaskFlags)> {
+ let (parsed, flags) = parse::task_with_flags(s)
+ .ok()
+ .context("Invalid task syntax")?;
- let recipe = parsed.recipe.to_string();
- let task = parsed.task.to_string();
+ let recipe = parsed.id.recipe.to_string();
+ let task = parsed.id.task.to_string();
let id = TaskID { recipe, task };
let (ctx_id, _) = self
@@ -368,7 +373,7 @@ impl Context {
let mut args = self.globals.clone();
- if let Some(host) = parsed.host {
+ if let Some(host) = parsed.args.host {
let plat = self
.platforms
.get(host)
@@ -376,7 +381,7 @@ impl Context {
args.set("host", Some(plat));
args.set("target", Some(plat));
}
- if let Some(target) = parsed.target {
+ if let Some(target) = parsed.args.target {
let plat = self
.platforms
.get(target)
@@ -419,7 +424,7 @@ impl Context {
Ok(Cow::Owned(ret))
}
- fn inherit_ref<'ctx>(&'ctx self, dep: &'ctx InheritDep, args: &TaskArgs) -> Result<TaskRef> {
+ fn parent_ref<'ctx>(&'ctx self, dep: &'ctx ParentDep, args: &TaskArgs) -> Result<TaskRef> {
let mapped_args = Context::map_args(&dep.dep.id, &dep.dep.args, args, false)?;
self.task_ref(&dep.dep.id, mapped_args.as_ref())
}
@@ -437,19 +442,18 @@ impl Context {
})
}
- pub fn get_inherit_depend<'ctx>(
+ pub fn get_parent_depend<'ctx>(
&'ctx self,
task_ref: &TaskRef<'ctx>,
) -> Result<Option<TaskRef>> {
let task = self.get(task_ref)?;
- let inherit = match &task.inherit {
- Some(inherit) => inherit,
- None => return Ok(None),
+ let Some(parent) = &task.parent else {
+ return Ok(None);
};
- Some(self.inherit_ref(inherit, &task_ref.args)).transpose()
+ Some(self.parent_ref(parent, &task_ref.args)).transpose()
}
- fn inherit_iter<'ctx>(
+ fn ancestor_iter<'ctx>(
&'ctx self,
task_ref: &TaskRef<'ctx>,
) -> impl Iterator<Item = Result<TaskRef>> {
@@ -463,7 +467,7 @@ impl Context {
Ok(task_ref) => task_ref,
Err(err) => return Some(Err(err)),
};
- self.1 = self.0.get_inherit_depend(&task_ref).transpose();
+ self.1 = self.0.get_parent_depend(&task_ref).transpose();
Some(Ok(task_ref))
}
}
@@ -478,7 +482,7 @@ impl Context {
let mut ret = HashSet::new();
let mut allow_noinherit = true;
- for current in self.inherit_iter(task_ref) {
+ for current in self.ancestor_iter(task_ref) {
let current_ref = current?;
let task = self.get(&current_ref)?;
let entries = task
@@ -502,7 +506,7 @@ impl Context {
let mut ret = HashSet::new();
let mut allow_noinherit = true;
- for current in self.inherit_iter(task_ref) {
+ for current in self.ancestor_iter(task_ref) {
let current_ref = current?;
let task = self.get(&current_ref)?;
let entries = task
@@ -520,10 +524,10 @@ impl Context {
}
}
-impl<'ctx> Index<&TaskRef<'ctx>> for &'ctx Context {
+impl Index<&TaskRef<'_>> for Context {
type Output = TaskDef;
- fn index(&self, index: &TaskRef<'ctx>) -> &TaskDef {
+ fn index(&self, index: &TaskRef) -> &TaskDef {
self.get(index).expect("Invalid TaskRef")
}
}
diff --git a/crates/driver/src/driver.rs b/crates/driver/src/driver.rs
index dfdd6e9..212f4cf 100644
--- a/crates/driver/src/driver.rs
+++ b/crates/driver/src/driver.rs
@@ -1,16 +1,23 @@
use std::{
collections::{HashMap, HashSet},
+ iter,
os::unix::{net::UnixStream, prelude::*},
};
use indoc::indoc;
-use nix::poll;
+use nix::{
+ poll,
+ sys::{
+ signal,
+ signalfd::{SfdFlags, SignalFd},
+ },
+};
use common::{error::*, string_hash::*, types::*};
use runner::Runner;
use crate::{
- context::{Context, TaskRef},
+ context::{Context, OutputRef, TaskRef},
paths, resolve,
task::*,
template,
@@ -30,7 +37,7 @@ impl<'ctx> CompletionState<'ctx> {
}
}
- // Treats both "depends" and "inherit" as dependencies
+ // Treats both "depends" and "parent" as dependencies
fn deps_satisfied(&self, task_ref: &TaskRef) -> bool {
resolve::get_dependent_tasks(self.ctx, task_ref)
.map_err(|_| Error::new(format!("invalid dependency for {}", task_ref)))
@@ -46,11 +53,9 @@ impl<'ctx> CompletionState<'ctx> {
.iter()
.map(|Fetch { name, sha256 }| {
Ok(Dependency::Fetch {
- name: template::ENGINE
- .eval_raw(name, &task.args)
- .with_context(|| {
- format!("Failed to evaluate fetch filename for task {}", task)
- })?,
+ name: template::ENGINE.eval(name, &task.args).with_context(|| {
+ format!("Failed to evaluate fetch filename for task {}", task)
+ })?,
target_dir: paths::TASK_DLDIR.to_string(),
sha256: *sha256,
})
@@ -58,55 +63,57 @@ impl<'ctx> CompletionState<'ctx> {
.collect()
}
- fn task_deps(&self, task: &TaskRef<'ctx>) -> Result<HashSet<Dependency>> {
- Ok(self
- .fetch_deps(task)?
+ fn dep_closure<I>(&self, deps: I, path: &'ctx str) -> impl Iterator<Item = Dependency> + '_
+ where
+ I: IntoIterator<Item = OutputRef<'ctx>>,
+ {
+ resolve::runtime_depends(self.ctx, deps)
+ .expect("invalid runtime depends")
.into_iter()
- .chain(
- resolve::runtime_depends(
- self.ctx,
- self.ctx
- .get_build_depends(task)
- .with_context(|| format!("invalid build depends for {}", task))?,
- )
- .expect("invalid runtime depends of build_depends")
- .into_iter()
- .filter_map(|dep| self.tasks_done[&dep.task].outputs.get(dep.output))
- .map(|&output| Dependency::Task {
- output,
- path: "".to_string(),
- }),
- )
- .chain(
- resolve::runtime_depends(
- self.ctx,
- self.ctx
- .get_host_depends(task)
- .with_context(|| format!("invalid depends for {}", task))?,
- )
- .expect("invalid runtime depends of host_depends")
- .into_iter()
- .filter_map(|dep| self.tasks_done[&dep.task].outputs.get(dep.output))
- .map(|&output| Dependency::Task {
- output,
- path: paths::TASK_SYSROOT.to_string(),
- }),
- )
- .collect())
+ .filter_map(|dep| self.tasks_done[&dep.task].outputs.get(dep.output))
+ .map(|&output| Dependency::Task {
+ output,
+ path: path.to_string(),
+ })
}
- fn task_inherit_chain(&self, task_ref: &TaskRef<'ctx>) -> Vec<LayerHash> {
- let inherit = match self
+ fn build_deps(&self, task: &TaskRef<'ctx>) -> Result<impl Iterator<Item = Dependency> + '_> {
+ Ok(self.dep_closure(
+ self.ctx
+ .get_build_depends(task)
+ .with_context(|| format!("invalid build depends for {}", task))?,
+ "",
+ ))
+ }
+
+ fn host_deps(&self, task: &TaskRef<'ctx>) -> Result<impl Iterator<Item = Dependency> + '_> {
+ Ok(self.dep_closure(
+ self.ctx
+ .get_host_depends(task)
+ .with_context(|| format!("invalid depends for {}", task))?,
+ paths::TASK_SYSROOT,
+ ))
+ }
+
+ fn task_deps(&self, task: &TaskRef<'ctx>) -> Result<HashSet<Dependency>> {
+ let fetch_deps = self.fetch_deps(task)?.into_iter();
+ let build_deps = self.build_deps(task)?;
+ let host_deps = self.host_deps(task)?;
+
+ Ok(fetch_deps.chain(build_deps).chain(host_deps).collect())
+ }
+
+ fn task_ancestors(&self, task_ref: &TaskRef<'ctx>) -> Vec<LayerHash> {
+ let Some(parent) = self
.ctx
- .get_inherit_depend(task_ref)
- .expect("invalid inherit depends")
- {
- Some(inherit) => inherit,
- None => return vec![],
+ .get_parent_depend(task_ref)
+ .expect("invalid parent depends")
+ else {
+ return vec![];
};
- let mut chain = self.task_inherit_chain(&inherit);
- if let Some(layer) = self.tasks_done[&inherit].layer {
+ let mut chain = self.task_ancestors(&parent);
+ if let Some(layer) = self.tasks_done[&parent].layer {
chain.push(layer);
}
chain
@@ -140,11 +147,18 @@ impl<'ctx> CompletionState<'ctx> {
}
}
+#[derive(Debug)]
enum SpawnResult {
Spawned(UnixStream),
Skipped(TaskOutput),
}
+#[derive(Debug, PartialEq, Eq, Hash)]
+enum TaskWaitResult {
+ Failed,
+ Interrupted,
+}
+
#[derive(Debug)]
pub struct Driver<'ctx> {
rdeps: HashMap<TaskRef<'ctx>, Vec<TaskRef<'ctx>>>,
@@ -299,13 +313,13 @@ impl<'ctx> Driver<'ctx> {
})
.collect();
- let inherit_chain = self.state.task_inherit_chain(task_ref);
+ let ancestors = self.state.task_ancestors(task_ref);
let mut run = Self::task_setup(task_ref);
run.push(&task_def.action.run);
let command = template::ENGINE
- .eval(&run.concat(), &task_ref.args)
+ .eval_sh(&run.concat(), &task_ref.args)
.with_context(|| {
format!("Failed to evaluate command template for task {}", task_ref)
})?;
@@ -316,7 +330,7 @@ impl<'ctx> Driver<'ctx> {
command,
workdir: paths::TASK_WORKDIR.to_string(),
rootfs: rootfs.0,
- inherit: inherit_chain,
+ ancestors,
depends: task_deps,
outputs: task_output,
pins: HashMap::from([rootfs.clone()]),
@@ -348,18 +362,28 @@ impl<'ctx> Driver<'ctx> {
Ok(())
}
- fn wait_for_task(&mut self) -> Result<()> {
- let mut pollfds: Box<[_]> = self
+ fn wait_for_task(&mut self, signal_fd: &mut SignalFd) -> Result<Option<TaskWaitResult>> {
+ let mut pollfds: Vec<_> = self
.tasks_running
- .keys()
- .copied()
+ .values()
+ .map(|(socket, _)| socket.as_fd())
+ .chain(iter::once(signal_fd.as_fd()))
.map(|fd| poll::PollFd::new(fd, poll::PollFlags::POLLIN))
.collect();
- while poll::poll(&mut pollfds, -1).context("poll()")? == 0 {}
+ while poll::poll(&mut pollfds, poll::PollTimeout::NONE).context("poll()")? == 0 {}
+
+ let pollevents: Vec<_> = pollfds
+ .into_iter()
+ .map(|pollfd| {
+ (
+ pollfd.as_fd().as_raw_fd(),
+ pollfd.revents().expect("Unknown events in poll() return"),
+ )
+ })
+ .collect();
- for pollfd in &*pollfds {
- let events = pollfd.revents().expect("Unknown events in poll() return");
+ for (fd, events) in pollevents {
if !events.contains(poll::PollFlags::POLLIN) {
if events.intersects(!poll::PollFlags::POLLIN) {
return Err(Error::new(
@@ -369,34 +393,85 @@ impl<'ctx> Driver<'ctx> {
continue;
}
- let fd = pollfd.as_raw_fd();
+ if fd == signal_fd.as_raw_fd() {
+ let _signal = signal_fd.read_signal().expect("read_signal()").unwrap();
+ return Ok(Some(TaskWaitResult::Interrupted));
+ }
+
let (socket, task_ref) = self.tasks_running.remove(&fd).unwrap();
- let task_output = Runner::result(&socket)?;
- self.update_runnable(task_ref, task_output);
+ match Runner::result(&socket) {
+ Ok(task_output) => {
+ self.update_runnable(task_ref, task_output);
+ }
+ Err(error) => {
+ eprintln!("{}", error);
+ return Ok(Some(TaskWaitResult::Failed));
+ }
+ }
}
- Ok(())
+ Ok(None)
}
- fn is_empty(&self) -> bool {
- self.tasks_runnable.is_empty() && self.tasks_running.is_empty()
+ fn is_done(&self) -> bool {
+ self.tasks_blocked.is_empty()
+ && self.tasks_runnable.is_empty()
+ && self.tasks_running.is_empty()
}
- fn is_done(&self) -> bool {
- self.is_empty() && self.tasks_blocked.is_empty()
+ fn setup_signalfd() -> Result<SignalFd> {
+ let mut signals = signal::SigSet::empty();
+ signals.add(signal::Signal::SIGINT);
+ signal::pthread_sigmask(signal::SigmaskHow::SIG_BLOCK, Some(&signals), None)
+ .expect("pthread_sigmask()");
+ SignalFd::with_flags(&signals, SfdFlags::SFD_CLOEXEC)
+ .context("Failed to create signal file descriptor")
}
- pub fn run(&mut self, runner: &Runner) -> Result<()> {
- while !self.is_empty() {
- self.run_tasks(runner)?;
- self.wait_for_task()?;
+ fn raise_sigint() {
+ let mut signals = signal::SigSet::empty();
+ signals.add(signal::Signal::SIGINT);
+ signal::pthread_sigmask(signal::SigmaskHow::SIG_UNBLOCK, Some(&signals), None)
+ .expect("pthread_sigmask()");
+ signal::raise(signal::Signal::SIGINT).expect("raise()");
+ unreachable!();
+ }
+
+ pub fn run(&mut self, runner: &Runner, keep_going: bool) -> Result<bool> {
+ let mut success = true;
+ let mut interrupted = false;
+
+ let mut signal_fd = Self::setup_signalfd()?;
+
+ self.run_tasks(runner)?;
+
+ while !self.tasks_running.is_empty() {
+ match self.wait_for_task(&mut signal_fd)? {
+ Some(TaskWaitResult::Failed) => {
+ success = false;
+ }
+ Some(TaskWaitResult::Interrupted) => {
+ if interrupted {
+ Self::raise_sigint();
+ }
+ eprintln!("Interrupt received, not spawning new tasks. Interrupt again to stop immediately.");
+ interrupted = true;
+ }
+ None => {}
+ }
+ if !interrupted && (success || keep_going) {
+ self.run_tasks(runner)?;
+ }
}
- assert!(self.is_done(), "No runnable tasks left");
+ if interrupted || !success {
+ return Ok(false);
+ }
+ assert!(self.is_done(), "No runnable tasks left");
self.state.print_summary();
- Ok(())
+ Ok(true)
}
}
diff --git a/crates/driver/src/main.rs b/crates/driver/src/main.rs
index ea97ee5..bd08f18 100644
--- a/crates/driver/src/main.rs
+++ b/crates/driver/src/main.rs
@@ -16,12 +16,15 @@ use clap::Parser;
use runner::Runner;
#[derive(Parser)]
-#[clap(version = clap::crate_version!())]
+#[clap(version, about)]
struct Opts {
/// Allow N jobs at once.
/// Defaults to the number of available CPUs
#[clap(short, long)]
jobs: Option<usize>,
+ /// Keep going after some tasks have failed
+ #[clap(short, long)]
+ keep_going: bool,
/// The tasks to run
#[clap(name = "task", required = true)]
tasks: Vec<String>,
@@ -62,8 +65,15 @@ fn main() {
}
let taskset = rsv.into_taskset();
let mut driver = driver::Driver::new(&ctx, taskset, force_run).unwrap();
- if let Err(error) = driver.run(&runner) {
- eprintln!("{}", error);
- std::process::exit(1);
+ match driver.run(&runner, opts.keep_going) {
+ Ok(success) => {
+ if !success {
+ std::process::exit(1);
+ }
+ }
+ Err(error) => {
+ eprintln!("{}", error);
+ std::process::exit(1);
+ }
}
}
diff --git a/crates/driver/src/parse.rs b/crates/driver/src/parse.rs
index aad9360..da85c99 100644
--- a/crates/driver/src/parse.rs
+++ b/crates/driver/src/parse.rs
@@ -1,95 +1,72 @@
-use nom::{
- bytes::complete::{tag, take_while1},
- combinator::{all_consuming, opt},
- error::ParseError,
- Err, IResult, InputLength, Parser,
-};
-
#[derive(Debug, Clone, Copy)]
-pub struct Task<'a> {
+pub struct TaskID<'a> {
pub recipe: &'a str,
pub task: &'a str,
+}
+
+#[derive(Debug, Clone, Copy, Default)]
+pub struct TaskArgs<'a> {
pub host: Option<&'a str>,
pub target: Option<&'a str>,
}
#[derive(Debug, Clone, Copy)]
-pub struct TaskFlags {
- pub force_run: bool,
-}
-
-fn is_name_char(c: char) -> bool {
- matches!(c, 'a'..='z' | 'A' ..='Z' | '0'..='9' | '_' | '-')
-}
-
-fn name(input: &str) -> IResult<&str, &str> {
- take_while1(is_name_char)(input)
-}
-
-fn task_id(input: &str) -> IResult<&str, (&str, &str)> {
- let (input, recipe) = name(input)?;
- let (input, _) = tag(":")(input)?;
- let (input, task) = name(input)?;
- Ok((input, (recipe, task)))
-}
-
-fn task_arg_target(input: &str) -> IResult<&str, &str> {
- let (input, _) = tag(":")(input)?;
- let (input, target) = name(input)?;
- Ok((input, target))
-}
-
-fn task_args(input: &str) -> IResult<&str, (Option<&str>, Option<&str>)> {
- let (input, _) = tag("/")(input)?;
- let (input, host) = opt(name)(input)?;
- let (input, target) = opt(task_arg_target)(input)?;
-
- Ok((input, (host, target)))
-}
-
-fn task(input: &str) -> IResult<&str, Task> {
- let (input, (recipe, task)) = task_id(input)?;
- let (input, args) = opt(task_args)(input)?;
-
- let (host, target) = args.unwrap_or_default();
-
- Ok((
- input,
- Task {
- recipe,
- task,
- host,
- target,
- },
- ))
-}
-
-fn task_flags(input: &str) -> IResult<&str, TaskFlags> {
- let (input, force_run) = opt(tag("+"))(input)?;
-
- Ok((
- input,
- TaskFlags {
- force_run: force_run.is_some(),
- },
- ))
+pub struct Task<'a> {
+ pub id: TaskID<'a>,
+ pub args: TaskArgs<'a>,
}
-fn task_with_flags(input: &str) -> IResult<&str, (Task, TaskFlags)> {
- let (input, task) = task(input)?;
- let (input, flags) = task_flags(input)?;
-
- Ok((input, (task, flags)))
+#[derive(Debug, Clone, Copy)]
+pub struct TaskFlags {
+ pub force_run: bool,
}
-fn parse_all<I, O, E: ParseError<I>, F>(f: F, input: I) -> Result<O, Err<E>>
-where
- I: InputLength,
- F: Parser<I, O, E>,
-{
- all_consuming(f)(input).map(|(_, result)| result)
+peg::parser! {
+ grammar rules() for str {
+ rule t<T>(tag: rule<()>, value: rule<T>) -> T
+ = tag() v:value() { v }
+
+ rule name_char()
+ = ['a'..='z' | 'A' ..='Z' | '0'..='9' | '_' | '-']
+
+ rule name() -> &'input str
+ = $(name_char()+)
+
+ rule recipe_id() -> &'input str
+ = $(name() ("/" name())?)
+
+ rule task_id() -> TaskID<'input>
+ = recipe:recipe_id() ":" task:name() {
+ TaskID { recipe, task }
+ }
+
+ rule task_args() -> TaskArgs<'input>
+ = "@" host:name()? target:t(<":">, <name()>)? {
+ TaskArgs {
+ host,
+ target,
+ }
+ }
+ / { Default::default() }
+
+ pub rule task() -> Task<'input>
+ = id:task_id() args:task_args() {
+ Task {
+ id,
+ args,
+ }
+ }
+
+ rule force_run() -> bool
+ = "+" { true }
+ / { false }
+
+ rule task_flags() -> TaskFlags
+ = force_run:force_run() { TaskFlags { force_run } }
+
+ pub rule task_with_flags() -> (Task<'input>, TaskFlags)
+ = task:task() flags:task_flags() { (task, flags) }
+ }
}
-pub fn parse_task_with_flags(input: &str) -> Option<(Task, TaskFlags)> {
- parse_all(task_with_flags, input).ok()
-}
+pub use rules::*;
diff --git a/crates/driver/src/recipe.rs b/crates/driver/src/recipe.rs
index c6a06f1..16d3751 100644
--- a/crates/driver/src/recipe.rs
+++ b/crates/driver/src/recipe.rs
@@ -1,12 +1,12 @@
-use std::{collections::HashMap, fs::File, path::Path, result};
+use std::{collections::HashMap, ffi::OsStr, fs::File, path::Path, result};
use scoped_tls_hkt::scoped_thread_local;
-use serde::{Deserialize, Deserializer};
+use serde::{de::DeserializeOwned, Deserialize, Deserializer};
use walkdir::WalkDir;
use common::{error::*, types::*};
-use crate::task::{RecipeMeta, TaskDef};
+use crate::task::{TaskDef, TaskMeta};
scoped_thread_local!(static CURRENT_RECIPE: str);
@@ -30,6 +30,12 @@ where
})
}
+#[derive(Clone, Debug, Deserialize, Default)]
+pub struct RecipeMeta {
+ pub name: Option<String>,
+ pub version: Option<String>,
+}
+
#[derive(Debug, Deserialize)]
struct Recipe {
#[serde(default)]
@@ -37,59 +43,144 @@ struct Recipe {
pub tasks: HashMap<String, TaskDef>,
}
-fn read_recipe(path: &Path) -> Result<Recipe> {
+#[derive(Debug, Deserialize)]
+struct Subrecipe {
+ pub tasks: HashMap<String, TaskDef>,
+}
+
+fn read_yaml<T: DeserializeOwned>(path: &Path) -> Result<T> {
let f = File::open(path).context("IO error")?;
- let recipe: Recipe = serde_yaml::from_reader(f)
+ let value: T = serde_yaml::from_reader(f)
.map_err(Error::new)
.context("YAML error")?;
- Ok(recipe)
+ Ok(value)
+}
+
+const RECIPE_NAME: &str = "build";
+const RECIPE_PREFIX: &str = "build.";
+
+fn recipe_name(path: &Path) -> Option<&str> {
+ if path.extension() != Some("yml".as_ref()) {
+ return None;
+ }
+
+ let stem = path.file_stem()?.to_str()?;
+ if stem == RECIPE_NAME {
+ return Some("");
+ }
+ stem.strip_prefix(RECIPE_PREFIX)
+}
+
+fn handle_recipe_tasks(
+ tasks: &mut HashMap<TaskID, Vec<TaskDef>>,
+ recipe_tasks: HashMap<String, TaskDef>,
+ meta: &TaskMeta,
+) {
+ for (label, mut task) in recipe_tasks {
+ let task_id = TaskID {
+ recipe: meta.recipe.clone(),
+ task: label,
+ };
+ task.meta = meta.clone();
+ tasks.entry(task_id).or_default().push(task);
+ }
+}
+
+fn read_recipe_tasks(
+ path: &Path,
+ basename: &str,
+ tasks: &mut HashMap<TaskID, Vec<TaskDef>>,
+) -> Result<RecipeMeta> {
+ let recipe_def = CURRENT_RECIPE.set(basename, || read_yaml::<Recipe>(path))?;
+
+ let name = recipe_def
+ .meta
+ .name
+ .as_deref()
+ .unwrap_or(basename)
+ .to_string();
+
+ let meta = TaskMeta {
+ basename: basename.to_string(),
+ recipename: "".to_string(),
+ recipe: basename.to_string(),
+ name,
+ version: recipe_def.meta.version.clone(),
+ };
+
+ handle_recipe_tasks(tasks, recipe_def.tasks, &meta);
+
+ Ok(recipe_def.meta)
}
-fn is_yml(path: &Path) -> bool {
- path.extension() == Some("yml".as_ref())
+fn read_subrecipe_tasks(
+ path: &Path,
+ basename: &str,
+ recipename: &str,
+ recipe_meta: &RecipeMeta,
+ tasks: &mut HashMap<TaskID, Vec<TaskDef>>,
+) -> Result<()> {
+ let recipe = format!("{basename}/{recipename}");
+ let recipe_def = CURRENT_RECIPE.set(&recipe, || read_yaml::<Subrecipe>(path))?;
+
+ let name = recipe_meta.name.as_deref().unwrap_or(basename).to_string();
+
+ let meta = TaskMeta {
+ basename: basename.to_string(),
+ recipename: recipename.to_string(),
+ recipe: recipe.clone(),
+ name,
+ version: recipe_meta.version.clone(),
+ };
+
+ handle_recipe_tasks(tasks, recipe_def.tasks, &meta);
+
+ Ok(())
}
pub fn read_recipes<P: AsRef<Path>>(path: P) -> Result<HashMap<TaskID, Vec<TaskDef>>> {
let mut tasks = HashMap::<TaskID, Vec<TaskDef>>::new();
+ let mut recipe_metas = HashMap::<String, RecipeMeta>::new();
for entry in WalkDir::new(path)
- .sort_by_file_name()
+ .sort_by(|a, b| {
+ // Files are sorted first by stem, then by extension, so that
+ // recipe.yml will always be read before recipe.NAME.yml
+ let stem_cmp = a.path().file_stem().cmp(&b.path().file_stem());
+ let ext_cmp = a.path().extension().cmp(&b.path().extension());
+ stem_cmp.then(ext_cmp)
+ })
.into_iter()
.filter_map(|e| e.ok())
{
let path = entry.path();
- if !path.is_file() || !is_yml(path) {
+ if !path.is_file() {
continue;
}
- let stem: &str = match path.file_stem().map(|n| n.to_str()) {
- Some(Some(v)) => v,
- _ => continue,
+ let Some(recipename) = recipe_name(path) else {
+ continue;
};
- let (basename, version) = match stem.split_once("@") {
- Some((basename, version)) => (basename, Some(version)),
- None => (stem, None),
+ let Some(basename) = path
+ .parent()
+ .and_then(Path::file_name)
+ .and_then(OsStr::to_str)
+ else {
+ continue;
};
- let recipe = CURRENT_RECIPE.set(basename, || read_recipe(path))?;
-
- let mut meta = recipe.meta;
- if meta.name.is_empty() {
- meta.name = basename.to_string();
- }
- if meta.version.is_none() {
- meta.version = version.map(|v| v.to_string());
- }
-
- for (label, mut task) in recipe.tasks {
- let task_id = TaskID {
- recipe: basename.to_string(),
- task: label,
+ if recipename.is_empty() {
+ recipe_metas.insert(
+ basename.to_string(),
+ read_recipe_tasks(path, basename, &mut tasks)?,
+ );
+ } else {
+ let Some(recipe_meta) = recipe_metas.get(basename) else {
+ continue;
};
- task.meta = meta.clone();
- tasks.entry(task_id).or_default().push(task);
+ read_subrecipe_tasks(path, basename, recipename, recipe_meta, &mut tasks)?;
}
}
diff --git a/crates/driver/src/resolve.rs b/crates/driver/src/resolve.rs
index 35915c0..102c483 100644
--- a/crates/driver/src/resolve.rs
+++ b/crates/driver/src/resolve.rs
@@ -7,7 +7,7 @@ use common::types::TaskID;
use crate::args::TaskArgs;
use crate::context::{self, Context, OutputRef, TaskRef};
-#[derive(Debug)]
+#[derive(Debug, Default)]
pub struct DepChain<'ctx>(pub Vec<TaskRef<'ctx>>);
impl<'ctx> fmt::Display for DepChain<'ctx> {
@@ -48,11 +48,14 @@ impl<'ctx> From<&'ctx TaskID> for DepChain<'ctx> {
}
}
+const MAX_ERRORS: usize = 100;
+
#[derive(Debug)]
pub enum ErrorKind<'ctx> {
Context(context::Error<'ctx>),
OutputNotFound(&'ctx str),
DependencyCycle,
+ TooManyErrors,
}
#[derive(Debug)]
@@ -76,6 +79,13 @@ impl<'ctx> Error<'ctx> {
}
}
+ fn too_many_errors() -> Self {
+ Error {
+ dep_chain: DepChain::default(),
+ kind: ErrorKind::TooManyErrors,
+ }
+ }
+
fn extend(&mut self, task: &TaskRef<'ctx>) {
self.dep_chain.0.push(task.clone());
}
@@ -94,6 +104,9 @@ impl<'ctx> fmt::Display for Error<'ctx> {
ErrorKind::DependencyCycle => {
write!(f, "Dependency Cycle: ")?;
}
+ ErrorKind::TooManyErrors => {
+ write!(f, "Too many errors, stopping.")?;
+ }
}
dep_chain.fmt(f)
}
@@ -190,8 +203,7 @@ pub fn get_dependent_outputs<'ctx>(
.into_iter()
.chain(
ctx.get_host_depends(task_ref)
- .map_err(|err| vec![err.into()])?
- .into_iter(),
+ .map_err(|err| vec![err.into()])?,
)
.collect();
runtime_depends(ctx, deps)
@@ -202,7 +214,7 @@ pub fn get_dependent_tasks<'ctx>(
task_ref: &TaskRef<'ctx>,
) -> Result<HashSet<TaskRef<'ctx>>, Vec<Error<'ctx>>> {
Ok(ctx
- .get_inherit_depend(task_ref)
+ .get_parent_depend(task_ref)
.map_err(|err| vec![err.into()])?
.into_iter()
.chain(
@@ -255,33 +267,43 @@ impl<'ctx> Resolver<'ctx> {
.insert(task.clone(), ResolveState::Resolving);
let mut ret = Vec::new();
- let mut handle_errors = |errors: Vec<Error<'ctx>>| {
+ let mut handle_errors = |errors: Vec<Error<'ctx>>| -> Result<(), ()> {
for mut error in errors {
error.extend(task);
ret.push(error);
+
+ if ret.len() > MAX_ERRORS {
+ ret.push(Error::too_many_errors());
+ return Err(());
+ }
}
+ Ok(())
};
- match self.ctx.get_inherit_depend(task) {
- Ok(Some(inherit)) => {
- handle_errors(self.add_task(&inherit, None));
- }
- Ok(None) => {}
- Err(err) => {
- handle_errors(vec![err.into()]);
+ let _ = (|| -> Result<(), ()> {
+ match self.ctx.get_parent_depend(task) {
+ Ok(Some(parent)) => {
+ handle_errors(self.add_task(&parent, None))?;
+ }
+ Ok(None) => {}
+ Err(err) => {
+ handle_errors(vec![err.into()])?;
+ }
}
- }
- match get_dependent_outputs(self.ctx, task) {
- Ok(rdeps) => {
- for rdep in rdeps {
- handle_errors(self.add_task(&rdep.task, Some(rdep.output)));
+ match get_dependent_outputs(self.ctx, task) {
+ Ok(rdeps) => {
+ for rdep in rdeps {
+ handle_errors(self.add_task(&rdep.task, Some(rdep.output)))?;
+ }
+ }
+ Err(errors) => {
+ handle_errors(errors)?;
}
}
- Err(errors) => {
- handle_errors(errors);
- }
- }
+
+ Ok(())
+ })();
if ret.is_empty() {
*self
diff --git a/crates/driver/src/task.rs b/crates/driver/src/task.rs
index df3bc68..e84766e 100644
--- a/crates/driver/src/task.rs
+++ b/crates/driver/src/task.rs
@@ -9,13 +9,6 @@ use crate::{
recipe,
};
-#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash, Default)]
-pub struct RecipeMeta {
- #[serde(default)]
- pub name: String,
- pub version: Option<String>,
-}
-
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash)]
pub struct TaskDep {
#[serde(flatten, deserialize_with = "recipe::deserialize_task_id")]
@@ -35,7 +28,7 @@ fn default_output_name() -> String {
}
#[derive(Clone, Debug, Deserialize)]
-pub struct InheritDep {
+pub struct ParentDep {
#[serde(flatten)]
pub dep: TaskDep,
}
@@ -69,14 +62,23 @@ impl Action {
}
}
+#[derive(Clone, Debug, Default)]
+pub struct TaskMeta {
+ pub basename: String,
+ pub recipename: String,
+ pub recipe: String,
+ pub name: String,
+ pub version: Option<String>,
+}
+
#[derive(Clone, Debug, Deserialize, Default)]
pub struct TaskDef {
#[serde(skip)]
- pub meta: RecipeMeta,
+ pub meta: TaskMeta,
#[serde(default)]
pub args: HashMap<String, ArgType>,
#[serde(default)]
- pub inherit: Option<InheritDep>,
+ pub parent: Option<ParentDep>,
#[serde(default)]
pub fetch: HashSet<Fetch>,
#[serde(default)]
diff --git a/crates/driver/src/template.rs b/crates/driver/src/template.rs
index b663e7d..1a091ed 100644
--- a/crates/driver/src/template.rs
+++ b/crates/driver/src/template.rs
@@ -5,38 +5,36 @@ use common::error::*;
use crate::args::TaskArgs;
-fn escape(s: &str) -> String {
- format!("'{}'", s.replace("'", "'\\''"))
+fn escape_sh(s: &str) -> String {
+ format!("'{}'", s.replace('\'', "'\\''"))
}
#[derive(Debug)]
pub struct TemplateEngine {
tpl: Handlebars<'static>,
- tpl_raw: Handlebars<'static>,
+ tpl_sh: Handlebars<'static>,
}
impl TemplateEngine {
pub fn new() -> Self {
let mut tpl = Handlebars::new();
tpl.set_strict_mode(true);
- tpl.register_escape_fn(escape);
+ tpl.register_escape_fn(handlebars::no_escape);
- let mut tpl_raw = Handlebars::new();
- tpl_raw.set_strict_mode(true);
- tpl_raw.register_escape_fn(handlebars::no_escape);
+ let mut tpl_sh = Handlebars::new();
+ tpl_sh.set_strict_mode(true);
+ tpl_sh.register_escape_fn(escape_sh);
- TemplateEngine { tpl, tpl_raw }
- }
-
- pub fn eval_raw(&self, input: &str, args: &TaskArgs) -> Result<String> {
- self.tpl_raw
- .render_template(input, args)
- .map_err(Error::new)
+ TemplateEngine { tpl, tpl_sh }
}
pub fn eval(&self, input: &str, args: &TaskArgs) -> Result<String> {
self.tpl.render_template(input, args).map_err(Error::new)
}
+
+ pub fn eval_sh(&self, input: &str, args: &TaskArgs) -> Result<String> {
+ self.tpl_sh.render_template(input, args).map_err(Error::new)
+ }
}
lazy_static! {
diff --git a/crates/runner/Cargo.toml b/crates/runner/Cargo.toml
index 19ad124..0108e4b 100644
--- a/crates/runner/Cargo.toml
+++ b/crates/runner/Cargo.toml
@@ -11,15 +11,15 @@ edition = "2021"
common = { path = "../common", package = "rebel-common" }
bincode = "1.3.3"
-blake3 = { version = "1.0.0", features = ["traits-preview"] }
+blake3 = { version = "1.3.0", features = ["traits-preview"] }
capctl = "0.2.0"
-digest = "0.9.0"
+digest = "0.10.1"
libc = "0.2.84"
-nix = "0.23.0"
+nix = { version = "0.28.0", features = ["user", "fs", "process", "mount", "sched", "poll", "signal", "hostname", "resource"] }
olpc-cjson = "0.1.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.62"
tar = "0.4.32"
-tee_readwrite = "0.1.0"
-uds = "0.2.6"
+tee_readwrite = "0.2.0"
+uds = "0.4.1"
walkdir = "2.3.2"
diff --git a/crates/runner/src/jobserver.rs b/crates/runner/src/jobserver.rs
index 3b6c856..b0b88cd 100644
--- a/crates/runner/src/jobserver.rs
+++ b/crates/runner/src/jobserver.rs
@@ -1,4 +1,7 @@
-use std::{os::unix::prelude::RawFd, slice};
+use std::{
+ os::fd::{AsFd, AsRawFd, OwnedFd},
+ slice,
+};
use nix::{errno::Errno, fcntl::OFlag, poll, unistd};
@@ -9,8 +12,8 @@ use super::util::unix;
#[derive(Debug)]
pub struct Jobserver {
tokens: usize,
- r: RawFd,
- w: RawFd,
+ r: OwnedFd,
+ w: OwnedFd,
}
impl Jobserver {
@@ -18,11 +21,11 @@ impl Jobserver {
let (r, w) = unistd::pipe2(OFlag::O_CLOEXEC | OFlag::O_NONBLOCK).context("pipe()")?;
for _ in 0..tokens {
- if let Err(_) = unistd::write(w, b"+") {
+ if unistd::write(w.as_fd(), b"+").is_err() {
break;
}
}
- unix::set_blocking(w, true)?;
+ unix::set_blocking(&w, true)?;
Ok(Jobserver { tokens, r, w })
}
@@ -30,13 +33,13 @@ impl Jobserver {
pub fn wait(&mut self) -> u8 {
loop {
poll::poll(
- &mut [poll::PollFd::new(self.r, poll::PollFlags::POLLIN)],
- -1,
+ &mut [poll::PollFd::new(self.r.as_fd(), poll::PollFlags::POLLIN)],
+ poll::PollTimeout::NONE,
)
.expect("poll()");
let mut token = 0;
- match unistd::read(self.r, slice::from_mut(&mut token)) {
+ match unistd::read(self.r.as_raw_fd(), slice::from_mut(&mut token)) {
Ok(n) => {
assert!(n == 1);
return token;
@@ -53,25 +56,24 @@ impl Jobserver {
}
pub fn post(&mut self, token: u8) {
- let n = unistd::write(self.w, slice::from_ref(&token)).expect("write()");
+ let n = unistd::write(self.w.as_fd(), slice::from_ref(&token)).expect("write()");
assert!(n == 1);
}
pub fn set_cloexec(&mut self, cloexec: bool) -> Result<()> {
- unix::set_cloexec(self.r, cloexec)?;
- unix::set_cloexec(self.w, cloexec)?;
+ unix::set_cloexec(&self.r, cloexec)?;
+ unix::set_cloexec(&self.w, cloexec)?;
Ok(())
}
pub fn to_makeflags(&self) -> String {
- format!(" -j{} --jobserver-auth={},{}", self.tokens, self.r, self.w)
+ format!(
+ " -j{} --jobserver-auth={},{}",
+ self.tokens,
+ self.r.as_raw_fd(),
+ self.w.as_raw_fd(),
+ )
}
}
-impl Drop for Jobserver {
- fn drop(&mut self) {
- // FIXME Logging
- let _ = unistd::close(self.r);
- let _ = unistd::close(self.w);
- }
-}
+// FIXME Log lost tokens on drop
diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs
index cfaf658..ab90420 100644
--- a/crates/runner/src/lib.rs
+++ b/crates/runner/src/lib.rs
@@ -17,6 +17,7 @@ use std::{
use capctl::prctl;
use nix::{
errno::Errno,
+ fcntl::Flock,
poll,
sched::CloneFlags,
sys::{
@@ -95,7 +96,18 @@ fn handle_socket(ctx: &mut RunnerContext) -> bool {
true
}
-fn runner(uid: Uid, gid: Gid, socket: UnixSeqpacketConn, _lockfile: File, options: &Options) -> ! {
+fn borrow_socket_fd(socket: &UnixSeqpacketConn) -> BorrowedFd<'_> {
+ unsafe { BorrowedFd::borrow_raw(socket.as_raw_fd()) }
+}
+
+fn runner(
+ uid: Uid,
+ gid: Gid,
+ socket: UnixSeqpacketConn,
+ _lockfile: Flock<File>,
+ options: &Options,
+) -> ! {
+ unistd::setsid().expect("setsid()");
ns::mount_proc();
ns::setup_userns(Uid::from_raw(0), Gid::from_raw(0), uid, gid);
@@ -117,35 +129,36 @@ fn runner(uid: Uid, gid: Gid, socket: UnixSeqpacketConn, _lockfile: File, option
signals.add(signal::Signal::SIGCHLD);
signal::pthread_sigmask(signal::SigmaskHow::SIG_BLOCK, Some(&signals), None)
.expect("pthread_sigmask()");
- let mut sfd = SignalFd::with_flags(&signals, SfdFlags::SFD_CLOEXEC)
+ let mut signal_fd = SignalFd::with_flags(&signals, SfdFlags::SFD_CLOEXEC)
.expect("Failed to create signal file descriptor");
- let mut pollfds = [
- poll::PollFd::new(sfd.as_raw_fd(), poll::PollFlags::POLLIN),
- poll::PollFd::new(ctx.socket.as_raw_fd(), poll::PollFlags::POLLIN),
- ];
-
loop {
- poll::poll(&mut pollfds, -1).expect("poll()");
-
- let events = pollfds[0]
+ let socket_fd = borrow_socket_fd(&ctx.socket);
+ let mut pollfds = [
+ poll::PollFd::new(signal_fd.as_fd(), poll::PollFlags::POLLIN),
+ poll::PollFd::new(socket_fd.as_fd(), poll::PollFlags::POLLIN),
+ ];
+ poll::poll(&mut pollfds, poll::PollTimeout::NONE).expect("poll()");
+
+ let signal_events = pollfds[0]
.revents()
.expect("Unknown events in poll() return");
- if events.contains(poll::PollFlags::POLLIN) {
- let _signal = sfd.read_signal().expect("read_signal()").unwrap();
+ let socket_events = pollfds[1]
+ .revents()
+ .expect("Unknown events in poll() return");
+
+ if signal_events.contains(poll::PollFlags::POLLIN) {
+ let _signal = signal_fd.read_signal().expect("read_signal()").unwrap();
handle_sigchld(&mut ctx).expect("Task process exited abnormally");
- } else if events.intersects(!poll::PollFlags::POLLIN) {
+ } else if signal_events.intersects(!poll::PollFlags::POLLIN) {
panic!("Unexpected error status for signal file descriptor");
}
- let events = pollfds[1]
- .revents()
- .expect("Unknown events in poll() return");
- if events.contains(poll::PollFlags::POLLIN) {
+ if socket_events.contains(poll::PollFlags::POLLIN) {
if !handle_socket(&mut ctx) {
break;
}
- } else if events.intersects(!poll::PollFlags::POLLIN) {
+ } else if socket_events.intersects(!poll::PollFlags::POLLIN) {
panic!("Unexpected error status for socket file descriptor");
}
}
diff --git a/crates/runner/src/ns.rs b/crates/runner/src/ns.rs
index 3a8b51f..4a8e3e7 100644
--- a/crates/runner/src/ns.rs
+++ b/crates/runner/src/ns.rs
@@ -17,12 +17,12 @@ pub fn setup_userns(inner_uid: Uid, inner_gid: Gid, outer_uid: Uid, outer_gid: G
std::fs::write("/proc/self/setgroups", "deny").expect("Failed to write /proc/self/setgroups");
std::fs::write(
"/proc/self/uid_map",
- &format!("{} {} 1", inner_uid, outer_uid),
+ format!("{} {} 1", inner_uid, outer_uid),
)
.expect("Failed to write /proc/self/uid_map");
std::fs::write(
"/proc/self/gid_map",
- &format!("{} {} 1", inner_gid, outer_gid),
+ format!("{} {} 1", inner_gid, outer_gid),
)
.expect("Failed to write /proc/self/gid_map");
}
diff --git a/crates/runner/src/paths.rs b/crates/runner/src/paths.rs
index 7af1e3a..4b3a126 100644
--- a/crates/runner/src/paths.rs
+++ b/crates/runner/src/paths.rs
@@ -102,7 +102,7 @@ pub fn depend_dir(hash: &ArchiveHash) -> String {
}
pub fn depend_lock_filename(hash: &ArchiveHash) -> String {
- join(&[DEPENDS_TMP_DIR, &format!("{}.lock", hash.to_string())])
+ join(&[DEPENDS_TMP_DIR, &format!("{}.lock", hash)])
}
pub fn archive_tmp_filename(hash: &InputHash) -> String {
diff --git a/crates/runner/src/tar.rs b/crates/runner/src/tar.rs
index 10cac92..1a66408 100644
--- a/crates/runner/src/tar.rs
+++ b/crates/runner/src/tar.rs
@@ -60,7 +60,7 @@ pub fn pack<W: Write, P: AsRef<Path>>(
ns::pivot_root(&rootfs);
let err = Command::new("tar")
- .args(&[
+ .args([
"-c",
"--sort=name",
"--numeric-owner",
diff --git a/crates/runner/src/task.rs b/crates/runner/src/task.rs
index 19a7484..19b74f4 100644
--- a/crates/runner/src/task.rs
+++ b/crates/runner/src/task.rs
@@ -11,7 +11,7 @@ use capctl::prctl;
use nix::{
mount::{self, MsFlags},
sched::{unshare, CloneFlags},
- sys::wait,
+ sys::{resource, time::TimeVal, wait},
unistd::{self, Gid, Uid},
};
use serde::Serialize;
@@ -52,7 +52,7 @@ fn input_hash(task: &Task) -> InputHash {
pub command: &'a str,
pub workdir: &'a str,
pub rootfs: &'a ArchiveHash,
- pub inherit: &'a [LayerHash],
+ pub ancestors: &'a [LayerHash],
pub depends: HashMap<DependencyHash, &'a Dependency>,
pub outputs: &'a HashMap<String, String>,
}
@@ -60,7 +60,7 @@ fn input_hash(task: &Task) -> InputHash {
command: &task.command,
workdir: &task.workdir,
rootfs: &task.rootfs,
- inherit: &task.inherit,
+ ancestors: &task.ancestors,
depends: task
.depends
.iter()
@@ -76,7 +76,7 @@ fn input_hash(task: &Task) -> InputHash {
fn init_task(input_hash: &InputHash, task: &Task) -> Result<fs::Mount> {
// Remove metadata first to ensure task invalidation
- fs::ensure_removed(&paths::task_cache_filename(input_hash))?;
+ fs::ensure_removed(paths::task_cache_filename(input_hash))?;
let task_state_dir = paths::task_state_dir(input_hash);
@@ -94,7 +94,7 @@ fn init_task(input_hash: &InputHash, task: &Task) -> Result<fs::Mount> {
.with_context(|| format!("Failed to write {}", runfile))?;
let mount_target = paths::join(&[&task_tmp_dir, &task.workdir]);
- let mount = if task.inherit.is_empty() {
+ let mount = if task.ancestors.is_empty() {
fs::mount(task_layer_dir, &mount_target, None, MsFlags::MS_BIND, None)
.with_context(|| format!("Failed to bind mount to {:?}", mount_target))?
} else {
@@ -104,7 +104,7 @@ fn init_task(input_hash: &InputHash, task: &Task) -> Result<fs::Mount> {
fs::fixup_permissions(&task_work_dir)?;
let lower = task
- .inherit
+ .ancestors
.iter()
.rev()
.map(paths::layer_dir)
@@ -250,11 +250,11 @@ fn init_task_rootfs(input_hash: &InputHash, task: &Task) -> Result<Stack<fs::Mou
fn cleanup_task(input_hash: &InputHash) -> Result<()> {
let task_tmp_dir = paths::task_tmp_dir(input_hash);
- fs::ensure_removed(&task_tmp_dir).context("Failed to remove task tmp dir")?;
+ fs::ensure_removed(task_tmp_dir).context("Failed to remove task tmp dir")?;
let task_state_dir = paths::task_state_dir(input_hash);
let task_work_dir = paths::join(&[&task_state_dir, paths::TASK_STATE_WORK_SUBDIR]);
- fs::ensure_removed(&task_work_dir).context("Failed to remove overlayfs workdir")?;
+ fs::ensure_removed(task_work_dir).context("Failed to remove overlayfs workdir")?;
Ok(())
}
@@ -445,14 +445,13 @@ fn run_task(input_hash: &InputHash, task: &Task, jobserver: &mut Jobserver) -> R
.context("Failed to unset O_CLOEXEC on jobserver pipe")?;
let err = Command::new("sh")
- .args(&["-ex", &paths::join(&[paths::TASK_TASKDIR, paths::TASK_RUN])])
+ .args(["-ex", &paths::join(&[paths::TASK_TASKDIR, paths::TASK_RUN])])
.stdin(Stdio::null())
.stdout(log_stdout)
.stderr(log_stderr)
.env_clear()
.env("PATH", "/usr/sbin:/usr/bin:/sbin:/bin")
.env("HOME", "/build")
- .env("INPUT_HASH", input_hash.to_string())
.env("MAKEFLAGS", jobserver.to_makeflags())
.exec();
eprintln!("{}", err);
@@ -556,7 +555,7 @@ fn load_cached(input_hash: &InputHash) -> Result<TaskOutput> {
}
fn save_cached(input_hash: &InputHash, output: &TaskOutput) -> Result<()> {
- fs::mkdir(&paths::task_state_dir(input_hash))?;
+ fs::mkdir(paths::task_state_dir(input_hash))?;
let tmp_filename = paths::task_cache_tmp_filename(input_hash);
let filename = paths::task_cache_filename(input_hash);
@@ -569,6 +568,26 @@ fn save_cached(input_hash: &InputHash, output: &TaskOutput) -> Result<()> {
Ok(())
}
+trait AsSecsF32 {
+ fn as_secs_f32(&self) -> f32;
+}
+
+impl AsSecsF32 for TimeVal {
+ fn as_secs_f32(&self) -> f32 {
+ self.tv_sec() as f32 + 1e-6 * (self.tv_usec() as f32)
+ }
+}
+
+fn get_usage(total: f32) -> String {
+ let usage = resource::getrusage(resource::UsageWho::RUSAGE_CHILDREN).expect("getrusage()");
+
+ let user = usage.user_time().as_secs_f32();
+ let system = usage.system_time().as_secs_f32();
+ let cpu = (100.0 * (user + system) / total).round();
+
+ format!("{user:.2}s user {system:.2}s system {cpu:.0}% cpu")
+}
+
pub fn handle(task: Task, jobserver: &mut Jobserver) -> Result<TaskOutput> {
let input_hash = input_hash(&task);
@@ -597,12 +616,11 @@ pub fn handle(task: Task, jobserver: &mut Jobserver) -> Result<TaskOutput> {
save_cached(&input_hash, &task_output)?;
- let duration = Instant::now().duration_since(start_time);
+ let duration = Instant::now().duration_since(start_time).as_secs_f32();
+ let usage = get_usage(duration);
println!(
- "Finished task {} ({}) in {}",
- task.label,
- input_hash,
- duration.as_secs_f32()
+ "Finished task {} ({}) in {:.2}s ({})",
+ task.label, input_hash, duration, usage,
);
if let Ok(cached_output) = cached_output {
diff --git a/crates/runner/src/util/clone.rs b/crates/runner/src/util/clone.rs
index 0af9e4d..51a31c3 100644
--- a/crates/runner/src/util/clone.rs
+++ b/crates/runner/src/util/clone.rs
@@ -27,6 +27,8 @@ pub unsafe fn clone(flags: sched::CloneFlags) -> nix::Result<unistd::ForkResult>
let size = mem::size_of_val(&args) as libc::size_t;
let pid = libc::syscall(libc::SYS_clone3, &mut args, size);
+
+ #[allow(clippy::comparison_chain)]
if pid < 0 {
Err(errno::Errno::last())
} else if pid == 0 {
diff --git a/crates/runner/src/util/fs.rs b/crates/runner/src/util/fs.rs
index 9e16648..5efd159 100644
--- a/crates/runner/src/util/fs.rs
+++ b/crates/runner/src/util/fs.rs
@@ -123,5 +123,5 @@ pub fn mount<P1: AsRef<Path>, P2: AsRef<Path>>(
pub fn pipe() -> Result<(File, File)> {
unistd::pipe2(OFlag::O_CLOEXEC)
.context("pipe2()")
- .map(|(piper, pipew)| unsafe { (File::from_raw_fd(piper), File::from_raw_fd(pipew)) })
+ .map(|(piper, pipew)| (File::from(piper), File::from(pipew)))
}
diff --git a/crates/runner/src/util/unix.rs b/crates/runner/src/util/unix.rs
index 710138c..08884ec 100644
--- a/crates/runner/src/util/unix.rs
+++ b/crates/runner/src/util/unix.rs
@@ -1,7 +1,7 @@
use std::{fs::File, os::unix::prelude::*, path::Path};
use nix::{
- fcntl::{self, FcntlArg, FdFlag, OFlag},
+ fcntl::{self, FcntlArg, FdFlag, Flock, OFlag},
sched,
unistd::Pid,
};
@@ -10,10 +10,11 @@ use common::error::*;
use super::fs;
-pub fn set_blocking(fd: RawFd, blocking: bool) -> Result<()> {
- let flags = unsafe {
- OFlag::from_bits_unchecked(fcntl::fcntl(fd, FcntlArg::F_GETFL).context("fcntl(F_GETFL)")?)
- };
+pub fn set_blocking<Fd: AsFd>(fd: &Fd, blocking: bool) -> Result<()> {
+ let raw_fd = fd.as_fd().as_raw_fd();
+
+ let flags =
+ OFlag::from_bits_retain(fcntl::fcntl(raw_fd, FcntlArg::F_GETFL).context("fcntl(F_GETFL)")?);
let new_flags = if blocking {
flags & !OFlag::O_NONBLOCK
@@ -22,16 +23,18 @@ pub fn set_blocking(fd: RawFd, blocking: bool) -> Result<()> {
};
if new_flags != flags {
- fcntl::fcntl(fd, FcntlArg::F_SETFL(new_flags)).context("fcntl(F_SETFL)")?;
+ fcntl::fcntl(raw_fd, FcntlArg::F_SETFL(new_flags)).context("fcntl(F_SETFL)")?;
}
Ok(())
}
-pub fn set_cloexec(fd: RawFd, cloexec: bool) -> Result<()> {
- let flags = unsafe {
- FdFlag::from_bits_unchecked(fcntl::fcntl(fd, FcntlArg::F_GETFD).context("fcntl(F_GETFD)")?)
- };
+pub fn set_cloexec<Fd: AsFd>(fd: &Fd, cloexec: bool) -> Result<()> {
+ let raw_fd = fd.as_fd().as_raw_fd();
+
+ let flags = FdFlag::from_bits_retain(
+ fcntl::fcntl(raw_fd, FcntlArg::F_GETFD).context("fcntl(F_GETFD)")?,
+ );
let new_flags = if cloexec {
flags | FdFlag::FD_CLOEXEC
@@ -40,7 +43,7 @@ pub fn set_cloexec(fd: RawFd, cloexec: bool) -> Result<()> {
};
if new_flags != flags {
- fcntl::fcntl(fd, FcntlArg::F_SETFD(new_flags)).context("fcntl(F_SETFD)")?;
+ fcntl::fcntl(raw_fd, FcntlArg::F_SETFD(new_flags)).context("fcntl(F_SETFD)")?;
}
Ok(())
@@ -62,7 +65,7 @@ pub fn nproc() -> Result<usize> {
Ok(count)
}
-pub fn lock<P: AsRef<Path>>(path: P, exclusive: bool, blocking: bool) -> Result<File> {
+pub fn lock<P: AsRef<Path>>(path: P, exclusive: bool, blocking: bool) -> Result<Flock<File>> {
use fcntl::FlockArg::*;
if let Some(parent) = path.as_ref().parent() {
@@ -77,8 +80,7 @@ pub fn lock<P: AsRef<Path>>(path: P, exclusive: bool, blocking: bool) -> Result<
};
let file = fs::create(path.as_ref())?;
- fcntl::flock(file.as_raw_fd(), arg)
- .with_context(|| format!("flock failed on {:?}", path.as_ref()))?;
-
- Ok(file)
+ fcntl::Flock::lock(file, arg)
+ .map_err(|(_, errno)| errno)
+ .with_context(|| format!("flock failed on {:?}", path.as_ref()))
}
diff --git a/examples/pins.yml.example b/examples/pins.yml.example
index 7bc7d45..c16cedb 100644
--- a/examples/pins.yml.example
+++ b/examples/pins.yml.example
@@ -1,13 +1,13 @@
-rootfs-c080605f9ab8:
- hash: 'c080605f9ab85b67b26e1d7cb0535789cad3df8a138811b54f3270694b9205d7'
+rootfs-8d1fb3274ebc:
+ hash: '8d1fb3274ebcb0f7ae88f3ce5810ad20014d08efca29e617a873670949de729d'
is-rootfs: true
provides:
- - recipe: 'gcc-libs'
+ - recipe: 'gcc/libs'
task: 'install'
output: ['default']
args:
host: 'build'
- - recipe: 'linux-uapi-headers'
+ - recipe: 'linux/uapi-headers'
task: 'install'
output: ['default']
args:
@@ -54,7 +54,7 @@ rootfs-c080605f9ab8:
args:
host: 'build'
target: 'build'
- - recipe: 'libgcc'
+ - recipe: 'gcc/libgcc'
task: 'install'
output: ['default']
args:
diff --git a/examples/recipes/bar.yml b/examples/recipes/bar/build.yml
index f25322e..f25322e 100644
--- a/examples/recipes/bar.yml
+++ b/examples/recipes/bar/build.yml
diff --git a/examples/recipes/binutils@2.37.yml b/examples/recipes/binutils/build.yml
index b3afa92..dd82d2e 100644
--- a/examples/recipes/binutils@2.37.yml
+++ b/examples/recipes/binutils/build.yml
@@ -1,16 +1,18 @@
+meta:
+ version: '2.41'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.xz'
- sha256: '820d9724f020a3e69cb337893a0b63c2db161dadcb0e06fc11dc29eb1e84a32c'
+ - name: '{{name}}-{{version}}.tar.xz'
+ sha256: 'ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.xz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.xz
configure:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -19,9 +21,9 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- mkdir {{pn}}-build
- cd {{pn}}-build
- ../{{pn}}-{{pv}}/configure \
+ mkdir {{name}}-build
+ cd {{name}}-build
+ ../{{name}}-{{version}}/configure \
--build={{build.gnu_triplet}} \
--host={{host.gnu_triplet}} \
--target={{target.gnu_triplet}} \
@@ -42,10 +44,10 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make
find -name config.log -delete
@@ -53,7 +55,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
@@ -61,5 +63,5 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}} install
diff --git a/examples/recipes/busybox@1.34.0.yml b/examples/recipes/busybox/build.yml
index bb62dc6..fa87bc3 100644
--- a/examples/recipes/busybox@1.34.0.yml
+++ b/examples/recipes/busybox/build.yml
@@ -1,27 +1,29 @@
+meta:
+ version: '1.36.1'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.bz2'
- sha256: 'ec8d1615edb045b83b81966604759c4d4ac921434ab4011da604f629c06074ce'
+ - name: '{{name}}-{{version}}.tar.bz2'
+ sha256: 'b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.bz2
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.bz2
configure:
- inherit:
+ parent:
task: 'unpack'
run: |
- mkdir {{pn}}-build
- cd {{pn}}-build
+ mkdir {{name}}-build
+ cd {{name}}-build
make \
- -f ../{{pn}}-{{pv}}/Makefile \
- KBUILD_SRC=../{{pn}}-{{pv}} \
+ -f ../{{name}}-{{version}}/Makefile \
+ KBUILD_SRC=../{{name}}-{{version}} \
defconfig
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
build_depends:
- recipe: 'toolchain'
@@ -30,21 +32,21 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make \
ARCH={{host.karch}} \
CROSS_COMPILE={{cross_compile}} \
EXTRA_CFLAGS='-DBB_EXTRA_VERSION=""' \
- {{pn}} busybox.links
+ {{name}} busybox.links
sed -i \
-e 's@^/usr@@' \
-e 's@^/sbin@/bin@' \
- {{pn}}.links
+ {{name}}.links
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
@@ -52,7 +54,7 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make \
ARCH={{host.karch}} \
CROSS_COMPILE={{cross_compile}} \
diff --git a/examples/recipes/e2fsprogs@1.46.4.yml b/examples/recipes/e2fsprogs/build.yml
index 6f308fa..508d1d4 100644
--- a/examples/recipes/e2fsprogs@1.46.4.yml
+++ b/examples/recipes/e2fsprogs/build.yml
@@ -1,15 +1,17 @@
+meta:
+ version: '1.47.0'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.xz'
- sha256: 'b11042533c1b1dcf17512f0da48e05b0c573dada1dd8b762864d10f4dc399713'
+ - name: '{{name}}-{{version}}.tar.xz'
+ sha256: '144af53f2bbd921cef6f8bea88bb9faddca865da3fbc657cc9b4d2001097d5db'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.xz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.xz
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -18,9 +20,9 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- mkdir {{pn}}-build
- cd {{pn}}-build
- ../{{pn}}-{{pv}}/configure \
+ mkdir {{name}}-build
+ cd {{name}}-build
+ ../{{name}}-{{version}}/configure \
--build={{build.gnu_triplet}} \
--host={{host.gnu_triplet}} \
--prefix={{host.prefix}}
@@ -29,17 +31,17 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make
find -name config.log -delete
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
@@ -47,6 +49,6 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}} install
diff --git a/examples/recipes/foo.yml b/examples/recipes/foo/build.yml
index 2982795..2982795 100644
--- a/examples/recipes/foo.yml
+++ b/examples/recipes/foo/build.yml
diff --git a/examples/recipes/libgcc-initial@11.2.0.yml b/examples/recipes/gcc/build.libgcc-initial.yml
index 43f6f45..ed230ba 100644
--- a/examples/recipes/libgcc-initial@11.2.0.yml
+++ b/examples/recipes/gcc/build.libgcc-initial.yml
@@ -1,18 +1,16 @@
-meta:
- name: 'gcc'
tasks:
configure:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
recipe: 'gcc'
task: 'compile'
depends:
- recipe: 'gcc'
task: 'header-stubs'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make configure-target-libgcc
# A hack borrowed from OpenEmbedded:
@@ -30,22 +28,22 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make all-target-libgcc
install:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default: {}
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}} install-target-libgcc
- ln -s libgcc.a {{destdir}}{{host.prefix}}/lib/gcc/{{target.gnu_triplet}}/"$(cat ../{{pn}}-{{pv}}/gcc/BASE-VER)"/libgcc_eh.a
+ ln -s libgcc.a {{destdir}}{{host.prefix}}/lib/gcc/{{target.gnu_triplet}}/"$(cat ../{{name}}-{{version}}/gcc/BASE-VER)"/libgcc_eh.a
diff --git a/examples/recipes/libgcc@11.2.0.yml b/examples/recipes/gcc/build.libgcc.yml
index 96a2ce8..67e21f7 100644
--- a/examples/recipes/libgcc@11.2.0.yml
+++ b/examples/recipes/gcc/build.libgcc.yml
@@ -1,11 +1,9 @@
-meta:
- name: 'gcc'
tasks:
compile:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
recipe: 'gcc'
task: 'compile'
depends:
@@ -14,19 +12,19 @@ tasks:
args:
host: 'target'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make all-target-libgcc
install:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default: {}
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}} install-target-libgcc
rm {{destdir}}{{host_to_target.sysroot}}{{target.prefix}}/lib/libgcc_s.so*
rmdir -p --ignore-fail-on-non-empty {{destdir}}{{host_to_target.sysroot}}{{target.prefix}}/lib
diff --git a/examples/recipes/gcc-libs@11.2.0.yml b/examples/recipes/gcc/build.libs.yml
index 5320d29..856fd1c 100644
--- a/examples/recipes/gcc-libs@11.2.0.yml
+++ b/examples/recipes/gcc/build.libs.yml
@@ -1,29 +1,27 @@
-meta:
- name: 'gcc'
tasks:
compile:
args:
host: 'platform'
- inherit:
- recipe: 'libgcc'
+ parent:
+ recipe: 'gcc/libgcc'
task: 'compile'
args:
host: 'build'
target: 'host'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make all-target-libatomic all-target-libgomp all-target-libquadmath all-target-libstdc++-v3
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
path: 'sysroot'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}}/install install-target-libgcc install-target-libatomic install-target-libgomp install-target-libquadmath install-target-libstdc++-v3
rm -r {{destdir}}/install{{build.prefix}}/lib/gcc
mv -T {{destdir}}/install/{{build_to_host.sysroot}} {{destdir}}/sysroot
diff --git a/examples/recipes/gcc@11.2.0.yml b/examples/recipes/gcc/build.yml
index 41a2bf6..3352b2d 100644
--- a/examples/recipes/gcc@11.2.0.yml
+++ b/examples/recipes/gcc/build.yml
@@ -1,12 +1,14 @@
+meta:
+ version: '13.2.0'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.xz'
- sha256: 'd08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b'
+ - name: '{{name}}-{{version}}.tar.xz'
+ sha256: 'e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.xz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.xz
- sed -i -e 's@^MULTILIB_OSDIRNAMES@# &@' {{pn}}-{{pv}}/gcc/config/*/t-*
+ sed -i -e 's@^MULTILIB_OSDIRNAMES@# &@' {{name}}-{{version}}/gcc/config/*/t-*
header-stubs:
args:
@@ -24,7 +26,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -45,9 +47,9 @@ tasks:
run: |
export CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++"
- mkdir {{pn}}-build
- cd {{pn}}-build
- ../{{pn}}-{{pv}}/configure \
+ mkdir {{name}}-build
+ cd {{name}}-build
+ ../{{name}}-{{version}}/configure \
--build={{build.gnu_triplet}} \
--host={{host.gnu_triplet}} \
--target={{target.gnu_triplet}} \
@@ -58,7 +60,7 @@ tasks:
--with-build-sysroot={{sysroot}} \
--with-native-system-header-dir={{target.prefix}}/include \
--with-toolexeclibdir={{host_to_target.sysroot}}{{target.prefix}}/lib \
- --with-gxx-include-dir={{host_to_target.sysroot}}{{target.prefix}}/include/c++/"$(cat ../{{pn}}-{{pv}}/gcc/BASE-VER)" \
+ --with-gxx-include-dir={{host_to_target.sysroot}}{{target.prefix}}/include/c++/"$(cat ../{{name}}-{{version}}/gcc/BASE-VER)" \
--with-gnu-ld \
--enable-shared \
--enable-languages=c,c++ \
@@ -93,13 +95,13 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'configure'
depends:
- task: 'header-stubs'
noinherit: true
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make all-host
find -name config.log -delete
@@ -107,7 +109,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
@@ -119,6 +121,6 @@ tasks:
- recipe: 'zlib'
task: 'install'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}} install-host
diff --git a/examples/recipes/glibc@2.34.yml b/examples/recipes/glibc/build.yml
index 98016cd..f1bf890 100644
--- a/examples/recipes/glibc@2.34.yml
+++ b/examples/recipes/glibc/build.yml
@@ -1,43 +1,43 @@
+meta:
+ version: '2.38-25-gf6445dc94da1'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.xz'
- sha256: '44d26a1fe20b8853a48f470ead01e4279e869ac149b195dda4e44a195d981ab2'
+ - name: '{{name}}-{{version}}.tar.xz'
+ sha256: '92594ade540761f70d57de4f3a150128e7b7f7ed653a59d1acc23468ab70fae9'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.xz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.xz
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'gcc'
task: 'install'
- - recipe: 'libgcc-initial'
+ - recipe: 'gcc/libgcc-initial'
task: 'install'
depends:
- - recipe: 'linux-uapi-headers'
+ - recipe: 'linux/uapi-headers'
task: 'install'
run: |
export BUILD_CC="$CC_FOR_BUILD"
- mkdir {{pn}}-build
- cd {{pn}}-build
- ../{{pn}}-{{pv}}/configure \
+ mkdir {{name}}-build
+ cd {{name}}-build
+ ../{{name}}-{{version}}/configure \
--build={{build.gnu_triplet}} \
--host={{host.gnu_triplet}} \
--prefix={{host.prefix}} \
--includedir={{host.prefix}}/include \
--libdir={{host.prefix}}/lib \
--libexecdir={{host.prefix}}/lib \
- --enable-add-ons \
- --enable-obsolete-rpc \
- --enable-kernel=2.6.32 \
--enable-bind-now \
+ --enable-fortify-source \
+ --enable-kernel=4.4 \
+ --disable-nscd \
--disable-profile \
- --enable-stackguard-randomization \
- --enable-lock-elision \
--disable-werror
echo slibdir={{host.prefix}}/lib >> configparms
@@ -47,22 +47,22 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
runtime_depends:
- - recipe: 'linux-uapi-headers'
+ - recipe: 'linux/uapi-headers'
task: 'install'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make install_root={{destdir}} install
diff --git a/examples/recipes/gmp@6.2.1.yml b/examples/recipes/gmp/build.yml
index 0226fd9..322f0f0 100644
--- a/examples/recipes/gmp@6.2.1.yml
+++ b/examples/recipes/gmp/build.yml
@@ -1,15 +1,17 @@
+meta:
+ version: '6.3.0'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.lz'
- sha256: '2c7f4f0d370801b2849c48c9ef3f59553b5f1d3791d070cffb04599f9fc67b41'
+ - name: '{{name}}-{{version}}.tar.xz'
+ sha256: 'a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.lz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.xz
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -18,9 +20,9 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- mkdir {{pn}}-build
- cd {{pn}}-build
- ../{{pn}}-{{pv}}/configure \
+ mkdir {{name}}-build
+ cd {{name}}-build
+ ../{{name}}-{{version}}/configure \
--build={{build.gnu_triplet}} \
--host={{host.gnu_triplet}} \
--prefix={{host.prefix}}
@@ -29,16 +31,16 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
@@ -46,7 +48,7 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}} install
rm {{destdir}}{{host.prefix}}/lib/*.a
rm {{destdir}}{{host.prefix}}/lib/*.la
diff --git a/examples/recipes/rootfs.yml b/examples/recipes/image/build.yml
index 03b52d6..a42899f 100644
--- a/examples/recipes/rootfs.yml
+++ b/examples/recipes/image/build.yml
@@ -1,5 +1,5 @@
tasks:
- install:
+ rootfs:
args:
host: 'platform'
depends:
@@ -15,12 +15,13 @@ tasks:
mkdir -p \
{{destdir}}/dev \
{{destdir}}/proc \
- {{destdir}}/sys \
{{destdir}}/root \
{{destdir}}/run \
- {{destdir}}/var \
+ {{destdir}}/sys \
+ {{destdir}}/tmp \
{{destdir}}/usr/bin \
- {{destdir}}/usr/lib
+ {{destdir}}/usr/lib \
+ {{destdir}}/var
ln -s bin {{destdir}}/usr/sbin
ln -s usr/bin {{destdir}}/bin
@@ -31,7 +32,7 @@ tasks:
rsync -aHAXK {{sysroot}}/ {{destdir}}
- image-ext4:
+ ext4:
args:
host: 'platform'
build_depends:
@@ -40,17 +41,20 @@ tasks:
- recipe: 'make_ext4fs'
task: 'install'
depends:
- - task: 'install'
+ - task: 'rootfs'
output:
default: {}
run: |
- IMAGE={{destdir}}/{{pn}}.ext4
- UUID="$(
- python3 \
- -c 'import sys; import uuid; print(uuid.UUID(hex=sys.argv[1][:32], version=4))' \
- "$INPUT_HASH"
- )"
+ IMAGE={{destdir}}/{{name}}.ext4
mkdir {{destdir}}
make_ext4fs -l 2G -T "$SOURCE_DATE_EPOCH" -L root "$IMAGE" {{sysroot}}
+ E2FSPROGS_FAKE_TIME="$SOURCE_DATE_EPOCH" tune2fs -U '00000000-0000-4000-8000-000000000000' "$IMAGE"
+
+ HASH=$(sha256sum "$IMAGE")
+ UUID=$(
+ python3 \
+ -c 'import sys; import uuid; print(uuid.UUID(hex=sys.argv[1][:32], version=4))' \
+ "$HASH"
+ )
E2FSPROGS_FAKE_TIME="$SOURCE_DATE_EPOCH" tune2fs -U "$UUID" "$IMAGE"
diff --git a/examples/recipes/linux-uapi-headers@5.10.66.yml b/examples/recipes/linux/build.uapi-headers.yml
index 27d7fc2..a302aa9 100644
--- a/examples/recipes/linux-uapi-headers@5.10.66.yml
+++ b/examples/recipes/linux/build.uapi-headers.yml
@@ -1,21 +1,19 @@
-meta:
- name: 'linux'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.xz'
- sha256: '5dfa06bbbbd164b9ea669ec637b1e6d05fb5fea8ef3aeb6729f2cbcd0dfcc8a7'
+ - name: '{{name}}-{{version}}.tar.xz'
+ sha256: '8cf10379f7df8ea731e09bff3d0827414e4b643dd41dc99d0af339669646ef95'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.xz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.xz
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
output:
default: {}
run: |
- cd {{pn}}-{{pv}}
+ cd {{name}}-{{version}}
make INSTALL_HDR_PATH={{destdir}}{{host.prefix}} ARCH={{host.karch}} headers_install
diff --git a/examples/recipes/linux@5.10.66.yml b/examples/recipes/linux/build.yml
index 22b17c2..3f84291 100644
--- a/examples/recipes/linux@5.10.66.yml
+++ b/examples/recipes/linux/build.yml
@@ -1,24 +1,26 @@
+meta:
+ version: '6.5.5'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.xz'
- sha256: '5dfa06bbbbd164b9ea669ec637b1e6d05fb5fea8ef3aeb6729f2cbcd0dfcc8a7'
+ - name: '{{name}}-{{version}}.tar.xz'
+ sha256: '8cf10379f7df8ea731e09bff3d0827414e4b643dd41dc99d0af339669646ef95'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.xz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.xz
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'gcc'
task: 'install'
run: |
- mkdir {{pn}}-build
- cd {{pn}}-build
+ mkdir {{name}}-build
+ cd {{name}}-build
make \
- -f ../{{pn}}-{{pv}}/Makefile \
+ -f ../{{name}}-{{version}}/Makefile \
ARCH={{host.karch}} \
CROSS_COMPILE={{cross_compile}} \
defconfig
@@ -26,12 +28,12 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
export KBUILD_BUILD_TIMESTAMP="@${SOURCE_DATE_EPOCH}"
- cd {{pn}}-build
+ cd {{name}}-build
make \
ARCH={{host.karch}} \
CROSS_COMPILE={{cross_compile}} \
@@ -40,7 +42,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
boot:
@@ -48,7 +50,7 @@ tasks:
modules:
path: 'modules'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
mkdir -p {{destdir}}/boot
make \
ARCH={{host.karch}} \
diff --git a/examples/recipes/ls.yml b/examples/recipes/ls/build.yml
index 633336d..633336d 100644
--- a/examples/recipes/ls.yml
+++ b/examples/recipes/ls/build.yml
diff --git a/examples/recipes/make_ext4fs@2020-01-05.yml b/examples/recipes/make_ext4fs/build.yml
index 53fed98..183389a 100644
--- a/examples/recipes/make_ext4fs@2020-01-05.yml
+++ b/examples/recipes/make_ext4fs/build.yml
@@ -3,10 +3,10 @@ meta:
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.gz'
+ - name: '{{name}}-{{version}}.tar.gz'
sha256: 'bfe984cc757c676639090a5b34bdfc359cdef9b723de77efbce590872dce4132'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.gz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.gz
compile:
args:
@@ -19,16 +19,16 @@ tasks:
task: 'depends'
- recipe: 'zlib'
task: 'install'
- inherit:
+ parent:
task: 'unpack'
run: |
- cd {{pn}}-{{pv}}
+ cd {{name}}-{{version}}
make
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
@@ -38,7 +38,7 @@ tasks:
- recipe: 'zlib'
task: 'install'
run: |
- cd {{pn}}-{{pv}}
+ cd {{name}}-{{version}}
install -d {{destdir}}{{host.prefix}}/bin
install -m755 make_ext4fs {{destdir}}{{host.prefix}}/bin/
diff --git a/examples/recipes/mpc@1.2.1.yml b/examples/recipes/mpc/build.yml
index f5afb74..e415c60 100644
--- a/examples/recipes/mpc@1.2.1.yml
+++ b/examples/recipes/mpc/build.yml
@@ -1,15 +1,17 @@
+meta:
+ version: '1.3.1'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.gz'
- sha256: '17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459'
+ - name: '{{name}}-{{version}}.tar.gz'
+ sha256: 'ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.gz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.gz
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -20,9 +22,9 @@ tasks:
- recipe: 'mpfr'
task: 'install'
run: |
- mkdir {{pn}}-build
- cd {{pn}}-build
- ../{{pn}}-{{pv}}/configure \
+ mkdir {{name}}-build
+ cd {{name}}-build
+ ../{{name}}-{{version}}/configure \
--build={{build.gnu_triplet}} \
--host={{host.gnu_triplet}} \
--prefix={{host.prefix}}
@@ -31,16 +33,16 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
@@ -50,7 +52,7 @@ tasks:
- recipe: 'mpfr'
task: 'install'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}} install
rm {{destdir}}{{host.prefix}}/lib/*.a
rm {{destdir}}{{host.prefix}}/lib/*.la
diff --git a/examples/recipes/mpfr@4.1.0.yml b/examples/recipes/mpfr/build.yml
index de9e536..619bec7 100644
--- a/examples/recipes/mpfr@4.1.0.yml
+++ b/examples/recipes/mpfr/build.yml
@@ -1,15 +1,17 @@
+meta:
+ version: '4.2.1'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.xz'
- sha256: '0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f'
+ - name: '{{name}}-{{version}}.tar.xz'
+ sha256: '277807353a6726978996945af13e52829e3abd7a9a5b7fb2793894e18f1fcbb2'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.xz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.xz
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -20,9 +22,9 @@ tasks:
- recipe: 'gmp'
task: 'install'
run: |
- mkdir {{pn}}-build
- cd {{pn}}-build
- ../{{pn}}-{{pv}}/configure \
+ mkdir {{name}}-build
+ cd {{name}}-build
+ ../{{name}}-{{version}}/configure \
--build={{build.gnu_triplet}} \
--host={{host.gnu_triplet}} \
--prefix={{host.prefix}}
@@ -31,16 +33,16 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
@@ -50,7 +52,7 @@ tasks:
- recipe: 'gmp'
task: 'install'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}} install
rm {{destdir}}{{host.prefix}}/lib/*.a
rm {{destdir}}{{host.prefix}}/lib/*.la
diff --git a/examples/recipes/toolchain.yml b/examples/recipes/toolchain/build.yml
index ab8e6de..d612261 100644
--- a/examples/recipes/toolchain.yml
+++ b/examples/recipes/toolchain/build.yml
@@ -8,7 +8,7 @@ tasks:
runtime_depends:
- recipe: 'gcc'
task: 'install'
- - recipe: 'libgcc'
+ - recipe: 'gcc/libgcc'
task: 'install'
depends:
@@ -19,7 +19,7 @@ tasks:
runtime_depends:
- recipe: 'glibc'
task: 'install'
- - recipe: 'gcc-libs'
+ - recipe: 'gcc/libs'
task: 'install'
build:
diff --git a/examples/recipes/zlib@1.2.11.yml b/examples/recipes/zlib/build.yml
index 099b80c..3e72844 100644
--- a/examples/recipes/zlib@1.2.11.yml
+++ b/examples/recipes/zlib/build.yml
@@ -1,15 +1,17 @@
+meta:
+ version: '1.3'
tasks:
unpack:
fetch:
- - name: '{{pn}}-{{pv}}.tar.gz'
- sha256: 'c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1'
+ - name: '{{name}}-{{version}}.tar.gz'
+ sha256: 'ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e'
run: |
- tar xf {{dldir}}/{{pn}}-{{pv}}.tar.gz
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.gz
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -18,25 +20,25 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- mkdir {{pn}}-build
- cd {{pn}}-build
- ../{{pn}}-{{pv}}/configure \
+ mkdir {{name}}-build
+ cd {{name}}-build
+ ../{{name}}-{{version}}/configure \
--prefix={{host.prefix}}
find -name configure.log -delete
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
@@ -44,7 +46,7 @@ tasks:
- recipe: 'toolchain'
task: 'depends'
run: |
- cd {{pn}}-build
+ cd {{name}}-build
make DESTDIR={{destdir}} install
rm {{destdir}}{{host.prefix}}/lib/*.a