From ace5c45299aa4b7f88d3d84725e483ba160c3005 Mon Sep 17 00:00:00 2001 From: "sebeom.park" Date: Thu, 2 Aug 2018 18:12:55 +0900 Subject: [PATCH] Support strip depdning on gcc version from build.info file and addding exception case for reading build.info Change-Id: I8d1c7cdcbbc61967c4d6661c2d5db4f422e36c5f Signed-off-by: sebeom.park --- abs | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/abs b/abs index b44fc79..f24f577 100755 --- a/abs +++ b/abs @@ -27,7 +27,6 @@ import zipfile import errno g_home = os.path.dirname(os.path.realpath(__file__)) - class LocalError(Exception): """Local error exception.""" @@ -393,7 +392,6 @@ class Sdk(object): IF Debug + Manual Strip on then generate package-name.tpk with custom strip IF Release then generate package-name.tpk with strip option """ - if cert is None: cert = 'ABS' if pkg_type is None: pkg_type = 'tpk' if conf is None: conf = 'Debug' @@ -416,25 +414,47 @@ class Sdk(object): if manual_strip == True : strip_cmd=''; if self.arch == None: - raise LocalError('Architecture is Noen') - elif self.arch == 'x86' : - strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../i386-linux-gnueabi-gcc-4.9/bin/i386-linux-gnueabi-strip') - elif self.arch == 'arm' : - strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../arm-linux-gnueabi-gcc-4.9/bin/arm-linux-gnueabi-strip') - elif self.arch == 'x86_64' : - strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../x86_64-linux-gnu-gcc-4.9/bin/x86_64-linux-gnu-strip') - elif self.arch == 'aarch64' : - strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../aarch64-linux-gnu-gcc-4.9/bin/aarch64-linux-gnu-strip') - - print strip_cmd + raise LocalError('Architecture is None') for i, x in enumerate(source.project_list): dir = os.path.join(x['path'], conf) files = [os.path.join(dir,f) for f in os.listdir(dir) if os.path.isfile(os.path.join(dir,f))] + + # dir must be "project/Debug directory" + info_path = os.path.join(dir, "build.info") + # Default Strip gcc version is 6.2 + gcc_version = "6.2" + # Parsing GCC version from build.info inside Debug directory in Project to each project + if os.path.exists(info_path) : + with open(info_path) as fp : + for line in fp : + if line.startswith("toolchain=") : + line = line.strip() + gcc_version = re.findall("\d+\.\d+", line)[0] + else : + print "Cannot find Debug/build.info. The default gcc will strip tpk" + + print "gcc version:" + gcc_version + + if self.arch == 'x86' : + if(gcc_version == "4.9"): + strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../i386-linux-gnueabi-gcc-' + gcc_version + '/bin/i386-linux-gnueabi-strip') + else: + strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../i586-linux-gnueabi-gcc-' + gcc_version + '/bin/i586-linux-gnueabi-strip') + elif self.arch == 'arm' : + strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../arm-linux-gnueabi-gcc-' + gcc_version + '/bin/arm-linux-gnueabi-strip') + elif self.arch == 'x86_64' : + strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../x86_64-linux-gnu-gcc-' + gcc_version + '/bin/x86_64-linux-gnu-strip') + elif self.arch == 'aarch64' : + strip_cmd = os.path.join(os.path.dirname(self.tizen), '../../aarch64-linux-gnu-gcc-' + gcc_version + '/bin/aarch64-linux-gnu-strip') + + print strip_cmd + for k in files: cmdline = strip_cmd + ' ' + k; #print 'my command line ' + cmdline; Executor().run(cmdline, show=False) + elif conf == 'Release': main_args.extend(['--strip', 'on']) -- 2.7.4