def get_binary_name_from_git(args, package_dirs): ''' get binary rpm name from specified git package''' binary_list = [] packaging_dir = get_packaging_dir(args) if args.commit: commit = args.commit elif args.include_all: commit = 'WC.UNTRACKED' else: commit = 'HEAD' for package_dir in package_dirs: main_spec, rest_specs = guess_spec(package_dir, packaging_dir, None, commit) rest_specs.append(main_spec) for spec in rest_specs: if args.include_all: spec_to_parse = os.path.join(package_dir, spec) else: content = show_file_from_rev(package_dir, spec, commit) if content is None: raise GbsError('failed to checkout %s from commit: %s' % (spec, commit)) tmp_spec = Temp(content=content) spec_to_parse = tmp_spec.path try: spec = rpm.SpecFile(spec_to_parse) except GbpError, err: raise GbsError('%s' % err) binary_list.append(spec.name)
if args.commit: commit = args.commit elif args.include_all: commit = 'WC.UNTRACKED' else: commit = 'HEAD' relative_spec = utils.guess_spec(workdir, packaging_dir, args.spec, commit)[0] if args.include_all: # include_all means to use work copy, # otherwise use the reversion in git history spec_to_parse = os.path.join(workdir, relative_spec) else: content = utils.show_file_from_rev(workdir, relative_spec, commit) if content is None: raise GbsError('failed to checkout %s from commit: %s' % (relative_spec, commit)) tmp_spec = utils.Temp(content=content) spec_to_parse = tmp_spec.path # get 'name' and 'version' from spec file try: spec = gbp.rpm.SpecFile(spec_to_parse) except GbpError, err: raise GbsError('%s' % err) if not spec.name: raise GbsError("can't get correct name.")