Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches
@ 2012-08-13 17:10 Bruce Ashfield
  2012-08-13 17:10 ` [PATCH 1/1] linux-yocto: allow do_validate_branches to handle all branches Bruce Ashfield
  2012-08-22  5:27 ` [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches Tom Zanussi
  0 siblings, 2 replies; 7+ messages in thread
From: Bruce Ashfield @ 2012-08-13 17:10 UTC (permalink / raw)
  To: scott.a.garman; +Cc: openembedded-core

Scott,

Here's a fix for validate_branches that comes from a pending master
change that I've been running for 3 weeks, and one that TomZ has tested
in his yocto BSP work on denzil.

It fixes some BSP use cases that involve setting a specific SRCREV
on a base branch, so that a BSP branch that doesn't yet exist can 
be created off of that known base. Previously only an existing BSP
branch could have it's SRCREV restricted.

cc: Tom Zanussi <tom.zanussi@intel.com>

Cheers,

Bruce

The following changes since commit 73cdebf60df225ee10f2eb215935be3b61e1b831:

  documentation/dev-manual/dev-manual-kernel-appendix.xml: Add note about conflict (2012-06-29 15:54:26 +0100)

are available in the git repository at:
  git://git.pokylinux.org/poky-contrib zedd/kernel-denzil
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=zedd/kernel-denzil

Bruce Ashfield (1):
  linux-yocto: allow do_validate_branches to handle all branches

 meta/classes/kernel-yocto.bbclass |  119 +++++++++++++++++++++++++------------
 1 files changed, 80 insertions(+), 39 deletions(-)

-- 
1.7.5.4




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

* [PATCH 1/1] linux-yocto: allow do_validate_branches to handle all branches
  2012-08-13 17:10 [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches Bruce Ashfield
@ 2012-08-13 17:10 ` Bruce Ashfield
  2012-08-22  5:27 ` [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches Tom Zanussi
  1 sibling, 0 replies; 7+ messages in thread
From: Bruce Ashfield @ 2012-08-13 17:10 UTC (permalink / raw)
  To: scott.a.garman; +Cc: openembedded-core

Branch validation will not restrict a branch that doesn't exist
in the tree at the time of validation (since you can't reset a
SRCREV on a non-existent branch). This restriction can be removed
by looking for all branches that contain the specified SRCREV
and forcing them to that value.

Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
 meta/classes/kernel-yocto.bbclass |  119 +++++++++++++++++++++++++------------
 1 files changed, 80 insertions(+), 39 deletions(-)

diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index c995a2e..d859d76 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -214,63 +214,104 @@ python do_kernel_configcheck() {
     bb.plain( "%s" % result )
 }
 
-
-# Ensure that the branches (BSP and meta) are on the locatios specified by
+# Ensure that the branches (BSP and meta) are on the locations specified by
 # their SRCREV values. If they are NOT on the right commits, the branches
-# are reset to the correct commit.
+# are corrected to the proper commit.
 do_validate_branches() {
 	cd ${S}
+	export KMETA=${KMETA}
 
-	# nothing to do if bootstrapping
- 	if [ -n "${YOCTO_KERNEL_EXTERNAL_BRANCH}" ]; then
- 	 	return
- 	fi
-
-	# nothing to do if SRCREV is AUTOREV
+	set +e
+	# if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to
+	# check and we can exit early
 	if [ "${SRCREV_machine}" = "AUTOINC" ]; then
-		# restore the branch for builds
-		git checkout -f ${KBRANCH}
 		return
 	fi
 
- 	branch_head=`git show-ref -s --heads ${KBRANCH}`
+	# If something other than the default branch was requested, it must
+	# exist in the tree, and it's a hard error if it wasn't
+	git show-ref --quiet --verify -- "refs/heads/${KBRANCH}"
+	if [ $? -eq 1 ]; then
+		if [ -n "${KBRANCH_DEFAULT}" ] && 
+                      [ "${KBRANCH}" != "${KBRANCH_DEFAULT}" ]; then
+			echo "ERROR: branch ${KBRANCH} was set for kernel compilation, "
+			echo "       but it does not exist in the kernel repository."
+			echo "       Check the value of KBRANCH and ensure that it describes"
+			echo "       a valid banch in the source kernel repository"
+			exit 1
+		fi
+	fi
+
+	if [ -z "${SRCREV_machine}" ]; then
+		target_branch_head="${SRCREV}"
+	else
+	 	target_branch_head="${SRCREV_machine}"
+	fi
+
+	# $SRCREV could have also been AUTOINC, so check again
+	if [ "${target_branch_head}" = "AUTOINC" ]; then
+		return
+	fi
+
+	containing_branches=`git branch --contains $target_branch_head | sed 's/^..//'`
+	if [ -z "$containing_branches" ]; then
+		echo "ERROR: SRCREV was set to \"$target_branch_head\", but no branches"
+		echo "       contain this commit"
+		exit 1
+	fi
+	ref=`git show ${target_branch_head} 2>&1 | head -n1 || true`
+	if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then
+	    echo "ERROR ${target_branch_head} is not a valid commit ID."
+	    echo "The kernel source tree may be out of sync"
+	    exit 1
+	fi
+
+	# force the SRCREV in each branch that contains the specified
+	# SRCREV (if it isn't the current HEAD of that branch)
+	git checkout -q master
+	for b in $containing_branches; do
+		branch_head=`git show-ref -s --heads ${b}`
+		if [ "$branch_head" != "$target_branch_head" ]; then
+			echo "[INFO] Setting branch $b to ${target_branch_head}"	      
+			git branch -D $b > /dev/null
+			git branch $b $target_branch_head > /dev/null
+		fi
+	done
+
+	## KMETA branch validation
  	meta_head=`git show-ref -s --heads ${KMETA}`
- 	target_branch_head="${SRCREV_machine}"
  	target_meta_head="${SRCREV_meta}"
+	git show-ref --quiet --verify -- "refs/heads/${KMETA}"
+	if [ $? -eq 1 ]; then
+		return
+	fi
 
-	current=`git branch |grep \*|sed 's/^\* //'`
-	if [ -n "$target_branch_head" ] && [ "$branch_head" != "$target_branch_head" ]; then
-		if [ -n "${KERNEL_REVISION_CHECKING}" ]; then
-			ref=`git show ${target_meta_head} 2>&1 | head -n1 || true`
-			if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then
-				echo "ERROR ${target_branch_head} is not a valid commit ID."
-				echo "The kernel source tree may be out of sync"
-				exit 1
-			else
-				echo "Forcing branch $current to ${target_branch_head}"
-				git branch -m $current $current-orig
-				git checkout -b $current ${target_branch_head}
-			fi
-		fi
+	if [ "${target_meta_head}" = "AUTOINC" ]; then
+		return
 	fi
 
 	if [ "$meta_head" != "$target_meta_head" ]; then
-		if [ -n "${KERNEL_REVISION_CHECKING}" ]; then
-			ref=`git show ${target_meta_head} 2>&1 | head -n1 || true`
-			if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then
-				echo "ERROR ${target_meta_head} is not a valid commit ID"
-				echo "The kernel source tree may be out of sync"
+		ref=`git show ${target_meta_head} 2>&1 | head -n1 || true`
+		if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then
+			echo "ERROR ${target_meta_head} is not a valid commit ID"
+			echo "The kernel source tree may be out of sync"
+			exit 1
+		else
+			echo "[INFO] Setting branch ${KMETA} to ${target_meta_head}"
+			git branch -m ${KMETA} ${KMETA}-orig
+			git checkout -q -b ${KMETA} ${target_meta_head}
+			if [ $? -ne 0 ];then
+				echo "ERROR: could not checkout ${KMETA} branch from known hash ${target_meta_head}"
 				exit 1
-			else
-				echo "Forcing branch meta to ${target_meta_head}"
-				git branch -m ${KMETA} ${KMETA}-orig
-				git checkout -b ${KMETA} ${target_meta_head}
-			fi	   
+			fi
 		fi
 	fi
 
-	# restore the branch for builds
-	git checkout -f ${KBRANCH}
+	git show-ref --quiet --verify -- "refs/heads/${KBRANCH}"
+	if [ $? -eq 0 ]; then
+		# restore the branch for builds
+		git checkout -q -f ${KBRANCH}
+	fi
 }
 
 # Many scripts want to look in arch/$arch/boot for the bootable
-- 
1.7.5.4




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

* Re: [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches
  2012-08-13 17:10 [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches Bruce Ashfield
  2012-08-13 17:10 ` [PATCH 1/1] linux-yocto: allow do_validate_branches to handle all branches Bruce Ashfield
@ 2012-08-22  5:27 ` Tom Zanussi
  2012-08-22  5:48   ` Bruce Ashfield
  2012-08-24  8:08   ` Scott Garman
  1 sibling, 2 replies; 7+ messages in thread
From: Tom Zanussi @ 2012-08-22  5:27 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: openembedded-core, scott.a.garman

On Mon, 2012-08-13 at 13:10 -0400, Bruce Ashfield wrote:
> Scott,
> 
> Here's a fix for validate_branches that comes from a pending master
> change that I've been running for 3 weeks, and one that TomZ has tested
> in his yocto BSP work on denzil.
> 
> It fixes some BSP use cases that involve setting a specific SRCREV
> on a base branch, so that a BSP branch that doesn't yet exist can 
> be created off of that known base. Previously only an existing BSP
> branch could have it's SRCREV restricted.
> 

Hi Scott,

I don't see this in denzil - do you have it queued for the next pull
request, or did it get missed?

Tom

> cc: Tom Zanussi <tom.zanussi@intel.com>
> 
> Cheers,
> 
> Bruce
> 
> The following changes since commit 73cdebf60df225ee10f2eb215935be3b61e1b831:
> 
>   documentation/dev-manual/dev-manual-kernel-appendix.xml: Add note about conflict (2012-06-29 15:54:26 +0100)
> 
> are available in the git repository at:
>   git://git.pokylinux.org/poky-contrib zedd/kernel-denzil
>   http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=zedd/kernel-denzil
> 
> Bruce Ashfield (1):
>   linux-yocto: allow do_validate_branches to handle all branches
> 
>  meta/classes/kernel-yocto.bbclass |  119 +++++++++++++++++++++++++------------
>  1 files changed, 80 insertions(+), 39 deletions(-)
> 





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

* Re: [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches
  2012-08-22  5:27 ` [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches Tom Zanussi
@ 2012-08-22  5:48   ` Bruce Ashfield
  2012-08-23 19:18     ` Tom Zanussi
  2012-08-24  8:08   ` Scott Garman
  1 sibling, 1 reply; 7+ messages in thread
From: Bruce Ashfield @ 2012-08-22  5:48 UTC (permalink / raw)
  To: Tom Zanussi; +Cc: openembedded-core, scott.a.garman

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

On 12-08-22 1:27 AM, Tom Zanussi wrote:
> On Mon, 2012-08-13 at 13:10 -0400, Bruce Ashfield wrote:
>> Scott,
>>
>> Here's a fix for validate_branches that comes from a pending master
>> change that I've been running for 3 weeks, and one that TomZ has tested
>> in his yocto BSP work on denzil.
>>
>> It fixes some BSP use cases that involve setting a specific SRCREV
>> on a base branch, so that a BSP branch that doesn't yet exist can
>> be created off of that known base. Previously only an existing BSP
>> branch could have it's SRCREV restricted.
>>
>
> Hi Scott,
>
> I don't see this in denzil - do you have it queued for the next pull
> request, or did it get missed?

I was wondering the same thing, in particular, since I just made a minor
tweak to this in master (which I'll send out tomorrow). The attached
patch should also be merged to denzil.

Bruce

>
> Tom
>
>> cc: Tom Zanussi<tom.zanussi@intel.com>
>>
>> Cheers,
>>
>> Bruce
>>
>> The following changes since commit 73cdebf60df225ee10f2eb215935be3b61e1b831:
>>
>>    documentation/dev-manual/dev-manual-kernel-appendix.xml: Add note about conflict (2012-06-29 15:54:26 +0100)
>>
>> are available in the git repository at:
>>    git://git.pokylinux.org/poky-contrib zedd/kernel-denzil
>>    http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=zedd/kernel-denzil
>>
>> Bruce Ashfield (1):
>>    linux-yocto: allow do_validate_branches to handle all branches
>>
>>   meta/classes/kernel-yocto.bbclass |  119 +++++++++++++++++++++++++------------
>>   1 files changed, 80 insertions(+), 39 deletions(-)
>>
>
>


[-- Attachment #2: 0001-kernel-yocto-set-master-branch-to-a-defined-SRCREV.patch --]
[-- Type: application/mbox, Size: 1628 bytes --]

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

* Re: [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches
  2012-08-22  5:48   ` Bruce Ashfield
@ 2012-08-23 19:18     ` Tom Zanussi
  2012-08-23 19:21       ` Bruce Ashfield
  0 siblings, 1 reply; 7+ messages in thread
From: Tom Zanussi @ 2012-08-23 19:18 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: openembedded-core, scott.a.garman

On Wed, 2012-08-22 at 01:48 -0400, Bruce Ashfield wrote:
> On 12-08-22 1:27 AM, Tom Zanussi wrote:
> > On Mon, 2012-08-13 at 13:10 -0400, Bruce Ashfield wrote:
> >> Scott,
> >>
> >> Here's a fix for validate_branches that comes from a pending master
> >> change that I've been running for 3 weeks, and one that TomZ has tested
> >> in his yocto BSP work on denzil.
> >>
> >> It fixes some BSP use cases that involve setting a specific SRCREV
> >> on a base branch, so that a BSP branch that doesn't yet exist can
> >> be created off of that known base. Previously only an existing BSP
> >> branch could have it's SRCREV restricted.
> >>
> >
> > Hi Scott,
> >
> > I don't see this in denzil - do you have it queued for the next pull
> > request, or did it get missed?
> 
> I was wondering the same thing, in particular, since I just made a minor
> tweak to this in master (which I'll send out tomorrow). The attached
> patch should also be merged to denzil.
> 

I tried the above patch on top of the other, built and booted a qemu arm
bsp generated by yocto-bsp, and didn't see any problems FWIW...

Tom

> Bruce
> 
> >
> > Tom
> >
> >> cc: Tom Zanussi<tom.zanussi@intel.com>
> >>
> >> Cheers,
> >>
> >> Bruce
> >>
> >> The following changes since commit 73cdebf60df225ee10f2eb215935be3b61e1b831:
> >>
> >>    documentation/dev-manual/dev-manual-kernel-appendix.xml: Add note about conflict (2012-06-29 15:54:26 +0100)
> >>
> >> are available in the git repository at:
> >>    git://git.pokylinux.org/poky-contrib zedd/kernel-denzil
> >>    http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=zedd/kernel-denzil
> >>
> >> Bruce Ashfield (1):
> >>    linux-yocto: allow do_validate_branches to handle all branches
> >>
> >>   meta/classes/kernel-yocto.bbclass |  119 +++++++++++++++++++++++++------------
> >>   1 files changed, 80 insertions(+), 39 deletions(-)
> >>
> >
> >
> 





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

* Re: [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches
  2012-08-23 19:18     ` Tom Zanussi
@ 2012-08-23 19:21       ` Bruce Ashfield
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Ashfield @ 2012-08-23 19:21 UTC (permalink / raw)
  To: Tom Zanussi; +Cc: openembedded-core, scott.a.garman

On 12-08-23 03:18 PM, Tom Zanussi wrote:
> On Wed, 2012-08-22 at 01:48 -0400, Bruce Ashfield wrote:
>> On 12-08-22 1:27 AM, Tom Zanussi wrote:
>>> On Mon, 2012-08-13 at 13:10 -0400, Bruce Ashfield wrote:
>>>> Scott,
>>>>
>>>> Here's a fix for validate_branches that comes from a pending master
>>>> change that I've been running for 3 weeks, and one that TomZ has tested
>>>> in his yocto BSP work on denzil.
>>>>
>>>> It fixes some BSP use cases that involve setting a specific SRCREV
>>>> on a base branch, so that a BSP branch that doesn't yet exist can
>>>> be created off of that known base. Previously only an existing BSP
>>>> branch could have it's SRCREV restricted.
>>>>
>>>
>>> Hi Scott,
>>>
>>> I don't see this in denzil - do you have it queued for the next pull
>>> request, or did it get missed?
>>
>> I was wondering the same thing, in particular, since I just made a minor
>> tweak to this in master (which I'll send out tomorrow). The attached
>> patch should also be merged to denzil.
>>
>
> I tried the above patch on top of the other, built and booted a qemu arm
> bsp generated by yocto-bsp, and didn't see any problems FWIW...

Good news. It will make the bsp tooling more robust for new boards.

Cheers,

Bruce

>
> Tom
>
>> Bruce
>>
>>>
>>> Tom
>>>
>>>> cc: Tom Zanussi<tom.zanussi@intel.com>
>>>>
>>>> Cheers,
>>>>
>>>> Bruce
>>>>
>>>> The following changes since commit 73cdebf60df225ee10f2eb215935be3b61e1b831:
>>>>
>>>>     documentation/dev-manual/dev-manual-kernel-appendix.xml: Add note about conflict (2012-06-29 15:54:26 +0100)
>>>>
>>>> are available in the git repository at:
>>>>     git://git.pokylinux.org/poky-contrib zedd/kernel-denzil
>>>>     http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=zedd/kernel-denzil
>>>>
>>>> Bruce Ashfield (1):
>>>>     linux-yocto: allow do_validate_branches to handle all branches
>>>>
>>>>    meta/classes/kernel-yocto.bbclass |  119 +++++++++++++++++++++++++------------
>>>>    1 files changed, 80 insertions(+), 39 deletions(-)
>>>>
>>>
>>>
>>
>
>




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

* Re: [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches
  2012-08-22  5:27 ` [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches Tom Zanussi
  2012-08-22  5:48   ` Bruce Ashfield
@ 2012-08-24  8:08   ` Scott Garman
  1 sibling, 0 replies; 7+ messages in thread
From: Scott Garman @ 2012-08-24  8:08 UTC (permalink / raw)
  To: Tom Zanussi; +Cc: openembedded-core

On 08/21/2012 10:27 PM, Tom Zanussi wrote:
> On Mon, 2012-08-13 at 13:10 -0400, Bruce Ashfield wrote:
>> Scott,
>>
>> Here's a fix for validate_branches that comes from a pending master
>> change that I've been running for 3 weeks, and one that TomZ has tested
>> in his yocto BSP work on denzil.
>>
>> It fixes some BSP use cases that involve setting a specific SRCREV
>> on a base branch, so that a BSP branch that doesn't yet exist can
>> be created off of that known base. Previously only an existing BSP
>> branch could have it's SRCREV restricted.
>>
>
> Hi Scott,
>
> I don't see this in denzil - do you have it queued for the next pull
> request, or did it get missed?
>
> Tom

Sorry about this - it did get missed. I now have it in my denzil-next 
branches and I'm planning to submit a pull request sometime next week.

Scott

-- 
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center



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

end of thread, other threads:[~2012-08-24  8:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-13 17:10 [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches Bruce Ashfield
2012-08-13 17:10 ` [PATCH 1/1] linux-yocto: allow do_validate_branches to handle all branches Bruce Ashfield
2012-08-22  5:27 ` [PATCH 0/1] [denzil] linux-yocto: make validate_branches handle non BSP branches Tom Zanussi
2012-08-22  5:48   ` Bruce Ashfield
2012-08-23 19:18     ` Tom Zanussi
2012-08-23 19:21       ` Bruce Ashfield
2012-08-24  8:08   ` Scott Garman

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