[DEV] continue integration of the isolated build methodologie
This commit is contained in:
parent
21af5be1a3
commit
a070f64716
@ -128,7 +128,7 @@ class HeritageList:
|
||||
|
||||
|
||||
class heritage:
|
||||
def __init__(self, module):
|
||||
def __init__(self, module, target):
|
||||
self.name = ""
|
||||
self.depends = []
|
||||
## Remove all variable to prevent error of multiple definition
|
||||
@ -140,6 +140,7 @@ class heritage:
|
||||
'static':[]
|
||||
}
|
||||
self.path = {}
|
||||
self.include = ""
|
||||
# update is set at true when data are newly created ==> force upper element to update
|
||||
self.hasBeenUpdated=False
|
||||
|
||||
@ -150,6 +151,10 @@ class heritage:
|
||||
# keep reference because the flags can change in time
|
||||
self.flags = module.flags["export"]
|
||||
self.path = module.path["export"]
|
||||
# if the user install some header ==> they will ba autoamaticaly exported ...
|
||||
if target != None:
|
||||
if len(module.header) > 0:
|
||||
self.include = target.get_build_path_include(module.name)
|
||||
|
||||
def add_depends(self, elements):
|
||||
self.depends.append(elements)
|
||||
@ -178,6 +183,13 @@ class heritage:
|
||||
debug.error("try add element none in a list ...")
|
||||
append_to_list(self.src, elements)
|
||||
|
||||
def auto_add_build_header(self):
|
||||
if self.include != "":
|
||||
# TODO :Set it better :
|
||||
if 'c' not in self.path:
|
||||
self.path['c'] = []
|
||||
self.path['c'].append(self.include)
|
||||
|
||||
def need_update(self, list):
|
||||
self.hasBeenUpdated=True
|
||||
|
||||
|
@ -79,7 +79,7 @@ class Module:
|
||||
raise 'Input value error'
|
||||
self.origin_file = file;
|
||||
self.origin_path = tools.get_current_path(self.origin_file)
|
||||
self.local_heritage = heritage.heritage(self)
|
||||
self.local_heritage = heritage.heritage(self, None)
|
||||
|
||||
self.package_prop = { "COMPAGNY_TYPE" : set(""),
|
||||
"COMPAGNY_NAME" : set(""),
|
||||
@ -311,10 +311,10 @@ class Module:
|
||||
# ckeck if not previously build
|
||||
if target.is_module_build(self.name)==True:
|
||||
if self.sub_heritage_list == None:
|
||||
self.local_heritage = heritage.heritage(self)
|
||||
self.local_heritage = heritage.heritage(self, target)
|
||||
return self.sub_heritage_list
|
||||
# create the package heritage
|
||||
self.local_heritage = heritage.heritage(self)
|
||||
self.local_heritage = heritage.heritage(self, target)
|
||||
|
||||
if package_name==None \
|
||||
and ( self.type == 'BINARY'
|
||||
@ -549,8 +549,7 @@ class Module:
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: 'binary'")
|
||||
else:
|
||||
debug.error("Dit not know the element type ... (impossible case) type=" + self.type)
|
||||
self.sub_heritage_list.add_heritage(self.local_heritage)
|
||||
debug.error("Did not known the element type ... (impossible case) type=" + self.type)
|
||||
|
||||
# ----------------------------------------------------
|
||||
# -- install header --
|
||||
@ -570,11 +569,15 @@ class Module:
|
||||
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 ...
|
||||
|
||||
# create local heritage specification
|
||||
self.local_heritage.auto_add_build_header()
|
||||
self.sub_heritage_list.add_heritage(self.local_heritage)
|
||||
|
||||
# ----------------------------------------------------
|
||||
# -- create package --
|
||||
# ----------------------------------------------------
|
||||
if self.type=='BINARY' \
|
||||
or self.type=="PACKAGE":
|
||||
if self.type[:6] == 'BINARY' \
|
||||
or self.type == 'PACKAGE':
|
||||
if target.end_generate_package == True:
|
||||
# generate the package with his properties ...
|
||||
if target.name=="Android":
|
||||
@ -686,6 +689,7 @@ class Module:
|
||||
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)
|
||||
|
@ -41,7 +41,7 @@ class System:
|
||||
if True==order:
|
||||
listout.sort()
|
||||
|
||||
def append_to_internalList(self, listout, list, order=False):
|
||||
def append_to_internal_list(self, listout, list, order=False):
|
||||
if type(list) == type(str()):
|
||||
self.append_and_check(listout, list, order)
|
||||
else:
|
||||
@ -50,22 +50,22 @@ class System:
|
||||
self.append_and_check(listout, elem, order)
|
||||
|
||||
def add_export_flag_LD(self, list):
|
||||
self.append_to_internalList(self.export_flags_ld, list)
|
||||
self.append_to_internal_list(self.export_flags_ld, list)
|
||||
|
||||
def add_export_flag_CC(self, list):
|
||||
self.append_to_internalList(self.export_flags_cc, list)
|
||||
self.append_to_internal_list(self.export_flags_cc, list)
|
||||
|
||||
def add_export_flag_XX(self, list):
|
||||
self.append_to_internalList(self.export_flags_xx, list)
|
||||
self.append_to_internal_list(self.export_flags_xx, list)
|
||||
|
||||
def add_export_flag_M(self, list):
|
||||
self.append_to_internalList(self.export_flags_m, list)
|
||||
self.append_to_internal_list(self.export_flags_m, list)
|
||||
|
||||
def add_export_flag_MM(self, list):
|
||||
self.append_to_internalList(self.export_flags_mm, list)
|
||||
self.append_to_internal_list(self.export_flags_mm, list)
|
||||
|
||||
def add_export_SRC(self, list):
|
||||
self.append_to_internalList(self.export_src, list)
|
||||
self.append_to_internal_list(self.export_src, list)
|
||||
|
||||
def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None):
|
||||
if name_of_state not in self.action_on_state:
|
||||
@ -158,7 +158,7 @@ def exist(lib_name, target_name, target) :
|
||||
data["system"] = theSystem.System(target)
|
||||
data["exist"] = data["system"].valid
|
||||
except:
|
||||
debug.debug("Not find: '" + data["name"] + "'")
|
||||
debug.warning("Not find: '" + data["name"] + "' ==> get exception")
|
||||
return data["exist"]
|
||||
return False
|
||||
|
||||
|
@ -78,8 +78,8 @@ class Target:
|
||||
self.suffix_warning='.warning'
|
||||
self.suffix_dependence='.d'
|
||||
self.suffix_obj='.o'
|
||||
self.prefix_lib='lib'
|
||||
self.suffix_lib_static='.a'
|
||||
self.prefix_lib_dynamic='lib'
|
||||
self.suffix_lib_dynamic='.so'
|
||||
self.suffix_binary=''
|
||||
self.suffix_package='.deb'
|
||||
@ -277,20 +277,20 @@ class Target:
|
||||
list.append(file)
|
||||
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))
|
||||
list.append(self.get_build_file_bin(binary_name) + self.suffix_cmd_line)
|
||||
list.append(self.get_build_file_bin(binary_name) + self.suffix_warning)
|
||||
elif (type=="lib-shared"):
|
||||
list.append(file)
|
||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, self.prefix_lib_dynamic + module_name + self.suffix_lib_dynamic))
|
||||
list.append(self.get_build_file_dynamic(module_name))
|
||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_dependence))
|
||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_dynamic + self.suffix_cmd_line))
|
||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_dynamic + self.suffix_warning))
|
||||
list.append(self.get_build_file_dynamic(module_name) + self.suffix_cmd_line)
|
||||
list.append(self.get_build_file_dynamic(module_name) + self.suffix_warning)
|
||||
elif (type=="lib-static"):
|
||||
list.append(file)
|
||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_static))
|
||||
list.append(self.get_build_file_static(module_name))
|
||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_dependence))
|
||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_static + self.suffix_cmd_line))
|
||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_static + self.suffix_warning))
|
||||
list.append(self.get_build_file_static(module_name) + self.suffix_cmd_line)
|
||||
list.append(self.get_build_file_static(module_name) + self.suffix_warning)
|
||||
elif (type=="jar"):
|
||||
list.append(file)
|
||||
list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar"))
|
||||
@ -325,7 +325,7 @@ class Target:
|
||||
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)
|
||||
return os.path.join(self.get_build_path(binary_name), self.path_lib)
|
||||
|
||||
def get_build_path_data(self, binary_name):
|
||||
return os.path.join(self.get_build_path(binary_name), self.path_data, binary_name)
|
||||
@ -337,6 +337,12 @@ class Target:
|
||||
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_build_file_static(self, binary_name):
|
||||
return os.path.join(self.get_build_path_lib(binary_name), self.prefix_lib + binary_name + self.suffix_lib_static)
|
||||
|
||||
def get_build_file_dynamic(self, binary_name):
|
||||
return os.path.join(self.get_build_path_lib(binary_name), self.prefix_lib + binary_name + self.suffix_lib_dynamic)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -50,16 +50,17 @@ def link(file, binary, target, depancy, name, basic_path, static = False):
|
||||
list_static = depancy.src['static']
|
||||
# get only parent shared that is not static
|
||||
for elem in depancy.src['dynamic']:
|
||||
if elem[:-len(target.suffix_lib_dynamic)] + target.suffix_lib_static not in depancy.src['static']:
|
||||
lib_name = elem[:-len(target.suffix_lib_dynamic)] + target.suffix_lib_static
|
||||
if lib_name not in depancy.src['static']:
|
||||
list_dynamic.append(elem)
|
||||
else:
|
||||
#get all parent dynamic libs
|
||||
list_dynamic = depancy.src['dynamic']
|
||||
# get only parent shared that is not static
|
||||
for elem in depancy.src['static']:
|
||||
if elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic not in depancy.src['dynamic']:
|
||||
lib_name = elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic
|
||||
if lib_name not in depancy.src['dynamic']:
|
||||
list_static.append(elem)
|
||||
|
||||
#create comand line:
|
||||
cmd = [
|
||||
target.xx
|
||||
@ -95,10 +96,12 @@ def link(file, binary, target, depancy, name, basic_path, static = False):
|
||||
try:
|
||||
for elem in list_dynamic:
|
||||
lib_path = os.path.dirname(elem)
|
||||
lib_name = elem[len(lib_path)+len(target.prefix_lib_dynamic)+1:-len(target.suffix_lib_dynamic)]
|
||||
lib_name = elem[len(lib_path)+len(target.prefix_lib)+1:-len(target.suffix_lib_dynamic)]
|
||||
cmd.append("-L" + lib_path)
|
||||
cmd.append("-l" + lib_name)
|
||||
#cmd.append(parents['dynamic'])
|
||||
if len(list_dynamic) > 0:
|
||||
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
|
@ -65,7 +65,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path):
|
||||
out += elem
|
||||
cmd.append(out)
|
||||
class_extern = []
|
||||
upper_jar = tools.filter_extention(depancy.src, ["jar"])
|
||||
upper_jar = tools.filter_extention(depancy.src['src'], ["jar"])
|
||||
#debug.warning("ploppppp = " + str(upper_jar))
|
||||
for elem in upper_jar:
|
||||
class_extern.append(elem)
|
||||
|
@ -40,6 +40,13 @@ def get_output_type():
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_path):
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-shared")
|
||||
#get all parent dynamic libs
|
||||
list_dynamic = depancy.src['dynamic']
|
||||
# get only parent shared that is not static
|
||||
list_static = []
|
||||
for elem in depancy.src['static']:
|
||||
if elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic not in depancy.src['dynamic']:
|
||||
list_static.append(elem)
|
||||
#create command Line
|
||||
cmd = [
|
||||
target.xx,
|
||||
@ -60,7 +67,21 @@ def link(file, binary, target, depancy, name, basic_path):
|
||||
pass
|
||||
try:
|
||||
# keep only compilated files ...
|
||||
cmd.append(tools.filter_extention(depancy.src, get_input_type()))
|
||||
cmd.append(tools.filter_extention(depancy.src['src'], get_input_type()))
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(list_static)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
for elem in list_dynamic:
|
||||
lib_path = os.path.dirname(elem)
|
||||
lib_name = elem[len(lib_path)+len(target.prefix_lib)+1:-len(target.suffix_lib_dynamic)]
|
||||
cmd.append("-L" + lib_path)
|
||||
cmd.append("-l" + lib_name)
|
||||
if len(list_dynamic) > 0:
|
||||
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
|
@ -65,6 +65,7 @@ def link(file, binary, target, depancy, name, basic_path):
|
||||
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
||||
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, "==>", os.path.relpath(file_dst))
|
||||
# explicitly remove the destination to prevent error ...
|
||||
|
@ -20,7 +20,7 @@ class System(system.System):
|
||||
# todo : Check if present ...
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_SRC(target.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar")
|
||||
self.add_export_SRC(target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar")
|
||||
self.add_action("PACKAGE", 10, "admod-auto-wrapper", tool_generate_main_java_class)
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ class System(system.System):
|
||||
# TODO : Check if the android sdk android.jar is present ...
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_SRC(target.folder_sdk + "/platforms/android-" + str(target.boardId) + "/android.jar")
|
||||
self.add_export_SRC(target.path_sdk + "/platforms/android-" + str(target.boardId) + "/android.jar")
|
||||
self.add_export_flag_LD("-ldl")
|
||||
self.add_export_flag_LD("-llog")
|
||||
self.add_export_flag_LD("-landroid")
|
||||
|
@ -76,11 +76,12 @@ class Target(target.Target):
|
||||
if not os.path.isdir(basepathX86):
|
||||
debug.info("Gcc x86 path does not exist !!!")
|
||||
|
||||
self.path_bin="/mustNotCreateBinary"
|
||||
self.path_lib="/data/lib/armeabi"
|
||||
self.path_data="/data/assets"
|
||||
self.path_doc="/doc"
|
||||
self.suffix_package='.pkg'
|
||||
# TODO : Set it back in the package only ...
|
||||
#self.path_bin="/mustNotCreateBinary"
|
||||
#self.path_lib="/data/lib/armeabi"
|
||||
#self.path_data="/data/assets"
|
||||
#self.path_doc="/doc"
|
||||
#self.suffix_package='.pkg'
|
||||
|
||||
# board id at 14 is for android 4.0 and more ...
|
||||
self.boardId = 14
|
||||
@ -203,8 +204,10 @@ class Target(target.Target):
|
||||
return True
|
||||
return False
|
||||
|
||||
"""
|
||||
def get_staging_path_data(self, binaryName):
|
||||
return self.get_staging_path(binaryName) + self.path_data
|
||||
"""
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath, heritage):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
|
@ -48,7 +48,7 @@ class Target(target.Target):
|
||||
result += elem
|
||||
return result
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath, heritage_list, type="generic"):
|
||||
def make_package(self, pkg_name, 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)
|
||||
@ -63,18 +63,19 @@ class Target(target.Target):
|
||||
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)
|
||||
or module.get_type() == 'BINARY_STAND_ALONE':
|
||||
self.make_package_generic_binary(pkg_name, pkgProperties, basePkgPath, heritage_list, static = True)
|
||||
if module.get_type() == 'BINARY_SHARED':
|
||||
self.make_package_generic_binary(pkg_name, pkgProperties, basePkgPath, heritage_list, static = False)
|
||||
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)
|
||||
self.make_package_debian(pkg_name, pkgProperties, basePkgPath, heritage_list)
|
||||
elif type == "generic":
|
||||
self.make_package_generic(pkgName, pkgProperties, basePkgPath, heritage_list)
|
||||
self.make_package_generic(pkg_name, pkgProperties, basePkgPath, heritage_list)
|
||||
|
||||
|
||||
"""
|
||||
@ -107,41 +108,60 @@ class Target(target.Target):
|
||||
* *--> YY
|
||||
*--> sources
|
||||
"""
|
||||
def make_package_generic_binary(self, pkgName, pkgProperties, basePkgPath, heritage_list):
|
||||
debianPkgName = re.sub("_", "-", pkgName)
|
||||
def make_package_generic_binary(self, pkg_name, pkgProperties, basePkgPath, heritage_list, static):
|
||||
debianpkg_name = re.sub("_", "-", pkg_name)
|
||||
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.info("Generate generic '" + debianpkg_name + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
#output path
|
||||
target_outpath = os.path.join(self.get_staging_path(pkgName), pkgName + ".app")
|
||||
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas
|
||||
target_outpath_data = os.path.join(target_outpath, "share", pkgName)
|
||||
if static == True:
|
||||
target_outpath_data = os.path.join(target_outpath, "share", pkg_name)
|
||||
else:
|
||||
target_outpath_data = os.path.join(target_outpath, "share")
|
||||
tools.create_directory_of_file(target_outpath_data)
|
||||
debug.debug("heritage for " + str(pkgName) + ":")
|
||||
debug.debug("heritage for " + str(pkg_name) + ":")
|
||||
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)
|
||||
if static == True:
|
||||
debug.debug(" need copy: " + path_src + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(path_src, target_outpath_data, recursive=True, force_identical=True)
|
||||
else:
|
||||
debug.debug(" need copy: " + os.path.dirname(path_src) + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(os.path.dirname(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))
|
||||
path_src = self.get_build_file_bin(pkg_name)
|
||||
path_dst = os.path.join(target_outpath_bin, pkg_name + self.suffix_binary)
|
||||
debug.verbose("path_dst: " + str(path_dst))
|
||||
tools.copy_file(path_src, path_dst)
|
||||
|
||||
## Create libraries
|
||||
|
||||
if static == False:
|
||||
#copy all shred libs...
|
||||
target_outpath_lib = os.path.join(target_outpath, "lib")
|
||||
tools.create_directory_of_file(target_outpath_lib)
|
||||
debug.verbose("libs for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
file_src = self.get_build_file_dynamic(heritage.name)
|
||||
debug.verbose(" has directory: " + file_src)
|
||||
if os.path.isfile(file_src):
|
||||
debug.debug(" need copy: " + file_src + " to " + target_outpath_lib)
|
||||
#copy all data:
|
||||
# TODO : We can have a problem when writing over library files ...
|
||||
tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)) )
|
||||
|
||||
## Create version file
|
||||
tmpFile = open(target_outpath + "/version.txt", 'w')
|
||||
@ -178,19 +198,19 @@ class Target(target.Target):
|
||||
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.write("No documentation for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
## Create licence file
|
||||
licenseFileDest = target_outpath + "/license/"+ debianPkgName + ".txt"
|
||||
licenseFileDest = target_outpath + "/license/"+ debianpkg_name + ".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.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
@ -201,37 +221,37 @@ class Target(target.Target):
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(changeLogFileDest, 'w')
|
||||
tmpFile.write("No changelog data " + pkgName + "\n")
|
||||
tmpFile.write("No changelog data " + pkg_name + "\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)
|
||||
#debug.info("plop:" + self.get_staging_path(pkg_name) + self.path_data)
|
||||
if os.path.exists(self.get_staging_path(pkg_name) + self.path_data) == True:
|
||||
tools.copy_anything(self.get_staging_path(pkg_name) + 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 + "/*",
|
||||
tools.copy_anything(self.get_staging_path(pkg_name) + 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")
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".app.pkg")
|
||||
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
||||
#multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".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")
|
||||
tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg")
|
||||
|
||||
|
||||
def make_package_debian(self, pkgName, pkgProperties, basePkgPath, heritage_list):
|
||||
def make_package_debian(self, pkg_name, pkgProperties, basePkgPath, heritage_list):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debianPkgName = re.sub("_", "-", pkgName)
|
||||
debianpkg_name = re.sub("_", "-", pkg_name)
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.info("Generate package '" + debianpkg_name + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
self.get_staging_path(pkgName)
|
||||
target_outpathDebian = self.get_staging_path(pkgName) + "/DEBIAN/"
|
||||
self.get_staging_path(pkg_name)
|
||||
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
|
||||
finalFileControl = target_outpathDebian + "control"
|
||||
finalFilepostRm = target_outpathDebian + "postrm"
|
||||
# create the paths :
|
||||
@ -240,7 +260,7 @@ class Target(target.Target):
|
||||
## Create the control file
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tmpFile = open(finalFileControl, 'w')
|
||||
tmpFile.write("Package: " + debianPkgName + "\n")
|
||||
tmpFile.write("Package: " + debianpkg_name + "\n")
|
||||
tmpFile.write("Version: " + pkgProperties["VERSION"] + "\n")
|
||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkgProperties["SECTION"]) + "\n")
|
||||
tmpFile.write("Priority: " + pkgProperties["PRIORITY"] + "\n")
|
||||
@ -254,17 +274,17 @@ class Target(target.Target):
|
||||
## Create the PostRm
|
||||
tmpFile = open(finalFilepostRm, 'w')
|
||||
tmpFile.write("#!/bin/bash\n")
|
||||
tmpFile.write("touch ~/." + pkgName + "\n")
|
||||
if pkgName != "":
|
||||
tmpFile.write("touch ~/.local/share/" + pkgName + "\n")
|
||||
tmpFile.write("rm -r ~/.local/share/" + pkgName + "\n")
|
||||
tmpFile.write("touch ~/." + pkg_name + "\n")
|
||||
if pkg_name != "":
|
||||
tmpFile.write("touch ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## Readme donumentation
|
||||
readmeFileDest = self.get_staging_path(pkgName) + "/usr/share/doc/"+ debianPkgName + "/README"
|
||||
readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
|
||||
tools.create_directory_of_file(readmeFileDest)
|
||||
if os.path.exists(basePkgPath + "/os-Linux/README")==True:
|
||||
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
|
||||
@ -275,48 +295,48 @@ class Target(target.Target):
|
||||
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.write("No documentation for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## licence file
|
||||
licenseFileDest = self.get_staging_path(pkgName) + "/usr/share/doc/"+ debianPkgName + "/copyright"
|
||||
licenseFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright"
|
||||
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.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
changeLogFileDest = self.get_staging_path(pkgName) + "/usr/share/doc/"+ debianPkgName + "/changelog"
|
||||
changeLogFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog"
|
||||
tools.create_directory_of_file(changeLogFileDest)
|
||||
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.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## create the package :
|
||||
debug.debug("package : " + self.get_staging_path(pkgName) + "/" + debianPkgName + ".deb")
|
||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkgName)
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb")
|
||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name)
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path("") + "/" + pkgName + self.suffix_package, self.get_final_path() + "/" + pkgName + self.suffix_package)
|
||||
tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
def install_package(self, pkgName):
|
||||
def install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
debug.info("Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -i " + self.get_final_path() + "/" + pkgName + self.suffix_package)
|
||||
os.system("sudo dpkg -i " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
def un_install_package(self, pkgName):
|
||||
def un_install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
debug.info("Un-Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -r " + self.get_final_path() + "/" + pkgName + self.suffix_package)
|
||||
os.system("sudo dpkg -r " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
"""
|
||||
.local/application
|
||||
@ -348,15 +368,15 @@ class Target(target.Target):
|
||||
* *--> YY
|
||||
*--> sources
|
||||
"""
|
||||
def make_package_generic(self, pkgName, pkgProperties, basePkgPath, heritage_list):
|
||||
debug.warning("heritage for " + str(pkgName) + ":")
|
||||
def make_package_generic(self, pkg_name, pkgProperties, basePkgPath, heritage_list):
|
||||
debug.warning("heritage for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.warning("heritage .... " + str(heritage.name) + " : " + str(heritage.depends))
|
||||
debianPkgName = re.sub("_", "-", pkgName)
|
||||
debianpkg_name = re.sub("_", "-", pkg_name)
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.info("Generate generic '" + debianpkg_name + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
target_outpath = self.get_staging_path(pkgName) + "/edn.app/"
|
||||
target_outpath = self.get_staging_path(pkg_name) + "/edn.app/"
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
## Create version file
|
||||
tmpFile = open(target_outpath + "/version.txt", 'w')
|
||||
@ -389,18 +409,18 @@ class Target(target.Target):
|
||||
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.write("No documentation for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create licence file
|
||||
licenseFileDest = target_outpath + "/license/"+ debianPkgName + ".txt"
|
||||
licenseFileDest = target_outpath + "/license/"+ debianpkg_name + ".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.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create changeLog file
|
||||
@ -410,26 +430,26 @@ class Target(target.Target):
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(changeLogFileDest, 'w')
|
||||
tmpFile.write("No changelog data " + pkgName + "\n")
|
||||
tmpFile.write("No changelog data " + pkg_name + "\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)
|
||||
#debug.info("plop:" + self.get_staging_path(pkg_name) + self.path_data)
|
||||
if os.path.exists(self.get_staging_path(pkg_name) + self.path_data) == True:
|
||||
tools.copy_anything(self.get_staging_path(pkg_name) + 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 + "/*",
|
||||
tools.copy_anything(self.get_staging_path(pkg_name) + 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")
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".app.pkg")
|
||||
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
||||
#multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".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")
|
||||
tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg")
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user