Commit Graph

129 Commits (25.04_branch)

Author SHA1 Message Date
Leah Rowe 718697c0e6 git.sh: re-write tmpclone without caching
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-08 22:19:22 +01:00
Leah Rowe a5c5089eda git.sh: use setvars for fail variables
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 22:19:17 +01:00
Leah Rowe 7b2671ea26 git.sh: hard fail if git am fails
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-08 22:19:12 +01:00
Leah Rowe 45b6d3b3ba git.sh: Hard fail if reset fails
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-08 22:19:06 +01:00
Leah Rowe add92cd405 lib.sh: support any command on find_exec()
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-08 16:01:25 +01:00
Leah Rowe eac3b96ddd git.sh: Simplify git am handling
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-06 14:47:15 +01:00
Leah Rowe 92374e6071 init.sh: New function dx_ to execute path files
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-06 04:49:17 +01:00
Leah Rowe 9d91c3da60 git.sh: move singletree() to lib.sh
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-05 16:12:05 +01:00
Leah Rowe cd979e3b09 lbmk: MUCH safer err function
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-04 17:43:18 +01:00
Leah Rowe b2c14b6759 lbmk: Unified local ./tmp handling
Make it an absolute directory, relative to xbmktmp.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04 17:32:24 +01:00
Leah Rowe 5a294b183e lib.sh: move singletree() to git.sh
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-30 15:40:54 +01:00
Leah Rowe 7dbd02fcd0 mk/git.sh: remove tree_depend variable
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-30 15:36:51 +01:00
Leah Rowe 7c6039a086 git.sh: remove unused xgcc linking feature
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-30 15:36:44 +01:00
Leah Rowe f6d81c4751 mk: simplify main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:36:05 +01:00
Leah Rowe b665d09442 Revert "git.sh: minor cleanup"
This reverts commit e63d8dd20d99ec18ef03699516fd800a81b7f1df.
2025-04-30 15:01:54 +01:00
Leah Rowe 0fa1265106 git.sh: minor cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:01:27 +01:00
Leah Rowe 5469f483fc git.sh: remove unnecessary comment
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 14:41:31 +01:00
Leah Rowe 991a98caec git.sh: remove link_crossgcc()
merge it with git_prep

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 14:41:22 +01:00
Leah Rowe 1915c84376 git.sh: remove move_repo()
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-30 14:41:17 +01:00
Leah Rowe 515c1782ad git.sh: remove prep_submodule()
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-30 14:41:11 +01:00
Leah Rowe 519d93691f git.sh: make git_prep command clearer
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-30 14:41:05 +01:00
Leah Rowe c3910fbc5f cbmk: minor cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 14:39:57 +01:00
Leah Rowe 7bd9fb9a7b git.sh: clean up fetch_project()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-14 01:51:10 +01:00
Leah Rowe 12e600bf5c cbmk: unified PWD handling (work directory)
instead of running pwd all the time, run it once in lib.sh,
and export PWD.

for cbmk-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 cbmk 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-11 20:39:55 +01:00
Leah Rowe dcc7f10ec7 cbmk: use pwd util, not PWD environmental variable
PWD could be anything, if the user manually exported
it before running cbmk.

always run pwd instead, to get the real string.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-11 20:36:54 +01:00
Leah Rowe 6e6b54cc24 clean up a few semicolons in the build system
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-11 20:36:05 +01:00
Leah Rowe d7063fc20d cbmk: minor code formatting cleanup
some lines were needlessly condensed, and less readable

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-11 20:32:10 +01:00
Leah Rowe d57303e080 update my copyright years on modified scripts
there are some lbmk scripts that i modified, starting
this year. update the headers.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-07 00:32:52 +00:00
Leah Rowe 3d1fea0977 fix lbmk shellcheck errors
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>
2025-01-07 00:28:41 +00:00
Leah Rowe 5a5a7c37f5 Fix globbing issue in cbmk
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>
2025-01-07 00:10:11 +00:00
Leah Rowe dd6f914186 git.sh: don't initialise livepull globally
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>
2025-01-06 23:53:38 +00:00
Leah Rowe 4c08c390dd git.sh: fix error with cache re-download
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-10-06 10:19:16 +01:00
Leah Rowe 018486d912 add swig to fedora dependencies
needed when compiling u-boot

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-10-06 10:19:07 +01:00
Leah Rowe 7942aff43d general code cleanup in the build system
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-26 20:53:06 +01:00
Leah Rowe 16f9ad55ca put cachedir in environmental variable
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-19 15:02:00 +01:00
Leah Rowe 6b2653f8cd git.sh: warn when a cached clone fails
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-19 15:01:33 +01:00
Leah Rowe 1458e1108e git.sh: fix typo in git command
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-19 15:01:27 +01:00
Leah Rowe 20b076714c git.sh: fix lack of error exits on fault
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-19 15:01:17 +01:00
Leah Rowe 0cf0fdcfc3 unify caching of files into cache/
hash/ becomes cache/hash/

repo/ becomes cache/repo/

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-18 02:16:37 +01:00
Leah Rowe 0d55d7b23a git.sh: remove previous tmprepo if args>5
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-18 02:13:00 +01:00
Leah Rowe 3e2e5ecf5a git.sh: try direct clone if cached git fails
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-18 02:12:31 +01:00
Leah Rowe 03c9670fef git.sh: re-try git pull three times
mitigate jittery internet connections

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-18 02:12:20 +01:00
Leah Rowe 055c9be15b trees: auto-delete+auto-rebuild if project changes
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-18 02:10:58 +01:00
Leah Rowe c44ff5ac47 git.sh: don't download to src/project/project/
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-18 02:10:13 +01:00
Leah Rowe 3590a53ed1 git.sh: cache git downloads to repo/
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-18 02:09:49 +01:00
Leah Rowe 3365fca06a trees: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-12 16:40:02 +01:00
Leah Rowe 3681c29e77 remove executable permission on include/
files under include/ should never be executed directly

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-12 16:36:53 +01:00
Leah Rowe ff00073666 git.sh: simpler for loop in git_am_patches()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30 18:33:18 +01:00
Leah Rowe de26bb9997 git.sh: merge for loops in git_am_patches()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-30 18:33:13 +01:00
Leah Rowe cc090de51e trees and git.sh: tidy up global variables
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-30 18:33:07 +01:00