commit:     aec6c83e31a883f9777198b45e8356660afb35d4
Author:     Matthew Smith <matthew <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 15 20:11:08 2022 +0000
Commit:     Matthew Smith <matthew <AT> gentoo <DOT> org>
CommitDate: Wed Feb 16 18:02:16 2022 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=aec6c83e

ebuild-writing/variables: Selectively lifting SRC_URI restrictions

Closes: https://github.com/gentoo/devmanual/pull/271
Signed-off-by: Matthew Smith <matthew <AT> gentoo.org>

 ebuild-writing/variables/text.xml | 62 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 61 insertions(+), 1 deletion(-)

diff --git a/ebuild-writing/variables/text.xml 
b/ebuild-writing/variables/text.xml
index e45794d..41976b2 100644
--- a/ebuild-writing/variables/text.xml
+++ b/ebuild-writing/variables/text.xml
@@ -431,7 +431,6 @@ SRC_URI="https://example.com/files/${PV}.tar.gz -&gt; 
${P}.tar.gz"
 </body>
 </subsection>
 
-
 <subsection>
 <title>Third-party mirrors</title>
 <body>
@@ -486,6 +485,67 @@ infrastructure</uri>; in that case, the benefit to using 
third-party mirror
 list does not outweigh the burden of maintaining it.
 </p>
 
+</body>
+</subsection>
+
+
+<subsection>
+<title>Lifting restrictions</title>
+<body>
+
+<p>
+In EAPI 8, individual items in <c>SRC_URI</c> can be exempted from automatic
+mirroring and fetching restrictions (imposed by <c>RESTRICT="mirror"</c> and
+<c>RESTRICT="fetch"</c>) by prefixing the addresses with <c>mirror+</c> or
+<c>fetch+</c>.  For example, in the following ebuild,
+</p>
+
+<codesample lang="ebuild">
+EAPI="8"
+
+SRC_URI="${P}.tar.gz
+       mirror+https://dev.gentoo.org/~larry/distfiles/${P}-addons.tar.gz";
+
+RESTRICT="fetch"
+</codesample>
+
+<p>
+Portage will be prevented from trying to fetch <c>${P}.tar.gz</c> as expected,
+but the <c>${P}-patches.tar.gz</c> file will be mirrored and fetched by Portage
+without restriction.
+</p>
+
+<p>
+The following table shows the effects of the prefixes when 
<c>RESTRICT="mirror"</c> and <c>RESTRICT="fetch"</c> are set:
+</p>
+
+<table>
+<tr>
+  <th></th>
+  <th><e>(no prefix)</e></th>
+  <th><c>fetch+</c></th>
+  <th><c>mirror+</c></th>
+</tr>
+<tr>
+  <th><e>(no RESTRICT)</e></th>
+  <ti>fetch &amp; mirror</ti>
+  <ti>fetch &amp; mirror</ti>
+  <ti>fetch &amp; mirror</ti>
+</tr>
+<tr>
+  <th><c>RESTRICT="mirror"</c></th>
+  <ti>fetch only</ti>
+  <ti>fetch only</ti>
+  <ti>fetch &amp; mirror</ti>
+</tr>
+<tr>
+  <th><c>RESTRICT="fetch"</c></th>
+  <ti>unfetchable</ti>
+  <ti>fetch only</ti>
+  <ti>fetch &amp; mirror</ti>
+</tr>
+</table>
+
 </body>
 </subsection>
 </section>

Reply via email to