[PATCH] build: propagate errors in scan and feed update
Karsten Sperling
ksperling at apple.com
Mon Aug 28 18:00:37 PDT 2023
Currently, when an error occurs during scanning of a package Makefile, an
error message is logged, but the error is not actually propagated. This
makes it easy for build scripts to accidentally proceed based on an incomplete
package scan.
Propagate errors correctly in scan.mk and update_index in the feeds script.
Signed-off-by: Karsten Sperling <ksperling at apple.com>
---
include/scan.mk | 1 +
scripts/feeds | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/scan.mk b/include/scan.mk
index 33a5832ff5..fa1909caa3 100644
--- a/include/scan.mk
+++ b/include/scan.mk
@@ -55,6 +55,7 @@ define PackageDir
$(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(SCAN_DIR)/$(2)/dump.txt 2>&1; \
$$(call progress,ERROR: please fix $(SCAN_DIR)/$(2)/Makefile - see logs/$(SCAN_DIR)/$(2)/dump.txt for details\n) \
rm -f $$@; \
+ exit 2; \
}; \
echo; \
} > $$@.tmp
diff --git a/scripts/feeds b/scripts/feeds
index aee73e793f..f321649807 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -127,11 +127,11 @@ sub update_index($)
-d "./feeds/$name.tmp" or mkdir "./feeds/$name.tmp" or return 1;
-d "./feeds/$name.tmp/info" or mkdir "./feeds/$name.tmp/info" or return 1;
- system("$mk -s prepare-mk OPENWRT_BUILD= TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");
- system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"packageinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"package\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");
- system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"targetinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"target\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" SCAN_MAKEOPTS=\"TARGET_BUILD=1\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");
- system("ln -sf $name.tmp/.packageinfo ./feeds/$name.index");
- system("ln -sf $name.tmp/.targetinfo ./feeds/$name.targetindex");
+ system("$mk -s prepare-mk OPENWRT_BUILD= TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"") == 0 or return 1;
+ system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"packageinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"package\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"") == 0 or return 1;
+ system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"targetinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"target\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" SCAN_MAKEOPTS=\"TARGET_BUILD=1\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"") == 0 or return 1;
+ system("ln -sf $name.tmp/.packageinfo ./feeds/$name.index") == 0 or return 1;
+ system("ln -sf $name.tmp/.targetinfo ./feeds/$name.targetindex") == 0 or return 1;
return 0;
}
--
2.40.1
More information about the openwrt-devel
mailing list