Fix bugs when linux usernames including backslash 54/173654/1
authorjingui.ren <jingui.ren@samsung.com>
Fri, 23 Mar 2018 03:08:31 +0000 (11:08 +0800)
committerjingui.ren <jingui.ren@samsung.com>
Fri, 23 Mar 2018 03:08:31 +0000 (11:08 +0800)
Change-Id: I3226dd95b76cbaab897fa9d4eeb3951d8be1146f
Signed-off-by: jingui.ren <jingui.ren@samsung.com>
gitbuildsys/cmd_build.py
gitbuildsys/cmd_export.py

index fcd0ad8..9e2d2fa 100644 (file)
@@ -198,9 +198,10 @@ def prepare_repos_and_build_conf(args, arch, profile):
     if not distconf.endswith('.conf') or '-' in os.path.basename(distconf):
         raise GbsError("build config file must end with .conf, and can't "
                        "contain '-'")
-    dist = os.path.basename(distconf)[:-len('.conf')]
+    dist = "'"+os.path.basename(distconf)[:-len('.conf')]+"'"
     cmd_opts += ['--dist=%s' % dist]
-    cmd_opts += ['--configdir=%s' % os.path.dirname(distconf)]
+    path = "'"+os.path.dirname(distconf)+"'"
+    cmd_opts += ['--configdir=%s' % path]
 
     return cmd_opts
 
@@ -716,7 +717,7 @@ def main(args):
     else:
         cmd += ['--noinit']
 
-    cmd += ['--path=%s' % workdir]
+    cmd += ['--path=%s' % "'"+str(workdir)+"'"]
 
     if args.ccache:
         cmd += ['--ccache']
index 70071fb..0141f3e 100644 (file)
@@ -254,13 +254,13 @@ def main(args):
 
     if args.commit and args.include_all:
         raise Usage("--commit can't be specified together with --include-all")
-
+    log.debug("export begin")
     workdir = args.gitdir
     try:
         repo = RpmGitRepository(workdir)
     except GitRepositoryError, err:
         raise GbsError(str(err))
-
+    log.debug("read repo path")
     utils.read_localconf(repo.path)
     utils.git_status_checker(repo, args)
     workdir = repo.path
@@ -276,10 +276,11 @@ def main(args):
         commit = 'HEAD'
     orphan_packaging = configmgr.get('packaging_branch', 'orphan-devel')
     spec_commit_id = orphan_packaging if orphan_packaging else commit
+    log.debug("check packaging_dir")
     packaging_dir = get_packaging_dir(args)
     main_spec, rest_specs = utils.guess_spec(workdir, packaging_dir,
                                              args.spec, spec_commit_id)
-
+    log.debug("check outdir")
     if args.outdir:
         outdir = args.outdir
     else:
@@ -290,7 +291,7 @@ def main(args):
             raise GbsError('no write permission to outdir: %s' % outdir)
     else:
         mkdir_p(outdir)
-
+    log.debug("check tmpdir")
     tmpdir = configmgr.get('tmpdir', 'general')
     tempd = utils.Temp(prefix=os.path.join(tmpdir, '.gbs_export_'),
                        directory=True)
@@ -336,7 +337,7 @@ def main(args):
         else:
             outdir = "%s/%s-%s-%s" % (outdir, spec.name, spec.upstreamversion,
                                       spec.release)
-
+    log.debug("check outdir")
     if os.path.exists(outdir):
         if not os.access(outdir, os.W_OK|os.X_OK):
             raise GbsError('no permission to update outdir: %s' % outdir)