예제 #1
0
파일: cmd_export.py 프로젝트: yoonkiss/gbs
def export_sources(repo, commit, export_dir, spec, args, create_tarball=True):
    """
    Export packaging files using git-buildpackage
    """
    tmp = utils.Temp(prefix='gbp_', dirn=configmgr.get('tmpdir', 'general'),
                            directory=True)

    gbp_args = create_gbp_export_args(repo, commit, export_dir, tmp.path,
                                      spec, args, create_tarball=create_tarball)
    try:
        ret = gbp_build(gbp_args)
        if ret == 2 and not is_native_pkg(repo, args):
            # Try falling back to old logic of one monolithic tarball
            log.error("Generating upstream tarball and/or generating patches "
                      "failed. GBS tried this as you have upstream branch in "
                      "you git tree. Fix the problem by either:\n"
                      "  1. Update your upstream branch and/or fix the spec "
                      "file. Also, check the upstream tag format.\n"
                      "  2. Remove or rename the upstream branch (change the "
                      "package to native)\n"
                      "See https://source.tizen.org/documentation/reference/"
                      "git-build-system/upstream-package for more details.")
        if ret:
            raise GbsError("Failed to export packaging files from git tree")
    except GitRepositoryError, excobj:
        raise GbsError("Repository error: %s" % excobj)
예제 #2
0
        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.")
    package = spec.name

    base_prj = None
    if args.base_obsprj:
        base_prj = args.base_obsprj
예제 #3
0
파일: cmd_export.py 프로젝트: yoonkiss/gbs
    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)
    export_dir = tempd.path

    tracked_branches = track_export_branches(repo, args)

    with utils.Workdir(workdir):
        export_sources(repo, commit, export_dir, main_spec, args)

        if rest_specs:
            # backup updated spec file
            specbakd = utils.Temp(prefix=os.path.join(tmpdir, '.gbs_export_'),
                               directory=True)
            shutil.copy(os.path.join(export_dir,
                        os.path.basename(main_spec)), specbakd.path)
            for spec in rest_specs:
                export_sources(repo, commit, export_dir, spec, args,