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 ;)
This commit is contained in:
+38
-4
@@ -75,8 +75,9 @@ def check_path_collision(package, pkgList):
|
|||||||
# collide. Exp:
|
# collide. Exp:
|
||||||
# pinfo.path: /usr/share
|
# pinfo.path: /usr/share
|
||||||
# path.path: /usr/share/doc
|
# path.path: /usr/share/doc
|
||||||
if path.path.endswith(ctx.const.ar_file_suffix) and ctx.get_option('create_static'):
|
if (path.path.endswith(ctx.const.ar_file_suffix) and ctx.get_option('create_static')) or \
|
||||||
# don't throw collision error for ar files.
|
(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..
|
# we'll handle this in gen_files_xml..
|
||||||
continue
|
continue
|
||||||
if util.subpath(pinfo.path, path.path):
|
if util.subpath(pinfo.path, path.path):
|
||||||
@@ -488,6 +489,28 @@ class Builder:
|
|||||||
|
|
||||||
return static_package_obj
|
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):
|
def strip_install_dir(self):
|
||||||
"""strip install directory"""
|
"""strip install directory"""
|
||||||
ctx.ui.action(_("Stripping files.."))
|
ctx.ui.action(_("Stripping files.."))
|
||||||
@@ -555,11 +578,17 @@ class Builder:
|
|||||||
def add_path(path):
|
def add_path(path):
|
||||||
# add the files under material path
|
# add the files under material path
|
||||||
for fpath, fhash in util.get_file_hashes(path, collisions, install_dir):
|
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 fpath.endswith(ctx.const.ar_file_suffix) \
|
||||||
and not package.name.endswith(ctx.const.static_name_suffix) \
|
and not package.name.endswith(ctx.const.static_name_suffix) \
|
||||||
and util.is_ar_file(fpath):
|
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.
|
# don't include this file into the package.
|
||||||
continue
|
continue
|
||||||
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
||||||
@@ -672,6 +701,11 @@ class Builder:
|
|||||||
if obj:
|
if obj:
|
||||||
self.spec.packages.append(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 = []
|
package_names = []
|
||||||
old_package_names = []
|
old_package_names = []
|
||||||
|
|
||||||
|
|||||||
@@ -361,7 +361,9 @@ unpack, setup, build, install, package
|
|||||||
self.parser.add_option("-B", "--ignore-comar", action="store_true",
|
self.parser.add_option("-B", "--ignore-comar", action="store_true",
|
||||||
default=False, help=_("bypass comar configuration agent"))
|
default=False, help=_("bypass comar configuration agent"))
|
||||||
self.parser.add_option("-S", "--create-static", action="store_true",
|
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):
|
def run(self):
|
||||||
|
|||||||
+5
-1
@@ -49,9 +49,13 @@ class Constants:
|
|||||||
self.__c.package_suffix = ".pisi"
|
self.__c.package_suffix = ".pisi"
|
||||||
self.__c.xdelta_suffix = ".xdelta"
|
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
|
# suffix for auto generated ar packages
|
||||||
self.__c.static_name_suffix = "-static" # an admissible use of constant
|
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
|
# directory suffixes for build
|
||||||
self.__c.work_dir_suffix = "/work" # these, too, because we might wanna change 'em
|
self.__c.work_dir_suffix = "/work" # these, too, because we might wanna change 'em
|
||||||
|
|||||||
+4
-4
@@ -525,13 +525,13 @@ def strip_file(filepath):
|
|||||||
|
|
||||||
def save_elf_debug(f):
|
def save_elf_debug(f):
|
||||||
"""copy debug info into file.debug file"""
|
"""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()
|
ret = p.close()
|
||||||
if ret:
|
if ret:
|
||||||
ctx.ui.warning(_("objcopy (keep-debug) command failed for file '%s'!") % f)
|
ctx.ui.warning(_("objcopy (keep-debug) command failed for file '%s'!") % f)
|
||||||
|
|
||||||
"""mark binary/shared objects to use file.debug"""
|
"""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()
|
ret = p.close()
|
||||||
if ret:
|
if ret:
|
||||||
ctx.ui.warning(_("objcopy (add-debuglink) command failed for file '%s'!") % f)
|
ctx.ui.warning(_("objcopy (add-debuglink) command failed for file '%s'!") % f)
|
||||||
@@ -541,13 +541,13 @@ def strip_file(filepath):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
elif "SB executable" in o:
|
elif "SB executable" in o:
|
||||||
if ctx.config.values.build.debug == "True":
|
if ctx.get_option('create_debug'):
|
||||||
save_elf_debug(filepath)
|
save_elf_debug(filepath)
|
||||||
run_strip(filepath)
|
run_strip(filepath)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
elif "SB shared object" in o:
|
elif "SB shared object" in o:
|
||||||
if ctx.config.values.build.debug == "True":
|
if ctx.get_option('create_debug'):
|
||||||
save_elf_debug(filepath)
|
save_elf_debug(filepath)
|
||||||
run_strip(filepath, "--strip-unneeded")
|
run_strip(filepath, "--strip-unneeded")
|
||||||
# FIXME: warn for TEXTREL
|
# FIXME: warn for TEXTREL
|
||||||
|
|||||||
Reference in New Issue
Block a user