summaryrefslogtreecommitdiff
path: root/include/git.sh
AgeCommit message (Collapse)Author
2024-05-22git.sh: move repo copying to a new functionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: move link_crossgcc to end of fileLeah Rowe
link_crossgcc is called after git_am_patches, so put it after ward Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: move xgcc linking to a new functionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: skip submodules if .gitmodules missingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: merge patch_submodules in prep_submodulesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: split submodule handling to new functionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: remove errant line breakLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: remove another meaningless checkLeah Rowe
again, the directory in question is simply used in a for loop using asterisk (git_am_patches) and the for loop simply won't iterate if either the directory doesn't exist or it contains no items. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: shorter variable namesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: remove meaningless checkLeah Rowe
in the function that immediately follows, it starts two for loops that check every item in that directory, using the asterisk wildcard. if the directory does not exist, then the for loop will simply break on first pass. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: remove variable not meaningfully usedLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-21git.sh: fix invalid command in git_prep()Leah Rowe
"./update project trees" is a leftover from the old build system design, prior to audits. this particular call is for when xtree is defined, which means that a given tree must rely on the given coreboot tree defined by xtree. the "xtree" tree is downloaded, so that its crossgcc builds can be re-used to save time when building targets across many trees. this is because trees often use identical crossgcc builds. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-20git.sh: allow patching submodulesLeah Rowe
for single-tree project (e.g. flashprog): config/submodule/PROJECT/MODNAME/patches for multi-tree project (e.g. coreboot): config/submodule/PROJECT/TREE/MODNAME/patches MODNAME is e.g.: 3rdparty/vboot directory in coreboot: would become vboot (the submodule codepath is filtered to up to the final slash) another example: submodire src dir 3rdparty/foo/bar MODNAME would be "bar" Add whatever patches you like to a given submodule. An example patch is included in this commit. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-19git.sh: don't delete .git if src/project/projectLeah Rowe
otherwise, "./update release" will epicly fail Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-19git.sh: remove fetch_from_upstream()Leah Rowe
the function is very small and only called once, from fetch_project_trees() merge it into fetch_project_trees() Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-18git.sh: Remove .git if XBMK_RELEASE=yLeah Rowe
The build system already deletes .git in all source directories for each given release, but does so at the very end; it still does, but now it is deleted one by one per project, to save space during very large builds (release sizes vary wildly, depending on how many trees exist for coreboot basically). If you're building entirely in tmpfs (as I do), this could be a problem if you have lots of .git/ directories. This change reduces disk usage, or in the above example, memory usage when running the build system from tmpfs. This complements another recent change, where ROM images are compressed per target during release builds, rather than all at the very end of the process. It is part of a series of optimisations, to reduce the memory and disk usage of the build system, and to reduce I/O wastage in general. This change will not be the last of such changes! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-11git.sh: remove errant commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-03-27safer, simpler error handling in lbmkLeah Rowe
in shell scripts, a function named the same as a program included in the $PATH will override that program. for example, you could make a function called ls() and this would override the standand "ls". in lbmk, a part of it was first trying to run the "fail" command, deferring to "err", because some scripts call fail() which does some minor cleanup before calling err. in most cases, fail() is not defined, and it's possible that the user could have a program called "fail" in their $PATH, the behaviour of which we could not determine, and it could have disastrous effects. lbmk error handling has been re-engineered in such a way that the err function is defined in a variable, which defaults to err_ which calls err_, so defined under include/err.sh. in functions that require cleanup prior to error handling, a fail() function is still defined, and err is overridden, thus: err="fail" this change has made xx_() obsolete, so now only x_ is used. the x_ function is a wrapper that can be used to run a command and exit with non-zero status (from lbmk) if the command fails. the xx_ command did the same thing, but called fail() which would have called err(); now everything is $err example: rm -f "$filename" || err "could not delete file" this would now be: rm -f "$filename" || $err "could not delete file" overriding of err= must be done *after* including err.sh. for example: err="fail" . "include/err.sh" ^ this is wrong. instead, one must do: . "include/err.sh" err="fail" this is because err is set as a global variable under err.sh the new error handling is much cleaner, and safer. it also reduces the chance of mistakes such as: calling err when you meant to call fail. this is because the standard way is now to call $err, so you set err="fail" at the top of the script and all is well. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-26git.sh: also reset xtree/tree_depend hereLeah Rowe
it's still necessary here, to prevent the same bug identified in the previous patch. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21git.sh: fix bad call to ./updateLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21git.sh: support downloading dependency treesLeah Rowe
a tree can specify: tree_depend="treename" this will make the other tree be downloaded. this is used for coreboot trees, to ensure that dependency trees are downloaded, because trees can now re-use crossgcc from other trees. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21re-use crossgcc builds on the coreboot treesLeah Rowe
don't build crossgcc twice, especially if two coreboot trees use the same revision! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.cfg: simplified revision checkingLeah Rowe
it only needs to be checked before git reset Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01add copyright 2024 leah rowe to edited filesLeah Rowe
i forgot to add 2024 on the copyright years, for my copyright files that i edited on 1 january 2024 Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: simplify submodule handling in git_prepLeah Rowe
u-boot doesn't use submodules, so there's no point in checking for it. now we can do with just one call to the git submodule command, for simplicity also, general code cleanup in this file (minor code formatting improvements) Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: further simplify git_prepLeah Rowe
the directory is checked for deletion, but it's already checked before download, to see whether it already exists. lbmk already exits with zero status if the directory exists, so the check is pointless (in this function) also, general code style/formatting cleanup Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: unify am/submodule and tree copyingLeah Rowe
do it all in a single function! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh cleanup: git am handling (remove patchfail)Leah Rowe
the patchfail variable was only needed in the old design, where git am was being handled inside a subshell, and also when we did it directly in the target directory without using a temporary directory. with the current design, we can just call err() and ditch the tmp repo Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: clean up handling of tmp_git_dirLeah Rowe
delete it once once, and delete it much sooner, right at the start of script/update/trees main() Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: fix regression: patches before submodulseLeah Rowe
there isn't really a problem right now, but a desired and implemented behavioural change was that patches are to be applied *before* updating submodules. well, the previous commit reversed this change, under certain conditions, such that submodules were applied first. this patch fixes it, so that patches are done first. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: clean up git submodule/am handlingLeah Rowe
unify all of the logic, where git am and submodule is handled Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30git.sh multi-tree: grab submodules *after* patchesLeah Rowe
right now, if we want to patch a project such that certain submodules are no tdownloaded, or diffreent submodules are downloaded, or current ones are downloaded from other locations, we cannot do this, because we apply submodule updates *before* applying patches. therefore, we should change it so that they are applied *after* installing patches. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-28lbmk scripts: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-24lbmk scripts: shorter code linesLeah Rowe
while seemingly pedantic, this does actually make code easier to read. mostly just switching to shorthand for variable names, where no expansions or patterns are used Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23lbmk scripts: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-22general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19git.sh: simplify submodule handlingLeah Rowe
do not use a subshell. use git -C instead. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19git.sh git_am_patches: reduce indentationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19git.sh fetch_config: simplify tree name checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-16fix several shellcheck warningsLeah Rowe
lbmk didn't quote certain arguments in commands, or used ! -z instead of -n, things like that. simple fixes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-11handle errors on exits from subshellsLeah Rowe
most of these are probably redundant, and will never be called, but lbmk needs to be as safe as possible under fault conditions. fail early, fail hard. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-11improved safety/error handling on multitree git-amLeah Rowe
update/trees wasn't correctly returning non-zero status, even though it was printing an error message, when git-am failed. this is due to the way subshells work, and it was overlooked in previous auditing. additionally: don't directly copy trees to the destination, instead patch/reset first, then copy only under normal condition, just as with single-tree projects. when running build/roms, the script would continue after a bad git-am, without exit. this patch fixes it in the most paranoid way possible. i'm now fairly confident that lbmk will fail gracefully and efficiently, under error conditions. this should prevent bad image builds. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-01Libreboot 2023110120231101Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20include/git: fix already-exists download messageLeah Rowe
i forgot to put the download path in printf Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20Revert "Revert "include/git: don't re-download single-trees""Leah Rowe
This reverts commit baa3d4f217863ff34c03d54c4014f53812ae12ec.
2023-10-20include/git: fix error caused by sh idiosyncrasyLeah Rowe
when [] is used right at the end of a function, or certain loops/subshells, some sh implementations will just return a non-zero exit Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20Revert "include/git: don't re-download single-trees"Leah Rowe
This reverts commit 8de7bc93397a95312b742bc5af733208f702f3a8.
2023-10-20include/git: don't re-download single-treesLeah Rowe
only do it if the target source tree does not exist Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20update/trees: don't run make if mode=fetchLeah Rowe
this fixes a regression caused by a previous revision Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20include/git: fetch submodules on one-tree projectsLeah Rowe
only fetch if .gitmodules exists in some cases, lbmk is compiling source trees that use submodules, without having downloaded them first. in all cases, those submodules are either optional, or the build system auto-fetches them (or if it can, we sometimes disable it as with grub and gnulib). this is a nice fallback behaviour, for situations where we forget to put submodules as dependencies under config/git (and disable submodules in the given project). with this change, release archives are guaranteed to be complete, sans crossgcc downloads in coreboot; this will be handled in a follow-up commit. Signed-off-by: Leah Rowe <leah@libreboot.org>