formalize profile name to build conf, fix #1051
authorZhang Qiang <qiang.z.zhang@intel.com>
Mon, 15 Jul 2013 07:25:32 +0000 (15:25 +0800)
committerZhang Qiang <qiang.z.zhang@intel.com>
Mon, 15 Jul 2013 12:44:36 +0000 (20:44 +0800)
profile name is used to generate build conf, which has some special
format:
  - should not start with digital
  - should not contain '-'

This patch generate well formated build conf file name from profile
name.

Change-Id: Iee69c0abf8316227cbb6e2845ce11bbb2eaf03e3

gitbuildsys/cmd_build.py

index b98307d..606c282 100644 (file)
@@ -75,6 +75,18 @@ QEMU_CAN_BUILD = ['armv4l', 'armv5el', 'armv5l', 'armv6l', 'armv7l',
 USERID = pwd.getpwuid(os.getuid())[0]
 TMPDIR = None
 
+def formalize_build_conf(profile):
+    ''' formalize build conf file name from profile'''
+
+    # build conf file name should not start with digital, see:
+    # obs-build/Build.pm:read_config_dist()
+    start_digital_re = re.compile(r'^[0-9]')
+    if start_digital_re.match(profile):
+        profile = 'tizen%s' % profile
+
+    # '-' is not allowed, so replace with '_'
+    return profile.replace('-', '_');
+
 def prepare_repos_and_build_conf(args, arch, profile):
     '''generate repos and build conf options for depanneur'''
 
@@ -117,7 +129,7 @@ def prepare_repos_and_build_conf(args, arch, profile):
     cmd_opts += [('--repository=%s' % url.full) for url in repourls]
 
     profile = get_profile(args)
-    profile_name = profile.name.replace('profile.', '', 1)
+    profile_name = formalize_build_conf(profile.name.replace('profile.', '', 1))
     distconf = os.path.join(TMPDIR, '%s.conf' % profile_name)
 
     if args.dist: