From 819c17e138f10d23299a769fd90e7e832f296a8a Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 22 Jun 2023 16:22:10 +0200 Subject: [PATCH] Makefile: run 'bitbake package-index' after bitbake command building packages It was recently spotted that during a build of 201705-testing where sysmocom-openvpn-config was being rebuilt, the Packages(.gz) files (opkg package indexes) were rebuilt before the new .ipk files for sysmocom-openvpn-config were written to disk. Also then the Packages file didn't contain a reference to the new sysmocom-openvpn-config package version. So, it seems there was a race condition where the package index was built too early. Yocto documentation provides some hints: https://docs.yoctoproject.org/dev-manual/packages.html?highlight=bitbake+package+index#build-considerations """ Whenever you perform any sort of build step that can potentially generate a package or modify existing package, it is always a good idea to re-generate the package index after the build by using the following command: bitbake package-index Do not do "$ bitbake some-package package-index" as BitBake does not schedule the package index for after the completion of the package you are building. Consequently, you cannot be sure of the package index including information for the package you just built. Thus, be sure to run the package update step separately after building any packages. """ So far it seems we were relying on the "create filesystem" task triggered for image creation which would also trigger the package index recreation, according to https://yocto.yoctoproject.narkive.com/rjvLrVpW/question-about-rebuilding-rpm-package-index-for-updated-rpms-when-bitbake-completes """ The feed is normally indexed (createrepo) either when you manually run the package-index operation, or when you construct a filesystem. Until you do that, the feed directories are transient. """ Related: SYS#6023 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3becbb2..fb2d1bf 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,7 @@ build.%: | git/poky # Start a build.. %-build: | build.$(subst -build,,%) git/poky - $(Q)/bin/bash -c "source git/poky/oe-init-build-env build.$(CUR_MACHINE) && bitbake $(BUILD_TARGETS)" + $(Q)/bin/bash -c "source git/poky/oe-init-build-env build.$(CUR_MACHINE) && bitbake $(BUILD_TARGETS) && bitbake package-index" %-upload: | build.$(subst -upload,,%) git/poky $(Q)cd build.$(CUR_MACHINE) && ../scripts/upload-build.sh $(CUR_MACHINE) $(FEED_NAME)