From 30a51c1ff7991d5c3c607d424046a58fd7cf4359 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Fri, 1 Jan 2021 01:00:47 -0800 Subject: [PATCH] [build]: fix dpkg uninstall bug fix a bug when there are multiple debian packages to be uninstalled Signed-off-by: Guohan Lu --- rules/functions | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rules/functions b/rules/functions index d5aba46fd..104efa305 100644 --- a/rules/functions +++ b/rules/functions @@ -145,11 +145,11 @@ expand = $(foreach d,$(1),$(call expand,$($(d)_$(2)),$(2))) $(1) ## Uninstall debs ############################################################################### define UNINSTALL_DEBS -$(info $(1)) -$(foreach deb,$(1), \ - { while true; do \ - if mkdir $(DEBS_PATH)/dpkg_lock &> /dev/null; then \ - { sudo DEBIAN_FRONTEND=noninteractive dpkg -P $(firstword $(subst _, ,$(basename $(deb)))) $(LOG) && rm -d $(DEBS_PATH)/dpkg_lock && break; } || { rm -d $(DEBS_PATH)/dpkg_lock && exit 1 ; } \ - fi; \ - done; } ) +if [ -n "$(1)" ]; then \ + while true; do \ + if mkdir $(DEBS_PATH)/dpkg_lock &> /dev/null; then \ + { sudo DEBIAN_FRONTEND=noninteractive dpkg -P $(foreach deb,$(1),$(firstword $(subst _, ,$(basename $(deb))))) $(LOG) && rm -d $(DEBS_PATH)/dpkg_lock && break; } || { rm -d $(DEBS_PATH)/dpkg_lock && exit 1 ; } \ + fi; \ + done; \ +fi endef