update all spec files no matter if no --spec specified
authorZhang Qiang <qiang.z.zhang@intel.com>
Tue, 3 Sep 2013 10:26:19 +0000 (18:26 +0800)
committerZhang Qiang <qiang.z.zhang@intel.com>
Wed, 4 Sep 2013 07:08:25 +0000 (15:08 +0800)
Fixes: #1233

Change-Id: I5f3de2875273c552fce59141a1e7c4cd46ab51c2

gitbuildsys/cmd_export.py
gitbuildsys/utils.py

index cbb7565..381ac20 100644 (file)
@@ -256,8 +256,7 @@ def main(args):
     with utils.Workdir(workdir):
         export_sources(repo, commit, export_dir, main_spec, args)
 
-        # also update other spec files if no --spec option specified
-        if not args.spec and rest_specs:
+        if rest_specs:
             # backup updated spec file
             specbakd = utils.Temp(prefix=os.path.join(tmpdir, '.gbs_export_'),
                                directory=True)
index ad6afd4..c63036f 100644 (file)
@@ -74,11 +74,11 @@ def guess_spec(git_path, packaging_dir, given_spec, commit_id='WC.UNTRACKED'):
         glob_ = lambda pattern: glob_in_rev(git_path, pattern, commit_id)
         msg = "No such spec file %%s in %s" % commit_id
 
+    spec = None
     if given_spec:
         spec = os.path.join(packaging_dir, given_spec)
         if not check(spec):
             raise GbsError(msg % spec)
-        return [spec, []]
 
     specs = glob_(os.path.join(packaging_dir, '*.spec'))
     if not specs:
@@ -86,8 +86,9 @@ def guess_spec(git_path, packaging_dir, given_spec, commit_id='WC.UNTRACKED'):
                        "%s" % packaging_dir)
 
     project_name =  os.path.basename(git_path)
-    spec = os.path.join(packaging_dir, '%s.spec' % project_name)
-    spec = spec if spec in specs else specs[0]
+    if not spec:
+        spec = os.path.join(packaging_dir, '%s.spec' % project_name)
+        spec = spec if spec in specs else specs[0]
     specs.remove(spec)
     return [spec, specs]