unified projectname/version/versiondate handling

Signed-off-by: Leah Rowe <leah@libreboot.org>
btrfsvols
Leah Rowe 2023-10-07 02:36:46 +01:00
parent 24584296a8
commit fa8e204f14
6 changed files with 20 additions and 27 deletions

4
build
View File

@ -11,7 +11,7 @@ set -u -e
. "include/err.sh"
. "include/option.sh"
eval "$(setvars "" mode option project version versiondate aur_notice tmpdir)"
eval "$(setvars "" mode option aur_notice tmpdir)"
tmpdir_was_set="y"
set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n"
@ -119,7 +119,7 @@ usage()
Example: ./build coreboot list, which would yield:
$(./build coreboot list)
Refer to ${project} documentation for more info.
Refer to ${projectname} documentation for more info.
EOF
}

View File

@ -1,6 +1,8 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2022, 2023 Leah Rowe <leah@libreboot.org>
version=""; versiondate=""; projectname=""
x_() {
[ $# -lt 1 ] || ${@} || err "non-zero exit status: ${@}"
}
@ -27,24 +29,29 @@ git_err()
check_project()
{
_fail="${1}"
read project < projectname
read projectname < projectname || :
[ -f version ] && read version < version
[ ! -f version ] || read version < version || :
version_="${version}"
[ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \
version="git-$(git rev-parse HEAD 2>&1)" || version="${version_}"
[ -f versiondate ] && read versiondate < versiondate
[ ! -f versiondate ] || read versiondate < versiondate || :
versiondate_="${versiondate}"
[ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \
--pretty='%ct' HEAD)" || versiondate="${versiondate_}"
[ -z ${versiondate} ] && "${_fail}" "Unknown version date"
[ -z ${version} ] && "${_fail}" "Unknown version"
[ ! -z ${versiondate} ] || fail "Unknown version date" || \
err "Unknown version date"
[ ! -z ${version} ] || fail "Unknown version" || \
err "Unknown version"
[ ! -z ${projectname} ] || fail "Unknown project" || \
err "Unknown project"
printf "%s\n" "${version}" > version
printf "%s\n" "${versiondate}" > versiondate
xx_ printf "%s\n" "${version}" > version || \
x_ printf "%s\n" "${version}" > version
xx_ printf "%s\n" "${versiondate}" > versiondate || \
x_ printf "%s\n" "${versiondate}" > versiondate
}
setvars()
@ -64,3 +71,6 @@ err()
printf "ERROR %s: %s\n" "${0}" "${1}" 1>&2
exit 1
}
check_git
check_project

View File

@ -12,8 +12,6 @@ set -u -e
. "include/err.sh"
. "include/option.sh"
read projectname < projectname
seavgabiosrom="elf/seabios/default/libgfxinit/vgabios.bin"
grub_background="background1280x800.png"
grubelf="elf/grub/grub.elf"

View File

@ -10,9 +10,6 @@ set -u -e
. "include/err.sh"
. "include/option.sh"
read projectname < projectname
read version < version
export LOCALVERSION="-${projectname}-${version}"
eval "$(setvars "" arch cfgsdir codedir config config_name crossgcc_ada mode \

View File

@ -7,9 +7,6 @@ set -u -e
. "include/err.sh"
read projectname < projectname
version="version-unknown"
versiondate="version-date-unknown"
tree="default"
eval "$(setvars "" target CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \
CONFIG_KBC1126_FIRMWARE CONFIG_INCLUDE_SMSC_SCH5545_EC_FW)"
@ -31,8 +28,6 @@ main()
init_check()
{
[ -f version ] && read version < version
[ -f versiondate ] && read versiondate < versiondate
[ ! -d "bin/" ] && \
err "init_check: no ROMs built yet (error)"
[ -d "release/" ] || \

View File

@ -7,8 +7,6 @@ set -u -e
. "include/err.sh"
read projectname < projectname
trees_fetch_list="coreboot u-boot seabios"
simple_fetch_list="flashrom grub memtest86plus me_cleaner uefitool"
simple_fetch_list="${simple_fetch_list} bios_extract biosutilities"
@ -18,17 +16,12 @@ dirlist="config util script include"
linklist="update" # symlinks in main directory, to script: lbmk
filelist="build README.md COPYING version versiondate projectname .gitignore"
version="version-unknown"
versiondate="version-date-unknown"
eval "$(setvars "" reldir dirname srcdir)"
printf "Building source code archive, version %s\n" "${version}"
main()
{
[ -f version ] && read version < version
[ -f versiondate ] && read versiondate < versiondate
create_release_directory
download_modules
copy_files