Skip to content

Commit

Permalink
quilt.mk: don't error on refresh/update if patches doesn't exist
Browse files Browse the repository at this point in the history
The current code fails if we have package or host tools with no patches
to apply. The error printend is the following: (taking ubus as an
example)

make[2]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt/scripts/config'
make[1]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt'
make[2]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt/package/system/ubus'
The source directory contains no quilt patches.
make[2]: *** [Makefile:81: quilt-check] Error 1
make[2]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt/package/system/ubus'
time: package/system/ubus/refresh#0.06#0.00#0.07
    ERROR: package/system/ubus failed to build.
make[1]: *** [package/Makefile:120: package/system/ubus/refresh] Error 1
make[1]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt'
make: *** [/home/ansuel/openwrt-ansuel/openwrt/include/toplevel.mk:232: package/ubus/refresh] Error 2

This error is wrong and actually caused by quilt-check trying to find
patches while in reality the package doesn't have any patch to refresh.

To better handle this case, introduce a fake Quilt define template that
just print a warning message indicating the user that the refresh/update
is skipped and exit succesfully and use these fake define only if we
detect that the patches directory is empty or non existent.

Example:
make[2]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt/scripts/config'
make[1]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt'
make[2]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt/package/system/ubus'
Skipping refresh. /home/ansuel/openwrt-ansuel/openwrt/package/system/ubus/patches doesn't exist or is empty.
make[2]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt/package/system/ubus'
time: package/system/ubus/refresh#0.05#0.00#0.07
make[1]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt'

This is needed to support run like package/refresh that will run the
refresh process on any package present in the buildroot.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
  • Loading branch information
Ansuel committed Sep 25, 2023
1 parent 281cddb commit 187a241
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions include/quilt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,19 @@ define Quilt/Template
$(Quilt/Refresh/$(4))
endef

Build/Quilt=$(call Quilt/Template,$(PKG_BUILD_DIR),,,$(if $(TARGET_BUILD),Kernel,Package))
Host/Quilt=$(call Quilt/Template,$(HOST_BUILD_DIR),HOST_,host-,Host)
define Quilt/SkipTemplate
$(3)refresh:
@echo "Skipping refresh. $(1) doesn't exist or is empty".

$(3)update:
@echo "Skipping update. $(1) doesn't exist or is empty".
endef

Build/Quilt=$(if $(wildcard $(PATCH_DIR)/.*), \
$(call Quilt/Template,$(PKG_BUILD_DIR),,,$(if $(TARGET_BUILD),Kernel,Package)), \
$(call Quilt/SkipTemplate,$(PATCH_DIR)))
Host/Quilt=$(if $(wildcard $(HOST_PATCH_DIR)/.*), \
$(call Quilt/Template,$(HOST_BUILD_DIR),HOST_,host-,Host), \
$(call Quilt/SkipTemplate,$(HOST_PATCH_DIR)))

endif

0 comments on commit 187a241

Please sign in to comment.