depend on profile instead of build_id in remote repo
authorZhang Qiang <qiang.z.zhang@intel.com>
Wed, 29 May 2013 08:17:24 +0000 (16:17 +0800)
committerGerrit Code Review <gerrit2@otctools.jf.intel.com>
Fri, 31 May 2013 02:09:05 +0000 (19:09 -0700)
It's more reasonable to depend on user defined profile name for local
repo generation, instead of depend on build_id in remote repo now.

Change-Id: I3467168e50b8c2041b5f5d682383bffbd24411e3

gitbuildsys/cmd_build.py

index e241b00b5e4bbf70294234dc69e7dab85ba9ab0a..a49c04b48c881a1be2dceb33b087bf47d0f37dc3 100644 (file)
@@ -109,23 +109,25 @@ def prepare_repos_and_build_conf(args, arch, profile):
                        'following repos:\n%s' % (arch, '\n'.join(repos)))
     cmd_opts += [('--repository=%s' % url.full) for url in repourls]
 
+    profile = get_profile(args)
+    profile_name = profile.name.replace('profile.', '', 1)
+    distconf = os.path.join(TMPDIR, '%s.conf' % profile_name)
+
     if args.dist:
-        distconf = args.dist
-        if not os.path.exists(distconf):
-            raise GbsError('specified build conf %s does not exists' % distconf)
+        if not os.path.exists(args.dist):
+            raise GbsError('specified build conf %s does not exist' % args.dist)
+        shutil.copy(args.dist, distconf)
     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, TMPDIR)
-            distconf = os.path.join(TMPDIR, os.path.basename(\
-                                    repoparser.buildconf))
+            shutil.copy(repoparser.buildconf, distconf)
             log.info('build conf has been downloaded at:\n      %s' \
                        % distconf)
 
-    if distconf is None:
+    if not os.path.exists(distconf):
         raise GbsError('No build config file specified, please specify in '\
                        '~/.gbs.conf or command line using -D')