Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
    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)
    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
Exemplo n.º 4
0
    utils.git_status_checker(repo, args)
    workdir = repo.path


    # Only guess spec filename here, parse later when we have the correct
    # spec file at hand
    if args.commit:
        commit = args.commit
    elif args.include_all:
        commit = 'WC.UNTRACKED'
    else:
        commit = 'HEAD'
    orphan_packaging = configmgr.get('packaging_branch', 'orphan-devel')
    spec_commit_id = orphan_packaging if orphan_packaging else commit
    packaging_dir = get_packaging_dir(args)
    main_spec, rest_specs = utils.guess_spec(workdir, packaging_dir,
                                             args.spec, spec_commit_id)

    if args.outdir:
        outdir = args.outdir
    else:
        outdir = os.path.join(workdir, packaging_dir)
    outdir = os.path.abspath(outdir)
    if os.path.exists(outdir):
        if not os.access(outdir, os.W_OK|os.X_OK):
            raise GbsError('no write permission to outdir: %s' % outdir)
    else:
        mkdir_p(outdir)

    tmpdir = configmgr.get('tmpdir', 'general')
    tempd = utils.Temp(prefix=os.path.join(tmpdir, '.gbs_export_'), \
                       directory=True)
Exemplo n.º 5
0
def main(args):
    """gbs devel entry point."""

    try:
        repo = RpmGitRepository(args.gitdir)
    except GitRepositoryError, err:
        raise GbsError(str(err))

    tmp = Temp(prefix='gbp_', dirn=configmgr.get('tmpdir', 'general'),
                     directory=True)
    packaging_dir = get_packaging_dir(args)

    # Guess spec from correct branch
    packaging_branch = configmgr.get('packaging_branch', 'orphan-devel')
    commit_id = packaging_branch if packaging_branch else 'WC.UNTRACKED'
    specfile = guess_spec(repo.path, packaging_dir, args.spec, commit_id)[0]

    # Get current branch
    try:
        current_branch = repo.get_branch()
    except GitRepositoryError:
        current_branch = None

    gbp_args = compose_gbp_args(repo, tmp.path, specfile, args)

    # Run gbp command
    if args.action == 'start':
        ret = gbp_pq_rpm(gbp_args + ['import'])
        if not ret:
            update_local_conf(repo, {'orphan-devel':
                                     {'packaging_branch': current_branch}})
Exemplo n.º 6
0
def main(args):
    """gbs changelog entry point."""

    try:
        repo = RpmGitRepository(args.gitdir)
    except GitRepositoryError, err:
        raise GbsError(str(err))

    packaging_dir = get_packaging_dir(args)
    changes_file_list = glob.glob("%s/%s/*.changes" % (repo.path,
                                                       packaging_dir))

    if args.spec or not changes_file_list:
        # Create .changes file with the same name as a spec
        specfile = os.path.basename(guess_spec(repo.path,
                                               packaging_dir, args.spec)[0])
        fn_changes = os.path.splitext(specfile)[0] + ".changes"
        fn_changes = os.path.join(repo.path, packaging_dir, fn_changes)
    else:
        fn_changes = changes_file_list[0]
        if len(changes_file_list) > 1:
            log.warning("Found more than one changes files, %s is taken "
                           % (changes_file_list[0]))

    # get the commit start from the args.since
    commitid_since = get_first_commit(repo, fn_changes, args.since)

    commits = repo.get_commits(commitid_since, 'HEAD')
    if not commits:
        raise GbsError("Nothing found between %s and HEAD" % commitid_since)
Exemplo n.º 7
0
    """gbs devel entry point."""

    try:
        repo = RpmGitRepository(args.gitdir)
    except GitRepositoryError, err:
        raise GbsError(str(err))

    tmp = Temp(prefix='gbp_',
               dirn=configmgr.get('tmpdir', 'general'),
               directory=True)
    packaging_dir = get_packaging_dir(args)

    # Guess spec from correct branch
    packaging_branch = configmgr.get('packaging_branch', 'orphan-devel')
    commit_id = packaging_branch if packaging_branch else 'WC.UNTRACKED'
    specfile = guess_spec(repo.path, packaging_dir, args.spec, commit_id)[0]

    # Get current branch
    try:
        current_branch = repo.get_branch()
    except GitRepositoryError:
        current_branch = None

    gbp_args = compose_gbp_args(repo, tmp.path, specfile, args)

    # Run gbp command
    if args.action == 'start':
        ret = gbp_pq_rpm(gbp_args + ['import'])
        if not ret:
            update_local_conf(
                repo, {'orphan-devel': {
Exemplo n.º 8
0
from gbp.rpm.git import GitRepositoryError, RpmGitRepository
from gbp.scripts.rpm_ch import main as gbp_rpm_ch



def main(args):
    """gbs changelog entry point."""

    try:
        repo = RpmGitRepository(args.gitdir)
    except GitRepositoryError, err:
        raise GbsError(str(err))

    packaging_dir = get_packaging_dir(args)
    specfile = guess_spec(repo.path, packaging_dir, args.spec)[0]
    changes_file_list = glob.glob("%s/%s/*.changes" % (repo.path,
                                                       packaging_dir))
    if changes_file_list:
        fn_changes = changes_file_list[0]
        if len(changes_file_list) > 1:
            log.warning("Found more than one changes files, %s is taken "
                        % (changes_file_list[0]))
    else:
        fn_changes = 'CHANGES'

    gbp_args = ['dummy argv[0]',
                '--color-scheme=magenta:green:yellow:red',
                '--ignore-branch',
                '--changelog-revision=%(tagname)s',
                '--spawn-editor=always',