kdevops.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] bootlinux: add support for "config-kdevops"
@ 2023-08-17 22:00 Jeff Layton
  2023-08-17 22:42 ` Luis Chamberlain
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2023-08-17 22:00 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: kdevops, Jeff Layton

Currently, you're expected to have a kernel config file with a name
like "config-{{ target_linux_config }}". If there isn't one, then the
play aborts.

For my use-case, I just want to have a stock config that I periodically
update and use regardless of the branch name. If there is a file called
config-kdevops in the template directory, use that instead of any
version-specific branch.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Another alterative would be to allow config-branchname to take precedence,
and make this one the fallback when one isn't present.
---
 playbooks/roles/bootlinux/tasks/main.yml | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/roles/bootlinux/tasks/main.yml
index e90ba60e1edb..488ff7738078 100644
--- a/playbooks/roles/bootlinux/tasks/main.yml
+++ b/playbooks/roles/bootlinux/tasks/main.yml
@@ -265,9 +265,25 @@
   run_once: true
   delegate_to: localhost
 
+- name: Check whether config-kdevops exists
+  stat:
+    path: "{{ role_path }}/templates/config-kdevops"
+  register: config_kdevops
+  delegate_to: localhost
+
+- name: Found config-kdevops, using it for template
+  set_fact:
+    linux_config: "config-kdevops"
+  when: config_kdevops.stat.exists
+
+- name: No config-kdevops, looking for {{ target_linux_config }}
+  set_fact:
+    linux_config: "{{ target_linux_config }}"
+  when: not config_kdevops.stat.exists
+
 - name: Copy configuration for Linux {{ target_linux_tree }} on the client side
   template:
-    src: "{{ target_linux_config }}"
+    src: "{{ linux_config }}"
     dest: "{{ target_linux_dir_path }}/.config"
     owner: "{{ data_user }}"
     group: "{{ data_group }}"
@@ -278,7 +294,7 @@
 
 - name: Copy configuration for Linux {{ target_linux_tree }} on the host side
   template:
-    src: "{{ target_linux_config }}"
+    src: "{{ linux_config }}"
     dest: "{{ bootlinux_9p_host_path }}/.config"
     mode: 0644
   tags: [ 'linux', 'git', 'config' ]

---
base-commit: 999512fbd14e577be47aafa8703c367bb0089cdc
change-id: 20230817-config-kdevops-cd742de641fd

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RFC] bootlinux: add support for "config-kdevops"
  2023-08-17 22:00 [PATCH RFC] bootlinux: add support for "config-kdevops" Jeff Layton
@ 2023-08-17 22:42 ` Luis Chamberlain
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Chamberlain @ 2023-08-17 22:42 UTC (permalink / raw)
  To: Jeff Layton; +Cc: kdevops

On Thu, Aug 17, 2023 at 06:00:21PM -0400, Jeff Layton wrote:
> Currently, you're expected to have a kernel config file with a name
> like "config-{{ target_linux_config }}". If there isn't one, then the
> play aborts.
> 
> For my use-case, I just want to have a stock config that I periodically
> update and use regardless of the branch name. If there is a file called
> config-kdevops in the template directory, use that instead of any
> version-specific branch.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

This is nice!

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>

> ---
> Another alterative would be to allow config-branchname to take precedence,
> and make this one the fallback when one isn't present.

Whoever wants that can add that when needed, unless you want to be
proactive and just add that now.

  Luis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-17 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17 22:00 [PATCH RFC] bootlinux: add support for "config-kdevops" Jeff Layton
2023-08-17 22:42 ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).