Commit Graph

17 Commits (54ca5f24d20531ac728a9475a94912f0a08f29f7)

Author SHA1 Message Date
Leah Rowe f4b2a588e2 build: don't generate version/versiondate as root
don't run it directly at the bottom of err.sh,
because otherwise the version and versiondate
files will be generated when running "./build
dependencies distroname" which would then create
these files, but as root because the user runs
that specific command as root.

the rest of lbmk, for any other command, prevents
use of the root account, so running check_project
during "./build dependencies distroname" will cause
the build system to fail (because as non-root user,
the user will run lbmk and it will try to update
those files, and fail because it can't, due to lack
of permissions)

this patch fixes the issue, by only generating those
files if the user is *not* root

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-08 06:11:24 +00:00
Leah Rowe e90bffff3c move git_init to the main build script
also, don't use x_ because it totally b0rks on
these commands. handle exit status directly.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 21:10:26 +01:00
Leah Rowe 54a05fc167 always re-generate .git in lbmk
in release archives, .git is excluded but the version
and versiondate files are included. from these, the
git history is re-created with the exact date (but not
taking into account timezone, at present).

in this way, lbmk will have git history in a release
archive. some build systems, like coreboot, prefer that
there be git history available, so this is a nice
workaround on those build systems.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 11:16:25 +01:00
Leah Rowe 65af756fc3 x/xx: slightly more verbose error messages
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 09:01:58 +01:00
Leah Rowe 7e3a031a1d include/err.sh: don't run check_git
it's already executed in "build"

running it in err.sh makes the user have to set
git name/email as root, when running dependencies
scripts. this is a regression, that this patch
fixes. git isn't needed to install dependencies.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-09 20:53:49 +01:00
Leah Rowe fa8e204f14 unified projectname/version/versiondate handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 02:46:47 +01:00
Leah Rowe 923a96c18e check git/version: properly call err()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-04 10:02:59 +01:00
Leah Rowe 1223bfaeef check_git: call fail() first (fallback to err)
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-04 10:00:12 +01:00
Leah Rowe 727dc7ff2f more verbosely print git config error
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-04 09:57:42 +01:00
Leah Rowe fbd464b4f7 include/err.sh: checkgit,checkversion
call these as functions, instead of executing scripts

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-04 08:06:10 +01:00
Leah Rowe d38b958d7a include/err x_(): more verbose error message
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:57:51 +01:00
Leah Rowe 8886f9958f include/err: remove unused variable
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:56:53 +01:00
Leah Rowe 8c03b886c4 Greatly simplify error handling in shell scripts
Instead of having detailed error messages, run most
commands through a function that calls err() under
fault conditions.

Where detail is still required, err() is still called
manually. Where it isn't, the error message is simply
whatever command was executed to cause the error.

This results in a massive sloccount reduction for lbmk;
specifically, 178 sloc reduction, or a 8.1% reduction.
The total sloccount is now 2022, for shell scripts.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-01 22:47:02 +01:00
Leah Rowe 0a0defd325 simplify initialising variables in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 19:09:25 +01:00
Leah Rowe 208620198c Update email address for Leah Rowe copyrights
also, some of them were out of date; years now updated.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 02:27:26 +01:00
Leah Rowe cc1642096e Use SPDX license headers on all scripts
This results in much cleaner copyright and license declarations.
SPDX headers are legally recognised and make auditing easier.

Also, remove descriptions of each script, from each script.
Libreboot documentation at docs/maintain/ describes them.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 02:19:48 +01:00
Leah Rowe 57adbc6eb1 unify err functions across scripts
include/err.sh

this new handling also does mundane things,
such as tell you what script b0rked

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-23 19:12:00 +01:00