summaryrefslogtreecommitdiff
path: root/include/tree.sh
AgeCommit message (Collapse)Author
2025-11-15tree.sh: tidy up check_gnu_pathLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-17Revert "get.sh: make forcepull a macro"Leah Rowe
This reverts commit b3232a7c4a6466381d798d7beda56fd020d86d54.
2025-10-17get.sh: make forcepull a macroLeah Rowe
: Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-17tree.sh: unify -f/-F in case/switch handlingLeah Rowe
they're the same commands, but -F does forcepull Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-17tree.sh: convert do_make into a macroLeah Rowe
use it similarly to if_dry_build/if_not_dry_build there is nothing cooler than an sh macro : Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-16xbmk: sort global variables alphabeticallyLeah Rowe
also separate some of the special ones. this makes the variables easier to read/find. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-07tree.sh: add missing -F flagLeah Rowe
i support -F, but didn't include it in the actual getopt string. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-06rom.sh/tree.sh: clean up if_not_dry_buildLeah Rowe
the way it was used is messy, and a relic of the old chained command coding style, from before when i recently loosened that requirement. the new focus is simple, readable code, regardless of size. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-06rom.sh: use if_dry_build macroLeah Rowe
instead of checking if_not_dry_build. use it here the same way. yes. shell script macros. it's how i roll. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04xbmk: don't call mkdir. use xbmkdir (new function)Leah Rowe
xbmkdir checks if a directory exists, before running mkdir, and then still uses -p i was testing xbmk on arch linux today, and noticed that it errored out when a directory already exists. i'm mitigating against buggy or differently behaving mkdir implementations this way, by wrapping around it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04xbmk: use sbase sha512sum, not host sha512sumLeah Rowe
the --status flag seems to be a GNUism as stated in the previous commit, i import sbase suckless now, so as to have a consistent implementation of sha512sum. this ensures that its output is reliable, when i'm using the output of this command within backticks. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04tree.sh: rename xtree to xgcctree, for clarityLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04tree.sh: rename btype to buildtype, for clarityLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04tree.sh: rename _f to flag, for code clarityLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04xbmk: rename the "dry" variable to if_not_dry_runLeah Rowe
and add a line break where it is used now it is essentially a macro of sorts, used in terms of syntax, to mean the same as: if [ "$dry" != ":" ]; do thing fi in this case, we say: $if_not_dry_build \ thing yes. macros in sh are a thing. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04xbmk: remove even more eval statementsLeah Rowe
in one or two cases, the use of eval is retained, but modified so as to be safer. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04xbmk: remove the setcfg functionLeah Rowe
this allows me to remove several eval calls, and the errors relating to configs can now show exactly which function they occured in, allowing for easier debugging. once again, eval should be used sparingly if at all. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04xbmk: clean up a few err callsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-04xbmk: general cleanup: unroll condensed code linesLeah Rowe
i overlooked a number of lines, during previous cleanup Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-02tree.sh: remove superfluous eval statementsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-01get.sh: allow force-pull via -F instead of -fLeah Rowe
use of ./mk -F behaves the same as -f before the previous commit. this can be useful, during development when we want to update revisions. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-01tree.sh: break up check_gnu_path to subfunctionsLeah Rowe
this whole check could probably be removed, honestly. it was only put in place during the debian trixie testing release cycle, before they finally updated gnat just before the stable release of trixie came out. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-26xbmk: tidy up some if statementsLeah Rowe
this is an extension of the previous work to unroll most of the condensed code lines. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-24make notices a bit more readableLeah Rowe
add line breaks, so that the license and author are visually separated. this makes it easier to read. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-24xbmk: cleanup of recent code refactoringLeah Rowe
be a bit less pedantic about if else clauses. leave the big ones still with then on separate lines, where else is specified. also unroll a few condensed code lines where i missed a few. sloccount 2303 in lbmk. that's still only slightly bigger than libreboot 20260907 which was 2180, and still much smaller than libreboot 20230625 which was 3322. this is *without* the condensed codelines, so now the only thing that's reduced is the overall amount of logic present in the build system. and i should clarify that lbmk is presently much more powerful than both of those two versions (20160907/20230625). the 2016 one is useful for comparison historically, since that was the last major version of libreboot prior to the great second coming of leah in 2021; and the 2023 june release was basically the last one before the great audits of 2023 to 2025 began. not to brag (not much anyway), but all of this means that lbmk is an insanely efficient build system, considering all the features it has and what it does. i unrolled the condensed code style in lbmk, making the scripts a lot easier to read, because i received complainst about the condensed style previously used; nicholas chin and alper nebi yasak both told me that it sucked, and riku viitanen had hinted at that same fact several months prior. so hopefully now, lbmk is a bit nicer. those and other people often find it challenging to challenge me because for reason they assume i'll get upset and fly off the handle, but it's the opposite. i want constant criticism, so that i know to improve! Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-23tree.sh: unroll condensed commandsLeah Rowe
i went further than in the previosu commit. in this commit, i also provide indentation inside subshells, to make it clearer that soomething is being done inside a subshell. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-18Revert "xbmk: don't use backticks for command substitution"Leah Rowe
This reverts commit 4999a49de39667b3239fc2010d0e99c958b29417.
2025-09-14tree.sh: fix bad variable referenceLeah Rowe
we didn't want to say a variable name here. we only wanted to say "trees". Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-13xbmk: much more verbose error messagesLeah Rowe
use the new functionality in err(), whereby a given function name and arguments can be provided, for debugging purposes. something similar was already done in a few places, and replaced with this unified functionality. this patch will make xbmk much easier to debug, under fault conditions. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-11xbmk: don't use backticks for command substitutionLeah Rowe
the newer way handles escaped characters better, and it can be nested more easily. it's also more readable. personally, i prefer the old way, because it's more minimalist, but it occurs to me that a lot of people nowadays don't know about backticks, but they do know of the modern way. to make the code more readable, i have modernised it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-07tree.sh: don't combine remkdir/cd gnupathLeah Rowe
it's stupid. separate them, to make the code readable. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-07init.sh/tree.sh: put PATH dirs in xbtmpLeah Rowe
e.g. gnupath, xbmkpath these currently go in XBMK_CACHE/, which is bad because they're meant to be temporary. XBMK_CACHE is for permanent files. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-04Revert "get.sh: put tmpclone dirs in xbtmp"Leah Rowe
This reverts commit 01a779d4ebcdfc7df406263aeb1dffb800eb0220. This commit broke ./mk -d coreboot for vendor files in lbmk.
2025-09-04Revert "tree.sh: add missing colon at the end of trees()"Leah Rowe
This reverts commit 568887cd5efd5df519c7f4f593300eb3ae2beaae. This commit broke ./mk -d coreboot for vendor files in lbmk.
2025-09-02tree.sh: add missing colon at the end of trees()Leah Rowe
this is because when using chained commands at the end of functions, sometimes you have to explicitly terminate the line. the way i do it in this patch is common across the build system, to mitigate this sh quirk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-02get.sh: put tmpclone dirs in xbtmpLeah Rowe
and generate them, don't hardcode them - this reduces the chance of race conditions, which we have seen in the past and which current execution flow in xbmk even mitigates in a few places, by doing things in a certain order. this change makes the code more robust and easier to maintain. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-23tree.sh: tidy up check_cross_compilerLeah Rowe
group related operations together, without whitespace. declare all variables at the start of the function. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-23tree.sh: don't re-check xgcc needlesslyLeah Rowe
instead, create a file indicating that a given xgcc target had already been built successfully, within a given coreboot tree. this will considerably speed up the building of release archives, especially when there are a lot of boards. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-23tree.sh: check xgcc AFTER checking elfdirLeah Rowe
if e.g. elf/coreboot/default/w500_16mb contains readied images from before, crossgcc is still being checked. if you already built all the coreboot images, and wanted to just modify all the payloads for example, this would result in a much slower re-build process, because it is needlessly re-checking crossgcc every time. by doing it this way, we need up the testing of payloads quite considerably, during xbmk development. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-10tree.sh: Delete files *before* updating hashesLeah Rowe
The current logic deletes old project files e.g. sources, but *after* updating the project hash. This means that if a deletion fails, and the directory is still there (e.g. src/coreboot/default/) afterward, it's now a tainted archive, yet the hash has been updated, so subsequent runs of the build system will cause unknown errors. This patch fixes that, by first copying the new hash to a temporary file. *Then*, deletions are handled, and the final hash file is updated afterward. The code is now a bit more bloated as a result, but this will reduce the risk of tainted sources being handled under fault conditions. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-10tree.sh: rename hashtype to hashnameLeah Rowe
since it's the name, e.g. "default", referring to a project tree (in this example, coreboot/default). Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-10tree.sh: rename hashname to hashdirLeah Rowe
since it's only ever used as a directory name Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-10tree.sh: rename hashvar to badhashvarLeah Rowe
now the code that uses it makes a bit more sense to the casual reader. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-10tree.sh: rename function and remove commentsLeah Rowe
the new function names make the comments redundant. the code is now self-explanatory. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-04tree.sh: don't delete builds if tree==targetLeah Rowe
in that case, the previous tree-wide check will cover it, so the current logic wastes computational time. this patch therefore somewhat optimises the code. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-04tree.sh: re-add comments to check_hashesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-02tree.sh: unified project hash handlingLeah Rowe
the target/project hash checks are basically identical, so let's unify them under a single function. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-07-10tree.sh: delete individual target builds if neededLeah Rowe
Detect when a config changes. This is done even if the entire tree doesn't change. This is already done per-tree if files change, but individual project files don't change. For example, if a grub.cfg changes, the given cached build for that GRUB tree isn't deleted. Same thing if a given U-Boot config doesn't change. This patch fixes a longstanding design flaw of lbmk, making auto-re-builds more reliable. This complements another recent change, that deletes all target builds of a given tree when the tree changes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-07-10tree.sh: Remove redundant deletionLeah Rowe
Target builds go inside a common directory for the given tree now, which gets deleted, thus deleting all target builds of that given tree. Therefore, the deletion being removed is redundant. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-07-08tree.sh: Place target builds under tree/target/Leah Rowe
as opposed to target/ for example: image the command: ./mk -b u-boot amd64coreboot This would put the U-Boot binaries here: elf/u-boot/amd64coreboot/default/ With this change, they now go here: elf/u-boot/x86_64/amd64coreboot/default/ This solves a problem that existed previously, where you could modify a given tree in a multi-tree project, but cached builds for targets branching separately off of each tree would not be deleted, and thus not re-built. This accomplishes such a result, without needing to further check hashes of individual targets. The latter will still be done, in a future change, because this change doesn't fix another problem: If you change a given config, e.g. targetname "foo" which uses tree "bar", elf/foo/ would not be removed automatically for re-build. So this change only deletes individual target builds when their master tree changes. Where the target and tree are the same, this also means elf/tree/target/ for example: seabios/default would create binaries in: elf/seabios/default/default/ not: elf/seabios/default/ Signed-off-by: Leah Rowe <leah@libreboot.org>