Bug 7852 - bitbake-layers layerindex-fetch doesn't respect branch (-b|--branch) option
Summary: bitbake-layers layerindex-fetch doesn't respect branch (-b|--branch) option
Status: IN PROGRESS REVIEW
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 5.99
Assignee: Osama Abdelkader
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-06-05 18:07 UTC by Trevor Woerner
Modified: 2025-11-01 14:00 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
proposed fix (6.73 KB, patch)
2025-11-01 14:00 UTC, Osama Abdelkader
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Trevor Woerner 2015-06-05 18:07:15 UTC
$ git clone git://git.yoctoproject.org/poky meta-poky
$ source meta-poky/oe-init-build-env
$ bitbake-layers layerindex-fetch --branch fido meta-fsl-arm
Layer                Required by          Git repository                                          Subdirectory
===================================================================================================================
meta-fsl-arm         -                    git://git.yoctoproject.org/meta-fsl-arm
openembedded-core    meta-fsl-arm         git://git.openembedded.org/openembedded-core            meta
Cloning into '/home/trevor/tmp/build/meta-poky/meta-fsl-arm'...
remote: Counting objects: 9908, done.
remote: Compressing objects: 100% (3715/3715), done.
remote: Total 9908 (delta 6104), reused 9579 (delta 5776)
Receiving objects: 100% (9908/9908), 37.80 MiB | 292.00 KiB/s, done.
Resolving deltas: 100% (6104/6104), done.
Checking connectivity... done.
Adding layer "meta-fsl-arm" to conf/bblayers.conf

$ cat conf/bblayers.conf
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "6"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /home/trevor/tmp/build/meta-poky/meta \
  /home/trevor/tmp/build/meta-poky/meta-yocto \
  /home/trevor/tmp/build/meta-poky/meta-yocto-bsp \
  /home/trevor/tmp/build/meta-poky/meta-fsl-arm \
  "
BBLAYERS_NON_REMOVABLE ?= " \
  /home/trevor/tmp/build/meta-poky/meta \
  /home/trevor/tmp/build/meta-poky/meta-yocto \
  "

$ cd ../meta-poky/meta-fsl-arm
$ git branch
* master


The same is also true even if the original clone of poky is done on the fido branch, i.e.
$ git clone git://git.yoctoproject.org/poky meta-poky -b fido

The same is also true even if you use the short option to bitbake-layers, i.e.
$ bitbake-layers layerindex-fetch -b fido meta-fsl-arm
Comment 1 Paul Eggleton 2015-10-27 12:51:43 UTC
I meant to comment on this earlier - I'm pretty sure it is respecting the branch info in the layer index; what it's not doing is touching any of the cloned repositories on disk. I know that's not particularly useful though, it should at least be trying to checkout the appropriate branch.
Comment 2 Paul Eggleton 2020-06-03 21:40:20 UTC
So for checking out new branches this is fixed by the following commit:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=eae875dae728987575f1d797b6497900be5a0cb7

However, there are still two problems:
1) If the layer has already been fetched then it will add it to your bblayers.conf but will not check out the correct branch (and won't warn you).
2) If you have oe-core (or poky) checked out at the wrong branch it erroneously fetches it into a separate "openembedded-core" directory and adds it to your bblayers.conf.

In both of these scenarios it seems to me that the correct course would be to at least try doing a "git checkout" of the appropriate branch (probably after a git fetch); if that fails for any reason then bail out.
Comment 3 Randy MacLeod 2023-10-24 14:24:49 UTC
Bulk move from 4.99 or 0.00 to 5.99
Comment 4 Osama Abdelkader 2025-11-01 14:00:16 UTC
Created attachment 5153 [details]
proposed fix

Already submitted to bitbake-devel@lists.openembedded.org.