summaryrefslogtreecommitdiff
path: root/include/git.sh
AgeCommit message (Collapse)Author
8 dayslib.sh: move singletree() to git.shLeah Rowe
it is primarily used there, and then in mk, but only after git.sh is sourced. Signed-off-by: Leah Rowe <leah@libreboot.org>
8 daysmk/git.sh: remove tree_depend variableLeah Rowe
this was used alongside the xgcc linking, so that coreboot trees could specify that another tree was to be downloaded. since this variable will no longer be used, it should be removed, to avoid dead code bloat. Signed-off-by: Leah Rowe <leah@libreboot.org>
8 daysgit.sh: remove unused xgcc linking featureLeah Rowe
the "xtree" variable is used by projects such as u-boot, to export a CROSS_COMPILE variable specifying prefix for gnu compilers, and for building the named coreboot tree. for example, xtree can be "default", which is then the coreboot tree downloaded, for use of crossgcc. however, it is also used to symlink identical versions of crossgcc between coreboot trees. this latter feature was only needed for fam15h boards which were previously split between two mostly identical coreboot trees, that were later merged into a single tree, and this feature is therefore no longer used. remove this dead code, to reduce bloat in the build system. Signed-off-by: Leah Rowe <leah@libreboot.org>
8 daysmk: simplify main()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18Revert "git.sh: minor cleanup"Leah Rowe
This reverts commit e63d8dd20d99ec18ef03699516fd800a81b7f1df.
2025-04-18git.sh: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: remove unnecessary commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: remove link_crossgcc()Leah Rowe
merge it with git_prep Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: remove move_repo()Leah Rowe
merge it with git_prep, since it's only a small function and only called from there. the merged code still makes sense and its purpose is still quite clear on casual reading. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: remove prep_submodule()Leah Rowe
merge it with git_prep, since it's only a tiny function and only called from there. the for loop moved to the if block still makes sense on casual reading. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: make git_prep command clearerLeah Rowe
the "u" argument can actually be any thing. git_prep handles git submodules only for single-tree projects, under any candition, or on multi-tree projects if the number of arguments to git_prep is above four. "u" is the 5th argument, meant to enable submodule downloads. it really doesn't matter what this string says, so let's just make it as clear as possible. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17lbmk: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12git.sh: clean up fetch_project()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-11lbmk: unified PWD handling (work directory)Leah Rowe
instead of running pwd all the time, run it once in lib.sh, and export PWD. for lbmk-specific use of PWD, use xbmkpwd, which contains the value of PWD as was set by the pwd utility in lib.sh. many parts of lbmk rely on pwd, and it *must* be correct. this change adds basic error handling, since pwd can in fact return errors in some cases. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-11lbmk: use pwd util, not PWD environmental variableLeah Rowe
PWD could be anything, if the user manually exported it before running lbmk. always run pwd instead, to get the real string. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-11clean up a few semicolons in the build systemLeah Rowe
several code lines were condensed together, which make them less readable. make the code more readable by having separate commands on separate lines. i previously did this during my manic build system audits of 2023 and 2024; condensing lines like this is overly pedantic and serves no real purpose. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-06lbmk: minor code formatting cleanupLeah Rowe
some lines were needlessly condensed, and less readable Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03update my copyright years on modified scriptsLeah Rowe
there are some lbmk scripts that i modified, starting this year. update the headers. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-02fix lbmk shellcheck errorsLeah Rowe
There was also a condition in run_make_command that is now an OR, where it was an AND, on script/trees, to fix the use of mixed (and erroneous) OR/AND operators. I'm planning a much more invasive audit than this. These are light fixes, intended for Libreboot 20241206 rev8. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-12-30Fix globbing issue in lbmkLeah Rowe
When doing e.g. $@ we should use double quotes to prevent globbing. Thanks go to XRevan86 for pointing this out. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-12-26git.sh: don't initialise livepull globallyLeah Rowe
set this variable in the tmpclone function. otherwise, certain submodules might always download every time, when handling multiple projects. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-10-05git.sh: fix error with cache re-downloadLeah Rowe
in some cases, on a fresh clone, the cached repo already exists but lbmk tries to download it again. work around this by checking that the directory exists; it's in the main if statement, so that the "else" still applies. as a result, the fallback to a live repo would un-fall back to doing git-pull if the cached directory exists exists. if it doesn't seem to make sense, it's because it doesn't. this whole function needs to be rewritten better. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-09-30add swig to fedora dependenciesLeah Rowe
needed when compiling u-boot Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-26general code cleanup in the build systemLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-19put cachedir in environmental variableLeah Rowe
XBMK_CACHE is now used, instead of hardcoding cache/ this is exported initialised to cache/, if unset. this means you can set your own directory, and it means ./update release will use the same directory. this means bandwidth wastage is further avoided. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-18git.sh: warn when a cached clone failsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-18git.sh: fix typo in git commandLeah Rowe
the || : condition should be used, whereas i just wrote : by mistake. this was done in a previous change. fix it now. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-18git.sh: fix lack of error exits on faultLeah Rowe
a previous change made it more redundant, falling back on old behaviour (direct downloading, not cached), but the way it's done means that the function never returns an error condition in practise. this patch fixes it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-17unify caching of files into cache/Leah Rowe
hash/ becomes cache/hash/ repo/ becomes cache/repo/ Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-17git.sh: remove previous tmprepo if args>5Leah Rowe
if doing a retry, the directory may still exist, which would make git clone yield an error response; the existing directory will have been the one that failed to reset, so let's delete it. the one deleted is not the cache (repo/PROJECT/), thus otherwise maintaining current behaviour. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-17git.sh: try direct clone if cached git failsLeah Rowe
normally, a project is cached at repo/PROJECT/, and cloned from there to the final destination. errors lead to a calling of $err, but this will result in a return if done from inside a subshell, of non-zero value, so use this to re-try with a 6th argument when calling tmpclone(). in most cases, this fallback will never kick in, but it will kick in resetting or patching the cached clone fails; specifically, we are interested in the reset part. a given project name may change repositories in lbmk at a given time. if this happens, and the old one is cached, the overall result of this patch is that lbmk will fall back to the old behaviour, where git urls are tried directly, without caching. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-17git.sh: re-try git pull three timesLeah Rowe
mitigate jittery internet connections Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-17trees: auto-delete+auto-rebuild if project changesLeah Rowe
actual source code is not scanned, but config directories are scanned. simply get the checksum of each file under config/ pertaining to a given project/tree, and also for the given target. coreboot utilities are also handled. if it changes, in any way, delete and re-build automatically. such deletions should probably still be done manually, as part of understanding the build system, but this change should make the build system much easier to use during development. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-17git.sh: don't download to src/project/project/Leah Rowe
re-use repo/project/ this means that single- and multi-tree projects now have a unified cached git repo location, as per the new rules, thus saving on disk space usage. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-17git.sh: cache git downloads to repo/Leah Rowe
do it based on the URL, e.g. https://review.coreboot.org/coreboot becomes repo/coreboot the downside is if you have two projects with repo urls specifying the same string at the end, but this isn't the case at the moment and likely won't be the case, but it's a theoretical issue. this saves on bandwidth when downloading identical submodule repos between multiple trees within the same multi-tree project for example, coreboot 3rdparty/vboot is no longer downloaded more than once, instead cloned locally on subsequent downloads. if repo/DIR exists, git-pull is attempted, but errors do not result in a non-zero exit, by design. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-10trees: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-10remove executable permission on include/Leah Rowe
files under include/ should never be executed directly Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30git.sh: simpler for loop in git_am_patches()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30git.sh: merge for loops in git_am_patches()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30trees and git.sh: tidy up global variablesLeah Rowe
some of the variables only initialised in git.sh are also used in the trees script, which is technically ok because git.sh is included from the trees script, but it makes more sense to declare them in the latter. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30git.sh: simplified initialisation of "loc"Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30git.sh: condense fetch_targets() a bitLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30git.sh: short git_prep command in fetch_targets()Leah Rowe
loc is already set, and will correspond to the same path, so we can quite conveniently use it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30git.sh: merge prepare_new_tree with fetch_targetsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30git.sh: remove duplicate "xtree" variableLeah Rowe
it's already defined inside the trees script Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30trees, multi: download bare project *before* treesLeah Rowe
when downloading multi-tree projects, the rev can be reset to HEAD instead of the actual rev for a given target. this occurs when the bare repo (e.g. src/coreboot/coreboot) does not exist and has to be downloaded first. bare repository downloading does not rely on target.cfg, in this context, only pkg.cfg, but it uses the same variable names (e.g. "rev"). instead of using a separate variable name, thus increasing code complexity (which is the exact opposite of what i want to do), do the bare repository download first. this means that the git.sh script is much cleaner now, for multi-tree projects, in that it *only* copies the bare repo then runs git_prep; in that context, the bare repo is cloned directly by calling the relevant function from script/trees, which is the same behaviour as when cloning single-tree project sources. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30trees: unified multi-tree configuration handlingLeah Rowe
the same function that loads configurations for single-tree projects has been merged with the function for multi-tree configs in git.sh, and that functionality has been removed from git.sh; now it is all unified in the trees script. as the saying goes: write one program to do one thing well. the purpose of git.sh is to download source code, but not to handle configuration files; the latter is meant to be handled by the trees script, which then calls into git.sh before running the build logic for that given project. additionally: the "seen" files are no longer handled, at all. the logic there was added ages ago, because at the time, i was considering whether to separate configuration into a new repository, so that users could more easily make their own configuration, so it was a guard against misconfiguration. however, that decision was canceled and we're always very careful not to introduce a loop; if a loop does occur, the worst that can possibly happen is you waste some CPU cycles. Instead, print (on standard output) what config file is being used, so the operator can see when an infinite loop occurs. ALSO: remove _setcfgarg in load_project_config() it was used to skip when a target.cfg file didn't exist, specifically on single-tree projects, but this is now handled using -f instead, on the while loop inside that function, so _setcfgarg is now a redundant variable. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-29git.sh: rename Fetch_project_trees fetch_targetsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-29git.sh: rename fetch_project_repo to fetch_projectLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-28tidy up some setvars listsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>