build: use STAGING_DIR for special APK package versions
authorJonas Gorski <jonas.gorski@gmail.com>
Wed, 14 Jan 2026 19:19:30 +0000 (20:19 +0100)
committerRobert Marko <robimarko@gmail.com>
Sun, 1 Feb 2026 10:16:54 +0000 (11:16 +0100)
commita4e92f0484f365565072162dad3eeaca0e38b709
treeafde9e78bee7d6a55fc74cd97d837cb0479dff01
parent16239e90add1886b411ab26235c60ac42112fc39
build: use STAGING_DIR for special APK package versions

Removing tmp/ after having built base-files or toolchain currently
breaks rootfs generation:

$ rm -rf tmp
$ make V=w
...
 make[2] package/install
cat: .../openwrt/tmp/base-files.version: No such file or directory
cat: .../openwrt/openwrt/tmp/libc.version: No such file or directory
ERROR: 'base-files=' is not a valid world dependency, format is name(@tag)([<>~=]version)
make[2]: *** [package/Makefile:100: package/install] Error 99

The only way to recover from here is to clean toolchain and base-files via

$ make package/{base-files,toolchain}/clean

tmp is supposed to be ephemeral, so clearing it is an expected action,
which normally just triggers a regeneration of all files there.

Fix this by moving the version files to $(STAGING_DIR).

Fixes: 63e178f067 ("build: lock versions for special APK packages")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21803
Signed-off-by: Robert Marko <robimarko@gmail.com>
package/Makefile
package/base-files/Makefile
package/kernel/linux/Makefile
package/libs/toolchain/Makefile
target/imagebuilder/Makefile