Common BitBake Versioning
PATCH 1/1 Common BitBake Versioning
We discussed how to version bitbake and bitbake-setup on a Weekly Tech call at the end of January.
The initial proposal was to use the git tags in the bitbake git repository to dynamically determine the package version. There were complications in this approach due to conflicting conventions between how the Yocto Project maintains git tags and the format accepted by PyPI.
A simpler alternative of using the version strings directly was proposed. The request from Richard was to converge the 2 version strings for bitbake and bitbake-setup. He asked for it to be sent as a separate series from the PyPI changes. He also asked for some sort of version checking in case the scripts find the wrong version of the bb module.
Testing includes running bin/bitbake and bin/bitbake-setup inside the git repository as well as installed from the bitbake-setup package.
The value reported by bitbake --version is technically the bb.__version__ whereas bitbake-setup is technically reporting version.__version__. However in both cases we verify that version.__version__ and bb.__version__ match before any other work is performed.
In the coming PyPI series, the pyproject.toml setuptools.dynamic uses the version.REQUIRED_BBVERSION directly. Should the packager wish to add a suffix they may make the change in the pyproject.toml. There is also the option of adding additional VERSION variables in version.py should we decide to differentiate between the tool version, package version, and bb module version in the future.
PATCH 1/4 bin: Move version information to common file
--- bin/bitbake | 5 +++-- bin/bitbake-setup | 2 ++ bin/version.py | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 bin/version.py
bin/bitbake +3 -2
@@ -13,6 +13,9 @@ import os import sys import warnings + +from version import REQUIRED_BBVERSION as __version__ + warnings.simplefilter("default") sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),
@@ -27,8 +30,6 @@ from bb.main import bitbake_main, BitBakeConfigParameters, BBMainException bb.utils.check_system_locale() -__version__ = "2.16.0" - if __name__ == "__main__": if __version__ != bb.__version__: sys.exit("Bitbake core version and program version mismatch!")
bin/bitbake-setup +2 -0
@@ -21,6 +21,8 @@ import signal import functools import string +from version import REQUIRED_BBVERSION as __version__ + bindir = os.path.abspath(os.path.dirname(__file__)) sys.path[0:0] = [os.path.join(os.path.dirname(bindir), 'lib')]
bin/version.py new file +1 -0
@@ -0,0 +1 @@ +REQUIRED_BBVERSION = "2.16.0"
Signature · 1 line
2.39.5
PATCH 2/4 bitbake-setup: Add version option
In reply to Rob WoolleyThis adds the long-form version option to match bitbake.
--- bin/bitbake-setup | 1 + 1 file changed, 1 insertion(+)
bin/bitbake-setup +1 -0
@@ -1064,6 +1064,7 @@ def main(): ) parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') + parser.add_argument('--version', action='version', version='%(prog)s ' + __version__) parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') parser.add_argument('--no-network', action='store_true', help='Do not check whether configuration repositories and layer repositories have been updated; use only the local cache.') parser.add_argument('--global-settings', action='store', metavar='PATH', help='Path to the global settings file.')
Signature · 1 line
2.39.5
PATCH 3/4 bitbake-setup: Add the conditional script stanza
In reply to Rob WoolleyThis ensures that the main function is only executed if the module is executed in the top-level environment.
--- bin/bitbake-setup | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
bin/bitbake-setup +2 -1
@@ -1192,4 +1192,5 @@ def main(): from argparse import Namespace parser.print_help() -main() +if __name__ == '__main__': + main()
Signature · 1 line
2.39.5
PATCH 4/4 bitbake-setup: Add version check and catch exceptions
In reply to Rob WoolleyThis modifies the conditional script stanza to match bitbake.
It adds a version check to ensure that the correct bb module version has been found. It also catches any exceptions thrown during execution.
--- bin/bitbake-setup | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
bin/bitbake-setup +8 -1
@@ -1193,4 +1193,11 @@ def main(): parser.print_help() if __name__ == '__main__': - main() + if __version__ != bb.__version__: + sys.exit("Bitbake core version and program version mismatch!") + try: + sys.exit(main()) + except Exception: + import traceback + traceback.print_exc() + sys.exit(1)
Signature · 1 line
2.39.5
Hi Rob,
Quoted 8 lines · Rob Woolley
We discussed how to version bitbake and bitbake-setup on a Weekly Tech call at the end of January.
The initial proposal was to use the git tags in the bitbake git repository to dynamically determine the package version. There were complications in this approach due to conflicting conventions between how the Yocto Project maintains git tags and the format accepted by PyPI.
Quoted 5 lines
A simpler alternative of using the version strings directly was proposed. The request from Richard was to converge the 2 version strings for bitbake and bitbake-setup. He asked for it to be sent as a separate series from the PyPI changes. He also asked for some sort of version checking in case the scripts find the wrong version of the bb module.
Sorry, I think there has been a misunderstanding here :(. I asked that we reconcile the version strings from bitbake and lib/bb/__init__.py
I'm worried that we might end up with a bin/bitbake being run but a "lib/bb" coming from somewhere else. The current versions are compared to check that but if we install bitbake-setup to somewhere, I'm not sure how we'd continue to ensure this.
Putting a "version.py" into something we inject into PATH does worry me a bit as it is a very generic name and it doesn't really avoid the issue above I'm worried about.
Cheers,
Richard
Hi Richard,
No problem. I had reservations about the version.py approach, so I'm glad you provided that feedback.
I have some ideas, I'll take another run at it.
Regards,
Rob
Quoted 47 lines · Richard Purdie via lists.openembedded.org
Hi Rob,
Quoted 4 lines · Rob Woolley
We discussed how to version bitbake and bitbake-setup on a Weekly Tech call at the end of January.
The initial proposal was to use the git tags in the bitbake git
repository
Quoted 2 lines
to dynamically determine the package version. There were complications in this approach due to conflicting conventions between how the Yocto
Project
Quoted 4 lines
maintains git tags and the format accepted by PyPI.
A simpler alternative of using the version strings directly was proposed. The request from Richard was to converge the 2 version strings for
bitbake
Quoted 3 lines
and bitbake-setup. He asked for it to be sent as a separate series from the PyPI changes. He also asked for some sort of version checking in case the scripts find the wrong version of the bb module.
Sorry, I think there has been a misunderstanding here :(. I asked that we reconcile the version strings from bitbake and
lib/bb/__init__.pyI'm worried that we might end up with a bin/bitbake being run but a "lib/bb" coming from somewhere else. The current versions are compared to check that but if we install bitbake-setup to somewhere, I'm not sure how we'd continue to ensure this.
Putting a "
version.py" into something we inject into PATH does worry me a bit as it is a very generic name and it doesn't really avoid the issue above I'm worried about.Cheers,
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#19261):
https://lists.openembedded.org/g/bitbake-devel/message/19261
Mute This Topic: https://lists.openembedded.org/mt/118522774/556952
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-