From fd2a6f2a415a2f1850f088ec049c36527ca93bb1 Mon Sep 17 00:00:00 2001 From: Guan Junchun Date: Fri, 11 Oct 2013 10:54:20 +0800 Subject: [PATCH] Catch exception if buildconf specified in gbs conf doesn't exist Fixes: #1339 Change-Id: I0a6d326753815703423de95e1c49490cded12e8c --- gitbuildsys/cmd_build.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gitbuildsys/cmd_build.py b/gitbuildsys/cmd_build.py index d6bd6de..b0edc6d 100644 --- a/gitbuildsys/cmd_build.py +++ b/gitbuildsys/cmd_build.py @@ -133,20 +133,22 @@ def prepare_repos_and_build_conf(args, arch, profile): distconf = os.path.join(TMPDIR, '%s.conf' % profile_name) if args.dist: - if not os.path.exists(args.dist): - raise GbsError('specified build conf %s does not exist' % args.dist) - shutil.copy(args.dist, distconf) + buildconf = args.dist elif profile.buildconf: - shutil.copy(profile.buildconf, distconf) + buildconf = profile.buildconf else: if repoparser.buildconf is None: raise GbsError('failed to get build conf from repos, please ' 'use snapshot repo or specify build config using ' '-D option') else: - shutil.copy(repoparser.buildconf, distconf) + buildconf = repoparser.buildconf log.info('build conf has been downloaded at:\n %s' \ % distconf) + try: + shutil.copy(buildconf, distconf) + except IOError, err: + raise GbsError("Failed to copy build conf: %s" % (str(err))) if not os.path.exists(distconf): raise GbsError('No build config file specified, please specify in '\ -- 2.7.4