def compose_gbp_args(repo, tmp_dir, spec, args): """Compose command line arguments for gbp-pq-rpm""" upstream_tag = configmgr.get_arg_conf(args, 'upstream_tag') # transform variables from shell to python convention ${xxx} -> %(xxx)s upstream_tag = re.sub(r'\$\{([^}]+)\}', r'%(\1)s', upstream_tag) packaging_dir = get_packaging_dir(args) # Compose the list of command line arguments argv = ["argv[0] placeholder", "--color-scheme=magenta:green:yellow:red", "--vendor=Tizen", "--tmp-dir=%s" % tmp_dir, "--packaging-dir=%s" % packaging_dir, "--new-packaging-dir=%s" % packaging_dir, "--spec-file=%s" % spec, "--upstream-tag=%s" % upstream_tag, "--pq-branch=development/%(branch)s/%(upstreamversion)s", "--import-files=.gbs.conf", "--patch-export-compress=100k", "--patch-export-ignore-path=^(%s/.*|.gbs.conf)" % packaging_dir] if args.debug: argv.append("--verbose") if args.retain_history: argv.append("--retain-history") return argv
def compose_gbp_args(repo, tmp_dir, spec, args): """Compose command line arguments for gbp-pq-rpm""" upstream_tag = configmgr.get_arg_conf(args, 'upstream_tag') # transform variables from shell to python convention ${xxx} -> %(xxx)s upstream_tag = re.sub(r'\$\{([^}]+)\}', r'%(\1)s', upstream_tag) packaging_dir = get_packaging_dir(args) # Compose the list of command line arguments argv = [ "argv[0] placeholder", "--color-scheme=magenta:green:yellow:red", "--vendor=Tizen", "--tmp-dir=%s" % tmp_dir, "--packaging-dir=%s" % packaging_dir, "--new-packaging-dir=%s" % packaging_dir, "--spec-file=%s" % spec, "--upstream-tag=%s" % upstream_tag, "--pq-branch=development/%(branch)s/%(upstreamversion)s", "--import-files=.gbs.conf", "--patch-export-compress=100k", "--patch-export-ignore-path=^(%s/.*|.gbs.conf)" % packaging_dir ] if args.debug: argv.append("--verbose") if args.retain_history: argv.append("--retain-history") return argv
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)
def prepare_depanneur_opts(args): '''generate extra options for depanneur''' cmd_opts = [] if args.exclude: cmd_opts += ['--exclude=%s' % i for i in args.exclude.split(',')] if args.exclude_from_file: cmd_opts += ['--exclude-from-file=%s' % args.exclude_from_file] if args.overwrite: cmd_opts += ['--overwrite'] if args.clean_once: cmd_opts += ['--clean-once'] if args.clean_repos: cmd_opts += ['--clean-repos'] if args.debug: cmd_opts += ['--debug'] if args.incremental: cmd_opts += ['--incremental'] if args.no_configure: cmd_opts += ['--no-configure'] if args.keep_packs: cmd_opts += ['--keep-packs'] if args.baselibs: cmd_opts += ['--baselibs'] if args.skip_srcrpm: cmd_opts += ['--skip-srcrpm'] # if args.package_list: package_list = args.package_list.split(',') binary_list = get_binary_name_from_git(args, package_list) args.binary_list += ','+ ','.join(binary_list) if args.package_from_file: if not os.path.exists(args.package_from_file): raise GbsError('specified package list file %s not exists' % \ args.package_from_file) with open(args.package_from_file) as fobj: pkglist = [pkg.strip() for pkg in fobj.readlines() if pkg.strip()] binary_list = get_binary_name_from_git(args, pkglist) args.binary_list += ',' + ','.join(binary_list) if args.binary_list: blist = [i.strip() for i in args.binary_list.split(',')] cmd_opts += ['--binary-list=%s' % ','.join(blist)] if args.binary_from_file: if not os.path.exists(args.binary_from_file): raise GbsError('specified binary list file %s not exists' % \ args.binary_from_file) cmd_opts += ['--binary-from-file=%s' % args.binary_from_file] if args.deps: cmd_opts += ['--deps'] if args.rdeps: cmd_opts += ['--rdeps'] if args.icecream > 0: cmd_opts += ['--icecream=%s' % args.icecream] cmd_opts += ['--threads=%s' % args.threads] cmd_opts += ['--packaging-dir=%s' % get_packaging_dir(args)] return cmd_opts
def main(args): """gbs import entry point.""" if args.author_name: os.environ["GIT_AUTHOR_NAME"] = args.author_name if args.author_email: os.environ["GIT_AUTHOR_EMAIL"] = args.author_email path = args.path tmp = Temp(prefix='gbp_', dirn=configmgr.get('tmpdir', 'general'), directory=True) if args.upstream_branch: upstream_branch = args.upstream_branch else: upstream_branch = configmgr.get('upstream_branch', 'general') params = ["argv[0] placeholder", "--color-scheme=magenta:green:yellow:red", "--packaging-dir=%s" % get_packaging_dir(args), "--upstream-branch=%s" % upstream_branch, path, "--tmp-dir=%s" % tmp.path, ] if args.debug: params.append("--verbose") if not args.no_pristine_tar and os.path.exists("/usr/bin/pristine-tar"): params.append("--pristine-tar") if args.filter: params += [('--filter=%s' % f) for f in args.filter] if path.endswith('.src.rpm') or path.endswith('.spec'): if args.allow_same_version: params.append("--allow-same-version") if args.native: params.append("--native") if args.no_patch_import: params.append("--no-patch-import") ret = gbp_import_srpm(params) if ret == 2: log.warning("Importing of patches into packaging branch failed! " "Please import manually (apply and commit to git, " "remove files from packaging dir and spec) in order " "to enable automatic patch generation.") elif ret: raise GbsError("Failed to import %s" % path) else: if args.upstream_vcs_tag: params.append('--upstream-vcs-tag=%s' % args.upstream_vcs_tag) if args.merge: params.append('--merge') else: params.append('--no-merge') if gbp_import_orig(params): raise GbsError('Failed to import %s' % path) log.info('done.')
def prepare_depanneur_opts(args): '''generate extra options for depanneur''' cmd_opts = [] if args.exclude: cmd_opts += ['--exclude=%s' % i for i in args.exclude.split(',')] if args.exclude_from_file: cmd_opts += ['--exclude-from-file=%s' % args.exclude_from_file] if args.overwrite: cmd_opts += ['--overwrite'] if args.clean_once: cmd_opts += ['--clean-once'] if args.clean_repos: cmd_opts += ['--clean-repos'] if args.debug: cmd_opts += ['--debug'] if args.incremental: cmd_opts += ['--incremental'] if args.no_configure: cmd_opts += ['--no-configure'] if args.keep_packs: cmd_opts += ['--keep-packs'] if args.baselibs: cmd_opts += ['--baselibs'] # if args.package_list: package_list = args.package_list.split(',') binary_list = get_binary_name_from_git(args, package_list) args.binary_list += ',' + ','.join(binary_list) if args.package_from_file: if not os.path.exists(args.package_from_file): raise GbsError('specified package list file %s not exists' % \ args.package_from_file) with open(args.package_from_file) as fobj: pkglist = [pkg.strip() for pkg in fobj.readlines() if pkg.strip()] binary_list = get_binary_name_from_git(args, pkglist) args.binary_list += ',' + ','.join(binary_list) if args.binary_list: blist = [i.strip() for i in args.binary_list.split(',')] cmd_opts += ['--binary-list=%s' % ','.join(blist)] if args.binary_from_file: if not os.path.exists(args.binary_from_file): raise GbsError('specified binary list file %s not exists' % \ args.binary_from_file) cmd_opts += ['--binary-from-file=%s' % args.binary_from_file] if args.deps: cmd_opts += ['--deps'] if args.rdeps: cmd_opts += ['--rdeps'] cmd_opts += ['--threads=%s' % args.threads] cmd_opts += ['--packaging-dir=%s' % get_packaging_dir(args)] return cmd_opts
def prepare_depanneur_opts(args): '''generate extra options for depanneur''' cmd_opts = [] if args.exclude: cmd_opts += ['--exclude=%s' % i for i in args.exclude.split(',')] if args.exclude_from_file: cmd_opts += ['--exclude-from-file=%s' % args.exclude_from_file] if args.overwrite: cmd_opts += ['--overwrite'] if args.clean_once: cmd_opts += ['--clean-once'] if args.clean_repos: cmd_opts += ['--clean-repos'] if args.debug: cmd_opts += ['--debug'] if args.incremental: cmd_opts += ['--incremental'] if args.no_configure: cmd_opts += ['--no-configure'] if args.keep_packs: cmd_opts += ['--keep-packs'] if args.baselibs: cmd_opts += ['--baselibs'] if args.binary_list: blist = [ i.strip() for i in args.binary_list.split(',') ] cmd_opts += ['--binary-list=%s' % ','.join(blist)] if args.binary_from_file: if not os.path.exists(args.binary_from_file): raise GbsError('specified binary list file %s not exists' % \ args.binary_from_file) cmd_opts += ['--binary-from-file=%s' % args.binary_from_file] if args.deps: cmd_opts += ['--deps'] if args.rdeps: cmd_opts += ['--rdeps'] cmd_opts += ['--threads=%s' % args.threads] cmd_opts += ['--packaging-dir=%s' % get_packaging_dir(args)] return cmd_opts
if args.buildlog and None in (obs_repo, obs_arch): raise GbsError('please specify arch(-A) and repository(-R)') try: repo = RpmGitRepository(args.gitdir) except GitRepositoryError, err: raise GbsError(str(err)) workdir = repo.path utils.read_localconf(workdir) if not (args.buildlog or args.status): utils.git_status_checker(repo, args) packaging_dir = get_packaging_dir(args) 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)
def main(args): """gbs import entry point.""" if args.author_name: os.environ["GIT_AUTHOR_NAME"] = args.author_name if args.author_email: os.environ["GIT_AUTHOR_EMAIL"] = args.author_email path = args.path tmp = Temp(prefix='gbp_', dirn=configmgr.get('tmpdir', 'general'), directory=True) upstream_branch = configmgr.get_arg_conf(args, 'upstream_branch') upstream_tag = configmgr.get_arg_conf(args, 'upstream_tag') # transform variables from shell to python convention ${xxx} -> %(xxx)s upstream_tag = re.sub(r'\$\{([^}]+)\}', r'%(\1)s', upstream_tag) params = ["argv[0] placeholder", "--color-scheme=magenta:green:yellow:red", "--packaging-dir=%s" % get_packaging_dir(args), "--upstream-branch=%s" % upstream_branch, path, "--upstream-tag=%s" % upstream_tag, "--tmp-dir=%s" % tmp.path, ] if args.debug: params.append("--verbose") if not args.no_pristine_tar and os.path.exists("/usr/bin/pristine-tar"): params.append("--pristine-tar") if args.filter: params += [('--filter=%s' % f) for f in args.filter] if args.upstream_vcs_tag: params.append('--upstream-vcs-tag=%s' % args.upstream_vcs_tag) if path.endswith('.src.rpm') or path.endswith('.spec'): params.append("--create-missing-branches") if args.allow_same_version: params.append("--allow-same-version") if args.native: params.append("--native") if args.orphan_packaging: params.append("--orphan-packaging") if args.no_patch_import: params.append("--no-patch-import") ret = gbp_import_srpm(params) if ret == 2: log.warning("Importing of patches into packaging branch failed! " "Please import manually (apply and commit to git, " "remove files from packaging dir and spec) in order " "to enable automatic patch generation.") elif ret: raise GbsError("Failed to import %s" % path) else: if args.merge: params.append('--merge') else: params.append('--no-merge') if gbp_import_orig(params): raise GbsError('Failed to import %s' % path) log.info('done.')
def prepare_depanneur_opts(args): '''generate extra options for depanneur''' cmd_opts = [] if args.exclude: cmd_opts += ['--exclude=%s' % i for i in args.exclude.split(',')] if args.exclude_from_file: cmd_opts += ['--exclude-from-file=%s' % args.exclude_from_file] if args.overwrite: cmd_opts += ['--overwrite'] if args.clean_once: cmd_opts += ['--clean-once'] if args.clean_repos: cmd_opts += ['--clean-repos'] if args.debug: cmd_opts += ['--debug'] if args.incremental: cmd_opts += ['--incremental'] if args.no_configure: cmd_opts += ['--no-configure'] if args.keep_packs: cmd_opts += ['--keep-packs'] if args.use_higher_deps: cmd_opts += ['--use-higher-deps'] if args.not_export_source: cmd_opts += ['--not-export-source'] if args.baselibs: cmd_opts += ['--baselibs'] if args.skip_srcrpm: cmd_opts += ['--skip-srcrpm'] if args.fail_fast: cmd_opts += ['--fail-fast'] if args.keepgoing: cmd_opts += ['--keepgoing=%s' % args.keepgoing] # if args.package_list: package_list = args.package_list.split(',') binary_list = get_binary_name_from_git(args, package_list) args.binary_list += ','+ ','.join(binary_list) if args.package_from_file: if not os.path.exists(args.package_from_file): raise GbsError('specified package list file %s not exists' % \ args.package_from_file) with open(args.package_from_file) as fobj: pkglist = [pkg.strip() for pkg in fobj.readlines() if pkg.strip()] binary_list = get_binary_name_from_git(args, pkglist) args.binary_list += ',' + ','.join(binary_list) if args.binary_list: blist = [i.strip() for i in args.binary_list.split(',')] cmd_opts += ['--binary-list=%s' % ','.join(blist)] if args.binary_from_file: if not os.path.exists(args.binary_from_file): raise GbsError('specified binary list file %s not exists' % \ args.binary_from_file) cmd_opts += ['--binary-from-file=%s' % args.binary_from_file] if args.deps: cmd_opts += ['--deps'] if args.rdeps: cmd_opts += ['--rdeps'] if args.kvm: cmd_opts += ['--clean'] cmd_opts += ['--vm-type=kvm'] cmd_opts += ['--vm-memory=%s' % args.vm_memory] cmd_opts += ['--vm-disk=%s' % args.vm_disk] cmd_opts += ['--vm-swap=%s' % args.vm_swap] cmd_opts += ['--vm-diskfilesystem=%s' % args.vm_diskfilesystem] if not os.path.exists(args.vm_initrd): raise GbsError("Check file to exists vm-initrd") cmd_opts += ['--vm-initrd=%s' % args.vm_initrd] if not os.path.exists(args.vm_kernel): raise GbsError("Check file to exists vm-kernel") cmd_opts += ['--vm-kernel=%s' % args.vm_kernel] if args.icecream > 0: cmd_opts += ['--icecream=%s' % args.icecream] cmd_opts += ['--threads=%s' % args.threads] if args.kvm: loopdev = len([name for name in os.listdir('/dev') if bool(re.search("loop[0-9]",name))]) if not args.threads < loopdev: raise GbsError('When using the kvm, loop device should be larger than the threads option.') cmd_opts += ['--packaging-dir=%s' % get_packaging_dir(args)] return cmd_opts