#1831 how do you get RPMs associated with a scratch build task ID?
Closed: Fixed 4 years ago by tkopecek. Opened 4 years ago by dcantrel.

I am trying to use the XML-RPC API to get a list of RPMs associated with a scratch build task ID. So far I have not been able to do that.

With the task ID, I use getTaskInfo to get that struct. There's not much useful in that output except I can use the call to verify that a given ID is a valid task. I do save the user ID of the task owner from that output which I use later.

I then call getTaskDescendents on that task ID to get the other tasks where builds happen. I do not understand the difference between getTaskChildren and getTaskDescendents. I went with getTaskDescendents because that's what the web interface refers to those tasks as. The output of this call gives me an array of structs which appear to be the same output as getTaskInfo on an individual call for a task.

The problem now is I don't know where to go from here. All of the API calls that list RPMs refer to build IDs, but I can't figure out how to map a task ID to a build ID. Is there a way to get a list of RPMs from a scratch build task? In addition, is there a reliable way to build a download URL for those RPMs?

Thanks in advance for help and pointers. I am working on rpminspect and it communicates directly with the Koji hub to get build information and figure out what RPMs it needs to download.


getTaskChildren returns only one level of children. getTaskDescendents is recursive variant of this. As you are caring only about rpm builds, both should return same results - there is no deeper hierarchy now.

After you get all those buildArch tasks, you have to use getTaskResult call, which will return you dictionary of srpm and rpms for given task. Paths to those rpms are relative to task directory - but beware, task will get garbage-collected pretty quickly and content will be in scratch directory, which is in example in Fedora here: https://koji.fedoraproject.org/scratch/<user>/task_<task_id>

Metadata Update from @tkopecek:
- Custom field Size adjusted to None

4 years ago

Thank you. The getTaskResult line in the API listing doesn't have a description so I just kept scrolling past it. :)

Is there an API call that will give me the "https://koji.fedoraproject.org/scratch/" leading part of the URL? So far I've noticed that the base URL that I use for package downloads is one I can just append "/scratch/<user>/task_<task_id>" to in order to get the whole URL, but I was wondering if I could ask Koji for the download base URL.

For missing docs: I've created #1832

It is not completely about API, you need to have correct koji profile locally (or know topurl). If you've profile (fedora's koji in the example), then you should be able to run following:

import koji
mod = koji.get_profile_module('koji')
pi = koji.PathInfo(mod.config.topurl)
pi.scratch()
# https://kojipkgs.fedoraproject.org//scratch

Here's a script I use in order to download the results of a scratch build: https://github.com/ktdreyer/build-ceph-coverage/blob/master/rebuild.py

Check out the store_binaries() and get_koji_pathinfo() methods

Metadata Update from @tkopecek:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

4 years ago

Commit 27df9ed relates to this ticket

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #1832 Merged 4 years ago