Learn more about these different git repos.
Other Git URLs
As a package developer, I want to write shell scripts that use rpkg, So that I can automate common workflows
rpkg
Would you please add a --json flag to rpkg so that it will print machine-readable output?
--json
As one example, if we want to process the results of rpkg container-build --scratch (to find the resulting container's pullspec), there is no way to easily read that information without screen-scraping the final line(s) of output. This is further complicated when we encounter deprecation warnings (eg #498).
rpkg container-build --scratch
The koji call command currently supports a --json argument. Would you please add something like that for rpkg?
koji call
Few sentences to summarize the situation: I did some exploration on how can we use json arguments. I found only one place that supports --json ... the "call" method. It was mentioned already. But AFAIK (I am not a koji developer) this method is for calling XML-RPC methods. I don't know whether it is possible to execute build (or container-build) through this interface. Or how this "call" method can help in the procedure.
json
There is standalone koji command (not used by rpkg):
koji call --json-output getTaskInfo 83515383
but fedpkg/rpkg uses koji api, so it works something like:
# run with valid kerberos ticket import koji koji_config = koji.read_config('koji') session_opts = koji.grab_session_options(koji_config) session = koji.ClientSession(koji_config['server'], session_opts) session.gssapi_login() print("logged:", session.logged_in) print(session.getBuild("rpkg-1.64-2.fc35")) url = "xxxxxx.fc36.src.rpm" target = "rawhide" opts = {'scratch': True} session.build(url, target, opts, priority=None) # build task created
After creating the build task, we are watching the build until it is finished. Json is not provided to rpkg by koji. If needed, rpkg should prepare/convert it by itself. There is a current example of a randomly selected container repository: container/haproxy
$ fedpkg container-build --scratch Created task: 83532168 Task info: https://koji.fedoraproject.org/koji/taskinfo?taskID=83532168 Watching tasks (this may be safely interrupted)... 83532168 buildContainer (noarch): free 83532168 buildContainer (noarch): free -> open (buildvm-x86-05.iad2.fedoraproject.org) 83532168 buildContainer (noarch): open (buildvm-x86-05.iad2.fedoraproject.org) -> closed 0 free 0 open 1 done 0 failed 83532168 buildContainer (noarch) completed successfully repositories: candidate-registry.fedoraproject.org/f37/haproxy:rawhide-container-candidate-13737-20220302021353 koji_builds:
Verbose output:
$ fedpkg -v container-build --scratch Creating repo object from /repo/haproxy Missing kojiprofile option in [fedpkg.container-build] section. Using kojiprofile from [fedpkg] Missing build_client option in [fedpkg.container-build] section. Using build_client from [fedpkg] Initiating a koji session to https://koji.fedoraproject.org/kojihub Logging into https://koji.fedoraproject.org/kojihub with Kerberos authentication. Created task: 83532410 Task info: https://koji.fedoraproject.org/koji/taskinfo?taskID=83532410 Watching tasks (this may be safely interrupted)... 83532410 buildContainer (noarch): free 83532410 buildContainer (noarch): free -> open (buildvm-x86-02.iad2.fedoraproject.org) 83532410 buildContainer (noarch): open (buildvm-x86-02.iad2.fedoraproject.org) -> closed 0 free 0 open 1 done 0 failed 83532410 buildContainer (noarch) completed successfully repositories: candidate-registry.fedoraproject.org/f37/haproxy:rawhide-container-candidate-55450-20220302022146 koji_builds: Initiating a koji session to https://koji.fedoraproject.org/kojihub Logging into https://koji.fedoraproject.org/kojihub with Kerberos authentication.
What should look like the output you desire?
Login to comment on this ticket.