Gentoo Archives: gentoo-user

From: David Haller <gentoo@×××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: What is the meaning of "mirror" URI scheme in ebuilds?
Date: Wed, 28 Mar 2018 00:37:30
Message-Id: 20180328003657.4hklfioudleyc2cn@grusum.endjinn.de
In Reply to: [gentoo-user] Re: What is the meaning of "mirror" URI scheme in ebuilds? by Ian Zimmerman
1 Hello,
2
3 On Tue, 27 Mar 2018, Ian Zimmerman wrote:
4 >On 2018-03-27 22:00, David Haller wrote:
5 >
6 >> So, using your example, portage looks up the mirror for mirror://gnu
7 >> by looking in /etc/portage/mirrors (if it exists) and
8 >> /usr/portage/profiles/thirdpartymirrors for a line with the word "gnu"
9 >> at the beginning, and then tries the mirrors specified there. I.e.:
10 >
11 >Thanks, this helps. I have a related follow-up question.
12 >
13 >Sometimes, the SRC_URI in fact consists of multiple URIs. What is
14 >confusing about that is that in some cases the individual URI clearly
15 >refer to copies of the same file (I'm guessing this provides redundant
16 >locations where to download it from),
17
18 Yes.
19
20 >while in other cases they're clearly different files (for example
21 >upstream patches to be downloaded separately). There are even ebuilds
22 >when _both_ cases happen at the same time, such as
23 >media-libs/freetype-2.9 :
24 >
25 >SRC_URI="mirror://sourceforge/freetype/${P/_/}.tar.bz2
26 > mirror://nongnu/freetype/${P/_/}.tar.bz2
27 > utils? ( mirror://sourceforge/freetype/ft2demos-${PV}.tar.bz2
28 > mirror://nongnu/freetype/ft2demos-${PV}.tar.bz2 )
29 > doc? ( mirror://sourceforge/freetype/${PN}-doc-${PV}.tar.bz2
30 > mirror://nongnu/freetype/${PN}-doc-${PV}.tar.bz2 )"
31 >
32 >So, WTH is the semantics of this? How does portage know which URIs are
33 >for the main tarball and which are the extras? It has to know that to
34 >avoid downloading the main tarball twice.
35
36 I, too, am not sure how that's handled in portage, much less what the
37 spec (PMS) say about it, but practical observation leads me to
38 believe, that for each $(basename $URI) (i.e. each file), portage
39 tries to get them from the URIs specified, in this case, it tries to
40 get the freetype ${P/_/}.tar.bz2 tarball from a mirror specified in
41 the sourceforge or nongnu lists of /etc/portage/mirrors resp.
42 ${PORTAGE_DIR}/profiles/thirdpartymirrors and then the ft2demos and
43 -doc- tarballs from (in this case) the same mirror-lists.
44
45 Basically, it seems portage build a list of (think '$(basename $URI)')
46
47 file_to_get -> mirrorlist_or_direct_URI
48
49 i.e. here:
50
51 freetype-${VER}.tar.bz2 -> URI_LIST
52 ft2demos-${VER}.tar.bz2 -> URI_LIST
53 freetype-doc-${VER}.tar.bz2 -> URI_LIST
54
55 and for each of those it tries the specified URIs (here
56 mirror://sourceforge and mirror://nongnu mirrorlists). You quite often
57 also see a "direct" non-mirror:// URI at the end (as a "last resort"
58 or so).
59
60 Anyway, that's my take on it.
61
62 And yes (referring to the bug mentioned by Michael in his answer),
63 quite some mirrors in the (current) thirdpartymirrors list are
64 outdated, which is why I copied that to /etc/portage/mirrors and
65 massaged those mirrorlists I noticed "broken" or "slow", either adding
66 my favored mirrors up front or replacing the complete list with some
67 chosen "known-good" mirrors.
68
69 But for the most-used mirror:// URIs in ebuilds I've come across,
70 besides the core gentoo list, it's mainly sourceforge or gnu or so.
71 For the core "gentoo" mirrors, you can manage that mirrorlist via the
72 GENTOO_MIRRORS="" variable in make.conf, manually or via mirrorselect.
73
74 For me, it's rather easy, there's some "big", reliable "local" mirrors
75 (mostly at universities and related institutions) that mirror most
76 opensource software, from core projects (kernel, gnu) and various
77 projects (X, CTAN, CPAN) to various distros (SuSE, Gentoo, Debian, and
78 whatnot)... Weirdly enough, neither "thirdpartymirrors" nor
79 mirrorselect nor https://www.gentoo.org/downloads/mirrors/#DE list the
80 biggest mirror for gentoo-portage and -distfiles in .de, probably .eu ;)
81
82 *adding that one to my mirror-list*
83
84 HTH,
85 -dnh
86
87 --
88 Ceci n'est pas une .signature.