diff mbox

[OpenWrt-Devel] feeds: Add option for build-time configuration of opkg repositories

Message ID 1450412391-107196-1-git-send-email-openwrt@daniel.thecshore.com
State Changes Requested
Headers show

Commit Message

Daniel Dickinson Dec. 18, 2015, 4:19 a.m. UTC
From: Daniel Dickinson <openwrt@daniel.thecshore.com>

It can be convenient to separate builds into base system (included
in SDK), and task-oriented SDK builds (so that you limit the number
of packages which you must build at one time).  For this to work
well it is useful to use separate opkg repositories.

This option adds the option to add a user-configurable list of
opkg repositores (just the end, like feeds, for e.g. base-packages,
vpn-packages, etc).  We allow to combine separated feeds and this
option so that you can have e.g. base-packages/base base-packages/packages
vpn-packages/packages vpn-packages/luci and so on, if you want).

Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
---
 include/feeds.mk                   | 27 ++++++++++++++++++++-------
 package/base-files/image-config.in | 25 +++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 7 deletions(-)

Comments

Felix Fietkau Dec. 19, 2015, 11:24 a.m. UTC | #1
On 2015-12-18 05:19, openwrt@daniel.thecshore.com wrote:
> From: Daniel Dickinson <openwrt@daniel.thecshore.com>
> 
> It can be convenient to separate builds into base system (included
> in SDK), and task-oriented SDK builds (so that you limit the number
> of packages which you must build at one time).  For this to work
> well it is useful to use separate opkg repositories.
> 
> This option adds the option to add a user-configurable list of
> opkg repositores (just the end, like feeds, for e.g. base-packages,
> vpn-packages, etc).  We allow to combine separated feeds and this
> option so that you can have e.g. base-packages/base base-packages/packages
> vpn-packages/packages vpn-packages/luci and so on, if you want).
> 
> Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
> ---
>  include/feeds.mk                   | 27 ++++++++++++++++++++-------
>  package/base-files/image-config.in | 25 +++++++++++++++++++++++++
>  2 files changed, 45 insertions(+), 7 deletions(-)
> 
> diff --git a/include/feeds.mk b/include/feeds.mk
> index b1a8f81..ffac5cd 100644
> --- a/include/feeds.mk
> +++ b/include/feeds.mk
> @@ -28,12 +28,25 @@ endef
>  # 1: destination file
>  define FeedSourcesAppend
>  ( \
> -  $(strip $(if $(CONFIG_PER_FEED_REPO), \
> -	$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(feed) %U/$(feed)";) \
> -	$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
> -		$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(feed) %U/$(feed)";)) \
> -  , \
> -	echo "src/gz %n %U"; \
> -  )) \
> +  $(if $(CONFIG_SDK_REPO), \
> +  	$(strip $(if $(CONFIG_PER_FEED_REPO), \
> +		$(foreach repo,$(CONFIG_SDK_REPO),
> +			$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(repo)_$(feed) %U/$(repo)/$(feed)";) \
> +			$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
> +				$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(repo)_$(feed) %U/$(repo)/$(feed)";) \
> +			) \
> +		) \
> +	,
> +		$(foreach repo,$(CONFIG_SDK_REPO),echo "src/gz %n_$(repo) %U/$(repo)";) \
> +	)), \	
> +  	$(strip $(if $(CONFIG_PER_FEED_REPO), \
> +		$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(feed) %U/$(feed)";) \
> +		$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
> +			$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(feed) %U/$(repo)";) \
> +		) \
> +	,
> +  		$(echo "src/gz %n %U";) \
> + 	)) \
> +  ) \
I don't like the duplication here, especially since the code is already
somewhat dense and hard to read. Can you make it so that the menuconfig
symbol has a default for the official repo and the code here always
generates this stuff based on that symbol?

- Felix
Daniel Dickinson Dec. 19, 2015, 7:30 p.m. UTC | #2
On 19/12/15 06:24 AM, Felix Fietkau wrote:
> On 2015-12-18 05:19, openwrt@daniel.thecshore.com wrote:
>> From: Daniel Dickinson <openwrt@daniel.thecshore.com>
>>
>> It can be convenient to separate builds into base system (included
>> in SDK), and task-oriented SDK builds (so that you limit the number
>> of packages which you must build at one time).  For this to work
>> well it is useful to use separate opkg repositories.
>>
>> This option adds the option to add a user-configurable list of
>> opkg repositores (just the end, like feeds, for e.g. base-packages,
>> vpn-packages, etc).  We allow to combine separated feeds and this
>> option so that you can have e.g. base-packages/base base-packages/packages
>> vpn-packages/packages vpn-packages/luci and so on, if you want).
>>
>> Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
>> ---
>>   include/feeds.mk                   | 27 ++++++++++++++++++++-------
>>   package/base-files/image-config.in | 25 +++++++++++++++++++++++++
>>   2 files changed, 45 insertions(+), 7 deletions(-)
>>
>> diff --git a/include/feeds.mk b/include/feeds.mk
>> index b1a8f81..ffac5cd 100644
>> --- a/include/feeds.mk
>> +++ b/include/feeds.mk
>> @@ -28,12 +28,25 @@ endef
>>   # 1: destination file
>>   define FeedSourcesAppend
>>   ( \
>> -  $(strip $(if $(CONFIG_PER_FEED_REPO), \
>> -	$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(feed) %U/$(feed)";) \
>> -	$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
>> -		$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(feed) %U/$(feed)";)) \
>> -  , \
>> -	echo "src/gz %n %U"; \
>> -  )) \
>> +  $(if $(CONFIG_SDK_REPO), \
>> +  	$(strip $(if $(CONFIG_PER_FEED_REPO), \
>> +		$(foreach repo,$(CONFIG_SDK_REPO),
>> +			$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(repo)_$(feed) %U/$(repo)/$(feed)";) \
>> +			$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
>> +				$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(repo)_$(feed) %U/$(repo)/$(feed)";) \
>> +			) \
>> +		) \
>> +	,
>> +		$(foreach repo,$(CONFIG_SDK_REPO),echo "src/gz %n_$(repo) %U/$(repo)";) \
>> +	)), \	
>> +  	$(strip $(if $(CONFIG_PER_FEED_REPO), \
>> +		$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(feed) %U/$(feed)";) \
>> +		$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
>> +			$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(feed) %U/$(repo)";) \
>> +		) \
>> +	,
>> +  		$(echo "src/gz %n %U";) \
>> + 	)) \
>> +  ) \
> I don't like the duplication here, especially since the code is already
> somewhat dense and hard to read. Can you make it so that the menuconfig
> symbol has a default for the official repo and the code here always
> generates this stuff based on that symbol?

Sorry I'm tired and not parsing well right now.  Can you please explain 
what you mean a little more fully.  I'm not quite following what you're 
asking for.

Regards,

Daniel
diff mbox

Patch

diff --git a/include/feeds.mk b/include/feeds.mk
index b1a8f81..ffac5cd 100644
--- a/include/feeds.mk
+++ b/include/feeds.mk
@@ -28,12 +28,25 @@  endef
 # 1: destination file
 define FeedSourcesAppend
 ( \
-  $(strip $(if $(CONFIG_PER_FEED_REPO), \
-	$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(feed) %U/$(feed)";) \
-	$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
-		$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(feed) %U/$(feed)";)) \
-  , \
-	echo "src/gz %n %U"; \
-  )) \
+  $(if $(CONFIG_SDK_REPO), \
+  	$(strip $(if $(CONFIG_PER_FEED_REPO), \
+		$(foreach repo,$(CONFIG_SDK_REPO),
+			$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(repo)_$(feed) %U/$(repo)/$(feed)";) \
+			$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
+				$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(repo)_$(feed) %U/$(repo)/$(feed)";) \
+			) \
+		) \
+	,
+		$(foreach repo,$(CONFIG_SDK_REPO),echo "src/gz %n_$(repo) %U/$(repo)";) \
+	)), \	
+  	$(strip $(if $(CONFIG_PER_FEED_REPO), \
+		$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(feed) %U/$(feed)";) \
+		$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
+			$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(feed) %U/$(repo)";) \
+		) \
+	,
+  		$(echo "src/gz %n %U";) \
+ 	)) \
+  ) \
 ) >> $(1)
 endef
diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in
index 3dfbedc..535c5ea 100644
--- a/package/base-files/image-config.in
+++ b/package/base-files/image-config.in
@@ -228,12 +228,37 @@  if VERSIONOPT
 endif
 
 
+menuconfig SDK_REPO
+	string
+	prompt "SDK repositories" if IMAGEOPT
+	default ""
+	help
+		If set, a space separate list opkg package repositories to add
+		to the end of the repo name (e.g. if repo is
+		http://downloads.openwrt.org/%d/%n/%v/%S and this list is
+		"base-packages sdk-packages", then opkg will look for files in
+		http://downloads.openwrt.org/%d/%n/%v/%S/base-packages as the
+		first repo and
+		http://downloads.openwrt.org/%d/%n/%v/S/sdk-packages as the second
+		repo.  This is also used for ImageBuilder repositories.
+		This can be used in addition to per-feed repositories, in which
+		case the repositories are <sdk_repo>/<feed_name>, e.g.
+		base-packages/base, base-packages/packages, sdk-packages/base,
+		and sdk-packages/packages.
+		Note that this does not affect bin/<arch>/packages directories;
+		that comes entirely from "Separate feed repositories" setting.
+		
+
 menuconfig PER_FEED_REPO
 	bool "Separate feed repositories" if IMAGEOPT
 	default y
 	help
 		If set, a separate repository is generated within bin/*/packages/
 		for the core packages and each enabled feed.
+		This can be used in addition to SDK repositories, in which
+		case the repositories are <sdk_repo>/<feed_name>, e.g.
+		base-packages/base, base-packages/packages, sdk-packages/base,
+		and sdk-packages/packages.
 
 	config PER_FEED_REPO_ADD_DISABLED
 		bool "Add available but not enabled feeds to opkg.conf"