#
# Copyright (C) 2014 OpenWrt.org
+# Copyright (C) 2016 LEDE Project
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
FEEDS_ENABLED:=$(foreach feed,$(FEEDS_INSTALLED),$(if $(CONFIG_FEED_$(feed)),$(feed)))
FEEDS_DISABLED:=$(filter-out $(FEEDS_ENABLED),$(FEEDS_AVAILABLE))
+PACKAGE_SUBDIRS=$(PACKAGE_DIR)
+ifneq ($(CONFIG_PER_FEED_REPO),)
+ PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/base
+ ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
+ PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
+ else
+ PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_ENABLED),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
+ endif
+endif
+
PKG_CONFIG_DEPENDS += \
CONFIG_PER_FEED_REPO \
CONFIG_PER_FEED_REPO_ADD_DISABLED \
$(foreach feed,$(FEEDS_INSTALLED),CONFIG_FEED_$(feed))
# 1: package name
+# 2: flags
+# 3: section
define FeedPackageDir
$(strip $(if $(CONFIG_PER_FEED_REPO), \
- $(abspath $(PACKAGE_DIR)/$(if $(Package/$(1)/subdir),$(Package/$(1)/subdir),base)), \
+ $(if $(Package/$(1)/subdir), \
+ $(abspath $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(Package/$(1)/subdir)), \
+ $(PACKAGE_DIR)), \
$(PACKAGE_DIR)))
endef
ifeq ($(DUMP),)
define BuildTarget/ipkg
- PDIR_$(1):=$(call FeedPackageDir,$(1))
+ PDIR_$(1):=$(call FeedPackageDir,$(1),$(PKG_FLAGS),$(SECTION))
IPKG_$(1):=$$(PDIR_$(1))/$(1)_$(VERSION)_$(PKGARCH).ipk
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
prepare-package-install:
@mkdir -p $(PKG_INFO_DIR)
@touch $(PKG_INSTALL_STAMP).clean
- @echo "$(filter-out essential,$(PKG_FLAGS))" > $(PKG_INSTALL_STAMP).flags
+ @echo "$(filter-out essential nonshared,$(PKG_FLAGS))" > $(PKG_INSTALL_STAMP).flags
$(PACKAGE_DIR):
mkdir -p $@
- find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
rm -rf $(TARGET_DIR)
[ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp
- @$(FIND) `sed -e 's|.*|$(PACKAGE_DIR)$(if $(CONFIG_PER_FEED_REPO),/*)/&_*.ipk|' $(PACKAGE_INSTALL_FILES)` | sort -u | $(OPKG) install
+ @echo $(wildcard $(foreach dir,$(PACKAGE_SUBDIRS),$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(dir)/$(pkg)_*.ipk))) | $(OPKG) install
@for file in $(PACKAGE_INSTALL_FILES); do \
[ -s $$file.flags ] || continue; \
for flag in `cat $$file.flags`; do \
endif
endif
-PACKAGE_SUBDIRS=.
-ifneq ($(CONFIG_PER_FEED_REPO),)
- ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
- PACKAGE_SUBDIRS=base kernel $(FEEDS_AVAILABLE)
- else
- PACKAGE_SUBDIRS=base kernel $(FEEDS_ENABLED)
- endif
-endif
-
$(curdir)/index: FORCE
@echo Generating package index...
@for d in $(PACKAGE_SUBDIRS); do ( \
- mkdir -p $(PACKAGE_DIR)/$$d; \
- cd $(PACKAGE_DIR)/$$d || continue; \
+ mkdir -p $$d; \
+ cd $$d || continue; \
$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages && \
gzip -9nc Packages > Packages.gz; \
); done
ifdef CONFIG_SIGNED_PACKAGES
@echo Signing package index...
@for d in $(PACKAGE_SUBDIRS); do ( \
- [ -d $(PACKAGE_DIR)/$$d ] && \
- cd $(PACKAGE_DIR)/$$d || continue; \
+ [ -d $$d ] && \
+ cd $$d || continue; \
$(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
); done
else
else
@echo Signing package index...
@for d in $(PACKAGE_SUBDIRS); do ( \
- [ -d $(PACKAGE_DIR)/$$d ] && \
- cd $(PACKAGE_DIR)/$$d || continue; \
+ [ -d $$d ] && \
+ cd $$d || continue; \
openssl smime -binary -in Packages.gz \
-out Packages.sig -outform PEM -sign \
-signer $(CONFIG_OPKGSMIME_CERT) \