packaging_dir = os.readlink(packaging_dir)
check = lambda fname, dir_only=False: os.path.exists(os.path.join(
git_path, fname))
- glob_ = lambda pattern: [name.replace(git_path+'/', '') \
- for name in reversed(glob.glob(os.path.join(git_path, pattern)))]
+ glob_ = lambda pattern: glob_in_inc(git_path, packaging_dir, pattern)
msg = 'No such spec file %s'
else:
git_object = commit_id + ':' + packaging_dir
if not check(spec):
raise GbsError(msg % spec)
- specs = glob_(os.path.join(packaging_dir, '*.spec'))
+ if commit_id == 'WC.UNTRACKED':
+ specs=glob_('*.spec')
+ else:
+ specs = glob_(os.path.join(packaging_dir, '*.spec'))
if not specs:
raise GbsError("can't find any spec file under packaging dir: "
"%s" % packaging_dir)
return output != ''
+def glob_in_inc(git_path, packaging_dir, pattern):
+ f_path=os.path.join(git_path,packaging_dir)
+ specs = []
+ if(os.path.isdir(f_path)):
+ for filename in os.listdir(f_path):
+ if fnmatch.fnmatch(filename,pattern):
+ specs.append(os.path.join(packaging_dir,filename))
+ return specs
+
+
def glob_in_rev(git_path, pattern, commit_id):
"""Glob pattern in given revision."""