* [PATCH V3] add function to check for git config user
@ 2016-10-03 23:32 Stephano Cetola
2016-10-03 23:32 ` [PATCH V3] utils.bbclass: " Stephano Cetola
2016-10-06 3:26 ` [PATCH V3] " Stephano Cetola
0 siblings, 2 replies; 3+ messages in thread
From: Stephano Cetola @ 2016-10-03 23:32 UTC (permalink / raw)
To: openembedded-core
Chnages since V2:
moved functionality from sanity to utils
utilize existing name / email variables
Stephano Cetola (1):
utils.bbclass: add function to check for git config user
meta/classes/buildhistory.bbclass | 15 ++++++---------
meta/classes/kernel-yocto.bbclass | 3 +++
meta/classes/utils.bbclass | 10 ++++++++++
3 files changed, 19 insertions(+), 9 deletions(-)
--
2.10.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH V3] utils.bbclass: add function to check for git config user
2016-10-03 23:32 [PATCH V3] add function to check for git config user Stephano Cetola
@ 2016-10-03 23:32 ` Stephano Cetola
2016-10-06 3:26 ` [PATCH V3] " Stephano Cetola
1 sibling, 0 replies; 3+ messages in thread
From: Stephano Cetola @ 2016-10-03 23:32 UTC (permalink / raw)
To: openembedded-core
If attempting to patch a git repo without a proper git config setup,
an error will occur saying user.name/user.email are needed by git
am/apply. After some code was removed from kernel-yocto, it was
simple enough to reproduce this error by creating a kernel patch and
using a container to build.
This patch abstracts out functionality that existed in buildhistory
for use in other classes. It also adds a call to this functionality
to the kernel-yocto class.
Fixes [YOCTO #10346]
introduced in OE-core revision
0f698dfd1c8bbc0d53ae7977e26685a7a3df52a3
Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com>
---
meta/classes/buildhistory.bbclass | 15 ++++++---------
meta/classes/kernel-yocto.bbclass | 3 +++
meta/classes/utils.bbclass | 10 ++++++++++
3 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 6e5de0e..3a5bc2c 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -57,6 +57,9 @@ SSTATEPOSTINSTFUNCS[vardepvalueexclude] .= "| buildhistory_emit_pkghistory"
# class.
BUILDHISTORY_PRESERVE = "latest latest_srcrev"
+PATCH_GIT_USER_EMAIL ?= "buildhistory@oe"
+PATCH_GIT_USER_NAME ?= "OpenEmbedded"
+
#
# Write out metadata about this package for comparison when writing future packages
#
@@ -708,15 +711,9 @@ END
git tag -f build-minus-2 build-minus-1 > /dev/null 2>&1 || true
git tag -f build-minus-1 > /dev/null 2>&1 || true
fi
- # If the user hasn't set up their name/email, set some defaults
- # just for this repo (otherwise the commit will fail with older
- # versions of git)
- if ! git config user.email > /dev/null ; then
- git config --local user.email "buildhistory@${DISTRO}"
- fi
- if ! git config user.name > /dev/null ; then
- git config --local user.name "buildhistory"
- fi
+
+ check_git_config
+
# Check if there are new/changed files to commit (other than metadata-revs)
repostatus=`git status --porcelain | grep -v " metadata-revs$"`
HOSTNAME=`hostname 2>/dev/null || echo unknown`
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 53659f2..6160a29 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -1,5 +1,7 @@
# remove tasks that modify the source tree in case externalsrc is inherited
SRCTREECOVEREDTASKS += "do_kernel_configme do_validate_branches do_kernel_configcheck do_kernel_checkout do_fetch do_unpack do_patch"
+PATCH_GIT_USER_EMAIL ?= "kernel-yocto@oe"
+PATCH_GIT_USER_NAME ?= "OpenEmbedded"
# returns local (absolute) path names for all valid patches in the
# src_uri
@@ -159,6 +161,7 @@ do_kernel_metadata() {
do_patch() {
cd ${S}
+ check_git_config
meta_dir=$(kgit --meta)
(cd ${meta_dir}; ln -sf patch.queue series)
if [ -f "${meta_dir}/series" ]; then
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 800b565..dbb5e4c 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -419,3 +419,13 @@ def all_multilib_tune_list(vars, d):
values[v].append(localdata.getVar(v, True))
values['ml'].append(item)
return values
+
+# If the user hasn't set up their name/email, set some defaults
+check_git_config() {
+ if ! git config user.email > /dev/null ; then
+ git config --local user.email "${PATCH_GIT_USER_EMAIL}"
+ fi
+ if ! git config user.name > /dev/null ; then
+ git config --local user.name "${PATCH_GIT_USER_NAME}"
+ fi
+}
--
2.10.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V3] add function to check for git config user
2016-10-03 23:32 [PATCH V3] add function to check for git config user Stephano Cetola
2016-10-03 23:32 ` [PATCH V3] utils.bbclass: " Stephano Cetola
@ 2016-10-06 3:26 ` Stephano Cetola
1 sibling, 0 replies; 3+ messages in thread
From: Stephano Cetola @ 2016-10-06 3:26 UTC (permalink / raw)
To: openembedded-core; +Cc: Paul Eggleton
On 10/03, Stephano Cetola wrote:
> Chnages since V2:
> moved functionality from sanity to utils
> utilize existing name / email variables
>
> Stephano Cetola (1):
> utils.bbclass: add function to check for git config user
>
> meta/classes/buildhistory.bbclass | 15 ++++++---------
> meta/classes/kernel-yocto.bbclass | 3 +++
> meta/classes/utils.bbclass | 10 ++++++++++
> 3 files changed, 19 insertions(+), 9 deletions(-)
>
> --
> 2.10.0
>
I spoke with Paul and we both agree that this is a good compromise for now.
Thoughts?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-06 3:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-03 23:32 [PATCH V3] add function to check for git config user Stephano Cetola
2016-10-03 23:32 ` [PATCH V3] utils.bbclass: " Stephano Cetola
2016-10-06 3:26 ` [PATCH V3] " Stephano Cetola
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.