Age | Commit message (Collapse) | Author |
|
this is an extension of the previous work to unroll
most of the condensed code lines.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
This reverts commit 4999a49de39667b3239fc2010d0e99c958b29417.
|
|
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>
|
|
if more than one argument is provided, it is interpreted
as a command, and the command is outputted.
this means that now for example, where you have:
ls -l foo | err "could not list directory"
you could do:
ls -l foo | err "could not list directory" "$@"
this would show all the arguments given to the calling
function that tried to run "ls"
let's say that function was called bar, you might do:
ls -l foo | err "could not list directory" bar "$@"
right now, it's not easy to provide good debug info
where err is used, unless it was called with x_, which
provides the command/arguments that was bugging out.
with this, we now have an easy and readable/maintainable
way to do the same thing everywhere in xbmk.
this will now be done, in a follow-up commit.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
don't echo the arguments
this new logic shows quotes, in error outputs.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
check that there are at least two arguments, and ensure that
they are not empty.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
the release functions in release.sh rely on the
version string *not* being a path containing slashes.
just a single string e.g. "foo", not e.g. "foo/bar"
this is because several checks there make that
assumption. in practise, we always ensure that tags
and such do not contain these characters.
however, someone else working on their own version
of xbmk might not know of this design flaw, so let's
try to correct it in code.
we can add more filtering as designed, in the relevant
function (xbmk_sanitize_version).
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
error out under fault condition
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
instead of copying to a temp file and then
concatenating with padding back to the main
file, we concatenate and create the temp file,
then move the temp file back to the main file.
this is because cat can be quite error prone,
more so than mv, so this will reduce the chance
of corrupt files being left behind depending
on the context (of course, the latter is often
avoided due to xbmk's design, which emphasises
use of temporary files first).
this matches the same design used in the function
unpad_one_byte, which creates the deconcatenated
output in a temporary file first, moving it back.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
This was a problem when I did it before, because individual
target builds weren't automatically re-compiled when needed.
The recent design improvements in lbmk enable this to be
done again.
Cached images in elf/ have no payloads, so they are a liability,
therefore they are padded by one byte to prevent flashing. This
solves the problem that the previous caching had.
With this change, modifying payloads can be tested without
needing to re-build coreboot each time.
The cached coreboot builds are also automatically re-built when
needed, which is another improvement this time, compared to
the last time coreboot builds were cached in this manner.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
it means nothing here. in context, if a non-zero return
is observed, we should not do anything here, which is
already the behaviour anyway, except that "break" means
nothing since we're not in a loop here.
where an error exit should be observed, x_ is used inside
the command given for fx_
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
not elf/UTIL/TREE
This way, they are automatically deleted when a tree
has to be re-built.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Because of how sh works, having just the [] line causes
sh to exit, annoyingly without an error message, but it
does cause a non-zero exit.
This bug will have already been triggering, before I added
the recent error handling on files for this for loop.
also do it to the other loop in lib.sh
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
This is more reliable against globbing, in context of for.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
i overlooked these!
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
don't update them on child instances, since it's a waste
of time; the lock file prevents further execution, so we
are just wasting time writing to disk.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
in a few places, we use the presence of a file found
by fx_ to cause an exit, but the command that runs
looks something like:
exit 1 "string"
this yields an error, and a non-zero exit, because of
too many arguments to "exit", but we wanted a non-zero
exit anyway.
nevertheless, this is incorrect.
to fix it, eval is used instead. if the never-going-to-exist
condition one day exists where exit 1 actually returns, not,
you know, exits, we will use err instead, with the string
as argument.
this should be fine. it's a bit hacky, but so is fx_, and
it works. fx_ is used in several places to keep the sloccount
down, providing a common way to perform while loops on the
output of a command; that is its only purpose..
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
i don't need it. i can use fx_ instead, on functions
that previously called mk().
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
this is unused in cbmk.
it's only used from vendor.sh.
therefore, lbmk shall have it in vendor.sh.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
it's only used there
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
with fx_, i have more much granular control over
how errors are handled.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
it was too complicated. most of the logic has been moved
to a new function, try_file()
the for loop is handled by xbmkget(), whereas each try
is now handled in try_file()
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Use realpath only as a fallback.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
We don't need this, since we're exiting anyway.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Instead of calling fe_, prefix x_ as indicated.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Use fe_ with a new function, scankconfig, to do the
same thing. Not only is this simpler, it now also
operates on all coreboot configs for a given target,
whereas it previously only operated on the first one.
This is useful for cases where one config might use a
file that the other one does not; in practise, we don't
do this yet, but it's a theoretical possibility
Also: don't use the function check_defconfig, which is
now redundant and has been removed.
That function also conflicted with another function by
the same name in mk, but fortunately didn't cause an
issue in practise, due to how sh works; when vendor.sh
was used, it was without running the tree commands,
except under a separate lbmk instance.
So this is a simplification, a feature enhancement and
even a bug fix, all wrapped into one!
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
It's completely unnecessary, and I forsee this
check breaking the build system at some point,
since some commands rely on the output of other
commands. Therefore, I've removed this check.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
The current implementation is insanely over-engineered,
and completely unnecessary.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
fe_ returns an error on the find command, but we rely
on the only error ever being our intentional exit, upon
discovering files.
in singletree, the directory being checked was already
checked first, so we know it's safe not to err on find;
and find not reporting an error if no files are found is
ok.
on elfcheck, it's very much the same thing. In fact, we
very much want it to return 0 if the directory doesn't
exist, or if files don't exist within it.
Therefore, use fx_ which is designed for this use-case.
Quick re-cap: fx and fe execute a given function name with
each line outputting by find as an argument, each time. It
is somewhat similar in scope to find's -exec command.
We use fe_ as shorthand in several places all over lbmk.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
Some parts of lbmk set +u +e, to be reset later on
under normal conditions upon exit. We must ensure
such level of integrity in err() as well.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|