From a720dd209f8b345cdfa5d2432287520389404445 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 5 Aug 2014 11:24:24 +0000 Subject: build: introduce per feed repository support This changeset implements a new menuconfig option to generate separate repositories for each enabled package feed instead of one monolithic one. Signed-off-by: Jo-Philipp Wich SVN-Revision: 42002 --- include/feeds.mk | 23 +++++++++++++++++++++++ include/package-dumpinfo.mk | 1 + include/package-ipkg.mk | 10 +++++++--- include/scan.mk | 8 ++++++-- include/toplevel.mk | 2 ++ 5 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 include/feeds.mk (limited to 'include') diff --git a/include/feeds.mk b/include/feeds.mk new file mode 100644 index 0000000..17ce64f --- /dev/null +++ b/include/feeds.mk @@ -0,0 +1,23 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +-include $(TMP_DIR)/.packagefeeds + +FEEDS_AVAILABLE:=$(shell $(SCRIPT_DIR)/feeds list -n) +FEEDS_INSTALLED:=$(patsubst %.index,%,$(notdir $(wildcard $(TOPDIR)/feeds/*.index))) +FEEDS_ENABLED:=$(foreach feed,$(FEEDS_INSTALLED),$(if $(CONFIG_FEED_$(feed)),$(feed))) + +PKG_CONFIG_DEPENDS += \ + CONFIG_PER_FEED_REPO \ + $(foreach feed,$(FEEDS_INSTALLED),CONFIG_FEED_$(feed)) + +# 1: package name +define FeedPackageDir +$(strip $(if $(CONFIG_PER_FEED_REPO), \ + $(abspath $(PACKAGE_DIR)/$(if $(Package/$(1)/feed),$(Package/$(1)/feed),base)), \ + $(PACKAGE_DIR))) +endef diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk index 2bf78c3..9dc847d 100644 --- a/include/package-dumpinfo.mk +++ b/include/package-dumpinfo.mk @@ -46,6 +46,7 @@ Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if $(PKG_TARGETS),$ $(if $(KCONFIG),Kernel-Config: $(KCONFIG) )$(if $(BUILDONLY),Build-Only: $(BUILDONLY) )$(if $(HIDDEN),Hidden: $(HIDDEN) +)$(if $(FEED),Feed: $(FEED) )Description: $(if $(Package/$(1)/description),$(Package/$(1)/description),$(TITLE)) $(if $(URL),$(URL) )$(MAINTAINER) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 9783a63..be47526 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -5,6 +5,8 @@ # See /LICENSE for more information. # +include $(INCLUDE_DIR)/feeds.mk + # invoke ipkg-build with some default options IPKG_BUILD:= \ ipkg-build -c -o 0 -g 0 @@ -74,7 +76,8 @@ endif ifeq ($(DUMP),) define BuildTarget/ipkg - IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk + PDIR_$(1):=$(call FeedPackageDir,$(1)) + IPKG_$(1):=$$(PDIR_$(1))/$(1)_$(VERSION)_$(PKGARCH).ipk IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1) KEEP_$(1):=$(strip $(call Package/$(1)/conffiles)) @@ -187,11 +190,12 @@ ifeq ($(DUMP),) ) endif - $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR) + $(INSTALL_DIR) $$(PDIR_$(1)) + $(IPKG_BUILD) $$(IDIR_$(1)) $$(PDIR_$(1)) @[ -f $$(IPKG_$(1)) ] $(1)-clean: - rm -f $(PACKAGE_DIR)/$(1)_* + rm -f $$(PDIR_$(1))/$(1)_* clean: $(1)-clean diff --git a/include/scan.mk b/include/scan.mk index 4d08ee8..0998333 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -21,15 +21,19 @@ else endef endif +define feedname +$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1)))) +endef + define PackageDir $(TMP_DIR)/.$(SCAN_TARGET): $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1) $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1): $(SCAN_DIR)/$(2)/Makefile $(SCAN_STAMP) $(foreach DEP,$(DEPS_$(SCAN_DIR)/$(2)/Makefile) $(SCAN_DEPS),$(wildcard $(if $(filter /%,$(DEP)),$(DEP),$(SCAN_DIR)/$(2)/$(DEP)))) { \ $$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(2)) \ echo Source-Makefile: $(SCAN_DIR)/$(2)/Makefile; \ - $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \ + $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \ mkdir -p "$(TOPDIR)/logs/$(SCAN_DIR)/$(2)"; \ - $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(SCAN_DIR)/$(2)/dump.txt 2>&1; \ + $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(SCAN_DIR)/$(2)/dump.txt 2>&1; \ $$(call progress,ERROR: please fix $(SCAN_DIR)/$(2)/Makefile - see logs/$(SCAN_DIR)/$(2)/dump.txt for details\n) \ rm -f $$@; \ }; \ diff --git a/include/toplevel.mk b/include/toplevel.mk index 2e89c0b..dcde7e2 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -71,7 +71,9 @@ prepare-tmpinfo: FORCE f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ done + [ tmp/.config-feeds.in -nt tmp/.packagefeeds ] || ./scripts/feeds feed_config > tmp/.config-feeds.in ./scripts/metadata.pl package_mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; } + ./scripts/metadata.pl package_feeds tmp/.packageinfo > tmp/.packagefeeds || { rm -f tmp/.packagefeeds; false; } touch $(TOPDIR)/tmp/.build .config: ./scripts/config/conf $(if $(CONFIG_HAVE_DOT_CONFIG),,prepare-tmpinfo) -- cgit v1.1