diff options
Diffstat (limited to 'doc/tutorial/rebuild.md')
-rw-r--r-- | doc/tutorial/rebuild.md | 102 |
1 files changed, 66 insertions, 36 deletions
diff --git a/doc/tutorial/rebuild.md b/doc/tutorial/rebuild.md index 3f1ddd88..bc0c038e 100644 --- a/doc/tutorial/rebuild.md +++ b/doc/tutorial/rebuild.md @@ -2,14 +2,14 @@ Ensuring reproducibility of the build ===================================== Software builds should be -[reproducible](https://reproducible-builds.org/). The `just` tool, +[reproducible](https://reproducible-builds.org/). *Justbuild* supports this goal in local builds by isolating individual actions, -setting permissions and file time stamps to canonical values, etc; most +setting permissions and file time stamps to canonical values, etc.; most remote execution systems take even further measures to ensure the environment always looks the same to every action. Nevertheless, it is always possible to break reproducibility by bad actions, both coming from rules not carefully written, as well as from ad-hoc actions added -by the `generic` target. +by the `generic` target, such as ``` jsonc ... @@ -98,6 +98,29 @@ and the following `TARGETS` file: } ``` +The `repos.json` only needs the `"rules-cc"` repository and as main repository +the current working directory + +``` {.jsonc srcname="repos.json"} +{ "main": "" +, "repositories": + { "rules-cc": + { "repository": + { "type": "git" + , "branch": "master" + , "commit": "307c96681e6626286804c45273082dff94127878" + , "repository": "https://github.com/just-buildsystem/rules-cc.git" + , "subdir": "rules" + } + } + , "": + { "repository": {"type": "file", "path": "."} + , "bindings": {"rules": "rules-cc"} + } + } +} +``` + To search for the root cause of non-reproducibility, `just` has a subcommand `rebuild`. It builds the specified target again, requesting that every action be executed again (but target-level cache is still @@ -107,45 +130,52 @@ first `build` and then `rebuild`. Note that a repeated `build` simply takes the action result from cache. ``` sh +$ touch ROOT $ just-mr build -INFO: Requested target is [["@","tutorial","",""],{}] -INFO: Analysed target [["@","tutorial","",""],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching +INFO: Performing repositories setup +INFO: Found 2 repositories to set up +INFO: Setup finished, exec ["just","build","-C","..."] +INFO: Requested target is [["@","","",""],{}] +INFO: Analysed target [["@","","",""],{}] INFO: Discovered 6 actions, 1 trees, 0 blobs -INFO: Building [["@","tutorial","",""],{}]. +INFO: Building [["@","","",""],{}]. INFO: Processed 6 actions, 0 cache hits. INFO: Artifacts built, logical paths are: - bin/hello [59f7af154b3b7beac4a6cab40499cb3b388220c4:16608:x] - share/hello/OUT.txt [428b97b82b6c59cad7488b24e6b618ebbcd819bc:13:f] - share/hello/version.txt [088ae5a8a57f62016392bdf124a9b8dfc0288763:39:f] + bin/hello [68528cc2b32838573582c4dd4f0eccbae04cb5d6:18072:x] + share/hello/OUT.txt [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] + share/hello/version.txt [8a11b38c825a23d8a0ad36ba6793ded347c0aec8:21:f] $ just-mr build -INFO: Requested target is [["@","tutorial","",""],{}] -INFO: Analysed target [["@","tutorial","",""],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching +INFO: Performing repositories setup +INFO: Found 2 repositories to set up +INFO: Setup finished, exec ["just","build","-C","..."] +INFO: Requested target is [["@","","",""],{}] +INFO: Analysed target [["@","","",""],{}] INFO: Discovered 6 actions, 1 trees, 0 blobs -INFO: Building [["@","tutorial","",""],{}]. +INFO: Building [["@","","",""],{}]. INFO: Processed 6 actions, 6 cache hits. INFO: Artifacts built, logical paths are: - bin/hello [59f7af154b3b7beac4a6cab40499cb3b388220c4:16608:x] - share/hello/OUT.txt [428b97b82b6c59cad7488b24e6b618ebbcd819bc:13:f] - share/hello/version.txt [088ae5a8a57f62016392bdf124a9b8dfc0288763:39:f] + bin/hello [68528cc2b32838573582c4dd4f0eccbae04cb5d6:18072:x] + share/hello/OUT.txt [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] + share/hello/version.txt [8a11b38c825a23d8a0ad36ba6793ded347c0aec8:21:f] $ just-mr rebuild -INFO: Requested target is [["@","tutorial","",""],{}] -INFO: Analysed target [["@","tutorial","",""],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching +INFO: Performing repositories setup +INFO: Found 2 repositories to set up +INFO: Setup finished, exec ["just","rebuild","-C","..."] +INFO: Requested target is [["@","","",""],{}] +INFO: Analysed target [["@","","",""],{}] INFO: Discovered 6 actions, 1 trees, 0 blobs -INFO: Rebuilding [["@","tutorial","",""],{}]. +INFO: Rebuilding [["@","","",""],{}]. WARN: Found flaky action: - - id: c854a382ea26628e1a5b8d4af00d6d0cef433436 - - cmd: ["sh","-c","echo '#define VERSION \"0.0.0.'`date +%Y%m%d%H%M%S`'\"' > version.h\n"] - - output 'version.h' differs: - - [6aac3477e22cd57e8c98ded78562d3c017e5d611:39:f] (rebuilt) - - [789a29f39b6aa966f91776bfe092e247614e6acd:39:f] (cached) + - id: 98a14505f43f623c8154e29d4b2ae791bfee718a + - cmd: ["sh","-c","echo '#define VERSION \"0.0.0.'`date +%Y%m%d%H%M%S`'\"' > version.h\n"] + - output 'version.h' differs: + - [725d7c207138ed941a181fd2c068a06dd60dff6e:39:f] (rebuilt) + - [c1a2986953451f77021e121c15947259e33dd645:39:f] (cached) INFO: 2 actions compared with cache, 1 flaky actions found (0 of which tainted), no cache entry found for 4 actions. INFO: Artifacts built, logical paths are: - bin/hello [73994ff43ec1161aba96708f277e8c88feab0386:16608:x] - share/hello/OUT.txt [428b97b82b6c59cad7488b24e6b618ebbcd819bc:13:f] - share/hello/version.txt [8dd65747395c0feab30891eab9e11d4a9dd0c715:39:f] + bin/hello [b268a81d3192af9ef737ebd746f941f441dbc3db:18072:x] + share/hello/OUT.txt [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] + share/hello/version.txt [202ca71fec8bc5878559261a50c4547e0c851fb1:21:f] $ ``` @@ -166,22 +196,22 @@ $ just-mr rebuild --dump-flaky flakes.json --dump-graph actions.json $ cat flakes.json { "cache misses": [ - "ca45feffd2bab3bdbf752db7c89c451ce99d4803", - "eff0117276a0ad65a331eb29a2393a9b6e106e4b", - "1eef99333e887f2aa78d2eaee0a7c172db66009c", - "72a337628fa6187513818d5d8d00d36fbdb6923e" + "e346c2c18fe1f4662f772f12e85af968ecb2467c", + "2655bfeee10cdefb61c608fe8e81ce3f2846ab0f", + "108c6dee4f87b86cbfdd3cb8c74079a27444f846", + "14a72ddc8f4024eafb290815bc725e1a0d02c065" ], "flaky actions": { - "c854a382ea26628e1a5b8d4af00d6d0cef433436": { + "98a14505f43f623c8154e29d4b2ae791bfee718a": { "version.h": { "cached": { "file_type": "f", - "id": "789a29f39b6aa966f91776bfe092e247614e6acd", + "id": "c1a2986953451f77021e121c15947259e33dd645", "size": 39 }, "rebuilt": { "file_type": "f", - "id": "4b5e64f324745d628c893f9d7e29ce7febdfdd0c", + "id": "52996c0d65266d15173c7c2836b1835070c1a934", "size": 39 } } |