From 3c9908bb727b28da9897e0961daa10eecdb1c059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Mon, 12 Dec 2005 14:11:31 +0000 Subject: [PATCH] =?UTF-8?q?debug=20sembolleri=20/debug=20i=C3=A7ine=20de?= =?UTF-8?q?=C4=9Fil=20/debug/paket=5Fismi=20i=C3=A7ine=20kendi=20klas?= =?UTF-8?q?=C3=B6r=C3=BCne=20konsun,=20b=C3=B6ylece=20farkl=C4=B1=20revizy?= =?UTF-8?q?onlara/versiyonlara=20ait=20semboller=20kar=C4=B1=C5=9Fmas?= =?UTF-8?q?=C4=B1n...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/build.py | 5 +++-- pisi/util.py | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/pisi/build.py b/pisi/build.py index c5b81130..a63a8687 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -423,11 +423,12 @@ 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, nostrip) + util.strip_directory(install_dir, pkg_name, nostrip) except KeyError: - util.strip_directory(install_dir) + util.strip_directory(install_dir, pkg_name) def gen_metadata_xml(self, package): """Generate the metadata.xml file for build source. diff --git a/pisi/util.py b/pisi/util.py index 44b88015..9f6ef2ff 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -434,7 +434,7 @@ def do_patch(sourceDir, patchFile, level = 0, target = ''): os.chdir(cwd) -def strip_directory(top, excludelist=[]): +def strip_directory(top, package_name, excludelist=[]): for root, dirs, files in os.walk(top): for fn in files: frpath = join_path(root, fn) @@ -458,11 +458,11 @@ def strip_directory(top, excludelist=[]): ctx.ui.debug("%s [%s]" %(p, "NoStrip")) if strip: - if strip_file(frpath): + if strip_file(frpath, package_name): ctx.ui.debug("%s [%s]" %(p, "stripped")) -def strip_file(filepath): +def strip_file(filepath, package_name): """strip a file""" p = os.popen("file \"%s\"" % filepath) o = p.read() @@ -473,15 +473,19 @@ def strip_file(filepath): if ret: ctx.ui.warning(_("strip command failed for file '%s'!") % f) - def save_elf_debug(f): - """copy debug info into /debug/file.debug file""" - p = os.popen("objcopy --only-keep-debug %s /debug/%s.debug" % (f, os.path.basename(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))) ret = p.close() if ret: ctx.ui.warning(_("objcopy (keep-debug) command failed for file '%s'!") % f) - """mark binary/shared objects to use /debug/file.debug""" - p = os.popen("objcopy --add-gnu-debuglink=/debug/%s.debug %s" % (os.path.basename(f), 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)) ret = p.close() if ret: ctx.ui.warning(_("objcopy (add-debuglink) command failed for file '%s'!") % f) @@ -492,13 +496,13 @@ def strip_file(filepath): elif "SB executable" in o: if ctx.config.values.build.debug == "True": - save_elf_debug(filepath) + save_elf_debug(filepath, package_name) run_strip(filepath) return True elif "SB shared object" in o: if ctx.config.values.build.debug == "True": - save_elf_debug(filepath) + save_elf_debug(filepath, package_name) run_strip(filepath, "--strip-unneeded") # FIXME: warn for TEXTREL return True