bitbake-setup: use internal registry if run from git checkout, bitbake repo otherwise
PATCH 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
bin/bitbake-setup +9 -3
@@ -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,14 @@ GLOBAL_ONLY_SETTINGS = ( "top-dir-name", ) +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 +1090,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
Quoted 33 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.
Signed-off-by Alexander Kanavin <[email protected]>---
bin/bitbake-setup | 12 +++++++++---1 file changed, 9 insertions(+), 3 deletions(-)bin/bitbake-setup +0
-0@@ -21,8 +21,6 @@ import signalimport functools
import stringbin/bitbake-setup +0
-2-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')]bin/bitbake-setup +0
-0@@ -37,6 +35,14 @@ GLOBAL_ONLY_SETTINGS = ( "top-dir-name", )
bin/bitbake-setup GLOBAL_ONLY_SETTINGS = ( · line 45
Quoted 8 lines
bin/bitbake-setup +8
-0+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 +
Probably a silly question but why not just check if the default registry exists and if not, fall back to the git url?
i.e. why isn't this just if os.path.exists(internal_registry) ?
Cheers,
Richard
Quoted 12 lines · Richard Purdie
bin/bitbake-setup GLOBAL_ONLY_SETTINGS = ( · line 45
Quoted 8 lines
bin/bitbake-setup +8
-0+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 +Probably a silly question but why not just check if the default registry exists and if not, fall back to the git url?
Quoted 1 line
i.e. why isn't this just if
os.path.exists(internal_registry)?
The idea is to ensure that internal registry is used only from a bitbake git checkout. If someone makes a tarball, or otherwise installs bitbake-setup in a way that replicates the tree structure including the configs, then bitbake-setup should ignore any such possible in-tree configurations and get/update them from git.
Alex
Quoted 19 lines · Alexander Kanavin
Quoted 16 lines · Richard Purdie
Quoted 4 lines
+def
get_default_registry():
+internal_registry=os.path.normpath(os.path.dirname(__file__) + "/../default- registry")Quoted 8 lines
+
git_registry= "git://git.openembedded.org/bitbake;protocol=https;branch=master; rev=master"
+ ifos.path.exists(os.path.dirname(__file__) + "/../.git"):
+ returninternal_registry
+ else:
+ returngit_registry
+Probably a silly question but why not just check if the default registry exists and if not, fall back to the git url?
Quoted 7 lines
Quoted 1 line
i.e. why isn't this just if
os.path.exists(internal_registry)?The idea is to ensure that internal registry is used only from a bitbake git checkout. If someone makes a tarball, or otherwise installs bitbake-setup in a way that replicates the tree structure including the configs, then bitbake-setup should ignore any such possible in-tree configurations and get/update them from git.
It might be worth a comment about the design intent here, something like:
# 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
?
Cheers,
Richard
Quoted 8 lines · Richard Purdie
It might be worth a comment about the design intent here, something like:
# 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?
Yep, I sent a v2.
Alex