This happens on Ostro OS CI builders which run Ubuntu 14.04. Before each build, CI runs a verify pass using oe-selftest. After recent addition of "import git", oe-selftest fails: oe-selftest --run-tests iotsstatetests.SStateTests.test_sstate_samesigs Traceback (most recent call last): File "ostro-os/scripts/oe-selftest", line 39, in <module> import git ImportError: No module named 'git' It's not obvious/easy how to make Ubuntu 14.04 LTS host to support "import git" for python3. There exits package python-git, which I added on builders, but it does not help, being for python2, where oe-selftest explicitly needs python3. For python 3, there is no separate python-git package in Ubuntu repos usable by 14.04 system (with python3 version 3.4.3 installed).
Assuming --repository option is not mainstream use case: Another idea making impact of new "import git" smaller: What about moving "import git" to be local-scope instead of global, as this is only needed when new option --repository is present?
Olev, can you check if this patch fixes the issue: diff --git a/scripts/oe-selftest b/scripts/oe-selftest index f4b861f..bfcea66 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -36,7 +36,6 @@ import re import fnmatch import collections import imp -import git sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib') import scriptpath @@ -577,6 +576,7 @@ def main(): log.info("Finished") if args.repository: + import git # Commit tests results to repository metadata = metadata_from_bb() git_dir = os.path.join(os.getcwd(), 'selftest')
v2: diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py index ecbe763..5d8bf84 100644 --- a/meta/lib/oeqa/utils/metadata.py +++ b/meta/lib/oeqa/utils/metadata.py @@ -5,7 +5,6 @@ # Functions to get metadata from the testing host used # for analytics of test results. -from git import Repo, InvalidGitRepositoryError, NoSuchPathError from collections import OrderedDict from collections.abc import MutableMapping from xml.dom.minidom import parseString @@ -46,6 +45,7 @@ def metadata_from_data_store(d): def get_layers(layers): """ Returns layer name, branch, and revision as OrderedDict. """ + from git import Repo, InvalidGitRepositoryError, NoSuchPathError layer_dict = OrderedDict() for layer in layers.split(): diff --git a/scripts/oe-selftest b/scripts/oe-selftest index f4b861f..bfcea66 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -36,7 +36,6 @@ import re import fnmatch import collections import imp -import git sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib') import scriptpath @@ -577,6 +576,7 @@ def main(): log.info("Finished") if args.repository: + import git # Commit tests results to repository metadata = metadata_from_bb() git_dir = os.path.join(os.getcwd(), 'selftest')
patch has been sent for review: http://lists.openembedded.org/pipermail/openembedded-core/2016-December/130381.html
the fix has been merged into poky master