build: remove stale .ipk files if package dir changes
authorFelix Fietkau <nbd@nbd.name>
Tue, 8 Nov 2016 04:47:39 +0000 (05:47 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 8 Nov 2016 09:49:51 +0000 (10:49 +0100)
If a package nonshared status is changed, a stale .ipk file might still
be present in the old package directory. Remove the .ipk file from all
package directories when building a new one (or explicitly running
clean)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
include/feeds.mk
include/package-ipkg.mk
include/rootfs.mk

index c79c941ffa571230d0df1a2180933f509a76f555..2ff57e576246c9b3b587c1bb50cb5908cdcd8d3d 100644 (file)
@@ -25,6 +25,10 @@ endif
 
 PACKAGE_DIR_ALL := $(TOPDIR)/staging_dir/packages/$(BOARD)
 
+opkg_package_files = $(wildcard \
+       $(foreach dir,$(PACKAGE_SUBDIRS), \
+         $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))
+
 PKG_CONFIG_DEPENDS += \
        CONFIG_PER_FEED_REPO \
        CONFIG_PER_FEED_REPO_ADD_DISABLED \
index c90eeb2b46a619edf6fc256f1ab867eb3668a9f3..afd2d4ef7a21ada456c84cd97eeb9e2707cf106a 100644 (file)
@@ -175,7 +175,7 @@ $(_endef)
     $$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
     $$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG)
     $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk
-       @rm -rf $$(PDIR_$(1))/$(1)_* $$(IDIR_$(1))
+       @rm -rf $$(IDIR_$(1)) $$(call opkg_package_files,$(1))
        mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
        $(call Package/$(1)/install,$$(IDIR_$(1)))
        -find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| $(XARGS) rm -rf
@@ -230,7 +230,7 @@ $(_endef)
        @[ -f $$(IPKG_$(1)) ]
 
     $(1)-clean:
-       rm -f $$(PDIR_$(1))/$(1)_*
+       $$(if $$(call opkg_package_files,$(1)),rm -f $$(call opkg_package_files,$(1)))
 
     clean: $(1)-clean
 
index b1617215a3ecfc1f380c8aad46c76022545fccc3..90d70a11f2e775c83b9907ec1f296c0e4d535ad6 100644 (file)
@@ -45,10 +45,6 @@ opkg = \
        --add-arch all:100 \
        --add-arch $(if $(ARCH_PACKAGES),$(ARCH_PACKAGES),$(BOARD)):200
 
-opkg_package_files = $(wildcard \
-       $(foreach dir,$(PACKAGE_SUBDIRS), \
-         $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))
-
 TARGET_DIR_ORIG := $(TARGET_ROOTFS_DIR)/root.orig-$(BOARD)
 
 define prepare_rootfs