1
0
Fork 0
forked from infra/ansible

copr: fix the Pulp redirect script for devel repositories

We dont have a ticket but the problem was discovered on the @asahi/kernel
project and reported by @jannau. The use-case is

> We use the devel repositories for fedora asahi remix to have a bodhi like
> experience for copr projects

and technically, they enable the repositores on user machines like this:

26cab83/f/asahi-repos.spec (_149-160)
This commit is contained in:
Jakub Kadlcik 2026-04-22 22:45:17 +02:00 committed by Pavel Raiskup
commit ea2f954a44

View file

@ -66,6 +66,17 @@ function pulp_url(copr_path)
local split = string_split(copr_path, "/")
-- Nobody should use devel repositories on user machines but in reality,
-- some people do. In such case we need to transform
-- @asahi/kernel/fedora-43-x86_64/devel/ into
-- @asahi/kernel/fedora-43-x86_64-devel/
-- This is not needed for devel repositories in Copr buildroots, because
-- copr-frontend does the same kind of transformation
if split[4] == "devel" then
split[3] = split[3] .. "-devel"
table.remove(split, 4)
end
if copr_path:sub(-4) ~= ".rpm" then
-- This is easy for .xml files inside the repodata, because in Pulp they are
-- located at the same place where they would be on Copr backend.
@ -74,14 +85,14 @@ function pulp_url(copr_path)
-- This is the only thing that is needed to make `dnf copr enable` work, and
-- for the repos to use the https://download.copr.fedorainfracloud.org CDN.
-- This alone will not `dnf install` from the repos, though. See below.
url = url .. copr_path
url = url .. table.concat(split, "/")
elseif split[4] == "Packages" then
-- This is a .rpm file but the path already contains /Packages/, therefore
-- we know that this is a `dnf install` situation. The repo already points
-- to the correct path in Pulp, we just need to translate the CDN hostname
-- to the Pulp hostname
url = url .. copr_path
url = url .. table.concat(split, "/")
else
-- This is a .rpm file but we are not accessing it through a repository.