From fc7ae3e5903c176584cfefd6d3cf4c1549c4eaaa Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Sat, 22 Jun 2024 02:35:25 +0100
Subject: lib.sh: more unified config handling

replace it with logic that simply uses "." to load
files directly. for this, "vcfg" is added as a variable
in coreboot target.cfg files, referring to a directory
in config/vendor/ containing a file named pkg.cfg, and
this file then contains the same variables as the
erstwhile config/vendor/sources

config/git files are now directories, also containing
pkg.cfg files each with the same variables as before,
such as repository link and commit hash

this change results in a noticeable reduction in code
complexity within the build system.

unified reading of config files: new function setcfg()
added to lib.sh

setcfg checks if a config exists. if a 2nd argument is
passed, it is used as a return value for eval, otherwise
a string calling err is passed. setcfg output is passed
through eval, to set strings based on config; eval must
be used, so that the variables are set within the same
scope, otherwise they'd be set within setcfg which could
lead to some whacky results.

there's still a bit more more to do, but this single change
results in a substantial reduction in code complexity.

Signed-off-by: Leah Rowe <leah@libreboot.org>
---
 config/git/docs         | 6 ------
 config/git/docs/pkg.cfg | 3 +++
 2 files changed, 3 insertions(+), 6 deletions(-)
 delete mode 100644 config/git/docs
 create mode 100644 config/git/docs/pkg.cfg

(limited to 'config/git/docs')

diff --git a/config/git/docs b/config/git/docs
deleted file mode 100644
index 22892a21..00000000
--- a/config/git/docs
+++ /dev/null
@@ -1,6 +0,0 @@
-{docs}{
-	rev: e72d055915c3a9ffe739982946e101b146b2483c
-	loc: docs
-	url: https://codeberg.org/vimuser/untitled
-	bkup_url: https://notabug.org/untitled/untitled
-}
diff --git a/config/git/docs/pkg.cfg b/config/git/docs/pkg.cfg
new file mode 100644
index 00000000..9913ee5f
--- /dev/null
+++ b/config/git/docs/pkg.cfg
@@ -0,0 +1,3 @@
+rev="e72d055915c3a9ffe739982946e101b146b2483c"
+url="https://codeberg.org/vimuser/untitled"
+bkup_url="https://notabug.org/untitled/untitled"
-- 
cgit v1.2.1