Merge branch 'develop' into 'master'

fix package huge build time

See merge request sulinos/devel/inary!29
...@@ -145,7 +145,6 @@ def exclude_special_files(filepath, fileinfo, keeplist): ...@@ -145,7 +145,6 @@ def exclude_special_files(filepath, fileinfo, keeplist):
new_ladata) new_ladata)
if new_ladata != ladata: if new_ladata != ladata:
open(filepath, "w").write(new_ladata) open(filepath, "w").write(new_ladata)
for name, pattern in list(patterns.items()): for name, pattern in list(patterns.items()):
if name in keeplist: if name in keeplist:
continue continue
...@@ -170,16 +169,13 @@ def strip_debug_action(filepath, fileinfo, install_dir,excludelist): ...@@ -170,16 +169,13 @@ def strip_debug_action(filepath, fileinfo, install_dir,excludelist):
if path.startswith(excludelist): if path.startswith(excludelist):
return return
outputpath = util.join_path(os.path.dirname(install_dir), outputpath = util.join_path(os.path.dirname(install_dir),
ctx.const.debug_dir_suffix, ctx.const.debug_dir_suffix,
ctx.const.debug_files_suffix, ctx.const.debug_files_suffix,
path) path)
if util.strip_file(filepath, fileinfo, outputpath): if util.strip_file(filepath, fileinfo, outputpath):
ctx.ui.info("{0} [{1}]".format(path, "stripped"), verbose=True) ctx.ui.info("{0} [{1}]".format(path, "stripped"), verbose=True)
class Builder: class Builder:
"""Provides the package build and creation routines""" """Provides the package build and creation routines"""
...@@ -272,6 +268,7 @@ class Builder: ...@@ -272,6 +268,7 @@ class Builder:
self.has_ccache = False self.has_ccache = False
self.has_icecream = False self.has_icecream = False
self.variable_buffer={}
def set_spec_file(self, specuri): def set_spec_file(self, specuri):
...@@ -719,11 +716,15 @@ class Builder: ...@@ -719,11 +716,15 @@ class Builder:
fname, e)) fname, e))
def get_action_variable(self,name,default): def get_action_variable(self,name,default):
(ret, out , err) = util.run_batch('python3 -c \'import sys\nsys.path.append("{1}")\nimport actions\nsys.stdout.write(actions.{0})\''.format(name,os.getcwd())) if name in self.variable_buffer.keys():
if ret == 0: return self.variable_buffer[name]
return out
else: else:
return default (ret, out , err) = util.run_batch('python3 -c \'import sys\nsys.path.append("{1}")\nimport actions\nsys.stdout.write(actions.{0})\''.format(name,os.getcwd()))
if ret == 0:
self.variable_buffer[name]=out
return out
else:
return default
def pkg_src_dir(self): def pkg_src_dir(self):
"""Returns the real path of WorkDir for an unpacked archive.""" """Returns the real path of WorkDir for an unpacked archive."""
...@@ -968,6 +969,9 @@ class Builder: ...@@ -968,6 +969,9 @@ class Builder:
metadata.package.installedSize = int(size) metadata.package.installedSize = int(size)
self.metadata = metadata self.metadata = metadata
if int(size) == 0:
return False
return True
def gen_files_xml(self, package): def gen_files_xml(self, package):
"""Generates files.xml using the path definitions in specfile and """Generates files.xml using the path definitions in specfile and
...@@ -1063,6 +1067,8 @@ It is dangerous. So, if you wanna create stable packages, please fix \ ...@@ -1063,6 +1067,8 @@ It is dangerous. So, if you wanna create stable packages, please fix \
this issue in your workplace. Probably installing \"python3-filemagic\" \ this issue in your workplace. Probably installing \"python3-filemagic\" \
package might be a good solution.")) package might be a good solution."))
self.nostrip=tuple(self.get_action_variable("NoStrip", []))
self.keepspecial=self.get_action_variable("KeepSpecial", [])
for root, dirs, files in os.walk(install_dir): for root, dirs, files in os.walk(install_dir):
for fn in files: for fn in files:
filepath = util.join_path(root, fn) filepath = util.join_path(root, fn)
...@@ -1073,7 +1079,6 @@ package might be a good solution.")) ...@@ -1073,7 +1079,6 @@ package might be a good solution."))
ctx.ui.warning( ctx.ui.warning(
_("File \"{}\" might be a broken symlink. Check it before publishing package.".format(filepath))) _("File \"{}\" might be a broken symlink. Check it before publishing package.".format(filepath)))
fileinfo = "broken symlink" fileinfo = "broken symlink"
ctx.ui.info( ctx.ui.info(
_("\'magic\' return of \"{0}\" is \"{1}\"").format( _("\'magic\' return of \"{0}\" is \"{1}\"").format(
filepath, fileinfo), verbose=True) filepath, fileinfo), verbose=True)
...@@ -1092,8 +1097,9 @@ package might be a good solution.")) ...@@ -1092,8 +1097,9 @@ package might be a good solution."))
strip_debug_action( strip_debug_action(
filepath, filepath,
fileinfo, fileinfo,
install_dir,tuple(self.get_action_variable("NoStrip", []))) install_dir,self.nostrip)
exclude_special_files(filepath, fileinfo,self.get_action_variable("KeepSpecial", [])) exclude_special_files(filepath, fileinfo,self.keepspecial)
def build_packages(self): def build_packages(self):
"""Build each package defined in PSPEC file. After this process there """Build each package defined in PSPEC file. After this process there
...@@ -1106,6 +1112,9 @@ package might be a good solution.")) ...@@ -1106,6 +1112,9 @@ package might be a good solution."))
doc_ptrn = re.compile(ctx.const.doc_package_end) doc_ptrn = re.compile(ctx.const.doc_package_end)
self.fetch_component() # bug 856 self.fetch_component() # bug 856
ctx.ui.status(
_("Running file actions: \"{}\"").format(
self.spec.source.name), push_screen=True)
# Operations and filters for package files # Operations and filters for package files
self.file_actions() self.file_actions()
...@@ -1192,10 +1201,15 @@ package might be a good solution.")) ...@@ -1192,10 +1201,15 @@ package might be a good solution."))
package.name)) package.name))
continue continue
if not self.gen_metadata_xml(package):
ctx.ui.warning(
_("Ignoring empty package: \"{}\"").format(
package.name))
continue
ctx.ui.status( ctx.ui.status(
_("Building package: \"{}\"").format( _("Building package: \"{}\"").format(
package.name), push_screen=True) package.name), push_screen=True)
self.gen_metadata_xml(package)
name = self.package_filename(self.metadata.package) name = self.package_filename(self.metadata.package)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment