rosa-abf / rosa-build

Core of ABF
https://abf.rosalinux.ru/abf/rosa-build
Other
7 stars 13 forks source link

DNF Mirror list generation #12

Open berolinux opened 5 years ago

berolinux commented 5 years ago

The best way to support mirrors in DNF is replacing

baseurl=http://abf-downloads.openmandriva.org/cooker/repository/x86_64/main/release/ with mirrorlist=http://abf-downloads.openmandriva.org/mirrors?platform=cooker&arch=x86_64&repo=main&tree=release (or similar)

where that script would - based on the input parameters - put out a text file containing a list of mirrors, e.g.

http://abf-downloads.openmandriva.org/cooker/repository/x86_64/main/release/ http://distro.ibiblio.org/openmandriva/cooker/repository/x86_64/main/release/ http://www.mirrorservice.org/sites/downloads.openmandriva.org/cooker/repository/x86_64/main/release/

Would be nice to have a way to handle that in abf. (Alternatively, we can just run a script on another vhost.)

Example of functional mirrorlist bits from Mageia (obviously outside of abf): http://svnweb.mageia.org/packages/cauldron/mageia-repos/current/SOURCES/mageia-core-repo?view=markup&pathrev=1399571 https://www.mageia.org/mirrorlist/?release=7&arch=x86_64&section=core&repo=release

berolinux commented 5 years ago

Following up on question in IRC:

[02:51:45] well i got it, but how mageia or centos generates such list by requests ? any info? [02:52:12] they looking for IP of request and what?

No need to do anything, dnf takes care of it. Just a static list is ok.

This is the current list of mirrors: http://www.mirrorservice.org/sites/downloads.openmandriva.org http://openmandriva.c3sl.ufpr.br http://distrib-coffee.ipsl.jussieu.fr/pub/linux/openmandriva http://ftp-stud.hs-esslingen.de/pub/Mirrors/openmandriva http://ftp.tu-chemnitz.de/pub/linux/openmandriva http://ftp.nluug.nl/pub/os/Linux/distr/openmandriva http://mirror.lagoon.nc/pub/openmandriva http://mirror.rise.ph/openmandriva http://ftp.icm.edu.pl/pub/Linux/dist/openmandriva http://ftp.vectranet.pl/mirror/openmandriva.org http://ftp.pwr.wroc.pl/OpenMandriva http://mirror.yandex.ru/openmandriva http://ftp.acc.umu.se/mirror/openmandriva.org http://ftp.yzu.edu.tw/Linux/openmandriva http://distro.ibiblio.org/openmandriva http://abf-downloads.openmandriva.org

The script essentially just needs to

for i in $mirrors; do echo $i/$platform/repository/$arch/$repo/$release done

berolinux commented 5 years ago

For now (need to get something on that iso...), I've created a new virtual host and put a simple php script there. http://mirrors.openmandriva.org/mirrors.php?platform=cooker&arch=znver1&repo=main&release=release

Source of the php script:

<?php
header('Content-Type: text/plain');
$mirrors = [
        "http://www.mirrorservice.org/sites/downloads.openmandriva.org",
        "http://openmandriva.c3sl.ufpr.br",
        "http://distrib-coffee.ipsl.jussieu.fr/pub/linux/openmandriva",
        "http://ftp-stud.hs-esslingen.de/pub/Mirrors/openmandriva",
        "http://ftp.tu-chemnitz.de/pub/linux/openmandriva",
        "http://ftp.nluug.nl/pub/os/Linux/distr/openmandriva",
        "http://mirror.lagoon.nc/pub/openmandriva",
        "http://mirror.rise.ph/openmandriva",
        "http://ftp.icm.edu.pl/pub/Linux/dist/openmandriva",
        "http://ftp.vectranet.pl/mirror/openmandriva.org",
        "http://ftp.pwr.wroc.pl/OpenMandriva",
        "http://mirror.yandex.ru/openmandriva",
        "http://ftp.acc.umu.se/mirror/openmandriva.org",
        "http://ftp.yzu.edu.tw/Linux/openmandriva",
        "http://distro.ibiblio.org/openmandriva",
        "http://abf-downloads.openmandriva.org",
];
foreach ($mirrors as $mirror) {
        print($mirror . '/' . $_GET["platform"] . '/repository/' . $_GET["arch"] . '/' . $_GET["repo"] . '/' . $_GET["release"] . "/\n");
}
?>