Skip to contentSkip to conversation

devtool: Do not create annotated tags if tag.gpgSign is set

PATCH New Peter Kjellerstedt 1 participant 3 messages Mar 17, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 devtool: Do not create annotated tags if tag.gpgSign is set

If tag.gpgSign is configured in Git's configuration, then creating the devtool-base tag will fail (if Git's core.editor is not configured) or it will hang (when trying to open the editor). This is beacause tag.gpgSign causes git tag to create annotated tags. To avoid this, specify --no-sign as argument to git tag.

---
 scripts/lib/devtool/__init__.py | 4 ++--
 scripts/lib/devtool/upgrade.py  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
scripts/lib/devtool/__init__.py +2 -2
index 6133c1c5b4d..fa6e1a34fd1 100644
@@ -234,7 +234,7 @@ def setup_git_repo(repodir, version, devbranch, basetag='devtool-base', d=None):
             f.write(line)
 
     bb.process.run('git checkout -b %s' % devbranch, cwd=repodir)
-    bb.process.run('git tag -f %s' % basetag, cwd=repodir)
+    bb.process.run('git tag -f --no-sign %s' % basetag, cwd=repodir)
 
     # if recipe unpacks another git repo inside S, we need to declare it as a regular git submodule now,
     # so we will be able to tag branches on it and extract patches when doing finish/update on the recipe
@@ -256,7 +256,7 @@ def setup_git_repo(repodir, version, devbranch, basetag='devtool-base', d=None):
                     oe.patch.GitApplyTree.commitIgnored("Add additional submodule from SRC_URI", dir=os.path.join(root, ".."), d=d)
                     found = False
     if os.path.exists(os.path.join(repodir, '.gitmodules')):
-        bb.process.run('git submodule foreach --recursive  "git tag -f %s"' % basetag, cwd=repodir)
+        bb.process.run('git submodule foreach --recursive  "git tag -f --no-sign %s"' % basetag, cwd=repodir)
 
 def recipe_to_append(recipefile, config, wildcard=False):
     """
scripts/lib/devtool/upgrade.py +3 -3
index 94b6c11a37e..9abf72eccf1 100644
@@ -188,9 +188,9 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee
     if uri.startswith('git://') or uri.startswith('gitsm://'):
         __run('git fetch')
         __run('git checkout %s' % rev)
-        __run('git tag -f devtool-base-new')
+        __run('git tag -f --no-sign devtool-base-new')
         __run('git submodule update --recursive')
-        __run('git submodule foreach \'git tag -f devtool-base-new\'')
+        __run('git submodule foreach \'git tag -f --no-sign devtool-base-new\'')
         (stdout, _) = __run('git submodule --quiet foreach \'echo $sm_path\'')
         paths += [os.path.join(srctree, p) for p in stdout.splitlines()]
         checksums = {}
@@ -257,7 +257,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee
         useroptions = []
         oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=rd)
         __run('git %s commit -q -m "Commit of upstream changes at version %s" --allow-empty' % (' '.join(useroptions), newpv))
-        __run('git tag -f devtool-base-%s' % newpv)
+        __run('git tag -f --no-sign devtool-base-%s' % newpv)
 
     revs = {}
     for path in paths:
#1 lore raw

PATCH 2/3 devtool-source.bbclass: Do not create annotated tags if tag.gpgSign is set

If tag.gpgSign is configured in Git's configuration, then creating the devtool-patched tag will fail (if Git's core.editor is not configured) or it will hang (when trying to open the editor). This is beacause tag.gpgSign causes git tag to create annotated tags. To avoid this, specify --no-sign as argument to git tag.

---
 meta/classes/devtool-source.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/devtool-source.bbclass +2 -2
index 3e24800dcb0..9762003ba75 100644
@@ -179,9 +179,9 @@ python devtool_post_patch() {
                 # (otherwise we'd likely be left with identical commits that have different hashes)
                 bb.process.run('git rebase devtool-no-overrides', cwd=srcsubdir)
         bb.process.run('git checkout %s' % devbranch, cwd=srcsubdir)
-    bb.process.run('git tag -f devtool-patched', cwd=srcsubdir)
+    bb.process.run('git tag -f --no-sign devtool-patched', cwd=srcsubdir)
     if os.path.exists(os.path.join(srcsubdir, '.gitmodules')):
-        bb.process.run('git submodule foreach --recursive  "git tag -f devtool-patched"', cwd=srcsubdir)
+        bb.process.run('git submodule foreach --recursive  "git tag -f --no-sign devtool-patched"', cwd=srcsubdir)
 
 }
 
#2 lore raw

PATCH 3/3 buildhistory.bbclass: Do not create annotated tags if tag.gpgSign is set

In reply to Peter Kjellerstedt

If tag.gpgSign is configured in Git's configuration, then creating the build-minus-X tags will fail (if Git's core.editor is not configured) or it will hang (when trying to open the editor). This is beacause tag.gpgSign causes git tag to create annotated tags. To avoid this, specify --no-sign as argument to git tag.

---
 meta/classes/buildhistory.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/classes/buildhistory.bbclass +3 -3
index d735dd5fb5d..fc8b7a9fa45 100644
@@ -861,9 +861,9 @@ END
 		if [ ! -e .git ] ; then
 			git init -q
 		else
-			git tag -f ${BUILDHISTORY_TAG}-minus-3 ${BUILDHISTORY_TAG}-minus-2 > /dev/null 2>&1 || true
-			git tag -f ${BUILDHISTORY_TAG}-minus-2 ${BUILDHISTORY_TAG}-minus-1 > /dev/null 2>&1 || true
-			git tag -f ${BUILDHISTORY_TAG}-minus-1 > /dev/null 2>&1 || true
+			git tag -f --no-sign ${BUILDHISTORY_TAG}-minus-3 ${BUILDHISTORY_TAG}-minus-2 > /dev/null 2>&1 || true
+			git tag -f --no-sign ${BUILDHISTORY_TAG}-minus-2 ${BUILDHISTORY_TAG}-minus-1 > /dev/null 2>&1 || true
+			git tag -f --no-sign ${BUILDHISTORY_TAG}-minus-1 > /dev/null 2>&1 || true
 		fi
 
 		check_git_config