From: Hyokeun Jeon Date: Tue, 12 Nov 2019 10:56:14 +0000 (+0900) Subject: Handle keystore error issue X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af6471a4530dd2a5b5410f6bc37c3781b2f51d76;p=scm%2Fmeta%2Fabs.git Handle keystore error issue Change-Id: I1f28765b136e81095f1a5ed3c82fc605c1d898ee --- diff --git a/abs b/abs index bafea7a..8076924 100755 --- a/abs +++ b/abs @@ -248,8 +248,11 @@ class Sdk(object): """Run a tizen command""" cmd = [self.tizen, command] + args + if command == 'package': + cmd = ['dbus-run-session -- bash; echo build | gnome-keyring-daemon --unlock; '] + cmd print '\nRunning command:\n %s' % ' '.join(cmd) - return self.runtool.run(' '.join(cmd), show=show, checker=checker) + return self.runtool.run('{}'.format(' '.join(cmd)), \ + show=show, checker=checker) def copytree2(self, src, dst, symlinks=False, ignore=None): """Copy with Ignore & Overwrite""" @@ -394,6 +397,17 @@ class Sdk(object): if ret: raise LocalError(ret) + def raise_package_exception(self, out, output_dir, i, bname, appname): + logpath = os.path.join(output_dir, \ + 'package_%d_%s' % (i, bname)) + if not os.path.isdir(output_dir): + os.makedirs(output_dir) + with open(logpath + '.log', 'w') as lf: + lf.write(out) + if 'keystore password was incorrect' in out: + raise LocalError('keystore password was incorrect for %s.' % appname) + raise LocalError('TPK/WGT file not generated for %s.' % appname) + def package(self, source, cert=None, pkg_type=None, conf='Debug', manual_strip=False): """SDK CLI package command IF Debug + Manual Strip off then generate package-name-debug.tpk @@ -479,7 +493,7 @@ class Sdk(object): try: final_app = list_files(os.path.join(x['path'], conf), ext='tpk')[0] except: - raise LocalError('TPK file not generated for %s.' % x['APPNAME']) + self.raise_package_exception(out, source.output_dir, i, os.path.basename(x['path']), x['APPNAME']) x['out_package'] = final_app elif x['type'] == 'sharedLib': self._package_sharedlib(x['path'], conf, x['APPNAME']) @@ -493,7 +507,7 @@ class Sdk(object): try: final_app = list_files(os.path.join(x['path'], '.buildResult'), ext='wgt')[0] except: - raise LocalError('WGT file not generated for %s.' % x['APPNAME']) + self.raise_package_exception(out, source.output_dir, i, os.path.basename(x['path']), x['APPNAME']) x['out_package'] = final_app if source.b_multi == True: @@ -507,14 +521,14 @@ class Sdk(object): extra_args.extend(['--', '"%s"' % final_app]) if final_app.endswith('.tpk'): - out = self._run('package', main_args + extra_args) + out = '%s\n\n%s' % (out, self._run('package', main_args + extra_args)) elif final_app.endswith('.wgt'): - out = self._run('package', main_args_web + extra_args) + out = '%s\n\n%s' % (out, self._run('package', main_args_web + extra_args)) #TODO: signature validation check failed : Invalid file reference. An unsigned file was found. if final_app.endswith('.tpk'): print 'Packaging final step again!' - out = self._run('package', main_args + ['--', '"%s"' % final_app]) + out = '%s\n\n%s' % (out, self._run('package', main_args + ['--', '"%s"' % final_app])) #Append arch to web binary #if final_app.endswith('.wgt'): @@ -534,6 +548,7 @@ class Sdk(object): else : shutil.copy(final_app, source.output_dir) + def clean(self, source): """SDK CLI clean command""" @@ -704,4 +719,6 @@ if __name__ == '__main__': os.makedirs('_abs_out_') with open(os.path.join('_abs_out_', 'build_EXCEPTION.log'), 'w') as ef: ef.write('Exception %s' % repr(e)) - sys.exit(1) + if 'keystore password was incorrect' in repr(e): + sys.exit(99) + sys.exit(77) diff --git a/build.template b/build.template index ae4cac6..dd62134 100644 --- a/build.template +++ b/build.template @@ -65,17 +65,15 @@ TIDLC_PATH=`sed -n '/tidl/p' /home/build/.bashrc | cut -f2 -d':'` if [ ! -z ${TIDLC_PATH} ]; then echo "PATH=\$PATH:${TIDLC_PATH}" >> /home/build/.profile; fi su - build -c "tidlc --version" -DBUS_SESSION="dbus-run-session -- bash && echo build | gnome-keyring-daemon --unlock && " -su - build -c "gnome-keyring-daemon --help" -if [ $? -ne 0 ]; then - DBUS_SESSION=" " -fi for rs in $rs_list; do echo "BUILDING START TIME: `date`" #if [[ $rs == *"64.core"* ]]; then # echo "SKIP! 64-bit not supported!"; continue; #else - su - build -c "${DBUS_SESSION} ${ABS_CMD} build -r $rs -w ${BUILD_ROOT}/${PACKAGE} -s ABS -c ${BUILD_MODE} ${PARALLEL_JOBS} --profile-to-search ${PROFILE}" + + su - build -c "${ABS_CMD} build -r $rs -w ${BUILD_ROOT}/${PACKAGE} -s ABS -c ${BUILD_MODE} ${PARALLEL_JOBS} --profile-to-search ${PROFILE}" + build_result=$? + echo "BUILD RET: ${build_result}" #fi count=`ls -1 ${TMP_DIR}/*.tpk 2>/dev/null | wc -l` if [ $count != 0 ]; then @@ -85,7 +83,7 @@ for rs in $rs_list; do fi ret=$?; echo "BUILDING FINISH TIME: `date`" if [ $ret != 0 ]; then - echo $rs build fail; _clear 8 + echo $rs build fail; _clear $build_result fi done