[DEV] generic package generation on Linux is back
This commit is contained in:
parent
7e5d8db361
commit
0afb15c5b3
@ -11,12 +11,31 @@ import os
|
||||
from . import debug
|
||||
from . import env
|
||||
|
||||
def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
||||
debug.extreme_verbose("Resuest check of dependency of :")
|
||||
def _file_size(path):
|
||||
if not os.path.isfile(path):
|
||||
return 0
|
||||
statinfo = os.stat(path)
|
||||
return statinfo.st_size
|
||||
|
||||
def _file_read_data(path, binary=False):
|
||||
if not os.path.isfile(path):
|
||||
return ""
|
||||
if binary == True:
|
||||
file = open(path, "rb")
|
||||
else:
|
||||
file = open(path, "r")
|
||||
data_file = file.read()
|
||||
file.close()
|
||||
return data_file
|
||||
|
||||
|
||||
def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine="", force_identical=False):
|
||||
debug.extreme_verbose("Request check of dependency of :")
|
||||
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
||||
debug.extreme_verbose(" str='" + str(src) + "'")
|
||||
debug.extreme_verbose(" dept='" + str(dependFile) + "'")
|
||||
debug.extreme_verbose(" cmd='" + str(file_cmd) + "'")
|
||||
debug.extreme_verbose(" force_identical='" + str(force_identical) + "'")
|
||||
# if force mode selected ==> just force rebuild ...
|
||||
if env.get_force_mode():
|
||||
debug.extreme_verbose(" ==> must rebuild (force mode)")
|
||||
@ -33,7 +52,7 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
||||
and os.path.exists(src) == False:
|
||||
debug.warning(" ==> unexistant file :'" + src + "'")
|
||||
return True
|
||||
# chek the basic date if the 2 files
|
||||
# Check the basic date if the 2 files
|
||||
if dst != "" \
|
||||
and dst != None \
|
||||
and os.path.getmtime(src) > os.path.getmtime(dst):
|
||||
@ -100,6 +119,19 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
||||
return True
|
||||
# close the current file :
|
||||
file.close()
|
||||
# check the 2 files are identical:
|
||||
if force_identical == True:
|
||||
# check if the 2 cmdline are similar :
|
||||
size_src = _file_size(src)
|
||||
size_dst = _file_size(dst)
|
||||
if size_src != size_dst:
|
||||
debug.extreme_verbose(" Force Rewrite not the same size size_src=" + str(size_src) + " != size_dest=" + str(size_dst))
|
||||
return True
|
||||
data_src = _file_read_data(src, binary=True)
|
||||
data_dst = _file_read_data(dst, binary=True)
|
||||
if data_src != data_dst:
|
||||
debug.extreme_verbose(" Force Rewrite not the same data")
|
||||
return True
|
||||
|
||||
debug.extreme_verbose(" ==> Not rebuild (all dependency is OK)")
|
||||
return False
|
||||
|
@ -100,6 +100,8 @@ class Module:
|
||||
}
|
||||
self.sub_heritage_list = None
|
||||
|
||||
def get_type(self):
|
||||
return self.type
|
||||
##
|
||||
## @brief add Some copilation flags for this module (and only this one)
|
||||
##
|
||||
@ -200,66 +202,6 @@ class Module:
|
||||
|
||||
|
||||
|
||||
|
||||
# TODO : REMOVE ........................
|
||||
# TODO : REMOVE ........................
|
||||
# TODO : REMOVE ........................
|
||||
##
|
||||
## @brief Commands for copying files
|
||||
## @deprecated
|
||||
##
|
||||
def image_to_staging(self, binary_name, target):
|
||||
for source, destination, sizeX, sizeY in self.image_to_copy:
|
||||
extension = source[source.rfind('.'):]
|
||||
if extension != ".png" \
|
||||
and extension != ".jpg" \
|
||||
and sizeX > 0:
|
||||
debug.error("Can not manage image other than .png and jpg to resize : " + source);
|
||||
display_source = source
|
||||
source = self.origin_path + "/" + source
|
||||
if destination == "":
|
||||
destination = source[source.rfind('/')+1:]
|
||||
debug.verbose("Regenerate Destination : '" + destination + "'")
|
||||
file_cmd = target.generate_file(binary_name, self.name, self.origin_path, destination, "image")[0]
|
||||
if sizeX > 0:
|
||||
debug.verbose("Image file : " + display_source + " ==> " + destination + " resize=(" + str(sizeX) + "," + str(sizeY) + ")")
|
||||
fileName, fileExtension = os.path.splitext(self.origin_path+"/" + source)
|
||||
target.add_image_staging(source, destination, sizeX, sizeY, file_cmd)
|
||||
else:
|
||||
debug.verbose("Might copy file : " + display_source + " ==> " + destination)
|
||||
target.add_file_staging(source, destination, file_cmd)
|
||||
|
||||
# TODO : REMOVE ........................
|
||||
# TODO : REMOVE ........................
|
||||
# TODO : REMOVE ........................
|
||||
##
|
||||
## @brief Commands for copying files
|
||||
## @deprecated
|
||||
##
|
||||
def files_to_staging(self, binary_name, target):
|
||||
for source, destination in self.files:
|
||||
display_source = source
|
||||
source = self.origin_path + "/" + source
|
||||
if destination == "":
|
||||
destination = source[source.rfind('/')+1:]
|
||||
debug.verbose("Regenerate Destination : '" + destination + "'")
|
||||
file_cmd = target.generate_file(binary_name, self.name, self.origin_path, destination, "image")[0]
|
||||
# TODO : when destination is missing ...
|
||||
debug.verbose("Might copy file : " + display_source + " ==> " + destination)
|
||||
target.add_file_staging(source, destination, file_cmd)
|
||||
|
||||
# TODO : REMOVE ........................
|
||||
# TODO : REMOVE ........................
|
||||
# TODO : REMOVE ........................
|
||||
##
|
||||
## @brief Commands for copying files
|
||||
## @deprecated
|
||||
##
|
||||
def paths_to_staging(self, binary_name, target):
|
||||
for source, destination in self.paths:
|
||||
debug.debug("Might copy path : " + source + "==>" + destination)
|
||||
tools.copy_anything_target(target, self.origin_path + "/" + source, destination)
|
||||
|
||||
def gcov(self, target, generate_output=False):
|
||||
if self.type == 'PREBUILD':
|
||||
debug.error("Can not generate gcov on prebuid system ... : '" + self.name + "'");
|
||||
@ -597,7 +539,7 @@ class Module:
|
||||
self.image_to_build(target)
|
||||
self.files_to_build(target)
|
||||
self.paths_to_build(target)
|
||||
# TODO : do sothing that create a list of file set in this directory and remove it if necessary ... ==> if not needed anymore ...&
|
||||
# TODO : do sothing that create a list of file set in this directory and remove it if necessary ... ==> if not needed anymore ...
|
||||
|
||||
# ----------------------------------------------------
|
||||
# -- create package --
|
||||
@ -615,26 +557,6 @@ class Module:
|
||||
# return local dependency ...
|
||||
return self.sub_heritage_list
|
||||
|
||||
|
||||
|
||||
# TODO : REMOVE ........................
|
||||
# TODO : REMOVE ........................
|
||||
# TODO : REMOVE ........................
|
||||
# call here to build the module
|
||||
def build_tree(self, target, package_name):
|
||||
# ckeck if not previously build
|
||||
if target.is_module_build_tree(self.name)==True:
|
||||
return
|
||||
debug.verbose("build tree of " + self.name)
|
||||
# add all the elements (first added only one keep ==> permit to everload sublib element)
|
||||
self.image_to_staging(package_name, target)
|
||||
self.files_to_staging(package_name, target)
|
||||
self.paths_to_staging(package_name, target)
|
||||
#build tree of all submodules
|
||||
for dep in self.depends:
|
||||
inherit = target.build_tree(dep, package_name)
|
||||
|
||||
|
||||
# call here to clean the module
|
||||
def clean(self, target):
|
||||
if self.type=='PREBUILD':
|
||||
@ -688,9 +610,6 @@ class Module:
|
||||
def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
|
||||
self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
|
||||
|
||||
def add_export_path(self, list, type='c'):
|
||||
self.append_to_internal_list2(self.path["export"], type, list)
|
||||
|
||||
def add_path(self, list, type='c'):
|
||||
self.append_to_internal_list2(self.path["local"], type, list)
|
||||
|
||||
@ -734,8 +653,14 @@ class Module:
|
||||
def add_src_file(self, list):
|
||||
self.append_to_internal_list(self.src, list, True)
|
||||
|
||||
def add_header_file(self, list):
|
||||
def add_header_file(self, list, rm_path=""):
|
||||
if rm_path != "":
|
||||
debug.warning("remove the basic path ...")
|
||||
self.append_to_internal_list(self.header, list, True)
|
||||
# TODO : Maybe do sothing with this ...
|
||||
def add_export_path(self, list, type='c'):
|
||||
self.append_to_internal_list2(self.path["export"], type, list)
|
||||
|
||||
|
||||
def copy_image(self, source, destination='', sizeX=-1, sizeY=-1):
|
||||
self.image_to_copy.append([source, destination, sizeX, sizeY])
|
||||
|
@ -274,7 +274,7 @@ class Target:
|
||||
list=[]
|
||||
if (type=="bin"):
|
||||
list.append(file)
|
||||
list.append(os.path.join(self.get_build_path(binary_name), self.path_bin, module_name + self.suffix_binary))
|
||||
list.append(self.get_build_file_bin(binary_name))
|
||||
list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_dependence))
|
||||
list.append(os.path.join(self.get_build_path(binary_name), self.path_bin, module_name + self.suffix_binary + self.suffix_cmd_line))
|
||||
list.append(os.path.join(self.get_build_path(binary_name), self.path_bin, module_name + self.suffix_binary + self.suffix_warning))
|
||||
@ -321,7 +321,7 @@ class Target:
|
||||
return os.path.join(self.get_build_path(binary_name), self.path_object)
|
||||
|
||||
def get_build_path_bin(self, binary_name):
|
||||
return os.path.join(self.get_build_path(binary_name), self.path_bin, binary_name)
|
||||
return os.path.join(self.get_build_path(binary_name), self.path_bin)
|
||||
|
||||
def get_build_path_lib(self, binary_name):
|
||||
return os.path.join(self.get_build_path(binary_name), self.path_lib, binary_name)
|
||||
@ -333,17 +333,29 @@ class Target:
|
||||
return os.path.join(self.get_build_path(binary_name), self.path_include)
|
||||
|
||||
|
||||
def get_staging_path_bin(self, binary_name):
|
||||
return os.path.join(self.get_staging_path(binary_name), self.path_bin, binary_name)
|
||||
def get_build_file_bin(self, binary_name):
|
||||
return os.path.join(self.get_build_path_bin(binary_name), binary_name + self.suffix_binary)
|
||||
|
||||
def get_staging_path_lib(self, binary_name):
|
||||
return os.path.join(self.get_staging_path(binary_name), self.path_lib, binary_name)
|
||||
|
||||
def get_staging_path_data(self, binary_name):
|
||||
return os.path.join(self.get_staging_path(binary_name), self.path_data, binary_name)
|
||||
|
||||
def get_staging_path_include(self, binary_name):
|
||||
return os.path.join(self.get_staging_path(binary_name), self.path_include)
|
||||
|
||||
def get_staging_path_bin(self, package_name):
|
||||
return os.path.join(self.get_staging_path(package_name), self.path_bin)
|
||||
|
||||
def get_staging_path_lib(self, package_name):
|
||||
return os.path.join(self.get_staging_path(package_name), self.path_lib, package_name)
|
||||
|
||||
def get_staging_path_data(self, package_name):
|
||||
return os.path.join(self.get_staging_path(package_name), self.path_data, package_name)
|
||||
|
||||
def get_staging_path_include(self, package_name):
|
||||
return os.path.join(self.get_staging_path(package_name), self.path_include)
|
||||
|
||||
"""
|
||||
def get_staging_file_bin(self, package_name, binary_name):
|
||||
return os.path.join(self.get_staging_path_bin(package_name), binary_name + self.suffix_binary)
|
||||
"""
|
||||
|
||||
|
||||
|
||||
def get_doc_path(self, module_name):
|
||||
@ -369,7 +381,7 @@ class Target:
|
||||
self.module_list.append(newModule)
|
||||
|
||||
def get_module(self, name):
|
||||
for mod in self.build_done:
|
||||
for mod in self.module_list:
|
||||
if mod.name == name:
|
||||
return mod
|
||||
debug.error("the module '" + str(name) + "'does not exist/already build")
|
||||
|
@ -97,69 +97,58 @@ def add_prefix(prefix,list):
|
||||
result.append(prefix+elem)
|
||||
return result
|
||||
|
||||
def copy_file(src, dst, cmd_file=None, force=False, executable=False):
|
||||
def copy_file(src, dst, cmd_file=None, force=False, force_identical=False):
|
||||
if os.path.exists(src) == False:
|
||||
debug.error("Request a copy a file that does not existed : '" + src + "'")
|
||||
cmd_line = "copy \"" + src + "\" \"" + dst + "\""
|
||||
if force == False \
|
||||
and depend.need_re_build(dst, src, file_cmd=cmd_file , cmdLine=cmd_line) == False:
|
||||
and depend.need_re_build(dst, src, file_cmd=cmd_file , cmdLine=cmd_line, force_identical=force_identical) == False:
|
||||
debug.verbose ("no need to copy ...")
|
||||
return
|
||||
debug.print_element("copy file", src, "==>", dst)
|
||||
debug.print_element("copy file ", os.path.relpath(src), "==>", os.path.relpath(dst))
|
||||
create_directory_of_file(dst)
|
||||
shutil.copyfile(src, dst)
|
||||
if executable == True:
|
||||
os.chmod(dst, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
# copy property of the permition of the file ...
|
||||
stat_info = os.stat(src)
|
||||
os.chmod(dst, stat_info.st_mode)
|
||||
store_command(cmd_line, cmd_file)
|
||||
|
||||
|
||||
def copy_anything(src, dst, recursive = False, executable=False):
|
||||
def copy_anything(src, dst, recursive = False, force_identical=False):
|
||||
debug.verbose(" copy anything : '" + str(src) + "'")
|
||||
debug.verbose(" to : '" + str(dst) + "'")
|
||||
tmpPath = os.path.dirname(os.path.realpath(src))
|
||||
tmpRule = os.path.basename(src)
|
||||
debug.verbose(" " + str(tmpPath) + ":")
|
||||
for root, dirnames, filenames in os.walk(tmpPath):
|
||||
deltaRoot = root[len(tmpPath):]
|
||||
if os.path.isdir(os.path.realpath(src)):
|
||||
tmp_path = os.path.realpath(src)
|
||||
tmp_rule = ""
|
||||
else:
|
||||
tmp_path = os.path.dirname(os.path.realpath(src))
|
||||
tmp_rule = os.path.basename(src)
|
||||
|
||||
debug.verbose(" " + str(tmp_path) + ":")
|
||||
for root, dirnames, filenames in os.walk(tmp_path):
|
||||
deltaRoot = root[len(tmp_path):]
|
||||
if recursive == False \
|
||||
and deltaRoot != "":
|
||||
return
|
||||
debug.verbose(" root='" + str(deltaRoot) + "'") # dir='" + str(dirnames) + "' filenames=" + str(filenames))
|
||||
debug.verbose(" root='" + str(deltaRoot) + "'")
|
||||
debug.verbose(" files=" + str(filenames))
|
||||
tmpList = filenames
|
||||
if len(tmpRule) > 0:
|
||||
tmpList = fnmatch.filter(filenames, tmpRule)
|
||||
if len(tmp_rule) > 0:
|
||||
tmpList = fnmatch.filter(filenames, tmp_rule)
|
||||
# Import the module :
|
||||
for cycleFile in tmpList:
|
||||
#for cycleFile in filenames:
|
||||
debug.verbose(" '" + cycleFile + "'")
|
||||
debug.extreme_verbose("Might copy : '" + tmpPath + "/" + deltaRoot + "/" + cycleFile + "' ==> '" + dst + "'")
|
||||
copy_file(tmpPath + "/" + deltaRoot + "/" + cycleFile,
|
||||
dst + "/" + deltaRoot + "/" + cycleFile,
|
||||
executable=True)
|
||||
|
||||
## @deprecated ...
|
||||
def copy_anything_target(target, src, dst):
|
||||
tmpPath = os.path.dirname(os.path.realpath(src))
|
||||
tmpRule = os.path.basename(src)
|
||||
for root, dirnames, filenames in os.walk(tmpPath):
|
||||
debug.verbose(" root='" + str(root) + "' dir='" + str(dirnames) + "' filenames=" + str(filenames))
|
||||
tmpList = filenames
|
||||
if len(tmpRule)>0:
|
||||
tmpList = fnmatch.filter(filenames, tmpRule)
|
||||
# Import the module :
|
||||
for cycleFile in tmpList:
|
||||
#for cycleFile in filenames:
|
||||
newDst = dst
|
||||
if len(newDst) != 0 \
|
||||
and newDst[-1] != "/":
|
||||
newDst += "/"
|
||||
if root[len(src)-1:] != "":
|
||||
newDst += root[len(src)-1:]
|
||||
if len(newDst) != 0 \
|
||||
and newDst[-1] != "/":
|
||||
newDst += "/"
|
||||
debug.verbose("Might copy : '" + root+"/"+cycleFile + "' ==> '" + newDst+cycleFile + "'" )
|
||||
target.add_file_staging(root+"/"+cycleFile, newDst+cycleFile)
|
||||
|
||||
debug.extreme_verbose("Might copy : '" + tmp_path + "/" + deltaRoot + "/" + cycleFile + "' ==> '" + dst + "'")
|
||||
copy_file(tmp_path + "/" + deltaRoot + "/" + cycleFile,
|
||||
dst + "/" + deltaRoot + "/" + cycleFile,
|
||||
force_identical=force_identical)
|
||||
""" TODO : Might be better, but does not work ...
|
||||
debug.extreme_verbose("Might copy : '" + os.path.join(tmp_path, deltaRoot, cycleFile) + "' ==> '" + dst + "'")
|
||||
copy_file(os.path.join(tmp_path, deltaRoot, cycleFile),
|
||||
os.path.join(dst, deltaRoot, cycleFile),
|
||||
force_identical=force_identical)
|
||||
"""
|
||||
|
||||
def filter_extention(list_files, extentions, invert=False):
|
||||
out = []
|
||||
|
@ -88,7 +88,7 @@ def link(file, binary, target, depancy, name, basic_path):
|
||||
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
||||
return file_dst
|
||||
tools.create_directory_of_file(file_dst)
|
||||
debug.print_element("Executable", name, "==>", file_dst)
|
||||
debug.print_element("Executable", name, "==>", os.path.relpath(file_dst))
|
||||
|
||||
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||
if target.config["mode"] == "release"\
|
||||
|
@ -81,7 +81,7 @@ def link(file, binary, target, depancy, name, basic_path):
|
||||
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
||||
return file_dst
|
||||
tools.create_directory_of_file(file_dst)
|
||||
debug.print_element("SharedLib", name, "==>", file_dst)
|
||||
debug.print_element("SharedLib", name, "==>", os.path.relpath(file_dst))
|
||||
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||
# strip the output file:
|
||||
if target.config["mode"] == "release" \
|
||||
|
@ -66,7 +66,7 @@ def link(file, binary, target, depancy, name, basic_path):
|
||||
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
||||
return file_dst
|
||||
tools.create_directory_of_file(file_dst)
|
||||
debug.print_element("StaticLib", name, "==>", file_dst)
|
||||
debug.print_element("StaticLib", name, "==>", os.path.relpath(file_dst))
|
||||
# explicitly remove the destination to prevent error ...
|
||||
if os.path.exists(file_dst) and os.path.isfile(file_dst):
|
||||
os.remove(file_dst)
|
||||
|
@ -49,11 +49,180 @@ class Target(target.Target):
|
||||
return result
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath, heritage_list, type="generic"):
|
||||
#The package generated depend of the type of the element:
|
||||
end_point_module_name = heritage_list.list_heritage[-1].name
|
||||
module = self.get_module(end_point_module_name)
|
||||
if module == None:
|
||||
debug.error("can not create package ... ");
|
||||
if module.get_type() == 'PREBUILD':
|
||||
#nothing to do ...
|
||||
return
|
||||
if module.get_type() == 'LIBRARY' \
|
||||
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
||||
or module.get_type() == 'LIBRARY_STATIC':
|
||||
debug.info("Can not create package for library");
|
||||
return
|
||||
if module.get_type() == 'BINARY' \
|
||||
or module.get_type() == 'BINARY_STAND_ALONE' \
|
||||
or module.get_type() == 'BINARY_SHARED':
|
||||
self.make_package_generic_binary(pkgName, pkgProperties, basePkgPath, heritage_list)
|
||||
if module.get_type() == 'PACKAGE':
|
||||
debug.info("Can not create package for package");
|
||||
return
|
||||
return
|
||||
|
||||
if type == "debian":
|
||||
self.make_package_debian(pkgName, pkgProperties, basePkgPath, heritage_list)
|
||||
elif type == "generic":
|
||||
self.make_package_generic(pkgName, pkgProperties, basePkgPath, heritage_list)
|
||||
|
||||
|
||||
"""
|
||||
.local/application
|
||||
*--> applName -> applName.app/bin/applName
|
||||
*--> applName.app
|
||||
*--> appl_description.txt
|
||||
*--> appl_name.txt
|
||||
*--> changelog.txt
|
||||
*--> copyright.txt
|
||||
*--> readme.txt
|
||||
*--> version.txt
|
||||
*--> website.txt
|
||||
*--> icon.png
|
||||
*--> bin
|
||||
* *--> applName
|
||||
*--> doc
|
||||
* *--> applName
|
||||
*--> lib
|
||||
* *--> XX.so
|
||||
* *--> YY.so
|
||||
*--> license
|
||||
* *--> applName.txt
|
||||
* *--> libXX.txt
|
||||
* *--> libYY.txt
|
||||
*--> man
|
||||
*--> share
|
||||
* *--> applName
|
||||
* *--> XX
|
||||
* *--> YY
|
||||
*--> sources
|
||||
"""
|
||||
def make_package_generic_binary(self, pkgName, pkgProperties, basePkgPath, heritage_list):
|
||||
debianPkgName = re.sub("_", "-", pkgName)
|
||||
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
#output path
|
||||
target_outpath = os.path.join(self.get_staging_path(pkgName), pkgName + ".app")
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas
|
||||
target_outpath_data = os.path.join(target_outpath, "share")
|
||||
tools.create_directory_of_file(target_outpath_data)
|
||||
debug.debug("heritage for " + str(pkgName) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
path_src = self.get_build_path_data(heritage.name)
|
||||
debug.verbose(" has directory: " + path_src)
|
||||
if os.path.isdir(path_src):
|
||||
# TODO : Add os.path.dirname( for shared elements ... (like this, this add all element in a single os.path.dirname(path_src)
|
||||
debug.debug(" need copy: " + path_src + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
# TODO : We can have a problem when writing over library files ...
|
||||
tools.copy_anything(path_src, target_outpath_data, recursive=True, force_identical=True)
|
||||
|
||||
## Create share datas
|
||||
target_outpath_bin = os.path.join(target_outpath, "bin")
|
||||
tools.create_directory_of_file(target_outpath_bin)
|
||||
path_src = self.get_build_file_bin(pkgName)
|
||||
path_dst = os.path.join(target_outpath_bin, pkgName + self.suffix_binary)
|
||||
debug.warning("path_dst: " + str(path_dst))
|
||||
tools.copy_file(path_src, path_dst)
|
||||
## Create libraries
|
||||
|
||||
|
||||
## Create version file
|
||||
tmpFile = open(target_outpath + "/version.txt", 'w')
|
||||
tmpFile.write(pkgProperties["VERSION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
## Create maintainer file
|
||||
tmpFile = open(target_outpath + "/maintainer.txt", 'w')
|
||||
tmpFile.write(self.generate_list_separate_coma(pkgProperties["MAINTAINER"]))
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
## Create appl_name file
|
||||
tmpFile = open(target_outpath + "/appl_name.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkgProperties["NAME"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
## Create appl_description file
|
||||
tmpFile = open(target_outpath + "/appl_description.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkgProperties["DESCRIPTION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
## Create Readme file
|
||||
readmeFileDest = target_outpath + "/readme.txt"
|
||||
if os.path.exists(basePkgPath + "/os-Linux/README")==True:
|
||||
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(basePkgPath + "/README")==True:
|
||||
tools.copy_file(basePkgPath + "/README", readmeFileDest)
|
||||
elif os.path.exists(basePkgPath + "/README.md")==True:
|
||||
tools.copy_file(basePkgPath + "/README.md", readmeFileDest)
|
||||
else:
|
||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
||||
tmpFile = open(readmeFileDest, 'w')
|
||||
tmpFile.write("No documentation for " + pkgName + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
## Create licence file
|
||||
licenseFileDest = target_outpath + "/license/"+ debianPkgName + ".txt"
|
||||
tools.create_directory_of_file(licenseFileDest)
|
||||
if os.path.exists(basePkgPath + "/license.txt")==True:
|
||||
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(licenseFileDest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkgName + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
## Create changeLog file
|
||||
changeLogFileDest = target_outpath + "/changelog.txt"
|
||||
if os.path.exists(basePkgPath + "/changelog") == True:
|
||||
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(changeLogFileDest, 'w')
|
||||
tmpFile.write("No changelog data " + pkgName + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
## copy share path
|
||||
#debug.info("plop:" + self.get_staging_path(pkgName) + self.path_data)
|
||||
if os.path.exists(self.get_staging_path(pkgName) + self.path_data) == True:
|
||||
tools.copy_anything(self.get_staging_path(pkgName) + self.path_data + "/*", target_outpath + self.path_data, recursive=True)
|
||||
|
||||
## Create binary path:
|
||||
bin_path = target_outpath + self.path_bin
|
||||
#tools.create_directory_of_file(bin_path)
|
||||
tools.copy_anything(self.get_staging_path(pkgName) + self.path_bin + "/*",
|
||||
bin_path)
|
||||
|
||||
## create the package:
|
||||
debug.debug("package : " + self.get_staging_path(pkgName) + "/" + debianPkgName + ".app.pkg")
|
||||
os.system("cd " + self.get_staging_path(pkgName) + " ; tar -czf " + pkgName + ".app.tar.gz " + pkgName + ".app")
|
||||
#multiprocess.run_command("cd " + self.get_staging_path(pkgName) + " ; tar -czf " + pkgName + ".app.tar.gz " + pkgName + ".app")
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path(pkgName) + "/" + pkgName + ".app.tar.gz", self.get_final_path() + "/" + pkgName + ".app.gpkg")
|
||||
|
||||
|
||||
def make_package_debian(self, pkgName, pkgProperties, basePkgPath, heritage_list):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debianPkgName = re.sub("_", "-", pkgName)
|
||||
@ -61,9 +230,9 @@ class Target(target.Target):
|
||||
debug.info("Generate package '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
self.get_staging_path(pkgName)
|
||||
targetOutpathDebian = self.get_staging_path(pkgName) + "/DEBIAN/"
|
||||
finalFileControl = targetOutpathDebian + "control"
|
||||
finalFilepostRm = targetOutpathDebian + "postrm"
|
||||
target_outpathDebian = self.get_staging_path(pkgName) + "/DEBIAN/"
|
||||
finalFileControl = target_outpathDebian + "control"
|
||||
finalFilepostRm = target_outpathDebian + "postrm"
|
||||
# create the paths :
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tools.create_directory_of_file(finalFilepostRm)
|
||||
@ -186,30 +355,30 @@ class Target(target.Target):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
targetOutpath = self.get_staging_path(pkgName) + "/edn.app/"
|
||||
tools.create_directory_of_file(targetOutpath)
|
||||
target_outpath = self.get_staging_path(pkgName) + "/edn.app/"
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
## Create version file
|
||||
tmpFile = open(targetOutpath + "/version.txt", 'w')
|
||||
tmpFile = open(target_outpath + "/version.txt", 'w')
|
||||
tmpFile.write(pkgProperties["VERSION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create maintainer file
|
||||
tmpFile = open(targetOutpath + "/maintainer.txt", 'w')
|
||||
tmpFile = open(target_outpath + "/maintainer.txt", 'w')
|
||||
tmpFile.write(self.generate_list_separate_coma(pkgProperties["MAINTAINER"]))
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create appl_name file
|
||||
tmpFile = open(targetOutpath + "/appl_name.txt", 'w')
|
||||
tmpFile = open(target_outpath + "/appl_name.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkgProperties["NAME"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create appl_description file
|
||||
tmpFile = open(targetOutpath + "/appl_description.txt", 'w')
|
||||
tmpFile = open(target_outpath + "/appl_description.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkgProperties["DESCRIPTION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create Readme file
|
||||
readmeFileDest = targetOutpath + "/readme.txt"
|
||||
readmeFileDest = target_outpath + "/readme.txt"
|
||||
if os.path.exists(basePkgPath + "/os-Linux/README")==True:
|
||||
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(basePkgPath + "/README")==True:
|
||||
@ -223,7 +392,7 @@ class Target(target.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create licence file
|
||||
licenseFileDest = targetOutpath + "/license/"+ debianPkgName + ".txt"
|
||||
licenseFileDest = target_outpath + "/license/"+ debianPkgName + ".txt"
|
||||
tools.create_directory_of_file(licenseFileDest)
|
||||
if os.path.exists(basePkgPath + "/license.txt")==True:
|
||||
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest)
|
||||
@ -234,7 +403,7 @@ class Target(target.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create changeLog file
|
||||
changeLogFileDest = targetOutpath + "/changelog.txt"
|
||||
changeLogFileDest = target_outpath + "/changelog.txt"
|
||||
if os.path.exists(basePkgPath + "/changelog") == True:
|
||||
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest)
|
||||
else:
|
||||
@ -246,14 +415,13 @@ class Target(target.Target):
|
||||
## copy share path
|
||||
#debug.info("plop:" + self.get_staging_path(pkgName) + self.path_data)
|
||||
if os.path.exists(self.get_staging_path(pkgName) + self.path_data) == True:
|
||||
tools.copy_anything(self.get_staging_path(pkgName) + self.path_data + "/*", targetOutpath + self.path_data, recursive=True)
|
||||
tools.copy_anything(self.get_staging_path(pkgName) + self.path_data + "/*", target_outpath + self.path_data, recursive=True)
|
||||
|
||||
## Create binary path:
|
||||
bin_path = targetOutpath + self.path_bin
|
||||
bin_path = target_outpath + self.path_bin
|
||||
#tools.create_directory_of_file(bin_path)
|
||||
tools.copy_anything(self.get_staging_path(pkgName) + self.path_bin + "/*",
|
||||
bin_path,
|
||||
executable=True)
|
||||
bin_path)
|
||||
|
||||
## create the package:
|
||||
debug.debug("package : " + self.get_staging_path(pkgName) + "/" + debianPkgName + ".app.pkg")
|
||||
|
Loading…
x
Reference in New Issue
Block a user