From 8347e2c85da0841dd35d6f94a5b3cf14bd1adff0 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 24 Sep 2025 13:19:23 +0100 Subject: xbmk: cleanup of recent code refactoring be a bit less pedantic about if else clauses. leave the big ones still with then on separate lines, where else is specified. also unroll a few condensed code lines where i missed a few. sloccount 2303 in lbmk. that's still only slightly bigger than libreboot 20260907 which was 2180, and still much smaller than libreboot 20230625 which was 3322. this is *without* the condensed codelines, so now the only thing that's reduced is the overall amount of logic present in the build system. and i should clarify that lbmk is presently much more powerful than both of those two versions (20160907/20230625). the 2016 one is useful for comparison historically, since that was the last major version of libreboot prior to the great second coming of leah in 2021; and the 2023 june release was basically the last one before the great audits of 2023 to 2025 began. not to brag (not much anyway), but all of this means that lbmk is an insanely efficient build system, considering all the features it has and what it does. i unrolled the condensed code style in lbmk, making the scripts a lot easier to read, because i received complainst about the condensed style previously used; nicholas chin and alper nebi yasak both told me that it sucked, and riku viitanen had hinted at that same fact several months prior. so hopefully now, lbmk is a bit nicer. those and other people often find it challenging to challenge me because for reason they assume i'll get upset and fly off the handle, but it's the opposite. i want constant criticism, so that i know to improve! Signed-off-by: Leah Rowe --- include/release.sh | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) (limited to 'include/release.sh') diff --git a/include/release.sh b/include/release.sh index 6f8e4a6d..3b5e1905 100644 --- a/include/release.sh +++ b/include/release.sh @@ -9,22 +9,23 @@ release() reldir="release" - while getopts m: option - do - if [ -z "$OPTARG" ] - then + while getopts m: option; do + if [ -z "$OPTARG" ]; then err "empty argument not allowed" "release" "$@" fi case "$option" in - m) relmode="$OPTARG" ;; - *) err "invalid option '-$option'" "release" "$@" ;; + m) + relmode="$OPTARG" + ;; + *) + err "invalid option '-$option'" "release" "$@" + ;; esac done reldest="$reldir/$version" - if [ -e "$reldest" ] - then + if [ -e "$reldest" ]; then err "already exists: \"$reldest\"" "release" "$@" fi @@ -40,8 +41,7 @@ release() prep_release src prep_release tarball - if [ "$relmode" != "src" ] - then + if [ "$relmode" != "src" ]; then prep_release bin fi x_ rm -Rf "$rsrc" @@ -56,9 +56,7 @@ release() prep_release() { ( - - if [ "$1" != "tarball" ] - then + if [ "$1" != "tarball" ]; then x_ cd "$rsrc" fi @@ -74,19 +72,15 @@ prep_release_src() fx_ "x_ rm -Rf" x_ find . -name ".git" fx_ "x_ rm -Rf" x_ find . -name ".gitmodules" - ( - - fx_ nuke x_ find config -type f -name "nuke.list" - - ) || err "can't prune project files" "prep_release_src" "$@"; : + ( fx_ nuke x_ find config -type f -name "nuke.list" ) || \ + err "can't prune project files" "prep_release_src" "$@"; : } nuke() { r="$rsrc/src/${1#config/}" - if [ -d "${r%/*}" ] - then + if [ -d "${r%/*}" ]; then x_ cd "${r%/*}" dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$rsrc/$1" @@ -103,7 +97,6 @@ prep_release_tarball() x_ rm -Rf "$rsrc/cache" "$rsrc/xbmkwd" ( - x_ cd "${rsrc%/*}" x_ mktarball "${rsrc##*/}" "${rsrc##*/}.tar.xz" @@ -114,8 +107,10 @@ prep_release_bin() { x_ ./mk -d coreboot - fx_ "x_ ./mk -b" printf \ - "coreboot\npico-serprog\nstm32-vserprog\npcsx-redux\n" + x_ ./mk -b coreboot + x_ ./mk -b pico-serprog + x_ ./mx -b stm32-vserprog + x_ ./mk -b pcsx-redux fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*" -- cgit v1.2.1