summaryrefslogtreecommitdiff
path: root/include/git.sh
AgeCommit message (Collapse)Author
2025-05-13git.sh: rename to get.shLeah Rowe
it now handles more than just git, and i forsee it handling even more in the future, e.g. rsync, ftp, bittorrent. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-13git.sh: Only create destination repo on successLeah Rowe
Don't leave a broken cache laying around, which would otherwise break lbmk for the user. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-13git.sh: cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-13git.sh: Re-implement redundant git downloadsLeah Rowe
And this time it works. I'm now calling xbmkget() which in turn calls tmpclone(), instead of me calling tmpclone() directly. The git-pull is done on both remotes, regardless of whether the first succeeds. This way, if I forgot to update a mirror, downloads would probably still work. This also fixes an issue people were having, for example where the gnulib repository of GRUB was always being downloaded every time. I'm using a new directory, XBMK_CACHE/clone, instead of XBMK_CACHE/repo (which I used before), in case people still have the old caches from before. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-12lib.sh: remove rmgit()Leah Rowe
We don't need to call it from git.sh, because it's only being done when building a release anyway, and we already run rmgit when doing a release. The function itself is only two simple fx_ calls, so we can just do that from build_release(). Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-12lib.sh: move xbmkget() to git.shLeah Rowe
in cbmk, it's only used from there. in lbmk, it's also used from vendor.sh. however, i plan to further expand git.sh at some point, tidying it up so that git cloning is also done from xbmkget, with dlop=git and git.sh would then be renamed to get.sh Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-09lbmk: use x_ instead of err, where appropriateLeah Rowe
many places in lbmk used err, because older versions of x_ did not handle globbing properly. however, use of x_ is preferable on trivial commands. the only time err() should be called is what it has to be, when x_ can't work, or when a more useful error message is needed, for context. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08git.sh: re-write tmpclone without cachingLeah Rowe
remove caching for now. it's buggy as hell. will re-write the caching feature next. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08git.sh: use setvars for fail variablesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08git.sh: hard fail if git am failsLeah Rowe
similar to the last patch, we must ensure that the inability to patch will cause a hard exit, regardless of any redundancy we have for cloning. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08git.sh: Hard fail if reset failsLeah Rowe
We allow a re-try when cloning fails, to account for redundancy, but resetfail currently doesn't cause any error exit at all. This patch mitigates that bug. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07lib.sh: support any command on find_exec()Leah Rowe
right now, we assume "find", but it adds any number of arguments next to that. change it instead to support any command, where the assumption is that it would generate a list of files and directories. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06git.sh: Simplify git am handlingLeah Rowe
fx_ and fe_ really are the best shell functions ever. really. they're the best. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05init.sh: New function dx_ to execute path filesLeah Rowe
Generated by find, this is a wrapper in place of using for loops everywhere. This simplification temporarily increases the amount of code, because we don't do this a lot, but this will reduce the growth of the build system code size in future changes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05git.sh: move singletree() to lib.shLeah Rowe
it's also used by mk, to determine which build function to use (build_project or build_targets). Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lbmk: MUCH safer err functionLeah Rowe
Don't directly call a variable. Call a function that checks the variable instead. The new err function also checks whether an exit was actually done, and exits 1 if not. If an exit was done by the given function, but the exit was zero, this is also corrected to perform an exit 1. This fixes a longstanding design flaw of lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03lbmk: Unified local ./tmp handlingLeah Rowe
Make it an absolute directory, relative to xbmktmp. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26lib.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>
2025-04-26mk/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>
2025-04-26git.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>
2025-04-26mk: 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>