summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-20 21:10:26 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-20 21:10:26 +0100
commite90bffff3c3c2afc734c41a424e164355aefd2e2 (patch)
tree81a15cb7e09bca5d0b1fc502c363203aa12cd68c /build
parentc7e764a3f088e2dbcacb507995476ce3082451ef (diff)
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>
Diffstat (limited to 'build')
-rwxr-xr-xbuild18
1 files changed, 17 insertions, 1 deletions
diff --git a/build b/build
index 4ade5e7e..9ca9de63 100755
--- a/build
+++ b/build
@@ -46,7 +46,7 @@ main()
check_git
check_project "fail"
- git_init xx_ fail
+ git_init
execute_command $@
lbmk_exit 0
@@ -81,6 +81,22 @@ install_packages()
printf "You must install AUR packages: %s\n" "${aur_notice}" 1>&2
}
+# release archives contain .gitignore, but not .git.
+# lbmk can be run from lbmk.git, or an archive.
+git_init()
+{
+ [ -L ".git" ] && fail "Reference .git is a symlink"
+ [ -e ".git" ] && return 0
+ eval "$(setvars "$(date -Rd @${versiondate})" cdate _nogit)"
+
+ git init || fail "${PWD}: cannot initialise Git repository"
+ git add -A . || fail "${PWD}: cannot add files to Git repository"
+ git commit -m "${projectname} ${version}" --date "${cdate}" || \
+ fail "${PWD}: can't commit ${projectname}/${version}, date ${cdate}"
+ git tag -a "${version}" -m "${projectname} ${version}" || \
+ fail "${PWD}: cannot git-tag ${projectname}/${version}"
+}
+
execute_command()
{
lbmkcmd="${buildpath}/${option}"