Obrigado pelo @muru por apontar a librepo responsável pelo download.
A solução atual é definir um debug_function
e passá-lo para set_debug_log_handler
(consulte download_packages.py
) em repo.py
:
def download_payloads(payloads, drpm):
# download packages
drpm.err.clear()
targets = [pload.librepo_target() for pload in payloads]
errs = _DownloadErrors()
try:
#START my custom code
def debug_function(msg, _):
print("##hole## msg:", msg)
librepo.set_debug_log_handler(debug_function)
#END my custom code
librepo.download_packages(targets, failfast=True)
except librepo.LibrepoException as e:
errs.fatal = e.args[1] or '<unspecified librepo error>'
...
Este arquivo repo.py
pode ser localizado manualmente:
[xiaobai@xiaobai log]$ python -c 'import sys, dnf.repo; print(sys.modules["dnf.repo"])'
<module 'dnf.repo' from '/usr/lib/python2.7/site-packages/dnf/repo.py'>
[xiaobai@xiaobai log]$
[UPDATE] No Fedora 24, o caminho é /usr/lib/python3.5/site-packages/dnf/repo.py
.
E agora posso obter o URL link :
[xiaobai@xiaobai test]$ dnf download --source readline
[sudo] password for xiaobai:
Using metadata from Thu Dec 31 19:18:09 2015 (1 day, 11:59:10 hours old)
...
##hole## msg: select_next_target: Selecting mirror for: r/readline-6.3-5.fc21.src.rpm
##hole## msg: select_suitable_mirror: Skipping rsync url: rsync://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/21/Everything/source/SRPMS/
##hole## msg: prepare_next_transfer: URL: http://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/21/Everything/source/SRPMS/r/readline-6.3-5.fc21.src.rpm
##hole## msg: prepare_next_transfer: Resume ignored, existing file was not originaly being downloaded by Librepo
##hole## msg: lr_download: Downloading started
##hole## msg: lr_headercb: Server returned Content-Length: "2493152" (converted 2493152/2493152 expected) ] --- B/s | 0 B --:-- ETA
##hole## msg: check_transfer_statuses: Transfer finished: r/readline-6.3-5.fc21.src.rpm (Effective url: http://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/21/Everything/source/SRPMS/r/readline-6.3-5.fc21.src.rpm)
##hole## msg: check_finished_trasfer_checksum: Checksum (sha256) 521bd47a3293e694190a237921a9954b20fa41d0e8e38183d186452d4cc62ac8 is OK
readline-6.3-5.fc21.src.rpm 1.4 MB/s | 2.4 MB 00:01
##hole## msg: lr_download_packages: Restoring an old SIGINT handler
[xiaobai@xiaobai test]$
Naturalmente, poderia ser melhor se dnf registrasse esta url para referência futura, ou recuperasse do comando dnf history
ou arquivo /var/log/dnf.log
.