From 68086fc2972e46f4144cc252a4e187947634539f Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Fri, 1 Jan 2021 01:14:15 -0800 Subject: [PATCH] [build]: check if package with given version is installed or not in case conflicting packages have same name but different version, the install step needs to wait till package with the conflicting version is uninstalled Signed-off-by: Guohan Lu --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index c75bf15e75..6393008b37 100644 --- a/slave.mk +++ b/slave.mk @@ -530,7 +530,7 @@ $(SONIC_INSTALL_TARGETS) : $(DEBS_PATH)/%-install : .platform $$(addsuffix -inst while true; do # wait for conflicted packages to be uninstalled $(foreach deb, $($*_CONFLICT_DEBS), \ - { while dpkg -s $(firstword $(subst _, ,$(basename $(deb)))) &> /dev/null; do echo "waiting for $(deb) to be uninstalled" $(LOG); sleep 1; done } ) + { while dpkg -s $(firstword $(subst _, ,$(basename $(deb)))) | grep "^Version: $(word 2, $(subst _, ,$(basename $(deb))))" &> /dev/null; do echo "waiting for $(deb) to be uninstalled" $(LOG); sleep 1; done } ) # put a lock here because dpkg does not allow installing packages in parallel if mkdir $(DEBS_PATH)/dpkg_lock &> /dev/null; then { sudo DEBIAN_FRONTEND=noninteractive dpkg -i $(DEBS_PATH)/$* $(LOG) && rm -d $(DEBS_PATH)/dpkg_lock && break; } || { rm -d $(DEBS_PATH)/dpkg_lock && exit 1 ; }