Skip to content

Commit 3c5357d

Browse files
committed
feeds: use common macro "FeedSourcesAppend" to populate opkg configurations
This introduces a common macro to assemble the correct url templates to avoid code duplication and have the feed config handling in a central place. Signed-off-by: Jo-Philipp Wich <[email protected]> SVN-Revision: 45799
1 parent 21e1696 commit 3c5357d

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

include/feeds.mk

+13
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,16 @@ $(strip $(if $(CONFIG_PER_FEED_REPO), \
2424
$(abspath $(PACKAGE_DIR)/$(if $(Package/$(1)/feed),$(Package/$(1)/feed),base)), \
2525
$(PACKAGE_DIR)))
2626
endef
27+
28+
# 1: destination file
29+
define FeedSourcesAppend
30+
( \
31+
$(strip $(if $(CONFIG_PER_FEED_REPO), \
32+
$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(feed) %U/$(feed)";) \
33+
$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
34+
$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(feed) %U/$(feed)";)) \
35+
, \
36+
echo "src/gz %n %U"; \
37+
)) \
38+
) >> $(1)
39+
endef

package/system/opkg/Makefile

+1-12
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,7 @@ define Package/opkg/Default/install
115115
ifneq ($(CONFIG_SIGNED_PACKAGES),)
116116
echo "option check_signature 1" >> $(1)/etc/opkg.conf
117117
endif
118-
ifeq ($(CONFIG_PER_FEED_REPO),)
119-
echo "src/gz %n %U" >> $(1)/etc/opkg.conf
120-
else
121-
for d in base $(FEEDS_ENABLED); do \
122-
echo "src/gz %n_$$$$d %U/$$$$d" >> $(1)/etc/opkg.conf; \
123-
done
124-
ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
125-
for d in $(FEEDS_DISABLED); do \
126-
echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$$$$d %U/$$$$d" >> $(1)/etc/opkg.conf; \
127-
done
128-
endif
129-
endif
118+
$(call FeedSourcesAppend,$(1)/etc/opkg.conf)
130119
$(VERSION_SED) $(1)/etc/opkg.conf
131120
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
132121
endef

target/imagebuilder/Makefile

+2-12
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,10 @@ $(BIN_DIR)/$(IB_NAME).tar.bz2: clean
3737

3838
ifeq ($(CONFIG_IB_STANDALONE),)
3939
echo '## Remote package repositories' >> $(PKG_BUILD_DIR)/repositories.conf
40-
ifeq ($(CONFIG_PER_FEED_REPO),)
41-
echo "src/gz %n %U" >> $(PKG_BUILD_DIR)/repositories.conf
42-
else
43-
for d in base $(FEEDS_ENABLED); do \
44-
echo "src/gz %n_$$d %U/$$d" >> $(PKG_BUILD_DIR)/repositories.conf; \
45-
done
46-
ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
47-
for d in $(FEEDS_DISABLED); do \
48-
echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$$d %U/$$d" >> $(PKG_BUILD_DIR)/repositories.conf; \
49-
done
50-
endif
51-
endif
40+
$(call FeedSourcesAppend,$(PKG_BUILD_DIR)/repositories.conf)
5241
endif
5342

43+
echo '' >> $(PKG_BUILD_DIR)/repositories.conf
5444
echo '## This is the local package repository, do not remove!' >> $(PKG_BUILD_DIR)/repositories.conf
5545
echo 'src imagebuilder file:packages' >> $(PKG_BUILD_DIR)/repositories.conf
5646

0 commit comments

Comments
 (0)