xbmk: reintroduce setvar as newvar (init only)

use the simpler logic recently introduced, generalised
but it only sets variables to empty. this is safer than
the previous design, and brings the same reduction in
sloccount overall since i wasn't doing anything other
than emptying variables anyway, when it was used before.

i didn't like the long list of variables inside files,
so this makes everything more readable.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-09-11 14:24:55 +01:00
parent aad748c5ca
commit 8173aea83b
6 changed files with 36 additions and 166 deletions
+2 -10
View File
@@ -3,16 +3,8 @@
# Copyright (c) 2020-2021,2023-2026 Leah Rowe <leah@libreboot.org>
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
url=""
bkup_url=""
depend=""
loc=""
subcurl=""
subcurl_bkup=""
subgit=""
subgit_bkup=""
subhash=""
eval "`newvar url bkup_url depend loc subcurl subcurl_bkup subgit subgit_bkup \
subhash`"
tmpgit="$xbtmp/gitclone"
tmpgitcache="$xbtmp/tmpgit"
+3 -19
View File
@@ -33,25 +33,9 @@ fi
sha512sum="util/sbase/sha512sum"
aur_notice=""
basetmp=""
board=""
checkvarschk=""
checkvarsxbmk=""
configdir=""
datadir=""
is_child=""
python=""
pyver=""
reinstall=""
relname=""
version=""
versiondate=""
xbmklock=""
xbmkpath=""
xbmkpwd=""
xbmkpwd=""
xbtmp=""
eval "`newvar aur_notice basetmp board checkvarschk checkvarsxbmk configdir \
datadir is_child python pyver reinstall relname version versiondate \
xbmklock xbmkpath xbmkpwd xbmkpwd xbtmp`"
xbmk_init()
{
+2 -12
View File
@@ -4,16 +4,6 @@
# Copyright (c) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
# Copyright (c) 2023-2026 Leah Rowe <leah@libreboot.org>
archive=""
board=""
boarddir=""
IFD_platform=""
ifdprefix=""
new_mac=""
tmpromdir=""
tree=""
xchanged=""
cbcfgsdir="config/coreboot"
tmpromdel="$XBMK_CACHE/DO_NOT_FLASH"
nvmutil="util/nvmutil/nvmutil"
@@ -21,8 +11,8 @@ ifdtool="elf/coreboot/default/ifdtool"
checkvars="CONFIG_GBE_BIN_PATH ${checkvarsxbmk-} ${checkvarschk-}"
eval "`printf "%s\n" "$checkvars" | \
awk '{ for (i=1; i<=NF; i++) $i = $i "=;"; print }'`"
eval "`newvar archive board boarddir IFD_platform ifdprefix \
new_mac tmpromdir tree xchanged $checkvars`"
inject()
{
+6
View File
@@ -8,6 +8,12 @@
cbfstool="elf/coreboot/default/cbfstool"
rmodtool="elf/coreboot/default/rmodtool"
newvar()
{
printf "%s\n" "$*" | \
awk '{ for (i=1; i<=NF; i++) $i = $i "=;"; print }'; :
}
mkrom_tarball()
{
update_xbmkver "$1"
+12 -65
View File
@@ -13,45 +13,11 @@ if_dry_build=":"
if_not_do_make=":"
if_not_dry_build=""
autoconfargs=""
autogenargs=""
badhash=""
badtghash=""
bootstrapargs=""
build_depend=""
buildtype=""
cleanargs=""
cmakedir=""
cmd=""
defconfig=""
dest_dir=""
elfdir=""
forcepull=""
gccdir=""
gccfull=""
gccver=""
gnatdir=""
gnatfull=""
gnatver=""
listfile=""
makeargs=""
mdir=""
mkhelper=""
mkhelpercfg=""
mode=""
postmake=""
premake=""
project=""
release=""
rev=""
srcdir=""
target=""
target_dir=""
targets=""
tree=""
xarch=""
xgcctree=""
xlang=""
eval "`newvar autoconfargs autogenargs badhash badtghash bootstrapargs \
build_depend buildtype cleanargs cmakedir cmd defconfig dest_dir elfdir \
forcepull gccdir gccfull gccver gnatdir gnatfull gnatver listfile \
makeargs mdir mkhelper mkhelpercfg mode postmake premake project release \
rev srcdir target target_dir targets tree xarch xgcctree xlang`"
trees()
{
@@ -74,7 +40,7 @@ trees()
# a large number of operations will be
# skipped. these are "if_not_dry_build build" scenarios
# where only a subset of build tasks are done,
# and $if_not_dry_build is prefixed to skipped commands
# and $if_not_dry_build is prefixed to skipped commands
if_dry_build=""
if_not_dry_build=":"
@@ -265,21 +231,9 @@ configure_project()
{
_tcfg="$1/target.cfg"
autoconfargs=""
badhash=""
badtghash=""
bootstrapargs=""
build_depend=""
buildtype=""
cleanargs=""
makeargs=""
mkhelper=""
postmake=""
premake=""
release=""
xarch=""
xgcctree=""
xlang=""
eval "`newvar autoconfargs badhash badtghash bootstrapargs \
build_depend buildtype cleanargs makeargs mkhelper postmake \
premake release xarch xgcctree xlang`"
if [ ! -f "$_tcfg" ]; then
buildtype="auto"
@@ -306,8 +260,7 @@ configure_project()
printf "Loading %s config: %s\n" "$project" "$_tcfg"
rev=""
tree=""
eval "`newvar rev tree`"
. "$_tcfg" || \
err "Can't read '$_tcfg'" "configure_project" "$@"
@@ -425,8 +378,7 @@ delete_old_project_files()
project_up_to_date()
{
old_hash=""
hash=""
eval "`newvar hash old_hash`"
hashdir="$1"
hashname="$2"
@@ -523,12 +475,7 @@ check_gnu_path()
err "Host '$1' unavailable" "check_gnu_path" "$@"
fi
gccdir=""
gccfull=""
gccver=""
gnatdir=""
gnatfull=""
gnatver=""
eval "`newvar gccdir gccfull gccver gnatdir gnatfull gnatver`"
if host_gcc_gnat_match "$@"; then
return 0
+11 -60
View File
@@ -36,67 +36,18 @@ checkvarsxbmk="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE \
CONFIG_FSP_FD_PATH CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS"
# lbmk-specific extensions; general variables
cbdir=""
cbfstoolref=""
has_hashes=""
hashfile=""
kbc1126_ec_dump=""
mecleaner=""
mfs=""
nuke=""
rom=""
vcfg=""
xromsize=""
eval "`newvar cbdir cbfstoolref has_hashes hashfile kbc1126_ec_dump mecleaner \
mfs nuke rom vcfg xromsize _7ztest _dest _dl _dl_bin _me _metmp _pre_dest`"
_7ztest=""
_dest=""
_dl=""
_dl_bin=""
_me=""
_metmp=""
_pre_dest=""
# lbmk-specific extensions; declared in pkg.cfg files in config/vendor/
DL_hash=""
DL_url=""
DL_url_bkup=""
E6400_VGA_bin_hash=""
E6400_VGA_DL_hash=""
E6400_VGA_DL_url=""
E6400_VGA_DL_url_bkup=""
E6400_VGA_offset=""
E6400_VGA_romname=""
EC_FW1_hash=""
EC_FW2_hash=""
EC_hash=""
EC_url=""
EC_url_bkup=""
FSPFD_hash=""
FSPM_bin_hash=""
FSPS_bin_hash=""
ME11bootguard=""
ME11delta=""
ME11pch=""
ME11sku=""
ME11version=""
ME_bin_hash=""
MEcheck=""
MEclean=""
MEshrink=""
MRC_bin_hash=""
MRC_refcode_cbtree=""
MRC_refcode_gbe=""
REF_bin_hash=""
SCH5545EC_bin_hash=""
SCH5545EC_DL_hash=""
SCH5545EC_DL_url=""
SCH5545EC_DL_url_bkup=""
TBFW_bin_hash=""
TBFW_hash=""
TBFW_size=""
TBFW_url=""
TBFW_url_bkup=""
XBMKmecleaner=""
# lbmk-specific extensions; declared by pkg.cfg files in config/vendor/
eval "`newvar DL_hash DL_url DL_url_bkup E6400_VGA_bin_hash E6400_VGA_DL_hash \
E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset E6400_VGA_romname \
EC_FW1_hash EC_FW2_hash EC_hash EC_url EC_url_bkup FSPFD_hash \
FSPM_bin_hash FSPS_bin_hash ME11bootguard ME11delta ME11pch ME11sku \
ME11version ME_bin_hash MEcheck MEclean MEshrink MRC_bin_hash \
MRC_refcode_cbtree MRC_refcode_gbe REF_bin_hash SCH5545EC_bin_hash \
SCH5545EC_DL_hash SCH5545EC_DL_url SCH5545EC_DL_url_bkup TBFW_bin_hash \
TBFW_hash TBFW_size TBFW_url TBFW_url_bkup XBMKmecleaner`"
download()
{