public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 0/2] Git reference handling improvements
@ 2025-05-15  8:06 Daniel Gomez
  2025-05-15  8:06 ` [PATCH 1/2] generate_refs: fix gitref duplicated refs Daniel Gomez
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Gomez @ 2025-05-15  8:06 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: kdevops, Daniel Gomez, Daniel Gomez

Ensure that Git references are not duplicated in user mode and adjust
the reference ordering to prioritize static references. This makes
the first static ref the default selection when available.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Daniel Gomez (2):
      generate_refs: fix gitref duplicated refs
      generate_refs: prioritize static refs in gitref generation

 scripts/generate_refs.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
base-commit: 498f1007e222158e4d1b6f454217da8edc354252
change-id: 20250515-gitref-fixes-8815b7c2efab

Best regards,
-- 
Daniel Gomez <da.gomez@samsung.com>


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

* [PATCH 1/2] generate_refs: fix gitref duplicated refs
  2025-05-15  8:06 [PATCH 0/2] Git reference handling improvements Daniel Gomez
@ 2025-05-15  8:06 ` Daniel Gomez
  2025-05-15  8:06 ` [PATCH 2/2] generate_refs: prioritize static refs in gitref generation Daniel Gomez
  2025-05-15 17:26 ` [PATCH 0/2] Git reference handling improvements Luis Chamberlain
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Gomez @ 2025-05-15  8:06 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: kdevops, Daniel Gomez, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Static references in YAML where not in consideration when using gitref
for the final ref generated file. Read them first and exclude any git
reference found that is already in the static list.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 scripts/generate_refs.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/generate_refs.py b/scripts/generate_refs.py
index cea4f7251226947f2983c31a4d26cc9d65eb7fac..e7032000bbac24ac872b83c7d962c8ee097064b2 100755
--- a/scripts/generate_refs.py
+++ b/scripts/generate_refs.py
@@ -257,7 +257,7 @@ def remote(args) -> List:
     return [heads["stdout"], tags["stdout"]]
 
 
-def gitref_getreflist(args, reflist):
+def gitref_getreflist(args, reflist, extraconfs):
     refs = []
     for refline in reflist.splitlines():
         if "^{}" in refline:
@@ -265,6 +265,8 @@ def gitref_getreflist(args, reflist):
         if len(refs) >= args.refs:
             break
         ref_name = refline.split("/")[-1]
+        if any(config["ref"] == ref_name for config in extraconfs):
+            continue
         refs.append(ref_name)
         logging.debug("release: {}".format(ref_name))
     return refs
@@ -296,14 +298,15 @@ def gitref(args) -> None:
     # Only generate git reference if we have connection. Otherwise the output
     # file would contain static reference only and they should be already
     # part of the kreleases generation.
+    extraconfs = _get_extraconfs(args)
     if _check_connection("git.kernel.org", 80):
         reflist = []
         refstr = remote(args)
         for rl in refstr:
-            _refs = gitref_getreflist(args, rl)
+            _refs = gitref_getreflist(args, rl, extraconfs)
             for r in _refs:
                 reflist.append(r)
-        ref_generator(args, reflist, _get_extraconfs(args))
+        ref_generator(args, reflist, extraconfs)
 
 
 def kreleases(args) -> None:

-- 
2.49.0


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

* [PATCH 2/2] generate_refs: prioritize static refs in gitref generation
  2025-05-15  8:06 [PATCH 0/2] Git reference handling improvements Daniel Gomez
  2025-05-15  8:06 ` [PATCH 1/2] generate_refs: fix gitref duplicated refs Daniel Gomez
@ 2025-05-15  8:06 ` Daniel Gomez
  2025-05-15 17:26 ` [PATCH 0/2] Git reference handling improvements Luis Chamberlain
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Gomez @ 2025-05-15  8:06 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: kdevops, Daniel Gomez, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Change the order of reference generation in gitref to prioritize static
references. This ensures that a static ref, appears first in the list
and is selected by default.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 scripts/generate_refs.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/generate_refs.py b/scripts/generate_refs.py
index e7032000bbac24ac872b83c7d962c8ee097064b2..4bd179b9ddfdfa7421c4ba66f3cf3b370287dfe7 100755
--- a/scripts/generate_refs.py
+++ b/scripts/generate_refs.py
@@ -202,7 +202,6 @@ def ref_generator(args, reflist, extraconfs) -> None:
         f.write('\tprompt "Tag or branch to use"\n\n')
 
     logging.debug("Generating...")
-    refs.update(_ref_generator_choices(args, reflist, len(refs)))
 
     if extraconfs:
         for config in extraconfs:
@@ -212,6 +211,8 @@ def ref_generator(args, reflist, extraconfs) -> None:
                 )
             )
 
+    refs.update(_ref_generator_choices(args, reflist, len(refs)))
+
     with open(args.output, "a") as f:
         f.write("endchoice\n\n")
         f.write("config {}_REF\n".format(args.prefix))

-- 
2.49.0


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

* Re: [PATCH 0/2] Git reference handling improvements
  2025-05-15  8:06 [PATCH 0/2] Git reference handling improvements Daniel Gomez
  2025-05-15  8:06 ` [PATCH 1/2] generate_refs: fix gitref duplicated refs Daniel Gomez
  2025-05-15  8:06 ` [PATCH 2/2] generate_refs: prioritize static refs in gitref generation Daniel Gomez
@ 2025-05-15 17:26 ` Luis Chamberlain
  2 siblings, 0 replies; 4+ messages in thread
From: Luis Chamberlain @ 2025-05-15 17:26 UTC (permalink / raw)
  To: Daniel Gomez; +Cc: kdevops, Daniel Gomez

On Thu, May 15, 2025 at 10:06:18AM +0200, Daniel Gomez wrote:
> Ensure that Git references are not duplicated in user mode and adjust
> the reference ordering to prioritize static references. This makes
> the first static ref the default selection when available.
> 
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

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

  Luis

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

end of thread, other threads:[~2025-05-15 17:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-15  8:06 [PATCH 0/2] Git reference handling improvements Daniel Gomez
2025-05-15  8:06 ` [PATCH 1/2] generate_refs: fix gitref duplicated refs Daniel Gomez
2025-05-15  8:06 ` [PATCH 2/2] generate_refs: prioritize static refs in gitref generation Daniel Gomez
2025-05-15 17:26 ` [PATCH 0/2] Git reference handling improvements Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox