commit:     33a7f172aa06d773f11d2916130a48d16760c7d1
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Jun  4 20:57:28 2023 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Jun  4 20:57:28 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=33a7f172

Support splited lines in auxdb output

Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>

 buildbot_gentoo_ci/steps/version.py | 53 +++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 29 deletions(-)

diff --git a/buildbot_gentoo_ci/steps/version.py 
b/buildbot_gentoo_ci/steps/version.py
index c6f333e..98e5403 100644
--- a/buildbot_gentoo_ci/steps/version.py
+++ b/buildbot_gentoo_ci/steps/version.py
@@ -26,11 +26,9 @@ def PersOutputOfGetEapi(rc, stdout, stderr):
     # split the lines
     for line in stdout.split('\n'):
         if line.startswith('EAPI'):
-            print(line[-1])
             m = _pms_eapi_re.match(line)
             if m is not None:
                 eapi = m.group(2)
-                print(eapi)
     if eapi is None or not eapi_is_supported(eapi):
         print('ERROR: invalid eapi or not found')
         eapi = False
@@ -41,37 +39,34 @@ def PersOutputOfGetEapi(rc, stdout, stderr):
         }
 
 def PersOutputOfGetAuxdb(rc, stdout, stderr):
-    metadata = None
     NoSplit = ['DESCRIPTION']
     ignore_list = ['SRC_URI']
-    #make dict of the stout
-    index = 1
-    metadata_line_dict = {}
-    for text_line in stdout.splitlines():
-        metadata_line_dict[index] = text_line
-        index = index + 1
+    metadata = {}
+    i = 0
     if not stderr == '':
         print('stderr')
-    # should have 22 lines
-    if len(auxdbkeys) != index -1:
-        # number of lines is incorrect.
-        print('ERROR: Number of lines is incorrect')
-        print(metadata_line_dict)
-        return {
-            'auxdb' : metadata
-            }
-    # split all keys to list instead of speces
-    metadata = {}
-    i = 1
-    for key in auxdbkeys:
-        if metadata_line_dict[i][-1] == '=' or key in ignore_list:
-            metadata[key] = False
-        else:
-            if ' ' in metadata_line_dict[i] and key not in NoSplit:
-                metadata[key] = metadata_line_dict[i].replace(key + '=', 
'').split(' ')
-            else:
-                metadata[key] = []
-                metadata[key].append(metadata_line_dict[i].replace(key + '=', 
''))
+    # make a dict of metadata
+    metadata_line_list = stdout.splitlines()
+    index = len(metadata_line_list)
+    for metadata_line in metadata_line_list:
+        print(metadata_line)
+        for key in auxdbkeys:
+            if metadata_line.startswith(key) and key not in ignore_list:
+                print(key)
+                if metadata_line[-1] == '=':
+                    metadata[key] = False
+                else:
+                    if ' ' in metadata_line and key not in NoSplit:
+                        if i+1 == index or 
metadata_line_list[i+1].startswith(auxdbkeys):
+                            metadata[key] = metadata_line.replace(key + '=', 
'').split(' ')
+                        else:
+                            # support one splited line
+                            print(metadata_line_list[i+1])
+                            metadata_line2 = metadata_line + 
metadata_line_list[i+1]
+                            metadata[key] = metadata_line2.replace(key + '=', 
'').split(' ')
+                    else:
+                        metadata[key] = []
+                        metadata[key].append(metadata_line.replace(key + '=', 
''))
         i = i + 1
     return {
         'auxdb' : metadata

Reply via email to