<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>10821</bug_id>
          
          <creation_ts>2016-12-19 10:49:21 +0000</creation_ts>
          <short_desc>oe-selftest: &quot;import git&quot; fails on Ubuntu 14.04</short_desc>
          <delta_ts>2016-12-20 16:18:10 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>Scripts and Tools</component>
          <version>2.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>2.3 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Olev Kartau">olev.kartau</reporter>
          <assigned_to name="Ed Bartosh">eduard.bartosh</assigned_to>
          <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>69205</commentid>
    <comment_count>0</comment_count>
    <who name="Olev Kartau">olev.kartau</who>
    <bug_when>2016-12-19 10:49:21 +0000</bug_when>
    <thetext>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 &quot;import git&quot;, 
oe-selftest fails:
oe-selftest --run-tests iotsstatetests.SStateTests.test_sstate_samesigs
Traceback (most recent call last):
File &quot;ostro-os/scripts/oe-selftest&quot;, line 39, in &lt;module&gt;
     import git
ImportError: No module named &apos;git&apos;

It&apos;s not obvious/easy how to make Ubuntu 14.04 LTS host
to support &quot;import git&quot; 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).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69206</commentid>
    <comment_count>1</comment_count>
    <who name="Olev Kartau">olev.kartau</who>
    <bug_when>2016-12-19 10:52:05 +0000</bug_when>
    <thetext>Assuming --repository option is not mainstream use case:
Another idea making impact of new &quot;import git&quot; smaller:
What about moving &quot;import git&quot; to be local-scope
instead of global, as this is only needed when
new option --repository is present?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69210</commentid>
    <comment_count>2</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-12-19 13:00:29 +0000</bug_when>
    <thetext>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__)) + &apos;/lib&apos;)
 import scriptpath
@@ -577,6 +576,7 @@ def main():
         log.info(&quot;Finished&quot;)
 
         if args.repository:
+            import git
             # Commit tests results to repository
             metadata = metadata_from_bb()
             git_dir = os.path.join(os.getcwd(), &apos;selftest&apos;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69211</commentid>
    <comment_count>3</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-12-19 13:20:41 +0000</bug_when>
    <thetext>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):
     &quot;&quot;&quot; Returns layer name, branch, and revision as OrderedDict. &quot;&quot;&quot;
+    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__)) + &apos;/lib&apos;)
 import scriptpath
@@ -577,6 +576,7 @@ def main():
         log.info(&quot;Finished&quot;)
 
         if args.repository:
+            import git
             # Commit tests results to repository
             metadata = metadata_from_bb()
             git_dir = os.path.join(os.getcwd(), &apos;selftest&apos;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69212</commentid>
    <comment_count>4</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-12-19 13:53:00 +0000</bug_when>
    <thetext>patch has been sent for review: http://lists.openembedded.org/pipermail/openembedded-core/2016-December/130381.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69231</commentid>
    <comment_count>5</comment_count>
    <who name="Ed Bartosh">eduard.bartosh</who>
    <bug_when>2016-12-20 16:18:10 +0000</bug_when>
    <thetext>the fix has been merged into poky master</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>