[gnome-continuous-yocto/gnomeostree-3.28-rocko: 4088/8267] oeqa.utils.metadata: drop 'unknown' git data elements



commit 4e67232f345a8756f20c6dc41a52e5c80533598c
Author: Markus Lehtonen <markus lehtonen linux intel com>
Date:   Fri Jan 13 15:12:39 2017 +0200

    oeqa.utils.metadata: drop 'unknown' git data elements
    
    It's better just to not have the xml elements than to have elements with
    faux data. One could have git branch named 'unknown', for example.
    
    [YOCTO #10590]
    
    (From OE-Core rev: fce531c21f5e56d0f416b3405a0b0fc5ba567679)
    
    Signed-off-by: Markus Lehtonen <markus lehtonen linux intel com>
    Signed-off-by: Ross Burton <ross burton intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 meta/lib/oeqa/utils/metadata.py |    7 +++----
 scripts/oe-selftest             |    4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py
index df6ed91..a389c6a 100644
--- a/meta/lib/oeqa/utils/metadata.py
+++ b/meta/lib/oeqa/utils/metadata.py
@@ -73,11 +73,10 @@ def get_layers(layers):
         try:
             repo = Repo(layer, search_parent_directories=True)
             revision, branch = repo.head.object.name_rev.split()
-            layer_dict[layer_name]['branch'] = branch
-            layer_dict[layer_name]['revision'] = revision
         except (InvalidGitRepositoryError, NoSuchPathError):
-            layer_dict[layer_name]['branch'] = 'unknown'
-            layer_dict[layer_name]['revision'] = 'unknown'
+            continue
+        layer_dict[layer_name]['branch'] = branch
+        layer_dict[layer_name]['revision'] = revision
     return layer_dict
 
 def write_metadata_file(file_path, metadata):
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index c3c491f..78806a6 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -603,7 +603,7 @@ def main():
             r_branches = set(r_branches.replace('origin/', '').split())
             l_branches = {str(branch) for branch in repo.branches}
             branch = '%s/%s/%s' % (metadata['hostname'],
-                                   metadata['layers']['meta']['branch'],
+                                   metadata['layers']['meta'].get('branch', '(nogit)'),
                                    metadata['machine'])
 
             if branch in l_branches:
@@ -631,7 +631,7 @@ def main():
             layer_info = ''
             for layer, values in metadata['layers'].items():
                 layer_info = '%s%-17s = %s:%s\n' % (layer_info, layer,
-                              values['branch'], values['revision'])
+                              values.get('branch', '(nogit)'), values.get('revision', '0'*40))
             msg = 'Selftest for build %s of %s for machine %s on %s\n\n%s' % (
                    log_prefix[12:], metadata['distro']['pretty_name'],
                    metadata['machine'], metadata['hostname'], layer_info)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]