From aacd46bf812369710a0080b7e51f1a1c7d1ce9ee Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 11:57:13 +0100 Subject: xbmk: simplify a few err calls many of the messages are redundant, because errors caused by the commands they handle would produce similar messages. Signed-off-by: Leah Rowe --- include/tree.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index 11607eed..e8f55c48 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -45,8 +45,7 @@ trees() [ -z "$_f" ] && err "missing flag ($flags)" [ -z "$project" ] && fx_ "x_ ./mk $_f" x_ ls -1 config/git && return 1 - [ -f "config/git/$project/pkg.cfg" ] || \ - err "config/git/$project/pkg.cfg missing" + e "config/git/$project/pkg.cfg" f missing && err "$project: no pkg.cfg" for d in "elf" "config/data" "config" "src"; do eval "${d#*/}dir=\"$d/$project\"" @@ -187,8 +186,7 @@ check_project_hashes() [ "$pjhash" != "$old_pjhash" ] && badhash="y" [ -f "$XBMK_CACHE/hash/$project$tree" ] || badhash="y" - printf "%s\n" "$pjhash" > "$XBMK_CACHE/hash/$project$tree" || \ - err "!mk $XBMK_CACHE/hash/$project$tree" + printf "%s\n" "$pjhash" > "$XBMK_CACHE/hash/$project$tree" || err [ "$badhash" != "y" ] || x_ rm -Rf "src/$project/$tree" \ "elf/$project/$tree" "elf/$project/$target"; : -- cgit v1.2.1 From f8444a879594d498a6304ca7e22f7971ecc5830b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 12:17:06 +0100 Subject: tree.sh: simplify build_project() Signed-off-by: Leah Rowe --- include/tree.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index e8f55c48..86779733 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -74,9 +74,7 @@ build_project() [ ! -f "$listfile" ] || $dry elfcheck || return 0 [ "$mode" = "distclean" ] && mode="clean" - run_make_command || return 0 - - [ -n "$mode" ] || $dry copy_elf; : + run_make_command && [ -z "$mode" ] && $dry copy_elf; : } build_targets() -- cgit v1.2.1 From bdd42c0f32facffd0a0fb8b82851ba0dc1a8bd07 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 12:19:56 +0100 Subject: tree.sh: simplify handle_defconfig() Signed-off-by: Leah Rowe --- include/tree.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index 86779733..fec9568e 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -117,8 +117,7 @@ handle_defconfig() [ "$_f" = "-d" ] || defconfig="$y" [ -n "$mode" ] || check_defconfig || continue - handle_makefile - [ -n "$mode" ] || $dry copy_elf + handle_makefile && [ -z "$mode" ] && $dry copy_elf; : done; : } -- cgit v1.2.1 From a0be6d11c07cf7ae5994be39425a8c5650df4bb2 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 12:52:53 +0100 Subject: tree.sh: simplify build_targets() Signed-off-by: Leah Rowe --- include/tree.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index fec9568e..cca827df 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -90,9 +90,7 @@ build_targets() target="$x" printf "'make %s', '%s', '%s'\n" "$mode" "$project" "$target" - x_ handle_defconfig - - [ -n "$mode" ] || x_ $postmake + x_ handle_defconfig && [ -z "$mode" ] && x_ $postmake; : done; : } -- cgit v1.2.1 From 68356a8ca0eb647ef9d4ddd0a3f873ff00ada867 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 12:54:13 +0100 Subject: tree.sh: condense configure_project() Signed-off-by: Leah Rowe --- include/tree.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index cca827df..e394e973 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -138,8 +138,7 @@ configure_project() [ "$do_make" != "n" ] && break [ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \ - && break - _tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg" + && break; _tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg" done [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && return 1 [ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || return 1 -- cgit v1.2.1 From f4a1d2217fe3d4b8b7ec29326a52a5eb25368f55 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 12:56:27 +0100 Subject: tree.sh: condense build_targets() Signed-off-by: Leah Rowe --- include/tree.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index e394e973..a2d4c378 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -86,9 +86,7 @@ build_targets() unset CROSS_COMPILE export PATH="$xbmkpath" [ "$x" = "list" ] && x_ ls -1 "config/$project" && \ - listfile="" && break - - target="$x" + listfile="" && break; target="$x" printf "'make %s', '%s', '%s'\n" "$mode" "$project" "$target" x_ handle_defconfig && [ -z "$mode" ] && x_ $postmake; : done; : -- cgit v1.2.1 From 49b02b759fbfbeb862d61045637fcb1e0dbc8853 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 12:59:42 +0100 Subject: tree.sh: more reliable clean in run_make_command Don't do no-op if it fails; fall back to "clean" instead, and fail if that fails. The no-op was there was not all projects have distclean, but we do intend for them all to be cleaned. We mitigate further error by only running make-clean if a makefile exists. Signed-off-by: Leah Rowe --- include/tree.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index a2d4c378..54de692b 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -292,8 +292,10 @@ run_make_command() $dry x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs [ -n "$mode" ] || x_ $mkhelper + check_makefile "$srcdir" || return 0 [ "$mode" != "clean" ] || \ - $dry make -C "$srcdir" $cleanargs distclean || :; : + $dry make -C "$srcdir" $cleanargs distclean || \ + $dry x_ make -C "$srcdir" $cleanargs clean; : } check_cmake() -- cgit v1.2.1 From 5af830209ba71ac3f13958a05224dd84d38f276f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 13:49:13 +0100 Subject: tree.sh: simplify check_autoconf() Signed-off-by: Leah Rowe --- include/tree.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index 54de692b..976e3b56 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -285,8 +285,8 @@ run_make_command() { [ -n "$mode" ] || x_ $premake - $dry check_cmake "$srcdir" && [ -z "$mode" ] && \ - $dry check_autoconf "$srcdir" + $dry check_cmake "$srcdir" + [ -n "$mode" ] || ( $dry check_autoconf "$srcdir" ) || err $dry check_makefile "$srcdir" || return 1 $dry x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs @@ -307,12 +307,10 @@ check_cmake() check_autoconf() { - ( x_ cd "$1" [ -f "bootstrap" ] && x_ ./bootstrap $bootstrapargs [ -f "autogen.sh" ] && x_ ./autogen.sh $autogenargs [ -f "configure" ] && x_ ./configure $autoconfargs; : - ) || err "can't bootstrap project: $1"; : } check_makefile() -- cgit v1.2.1 From 68eca880c683947e2f189c1368fb6032ce6fc832 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 14:32:34 +0100 Subject: tree.sh: simplify configure_project() Signed-off-by: Leah Rowe --- include/tree.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index 976e3b56..7bfddf67 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -122,8 +122,7 @@ configure_project() eval "`setvars "" cleanargs build_depend autoconfargs xtree postmake \ makeargs btype mkhelper bootstrapargs premake release xlang xarch \ badhash`" - _tcfg="$1/target.cfg" - [ -f "$_tcfg" ] || btype="auto" + _tcfg="$1/target.cfg" && [ ! -f "$_tcfg" ] && btype="auto" e "$datadir/mkhelper.cfg" f && eval "`setcfg "$datadir/mkhelper.cfg"`" while e "$_tcfg" f || [ "$cmd" != "build_project" ]; do -- cgit v1.2.1