partial fix of #2559 and correct wrong add-gnu-debuglink

This commit is contained in:
S.Çağlar Onur
2006-04-16 20:18:20 +00:00
parent 4ef0b4cd21
commit d680adc376
2 changed files with 11 additions and 16 deletions
+2 -3
View File
@@ -492,12 +492,11 @@ class Builder:
"""strip install directory"""
ctx.ui.action(_("Stripping files.."))
install_dir = self.pkg_install_dir()
pkg_name = self.spec.source.name + '-' + self.spec.source.version + '-' + self.spec.source.release
try:
nostrip = self.actionGlobals['NoStrip']
util.strip_directory(install_dir, pkg_name, nostrip)
util.strip_directory(install_dir, nostrip)
except KeyError:
util.strip_directory(install_dir, pkg_name)
util.strip_directory(install_dir)
def gen_metadata_xml(self, package):
"""Generate the metadata.xml file for build source.
+9 -13
View File
@@ -484,7 +484,7 @@ def do_patch(sourceDir, patchFile, level = 0, target = ''):
os.chdir(cwd)
def strip_directory(top, package_name, excludelist=[]):
def strip_directory(top, excludelist=[]):
for root, dirs, files in os.walk(top):
for fn in files:
frpath = join_path(root, fn)
@@ -508,11 +508,11 @@ def strip_directory(top, package_name, excludelist=[]):
ctx.ui.debug("%s [%s]" %(p, "NoStrip"))
if strip:
if strip_file(frpath, package_name):
if strip_file(frpath):
ctx.ui.debug("%s [%s]" %(p, "stripped"))
def strip_file(filepath, package_name):
def strip_file(filepath):
"""strip a file"""
p = os.popen("file \"%s\"" % filepath)
o = p.read()
@@ -523,19 +523,15 @@ def strip_file(filepath, package_name):
if ret:
ctx.ui.warning(_("strip command failed for file '%s'!") % f)
def save_elf_debug(f, package_name):
"""copy debug info into /debug/PACKAGE_NAME/file.debug file"""
try:
os.makedirs("/debug/%s" % package_name)
except OSError:
pass
p = os.popen("objcopy --only-keep-debug %s /debug/%s/%s.debug" % (f, package_name, os.path.basename(f)))
def save_elf_debug(f):
"""copy debug info into file.debug file"""
p = os.popen("objcopy --only-keep-debug %s %s.debug" % (f, f))
ret = p.close()
if ret:
ctx.ui.warning(_("objcopy (keep-debug) command failed for file '%s'!") % f)
"""mark binary/shared objects to use /debug/PACKAGE_NAME/file.debug"""
p = os.popen("objcopy --add-gnu-debuglink=/debug/%s/%s.debug %s" % (package_name, os.path.basename(f), f))
p = os.popen("objcopy --add-gnu-debuglink=%s %s.debug" % (f, f))
ret = p.close()
if ret:
ctx.ui.warning(_("objcopy (add-debuglink) command failed for file '%s'!") % f)
@@ -546,13 +542,13 @@ def strip_file(filepath, package_name):
elif "SB executable" in o:
if ctx.config.values.build.debug == "True":
save_elf_debug(filepath, package_name)
save_elf_debug(filepath)
run_strip(filepath)
return True
elif "SB shared object" in o:
if ctx.config.values.build.debug == "True":
save_elf_debug(filepath, package_name)
save_elf_debug(filepath)
run_strip(filepath, "--strip-unneeded")
# FIXME: warn for TEXTREL
return True