rpm-software-management / dnf5

Next-generation RPM package management system
Other
256 stars 86 forks source link

Option to retreive download url of a pacakge from all available mirrors #1734

Closed alimirjamali closed 1 month ago

alimirjamali commented 1 month ago

With dnf4, our downloadurl plugin (fork of download plugin) allowed us to get urls for specific package from all mirrors (our own infrastructure). So we could shuffle them and use curl/wget/... to download the package via our own interactive CLI/GUI tools from multiple mirrors (They are multi-gigabyte VM templates). The command was dnf downloadurl --url --all-mirrrors <pkg>.

It appears that downloadurl plugin is not compatible with dnf5 anymore. Neither dnf repoquery <pkg> --location nor dnf download <pkg> --url could do the same. Is there any workaround for dnf5?

alimirjamali commented 1 month ago

Never mind. Some confusion here. It is a forked version of download plugin. Not an official one.

marmarek commented 1 month ago

But maybe it still makes sense? What about adding --all-mirrors option to the download command? The way we have it in our ownloadurl plugin makes sense only for a single package (it prints all URLs but doesn't mark which one is for which package), but maybe still something that would be useful for others too?

alimirjamali commented 1 month ago

This line in dnf5 download plugin is what that has to be changed/improved to allow --all-mirrors (to be used together with --url option). I am ready to work on a patch if DNF5 maintainers approve it.

alimirjamali commented 1 month ago

Related: #497

ppisar commented 1 month ago

Would you print every URL on a separate line, or would you group URLs pertaining the same package on a single line, separating them with a white space? An example:

$ dnf download --all-mirrors --url foo bar
http://mirror1/foo.rpm
http://mirror2/foo.rpm
http://mirror1/bar.rpm
http://mirror2/bar.rpm

Or:

$ dnf download --all-mirrors --url foo bar
http://mirror1/foo.rpm http://mirror2/foo.rpm
http://mirror1/bar.rpm http://mirror2/bar.rpm

I recommend grouping. I has the advantage that a relation for the same package is delivered. E.g. a downloading application can stop trying other mirrors if it sees that one succeeded for the package.

Problem with not grouping is that you can have theoretically two different packages with the same package file name and than you cannot rely on the file name as an indicator that all the URLs resolve to the same package. An example:

$ dnf download --url foo bar
http://mirror1/foo/some.rpm
http://mirror1/bar/some.rpm

It's unusual, but not impossible.

alimirjamali commented 1 month ago

Would you print every URL on a separate line, or would you group URLs pertaining the same package on a single line, separating them with a white space?

For our current use case, we have been using the old DNF4 patched download plugin only for one package. So the grouping was not necessary. But grouping is doable and is very useful. I will amend the PR and apply the recommended change. Force-push it after testing.