[openwrt/openwrt] imagebuilder: fix APK for packages dir and cache
LEDE Commits
lede-commits at lists.infradead.org
Sat Nov 9 07:46:56 PST 2024
aparcar pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/ad1c1b7047b2e716b75031e26af544532f429f10
commit ad1c1b7047b2e716b75031e26af544532f429f10
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Fri Nov 1 12:33:49 2024 +0100
imagebuilder: fix APK for packages dir and cache
This commit solves multiple issues. First of just install the three
special packages base-files, libc and kernel directly from the index. In
upstream indexes, those will never appear to prevent accidental upgrades
may breaking the system.
Next, enable caching for the ImageBuilder, which speeds up consecutive
builds from ~33 seconds to ~5 seconds. Using cache however makes APK
create the folder `/var/cache/apk/` which conflicts with the base-files
installation, which ships a symlink from `/var` to `/tmp`, so specify
`--no-cache` for the rootfs initialization.
Lastly, drop the use of `apk update` since APK automatically does that.
Signed-off-by: Paul Spooren <mail at aparcar.org>
---
include/rootfs.mk | 1 -
package/Makefile | 4 ++--
target/imagebuilder/Makefile | 12 +++++++++---
target/imagebuilder/files/Makefile | 4 ----
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/include/rootfs.mk b/include/rootfs.mk
index e6cadc531d..26f249d818 100644
--- a/include/rootfs.mk
+++ b/include/rootfs.mk
@@ -48,7 +48,6 @@ apk = \
$(FAKEROOT) $(STAGING_DIR_HOST)/bin/apk \
--root $(1) \
--keys-dir $(if $(APK_KEYS),$(APK_KEYS),$(TOPDIR)) \
- --no-cache \
--no-logfile \
--preserve-env
diff --git a/package/Makefile b/package/Makefile
index abe76a619f..d78200fd80 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -98,7 +98,7 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(curdir)/merge-index
ifneq ($(CONFIG_USE_APK),)
$(file >$(TMP_DIR)/apk_install_list,\
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))
- $(call apk,$(TARGET_DIR)) add --initdb --no-scripts --arch $(ARCH_PACKAGES) \
+ $(call apk,$(TARGET_DIR)) add --no-cache --initdb --no-scripts --arch $(ARCH_PACKAGES) \
--repositories-file /dev/zero --repository file://$(PACKAGE_DIR_ALL)/packages.adb \
$$(cat $(TMP_DIR)/apk_install_list)
else
@@ -130,7 +130,7 @@ ifneq ($(CONFIG_USE_APK),)
--keys-dir $(TOPDIR) \
--sign $(BUILD_KEY_APK_SEC) \
--output packages.adb \
- $$(ls *.apk | grep -v 'kernel\|libc'); \
+ $$(ls *.apk | grep -v 'base-files\|kernel\|libc'); \
done
else
@for d in $(PACKAGE_SUBDIRS); do ( \
diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
index bdbbb45cb1..ff14a43bed 100644
--- a/target/imagebuilder/Makefile
+++ b/target/imagebuilder/Makefile
@@ -71,15 +71,21 @@ endif
ifeq ($(CONFIG_BUILDBOT),)
ifeq ($(CONFIG_IB_STANDALONE),)
$(FIND) $(call FeedPackageDir,libc) -type f \
- \( -name 'libc*.$(PACKAGE_SUFFIX)' -or -name 'kernel*.$(PACKAGE_SUFFIX)' -or -name 'kmod-*.$(PACKAGE_SUFFIX)' \) \
- -exec $(CP) -t $(PKG_BUILD_DIR)/packages {} +
+ \( \
+ -name 'base-files*.$(PACKAGE_SUFFIX)' -or \
+ -name 'libc*.$(PACKAGE_SUFFIX)' -or \
+ -name 'kernel*.$(PACKAGE_SUFFIX)' \) \
+ -exec $(CP) -t $(PKG_BUILD_DIR)/packages {} +
else
$(FIND) $(wildcard $(PACKAGE_SUBDIRS)) -type f -name '*.$(PACKAGE_SUFFIX)' \
-exec $(CP) -t $(PKG_BUILD_DIR)/packages/ {} +
endif
else
$(FIND) $(call FeedPackageDir,libc) -type f \
- \( -name 'libc*.$(PACKAGE_SUFFIX)' -or -name 'kernel*.$(PACKAGE_SUFFIX)' \) \
+ \( \
+ -name 'base-files*.$(PACKAGE_SUFFIX)' -or \
+ -name 'libc*.$(PACKAGE_SUFFIX)' -or \
+ -name 'kernel*.$(PACKAGE_SUFFIX)' \) \
-exec $(CP) -t $(IB_LDIR)/ {} +
endif
diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile
index f46b61b787..1ac05baa50 100644
--- a/target/imagebuilder/files/Makefile
+++ b/target/imagebuilder/files/Makefile
@@ -185,7 +185,6 @@ else
(cd $(PACKAGE_DIR); $(APK) mkndx \
$(if $(CONFIG_SIGNATURE_CHECK), --keys-dir $(APK_KEYS) --sign $(BUILD_KEY_APK_SEC)) \
--allow-untrusted --output packages.adb *.apk) >/dev/null 2>/dev/null || true
- $(APK) update >&2 || true
endif
package_reload:
@@ -208,7 +207,6 @@ else
$(MAKE) package_index; \
else \
mkdir -p $(TARGET_DIR)/tmp; \
- $(APK) update >&2 || true; \
fi
endif
@@ -228,8 +226,6 @@ ifeq ($(CONFIG_USE_APK),)
$(OPKG) install $(firstword $(wildcard $(LINUX_DIR)/kernel_*.ipk $(PACKAGE_DIR)/kernel_*.ipk))
$(OPKG) install $(BUILD_PACKAGES)
else
- $(APK) add --no-scripts $(firstword $(wildcard $(LINUX_DIR)/libc-*.apk $(PACKAGE_DIR)/libc-*.apk))
- $(APK) add --no-scripts $(firstword $(wildcard $(LINUX_DIR)/kernel-*.apk $(PACKAGE_DIR)/kernel-*.apk))
$(APK) add --no-scripts $(BUILD_PACKAGES)
endif
More information about the lede-commits
mailing list