Bug 1373566 - RFE: [API] Add method to get built RPMs from build #
Summary: RFE: [API] Add method to get built RPMs from build #
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Copr
Classification: Community
Component: frontend
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Copr Team
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-06 15:15 UTC by Igor Gnatenko
Modified: 2020-12-14 09:54 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-12-14 09:54:52 UTC


Attachments (Terms of Use)

Description Igor Gnatenko 2016-09-06 15:15:24 UTC
It's quite useful instead of parsing generated by lighttpd HTML page.

This is what we do now:
        # Parse results
        rpms = []
        for task in build.get_build_tasks():
            url_prefix = task.result_dir_url
            resp = requests.get(url_prefix)
            if resp.status_code != 200:
                raise Exception("Failed to fetch {!r}: {!s}".format(url_prefix, resp.text))
            soup = bs4.BeautifulSoup(resp.text, "lxml")
            for link in soup.find_all("a", href=True):
                href = link["href"]
                if href.endswith(".rpm") and not href.endswith(".src.rpm"):
rpms.append("{}/{}".format(url_prefix, href))

I would like to avoid this as much as possible.

Comment 1 clime 2016-09-08 00:30:30 UTC
There is: /api/coprs/build/<id>/ (CoprClient.get_build_details(...))

and also: /api_2/builds/<id> (CoprClient.builds.get_one(...))

For direct retrieval of rpm filenames you can use `dnf repoquery` on the backend repository.

Comment 2 Igor Gnatenko 2016-09-08 06:37:12 UTC
(In reply to clime from comment #1)
> There is: /api/coprs/build/<id>/ (CoprClient.get_build_details(...))
> 
> and also: /api_2/builds/<id> (CoprClient.builds.get_one(...))
Which returns no URLs to RPM.
> 
> For direct retrieval of rpm filenames you can use `dnf repoquery` on the
> backend repository.
1. repoquery is slow
2. I want to get all built RPMs from exact build# and repoquery is not helpful in that case, at all. It will list all RPMs (and actually without URLs). It doesn't show duplicated versions and etc.

Comment 3 Pavel Raiskup 2020-12-14 09:54:52 UTC
There's an upstream issue for this so I'm closing this in favour of https://pagure.io/copr/copr/issue/1411


Note You need to log in before you can comment on or make changes to this bug.