Skip to contentSkip to conversation

bitbake-setup: use internal registry if run from git checkout, bitbake repo otherwise

PATCH In review Alexander Kanavin 2 participants 3 messages Jan 14 – Jan 20 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bitbake-setup: use internal registry if run from git checkout, bitbake repo otherwise

From: Alexander Kanavin <[email protected]>

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.

---
 bin/bitbake-setup | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
bin/bitbake-setup +12 -3
index 2c2b6d8ec..4ed06fc62 100755
@@ -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',
                          }
Signature · 1 line
2.47.3
#1 lore raw

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

Quoted 76 lines · Alexander Kanavin via lists.openembedded.org

From: Alexander Kanavin <[email protected]>

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.

---
 bin/bitbake-setup | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
bin/bitbake-setup +6 -2
index 2c2b6d8ec..4ed06fc62 100755
@@ -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"

bin/bitbake-setup +6 -2
+    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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

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

Quoted 97 lines · Rob Woolley via lists.openembedded.org

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

Quoted 64 lines · Alexander Kanavin via lists.openembedded.org

From: Alexander Kanavin <[email protected]>

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.

---
 bin/bitbake-setup | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
bin/bitbake-setup +6 -2
index 2c2b6d8ec..4ed06fc62 100755
@@ -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"

bin/bitbake-setup +6 -2
+    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',
                          }
--
Quoted 6 lines

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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-