Skip to content

Commit

Permalink
fix shared object naming
Browse files Browse the repository at this point in the history
  • Loading branch information
egecetin committed Dec 29, 2024
1 parent f3aaaf8 commit 1983e8c
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions scripts/dump_syms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,10 @@

import errno
import os
import re
import sys
from optparse import OptionParser


def generateVersions(string):
pattern = r"(\d+)\.(\d+)\.(\d+)$"
match = re.search(pattern, string)

if match:
number1, number2, number3 = match.groups()
base_string = string[: match.start()]
return [
f"{base_string}{number1}",
f"{base_string}{number1}.{number2}",
f"{base_string}{number1}.{number2}.{number3}",
]
else:
return [string]


if __name__ == "__main__":
# Parse inputs
parser = OptionParser()
Expand Down Expand Up @@ -51,10 +34,6 @@ def generateVersions(string):
and not os.path.islink(os.path.join(binaryDir, filePath))
]

extendedBinaryPaths = []
for binaryPath in binaryPaths:
extendedBinaryPaths.extend(generateVersions(binaryPath))

for binaryPath in binaryPaths:
# Prepare command to dump symbols
outFilePath = outputDir + os.path.basename(binaryPath) + ".sym"
Expand All @@ -66,14 +45,12 @@ def generateVersions(string):
symFile = open(outFilePath, "r")
firstLine = symFile.readline().split(" ")

symbolsDir = (
outputDir + "/" + os.path.basename(binaryPath) + "/" + firstLine[-2] + "/"
)
symbolsDir = outputDir + "/" + firstLine[-1].strip() + "/" + firstLine[-2] + "/"

try:
os.makedirs(symbolsDir)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
os.rename(outFilePath, symbolsDir + os.path.basename(binaryPath) + ".sym")
os.rename(outFilePath, symbolsDir + firstLine[-1].strip() + ".sym")
os.system(f"strip {binaryPath}")

0 comments on commit 1983e8c

Please sign in to comment.