From 6c21bcaa65d0b9c38f60a9735de59cf441c3be52 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 27 May 2015 11:22:20 +0000 Subject: [PATCH] IB: use online repositories Change the IB packaging to only embed libc, kernel and kmod packages by default and generate repositories.conf to refer to the remote package repositories. Introduce a new config option CONFIG_IB_STANDALONE which restores the old behaviour of building self contained IB archives. Signed-off-by: Jo-Philipp Wich SVN-Revision: 45772 --- target/imagebuilder/Config.in | 8 +++++- target/imagebuilder/Makefile | 31 +++++++++++++++++++++ target/imagebuilder/files/Makefile | 4 +-- target/imagebuilder/files/repositories.conf | 2 -- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/target/imagebuilder/Config.in b/target/imagebuilder/Config.in index 6756c14c16..9d48e037e8 100644 --- a/target/imagebuilder/Config.in +++ b/target/imagebuilder/Config.in @@ -7,4 +7,10 @@ config IB with precompiled packages, kernel image and image building tools. You can use it to generate custom images without compiling anything - +config IB_STANDALONE + bool "Include package repositories" + depends on IB + help + By default, the ImageBuilder will use the online package repositories + to fetch additional .ipk archives. Enabling this option will cause + the ImageBuilder to embed all built packages locally instead. diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile index 1f97cb8613..218def7e1d 100644 --- a/target/imagebuilder/Makefile +++ b/target/imagebuilder/Makefile @@ -9,6 +9,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/version.mk +include $(INCLUDE_DIR)/feeds.mk override MAKEFLAGS= @@ -33,8 +34,38 @@ $(BIN_DIR)/$(IB_NAME).tar.bz2: clean $(TMP_DIR)/.targetinfo \ $(TMP_DIR)/.packageinfo \ $(PKG_BUILD_DIR)/ + +ifeq ($(CONFIG_IB_STANDALONE),) + echo '## Remote package repositories' >> $(PKG_BUILD_DIR)/repositories.conf + ifeq ($(CONFIG_PER_FEED_REPO),) + echo "src/gz %n %U" >> $(PKG_BUILD_DIR)/repositories.conf + else + for d in base $(FEEDS_ENABLED); do \ + echo "src/gz %n_$$d %U/$$d" >> $(PKG_BUILD_DIR)/repositories.conf; \ + done + ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),) + for d in $(FEEDS_DISABLED); do \ + echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$$d %U/$$d" >> $(PKG_BUILD_DIR)/repositories.conf; \ + done + endif + endif +endif + + echo '## This is the local package repository, do not remove!' >> $(PKG_BUILD_DIR)/repositories.conf + echo 'src imagebuilder file:packages' >> $(PKG_BUILD_DIR)/repositories.conf + $(VERSION_SED) $(PKG_BUILD_DIR)/repositories.conf + +ifeq ($(CONFIG_IB_STANDALONE),) + (cd $(PACKAGE_DIR); $(FIND) -type f -name 'libc_*.ipk' -or -name 'kernel_*.ipk' -or -name 'kmod-*.ipk') | \ + while read path; do \ + mkdir -p "$(PKG_BUILD_DIR)/packages/$${path%/*}"; \ + cp "$(PACKAGE_DIR)/$$path" "$(PKG_BUILD_DIR)/packages/$$path"; \ + done +else $(CP) $(PACKAGE_DIR) $(PKG_BUILD_DIR)/packages +endif + $(CP) $(TOPDIR)/target/linux $(PKG_BUILD_DIR)/target/ if [ -d $(TOPDIR)/staging_dir/host/lib/grub ]; then \ $(CP) $(TOPDIR)/staging_dir/host/lib/grub/ $(PKG_BUILD_DIR)/staging_dir/host/lib; \ diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index f3bfec1e31..0f0fe42b59 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -107,7 +107,7 @@ _call_image: $(MAKE) package_index; \ else \ mkdir -p $(TARGET_DIR)/tmp; \ - $(OPKG) update; \ + $(OPKG) update || true; \ fi $(MAKE) package_install ifneq ($(USER_FILES),) @@ -123,7 +123,7 @@ package_index: FORCE (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \ gzip -9c Packages > Packages.gz \ ) >/dev/null 2>/dev/null - $(OPKG) update + $(OPKG) update || true package_install: FORCE @echo diff --git a/target/imagebuilder/files/repositories.conf b/target/imagebuilder/files/repositories.conf index 708855eb8c..8f1f27fe50 100644 --- a/target/imagebuilder/files/repositories.conf +++ b/target/imagebuilder/files/repositories.conf @@ -2,5 +2,3 @@ # src/gz %n %U # src custom file:///usr/src/openwrt/bin/%T/packages -## This is the local package repository, do not remove! -src imagebuilder file:packages