Last active
June 13, 2019 17:31
-
-
Save FrostyX/ba098eb74147842174aff59017f1af43 to your computer and use it in GitHub Desktop.
Example replacement for `copr-rpmbuild scm` command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
./scm2task.py --clone-url <URL> --chroot fedora-28-x86_64 > task.json | |
copr-rpmbuild --task-file task.json --chroot fedora-28-x86_64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import json | |
import argparse | |
from copr_rpmbuild.helpers import SourceType | |
parser = argparse.ArgumentParser(add_help=False) | |
parser.add_argument("--chroot", help="Name of the chroot to build rpm package in (e.g. epel-7-x86_64).") | |
parser.add_argument("--clone-url", required=True, help="clone url to a project versioned by Git or SVN, required") | |
parser.add_argument("--commit", dest="committish", help="branch name, tag name, or git hash to be built") | |
parser.add_argument("--subdir", dest="subdirectory", help="relative path from the repo root to the package content") | |
parser.add_argument("--spec", help="relative path from the subdirectory to the .spec file") | |
parser.add_argument("--type", dest="type", choices=["git", "svn"], default="git", | |
help="Specify versioning tool. Default is 'git'.") | |
parser.add_argument("--method", dest="srpm_build_method", default="rpkg", | |
choices=["rpkg", "tito", "tito_test", "make_srpm"], | |
help="Srpm build method. Default is 'rpkg'.") | |
args = parser.parse_args() | |
task = { | |
"task_id": None, | |
"chroot": args.chroot, | |
"source_type": SourceType.SCM, | |
"source_json": json.dumps({ | |
'clone_url': args.clone_url, | |
'committish': args.committish, | |
'subdirectory': args.subdirectory, | |
'spec': args.spec, | |
'type': args.type, | |
'srpm_build_method': args.srpm_build_method, | |
}), | |
} | |
print(json.dumps(task, indent=4, sort_keys=False)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment