fix misleading error handling while no spec file found
authorZhang Qiang <qiang.z.zhang@intel.com>
Wed, 16 Jan 2013 06:38:22 +0000 (14:38 +0800)
committerZhang Qiang <qiang.z.zhang@intel.com>
Wed, 16 Jan 2013 06:38:22 +0000 (14:38 +0800)
Change-Id: I7be2d57cd5c9e1c2756686cb9f43d4eb1a998fd0

gitbuildsys/utils.py

index 4ad0982..33ce54b 100644 (file)
@@ -72,9 +72,6 @@ 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
 
-    if not check(packaging_dir, True):
-        raise GbsError("No packaging directory: '%s/', so there is nothing to "
-                       "export." % packaging_dir)
     if given_spec:
         spec = os.path.join(packaging_dir, given_spec)
         if not check(spec):
@@ -83,7 +80,8 @@ def guess_spec(git_path, packaging_dir, given_spec, commit_id='WC.UNTRACKED'):
 
     specs = glob_(os.path.join(packaging_dir, '*.spec'))
     if not specs:
-        raise GbsError("can't find any spec file")
+        raise GbsError("can't find any spec file under packaging dir: "
+                       "%s" % packaging_dir)
 
     project_name =  os.path.basename(git_path)
     spec = os.path.join(packaging_dir, '%s.spec' % project_name)