[OS-BUILD PATCHv2 12/21] kabi: ignore new stablelist metadata in show-kabi

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

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

kabi: ignore new stablelist metadata in show-kabi

Stablelist symbol definition shall be extended to include extra metadata,
such as a reference symtypes file, path to a file exporting given symbol,
and version history.

Reference and path information is not required by show-kabi and ignored.
Only the current version is processed by show-kabi.

Signed-off-by: Čestmír Kalina <ckalina@xxxxxxxxxx>
Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/redhat/kabi/show-kabi b/redhat/kabi/show-kabi
index blahblah..blahblah 100755
--- a/redhat/kabi/show-kabi
+++ b/redhat/kabi/show-kabi
@@ -23,7 +23,7 @@ __license__ = "GPL"
 import getopt
 import os
 import sys
-
+import re
 
 def load_kabi(dirname, kabi, order, arch):
     """Load a reference stablelist content."""
@@ -46,15 +46,30 @@ def load_kabi(dirname, kabi, order, arch):
 
         for arch in archlist:
             for symbol in os.listdir(dirname + "/kabi_" + arch):
-                if symbol.startswith('.'):
-                    # skip hidden files
+                if '.' in symbol:
+                    # skip files
                     continue
                 kabi_file = open(dirname + "/kabi_" + arch + "/" + symbol, "r")
                 line = []
-                # store version metadata
-                line.append(kabi_file.readline())
-                # store content ( no empty line is bad state )
-                line.append(kabi_file.readline().rstrip('\n'))
+                offset = 0
+                lines = 0
+                for l in kabi_file:
+                    l = l.rstrip('\n')
+                    m = re.match(r"^#([^0-9]+):(.*)", l)
+                    if m:
+                        # store index metadata
+                        if m.group(1) == "I":
+                            offset = int(m.group(2))
+                        # skip any other metadata
+                        continue
+                    if l.startswith("#"):
+                        # store version metadata
+                        line.append(l)
+                        continue
+                    if lines == offset:
+                        line.append(l)
+                        break
+                    lines += 1
                 kabi[arch][symbol] = line
                 order[arch].append(symbol)
                 kabi_file.close()
@@ -94,7 +109,7 @@ def show_kabi(kabi, order, release, fmt, show_head):
             if kabi[current_arch][sym][0][0] != "#":
                 print("Invalid metadata format: {}".format(kabi[current_arch][sym][0]))
                 sys.exit(1)
-            minor_range = kabi[current_arch][sym][0][1:-1].split("-", 2)
+            minor_range = kabi[current_arch][sym][0][1:].split("-", 2)
             minor_range[0] = int(minor_range[0])
             if minor_range[1] == "":
                 minor_range[1] = sys.maxsize

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2021
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux