[Uludag-commits] r7131 - in trunk/pisi/pisi: . cli
svn-uludag at uludag.org.tr
svn-uludag at uludag.org.tr
17 Nis 2006 Pzt 01:26:08 EEST
Author: meren
Date: Mon Apr 17 01:26:05 2006
New Revision: 7131
Modified:
trunk/pisi/pisi/build.py
trunk/pisi/pisi/cli/commands.py
trunk/pisi/pisi/constants.py
trunk/pisi/pisi/util.py
Log:
fixex #2559
--create-debug opsiyonu ile build esnasında oluşturulacak debug dosyaları on-the-fly oluşturulan bir PAKET-debug.pisi paketine doldurulacak. sonra oynarsınız onla işte.
daha sonra tekrar dönülüp temizlenecek bir iki FIXME var kod içerisinde, hemen kızmayın ;)
Modified: trunk/pisi/pisi/build.py
=================================================================
--- trunk/pisi/pisi/build.py (original)
+++ trunk/pisi/pisi/build.py Mon Apr 17 01:26:05 2006
@@ -75,8 +75,9 @@
# collide. Exp:
# pinfo.path: /usr/share
# path.path: /usr/share/doc
- if path.path.endswith(ctx.const.ar_file_suffix) and ctx.get_option('create_static'):
- # don't throw collision error for ar files.
+ if (path.path.endswith(ctx.const.ar_file_suffix) and ctx.get_option('create_static')) or \
+ (path.path.endswith(ctx.const.debug_file_suffix) and ctx.get_option('create_debug')):
+ # don't throw collision error for these files.
# we'll handle this in gen_files_xml..
continue
if util.subpath(pinfo.path, path.path):
@@ -488,6 +489,28 @@
return static_package_obj
+ def generate_debug_package_object(self):
+ debug_files = []
+ for root, dirs, files in os.walk(self.pkg_install_dir()):
+ for f in files:
+ if f.endswith(ctx.const.debug_file_suffix):
+ debug_files.append(util.join_path(root, f))
+
+ if not len(debug_files):
+ return None
+
+ static_package_obj = pisi.specfile.Package()
+ static_package_obj.name = self.spec.source.name + ctx.const.debug_name_suffix
+ # FIXME: find a better way to deal with the summary and description constants.
+ static_package_obj.summary['en'] = u'Debug files for %s' % (self.spec.source.name)
+ static_package_obj.description['en'] = u'Debug files for %s' % (self.spec.source.name)
+ static_package_obj.partOf = 'library:debug'
+ for f in debug_files:
+ static_package_obj.files.append(pisi.specfile.Path(path = f[len(self.pkg_install_dir()):], fileType = "debug"))
+ static_package_obj.packageDependencies.append(pisi.dependency.Dependency(package = self.spec.source.name))
+
+ return static_package_obj
+
def strip_install_dir(self):
"""strip install directory"""
ctx.ui.action(_("Stripping files.."))
@@ -555,11 +578,17 @@
def add_path(path):
# add the files under material path
for fpath, fhash in util.get_file_hashes(path, collisions, install_dir):
- if ctx.get_option('create_static') \
+ if ctx.get_option('create_static') \
and fpath.endswith(ctx.const.ar_file_suffix) \
and not package.name.endswith(ctx.const.static_name_suffix) \
and util.is_ar_file(fpath):
- # if this is an ar file, and this package is not a -static package,
+ # if this is an ar file, and this package is not a static package,
+ # don't include this file into the package.
+ continue
+ if ctx.get_option('create_debug') \
+ and fpath.endswith(ctx.const.debug_file_suffix) \
+ and not package.name.endswith(ctx.const.debug_name_suffix):
+ # if this is a debug file, and this package is not a debug package,
# don't include this file into the package.
continue
frpath = util.removepathprefix(install_dir, fpath) # relative path
@@ -672,6 +701,11 @@
if obj:
self.spec.packages.append(obj)
+ if ctx.get_option('create_debug'):
+ obj = self.generate_debug_package_object()
+ if obj:
+ self.spec.packages.append(obj)
+
package_names = []
old_package_names = []
Modified: trunk/pisi/pisi/cli/commands.py
=================================================================
--- trunk/pisi/pisi/cli/commands.py (original)
+++ trunk/pisi/pisi/cli/commands.py Mon Apr 17 01:26:05 2006
@@ -361,7 +361,9 @@
self.parser.add_option("-B", "--ignore-comar", action="store_true",
default=False, help=_("bypass comar configuration agent"))
self.parser.add_option("-S", "--create-static", action="store_true",
- default=False, help=_("automatically create a *-static package with ar files"))
+ default=False, help=_("automatically create a static package with ar files"))
+ self.parser.add_option("-g", "--create-debug", action="store_true",
+ default=False, help=_("automatically create a debug package with debug files"))
def run(self):
Modified: trunk/pisi/pisi/constants.py
=================================================================
--- trunk/pisi/pisi/constants.py (original)
+++ trunk/pisi/pisi/constants.py Mon Apr 17 01:26:05 2006
@@ -49,9 +49,13 @@
self.__c.package_suffix = ".pisi"
self.__c.xdelta_suffix = ".xdelta"
+ # suffix for auto generated debug packages
+ self.__c.debug_name_suffix = "-debug"
+ self.__c.debug_file_suffix = ".debug"
+
# suffix for auto generated ar packages
self.__c.static_name_suffix = "-static" # an admissible use of constant
- self.__c.ar_file_suffix = ".a"
+ self.__c.ar_file_suffix = ".a"
# directory suffixes for build
self.__c.work_dir_suffix = "/work" # these, too, because we might wanna change 'em
Modified: trunk/pisi/pisi/util.py
=================================================================
--- trunk/pisi/pisi/util.py (original)
+++ trunk/pisi/pisi/util.py Mon Apr 17 01:26:05 2006
@@ -525,13 +525,13 @@
def save_elf_debug(f):
"""copy debug info into file.debug file"""
- p = os.popen("objcopy --only-keep-debug %s %s.debug" % (f, f))
+ p = os.popen("objcopy --only-keep-debug %s %s%s" % (f, f, ctx.const.debug_file_suffix))
ret = p.close()
if ret:
ctx.ui.warning(_("objcopy (keep-debug) command failed for file '%s'!") % f)
"""mark binary/shared objects to use file.debug"""
- p = os.popen("objcopy --add-gnu-debuglink=%s.debug %s" % (f, f))
+ p = os.popen("objcopy --add-gnu-debuglink=%s%s %s" % (f, ctx.const.debug_file_suffix, f))
ret = p.close()
if ret:
ctx.ui.warning(_("objcopy (add-debuglink) command failed for file '%s'!") % f)
@@ -541,13 +541,13 @@
return True
elif "SB executable" in o:
- if ctx.config.values.build.debug == "True":
+ if ctx.get_option('create_debug'):
save_elf_debug(filepath)
run_strip(filepath)
return True
elif "SB shared object" in o:
- if ctx.config.values.build.debug == "True":
+ if ctx.get_option('create_debug'):
save_elf_debug(filepath)
run_strip(filepath, "--strip-unneeded")
# FIXME: warn for TEXTREL
Uludag-commits mesaj listesiyle ilgili
daha fazla bilgi