Please cc' me directly on any kernel-yocto changes, I only noticed this by chance.
On Wed, Mar 5, 2014 at 11:49 AM, Matt Fleming <[email protected]> wrote: > From: Matt Fleming <[email protected]> > > 'git branch' may use ANSI escape codes in its output (to provide colour) > which doesn't play well with commands expecting pure plain text, e.g. > > fatal: '^[[31mmaster^[[m' is not a valid branch name. Nasty corner case, one I've never run into .. but that's why the --no-color option exists. I'd prefer that it be used, and we reduce the footprint of the change. See below. > > Furthermore, the output of 'git branch' is subject to change and trying > to parse it could potentially lead to breakage in the future. I've never had a problem with it in 7 years of the tools and their variants, so the point is arguable and could be dropped from the commit log. > > Signed-off-by: Matt Fleming <[email protected]> > --- > meta/classes/kernel-yocto.bbclass | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/meta/classes/kernel-yocto.bbclass > b/meta/classes/kernel-yocto.bbclass > index fb8e04e..1115056 100644 > --- a/meta/classes/kernel-yocto.bbclass > +++ b/meta/classes/kernel-yocto.bbclass > @@ -196,7 +196,7 @@ do_kernel_checkout() { > # If KMETA is defined, the branch must exist, but a machine > branch > # can be missing since it may be created later by the tools. > if [ -n "${KMETA}" ]; then > - git branch -a | grep -q ${KMETA} > + git ls-remote --heads 2>/dev/null | awk '{print $NF}' | grep > -q ${KMETA} cut is lighter weight than awk, and doesn't have any variants (like awk does), so I'd prefer cut in the pipeline versus awk. Sure that's a preference, but I support the class, so I get the pain when it breaks (and it has). Good catch on the issue, like I said, I've never run into it .. but I can definitely see the need for the tweak. Cheers, Bruce > if [ $? -ne 0 ]; then > echo "ERROR. The branch '${KMETA}' is required and > was not" > echo "found. Ensure that the SRC_URI points to a > valid linux-yocto" > @@ -214,11 +214,11 @@ do_kernel_checkout() { > fi > > # convert any remote branches to local tracking ones > - for i in `git branch -a | grep remotes | grep -v HEAD`; do > - b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`; > - git show-ref --quiet --verify -- "refs/heads/$b" > + for i in `git ls-remote --heads 2>/dev/null | awk '{print $NF}'`; do > + b=`echo $i | sed 's%refs/heads/%%'`; > + git show-ref --quiet --verify -- "$i" > if [ $? -ne 0 ]; then > - git branch $b $i > /dev/null > + git branch $b remotes/origin/$b > /dev/null > fi > done > > -- > 1.8.5.3 > > _______________________________________________ > Openembedded-core mailing list > [email protected] > http://lists.openembedded.org/mailman/listinfo/openembedded-core -- "Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end" _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
