Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-dev] network sandbox challenge
Date: Tue, 31 Mar 2020 22:41:21
Message-Id: CAAr7Pr9d6vG8VuVcm18xZt_yGSQDs2x9abx7P6Y2o2ddEL0Nuw@mail.gmail.com
In Reply to: Re: [gentoo-dev] network sandbox challenge by Samuel Bernardo
1 On Tue, Mar 31, 2020 at 3:21 PM Samuel Bernardo <
2 samuelbernardo.mail@×××××.com> wrote:
3
4 > Hi,
5 > On 3/31/20 9:25 PM, Alec Warner wrote:
6 >
7 > From thirdpartymirrors file I can see more examples... The mirror type
8 >> can be any label that I decide to use?
9 >>
10 >
11 > man portage(5) says:
12 > Whenever portage encounters a mirror:// style URI it will look up the
13 > actual hosts here. If the mirror set is not found here, it will check
14 > the
15 > global mirrors file at /var/db/repos/gentoo/profiles/thirdpartymirrors.
16 > You may also set a special mirror type called "local". This list of
17 > mirrors will be checked before GENTOO_MIRRORS and will be used even if the
18 > package has RESTRICT="mirror" or RESTRICT="fetch".
19 >
20 > We have a bunch of existing mirror types (as you noticed). This lets us do
21 > things like "mirror://github" and then globally change the uri for github
22 > easily without editing the entire set of ebuilds because we late-bind the
23 > URI matching.
24 >
25 > Ok, so it works as an alias... The format definition led me to
26 > misunderstand:
27 >
28 > - mirror type followed by a list of hosts
29 >
30 > I interpreted mirror type as some internal definition not an alias.
31 >
32 >
33 >> Is URI mirror:// style deprecated in ebuilds and should use
34 >> restric="mirror" instead?
35 >>
36 >
37 > I don't understand how you could arrive at this conclusion. What would
38 > this do?
39 >
40 > RESTRICT=mirror is for things we are not legally allowed to mirror. That's
41 > basically all its for; it has nothing to do with custom mirrors or anything.
42 >
43 > Sorry for my dumb question, but my previous understanding of the context
44 > was that, since mirror:// is always accessed before the SRC_URI, there is
45 > no need to use mirror:// in ebuild SRC_URI, with the sources being
46 > downloaded from any available mirror (also remembering the dev manuals
47 > documentation related to mirror://gentoo policy for auto mirroring the
48 > sources).
49 >
50 > But after your explanation, I understand now that mirror types provides
51 > alias to use in ebuild SRC_URI, specially useful for the update task
52 > (awesome).
53 >
54 > Looking into overlay context, I think that I could add thirpartymirrors
55 > file inside overlay profiles directory to use mirror://<alias> in SRC_URI
56 > to simplify ebuild URI management in the end. For example, to all JetBrains
57 > software this will be awesome.
58 >
59 In general I'd avoid using the mirror system as URI simplification too
60 much; a lot of the idea is to avoid hardcoding specific hosts. E.g. for the
61 gentoo mirrors we want to avoid hardcoding a *specific* mirror in the
62 SRC_URI, so mirror://gentoo lets us say "any gentoo mirror will do." Often
63 other thirdpartymirror systems act similarly. You see this commonly where
64 mirrors are divided by region.
65
66 example.com/mirror # "global / us"
67 example.au/mirror # "australia"
68 example.co.uk/mirror # "UK"
69
70 From a layout perspective these are the same, but you would not want to
71 hardcode "https://example.com/mirror" in the ebuild, because then
72 australian users are routed to the US..which is wasteful. So we use a
73 generic:
74
75 "mirror://example"
76
77 And we potentially pick the best mirror at fetch time.
78
79 This is mostly spelled out in:
80 https://devmanual.gentoo.org/ebuild-writing/variables/#third-party-mirrors
81
82 If you have a bunch of packages that share a common domain and its not
83 sharded (there is only 1 host serving it) then you should consider using an
84 eclass to share data between your ebuilds and not use thirdpartymirrors
85 just to share a hostname.
86
87 -A
88
89
90 >
91 Thanks,
92 >
93 > Samuel
94 >

Replies

Subject Author
Re: [gentoo-dev] network sandbox challenge Samuel Bernardo <samuelbernardo.mail@×××××.com>