| Message ID | 20260114113348.2991476-1-alex.kanavin@gmail.com |
|---|---|
| State | Accepted, archived |
| Commit | 675e9076a25248d49f01d7877a78f5a08a9daabc |
| Headers | show |
| Series | [v2] bitbake-setup: use internal registry if run from git checkout, bitbake repo otherwise | expand |
Hi Alex, Thanks! I will give this a try. I have a need to be able to use bitbake-setup for air-gapped builds. I will experiment with how we might make this work for situations where git.openembedded.org is unavailable. (In the past I have used git "insteadof" to accomplish this) Regards, Rob On Wed, Jan 14, 2026 at 6:33 AM Alexander Kanavin via lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org> wrote: > From: Alexander Kanavin <alex@linutronix.de> > > If bitbake-setup is packaged and obtained from pypi, or another package > feed > it needs to be able to find standard configurations. It is not impossible > to package configurations into some location inside the package > and add logic to find them, but it is much easier to just fetch the bitbake > repo and use that as a configuration registry. The other benefit is that > such packaged/installed bitbake-setup will not have to be updated in order > to obtain latest configurations: it will simply check the registry and > fetch > them as needed, which is the original intent of config registries as repos. > > Signed-off-by: Alexander Kanavin <alex@linutronix.de> > --- > bin/bitbake-setup | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/bin/bitbake-setup b/bin/bitbake-setup > index 2c2b6d8ec..4ed06fc62 100755 > --- a/bin/bitbake-setup > +++ b/bin/bitbake-setup > @@ -21,8 +21,6 @@ import signal > import functools > import string > > -default_registry = os.path.normpath(os.path.dirname(__file__) + > "/../default-registry") > - > bindir = os.path.abspath(os.path.dirname(__file__)) > sys.path[0:0] = [os.path.join(os.path.dirname(bindir), 'lib')] > > @@ -37,6 +35,17 @@ GLOBAL_ONLY_SETTINGS = ( > "top-dir-name", > ) > > +# If bitbake is from a release tarball or somewhere like pypi where > +# updates may not be straightforward, prefer to use the git repo as the > +# default registry > +def get_default_registry(): > + internal_registry = os.path.normpath(os.path.dirname(__file__) + > "/../default-registry") > + git_registry = "git:// > git.openembedded.org/bitbake;protocol=https;branch=master;rev=master" > + if os.path.exists(os.path.dirname(__file__) + "/../.git"): > + return internal_registry > + else: > + return git_registry > + > def cache_dir(top_dir): > return os.path.join(top_dir, '.bitbake-setup-cache') > > @@ -1084,7 +1093,7 @@ def main(): > builtin_settings['default'] = { > 'top-dir-prefix':os.getcwd(), > 'top-dir-name':'bitbake-builds', > - 'registry':default_registry, > + 'registry':get_default_registry(), > 'use-full-setup-dir-name':'no', > 'common-sstate':'yes', > } > -- > 2.47.3 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#18752): > https://lists.openembedded.org/g/bitbake-devel/message/18752 > Mute This Topic: https://lists.openembedded.org/mt/117259398/556952 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ > rob.woolleywr@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
Hi Alex,
I tested your fix and confirm that it works both with and without the .git
directory present. When .git/ is missing I see the lines:
NOTE: Fetching configuration registry
git://
git.openembedded.org/bitbake;protocol=https;branch=master;rev=master
into
/ala-lpggp21/rwoolley/vanilla-bitbake-setup/bitbake-builds/.bitbake-setup-cache/configurations
In both cases, "bitbake-setup init" completes successfully.
I also rebased my Python packaging changes and hope to push the patches
soon.
Regards,
Rob
On Thu, Jan 15, 2026 at 9:53 AM Rob Woolley via lists.openembedded.org
<rob.woolleywr=gmail.com@lists.openembedded.org> wrote:
> Hi Alex,
>
> Thanks! I will give this a try.
>
> I have a need to be able to use bitbake-setup for air-gapped builds. I
> will experiment with how we might make this work for situations where
> git.openembedded.org is unavailable. (In the past I have used git
> "insteadof" to accomplish this)
>
> Regards,
> Rob
>
> On Wed, Jan 14, 2026 at 6:33 AM Alexander Kanavin via
> lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
> wrote:
>
>> From: Alexander Kanavin <alex@linutronix.de>
>>
>> If bitbake-setup is packaged and obtained from pypi, or another package
>> feed
>> it needs to be able to find standard configurations. It is not impossible
>> to package configurations into some location inside the package
>> and add logic to find them, but it is much easier to just fetch the
>> bitbake
>> repo and use that as a configuration registry. The other benefit is that
>> such packaged/installed bitbake-setup will not have to be updated in order
>> to obtain latest configurations: it will simply check the registry and
>> fetch
>> them as needed, which is the original intent of config registries as
>> repos.
>>
>> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
>> ---
>> bin/bitbake-setup | 15 ++++++++++++---
>> 1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/bin/bitbake-setup b/bin/bitbake-setup
>> index 2c2b6d8ec..4ed06fc62 100755
>> --- a/bin/bitbake-setup
>> +++ b/bin/bitbake-setup
>> @@ -21,8 +21,6 @@ import signal
>> import functools
>> import string
>>
>> -default_registry = os.path.normpath(os.path.dirname(__file__) +
>> "/../default-registry")
>> -
>> bindir = os.path.abspath(os.path.dirname(__file__))
>> sys.path[0:0] = [os.path.join(os.path.dirname(bindir), 'lib')]
>>
>> @@ -37,6 +35,17 @@ GLOBAL_ONLY_SETTINGS = (
>> "top-dir-name",
>> )
>>
>> +# If bitbake is from a release tarball or somewhere like pypi where
>> +# updates may not be straightforward, prefer to use the git repo as the
>> +# default registry
>> +def get_default_registry():
>> + internal_registry = os.path.normpath(os.path.dirname(__file__) +
>> "/../default-registry")
>> + git_registry = "git://
>> git.openembedded.org/bitbake;protocol=https;branch=master;rev=master"
>> + if os.path.exists(os.path.dirname(__file__) + "/../.git"):
>> + return internal_registry
>> + else:
>> + return git_registry
>> +
>> def cache_dir(top_dir):
>> return os.path.join(top_dir, '.bitbake-setup-cache')
>>
>> @@ -1084,7 +1093,7 @@ def main():
>> builtin_settings['default'] = {
>> 'top-dir-prefix':os.getcwd(),
>> 'top-dir-name':'bitbake-builds',
>> - 'registry':default_registry,
>> + 'registry':get_default_registry(),
>> 'use-full-setup-dir-name':'no',
>> 'common-sstate':'yes',
>> }
>> --
>> 2.47.3
>>
>>
>>
>>
>>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#18782):
> https://lists.openembedded.org/g/bitbake-devel/message/18782
> Mute This Topic: https://lists.openembedded.org/mt/117259398/556952
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [
> rob.woolleywr@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 2c2b6d8ec..4ed06fc62 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -21,8 +21,6 @@ import signal import functools import string -default_registry = os.path.normpath(os.path.dirname(__file__) + "/../default-registry") - bindir = os.path.abspath(os.path.dirname(__file__)) sys.path[0:0] = [os.path.join(os.path.dirname(bindir), 'lib')] @@ -37,6 +35,17 @@ GLOBAL_ONLY_SETTINGS = ( "top-dir-name", ) +# If bitbake is from a release tarball or somewhere like pypi where +# updates may not be straightforward, prefer to use the git repo as the +# default registry +def get_default_registry(): + internal_registry = os.path.normpath(os.path.dirname(__file__) + "/../default-registry") + git_registry = "git://git.openembedded.org/bitbake;protocol=https;branch=master;rev=master" + if os.path.exists(os.path.dirname(__file__) + "/../.git"): + return internal_registry + else: + return git_registry + def cache_dir(top_dir): return os.path.join(top_dir, '.bitbake-setup-cache') @@ -1084,7 +1093,7 @@ def main(): builtin_settings['default'] = { 'top-dir-prefix':os.getcwd(), 'top-dir-name':'bitbake-builds', - 'registry':default_registry, + 'registry':get_default_registry(), 'use-full-setup-dir-name':'no', 'common-sstate':'yes', }