[PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Raf Czlonka-2
Hi all,

Given that PKG_PATH and pkg.conf(5)'s installpath, now supports %c, %a,
etc. sequences, it might be worth advertising it a bit more by changing
all relevant uname(1), arch(1)/machine(1) occurrences or (hard-coded
release versions or hardware architectures for that matter) in the
documentation.

While there, I have also taken the liberty of changing ftp.openbsd.org
to your.local.mirror and ftp to http in packages(7) to keep it
consistent with other examples.

Main benefits:
- as the sequences themselves - not need to hard-code the values
- no need to run uname, arch/machine is sub-shells any more
- short and sweet

Regards,

Raf

Index: share/man/man7/packages.7
===================================================================
RCS file: /cvs/src/share/man/man7/packages.7,v
retrieving revision 1.40
diff -u -p -r1.40 packages.7
--- share/man/man7/packages.7 24 Oct 2015 08:44:49 -0000 1.40
+++ share/man/man7/packages.7 11 Jan 2016 14:26:49 -0000
@@ -240,7 +240,7 @@ are supported: pointing
 .Ev PKG_PATH
 to a distant package repository, e.g.,
 .Bd -literal -offset 1n
-# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
+# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/
 .Ed
 .Pp
 will let
Index: faq/faq15.html
===================================================================
RCS file: /cvs/www/faq/faq15.html,v
retrieving revision 1.116
diff -u -p -r1.116 faq15.html
--- faq/faq15.html 23 Nov 2015 03:15:50 -0000 1.116
+++ faq/faq15.html 11 Jan 2016 14:29:33 -0000
@@ -203,13 +203,13 @@ A list of possible locations to fetch pa
 Example 1: fetching from your <a href="../orders.html">CD-ROM</a>,
 assuming you mounted it on <tt>/mnt/cdrom</tt>
 <blockquote><pre>
-$ <b>export PKG_PATH=/mnt/cdrom/$(uname -r)/packages/$(machine -a)/</b>
+$ <b>export PKG_PATH=/mnt/cdrom/%c/packages/%a/</b>
 </pre></blockquote>
 
 <p>
 Example 2: fetching from a nearby <a href="../ftp.html">mirror</a>
 <blockquote><pre>
-$ <b>export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/</b>
+$ <b>export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/</b>
 </pre></blockquote>
 
 <p>
@@ -404,7 +404,7 @@ HTTP, or SCP locations.
 Let's consider installation via HTTP in the next example:
 
 <blockquote><pre>
-# <b>pkg_add http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/screen-4.0.3p3.tgz</b>
+# <b>pkg_add <a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz</b>
 screen-4.0.3p3: complete
 </pre></blockquote>
 
Index: faq/faq9.html
===================================================================
RCS file: /cvs/www/faq/faq9.html,v
retrieving revision 1.116
diff -u -p -r1.116 faq9.html
--- faq/faq9.html 23 Nov 2015 03:16:31 -0000 1.116
+++ faq/faq9.html 11 Jan 2016 14:29:33 -0000
@@ -362,7 +362,7 @@ To find out more about the packages and
 To install the above mentioned package you would issue
 
 <blockquote><pre>
-# export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
+# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/
 # pkg_add fedora_base
 </pre></blockquote>
 
Index: faq/pf/example1.html
===================================================================
RCS file: /cvs/www/faq/pf/example1.html,v
retrieving revision 1.63
diff -u -p -r1.63 example1.html
--- faq/pf/example1.html 10 Jan 2016 01:28:23 -0000 1.63
+++ faq/pf/example1.html 11 Jan 2016 14:29:33 -0000
@@ -346,7 +346,7 @@ to use (<tt>8.8.8.8@53</tt>, for example
 installing the tool and choosing a resolver.
 <p>
 <blockquote><pre>
-# <b>export PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)</b>
+# <b>export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/</b>
 # <b>pkg_add dnscrypt-proxy</b>
 # <b>rcctl enable dnscrypt_proxy</b>
 </pre></blockquote>
Index: faq/ports/guide.html
===================================================================
RCS file: /cvs/www/faq/ports/guide.html,v
retrieving revision 1.46
diff -u -p -r1.46 guide.html
--- faq/ports/guide.html 21 Dec 2015 16:35:48 -0000 1.46
+++ faq/ports/guide.html 11 Jan 2016 14:29:33 -0000
@@ -563,7 +563,7 @@ When dealing with multi-packages, it may
 >pkg_add(1)</a> and
 <a href="http://www.openbsd.org/cgi-bin/man.cgi?sektion=1&amp;query=pkg_delete"
 >pkg_delete(1)</a> directly,
-setting <tt>PKG_PATH</tt> to <tt>/usr/ports/packages/`arch -s`/all/</tt> in the
+setting <tt>PKG_PATH</tt> to <tt>/usr/ports/packages/%a/all/</tt> in the
 environment.
 
 <br><br><li>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Michael McConville-3
Raf Czlonka wrote:

> Hi all,
>
> Given that PKG_PATH and pkg.conf(5)'s installpath, now supports %c, %a,
> etc. sequences, it might be worth advertising it a bit more by changing
> all relevant uname(1), arch(1)/machine(1) occurrences or (hard-coded
> release versions or hardware architectures for that matter) in the
> documentation.
>
> While there, I have also taken the liberty of changing ftp.openbsd.org
> to your.local.mirror and ftp to http in packages(7) to keep it
> consistent with other examples.
>
> Main benefits:
> - as the sequences themselves - not need to hard-code the values
> - no need to run uname, arch/machine is sub-shells any more
> - short and sweet

ok mmcc@

> Index: share/man/man7/packages.7
> ===================================================================
> RCS file: /cvs/src/share/man/man7/packages.7,v
> retrieving revision 1.40
> diff -u -p -r1.40 packages.7
> --- share/man/man7/packages.7 24 Oct 2015 08:44:49 -0000 1.40
> +++ share/man/man7/packages.7 11 Jan 2016 14:26:49 -0000
> @@ -240,7 +240,7 @@ are supported: pointing
>  .Ev PKG_PATH
>  to a distant package repository, e.g.,
>  .Bd -literal -offset 1n
> -# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
> +# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/
>  .Ed
>  .Pp
>  will let
> Index: faq/faq15.html
> ===================================================================
> RCS file: /cvs/www/faq/faq15.html,v
> retrieving revision 1.116
> diff -u -p -r1.116 faq15.html
> --- faq/faq15.html 23 Nov 2015 03:15:50 -0000 1.116
> +++ faq/faq15.html 11 Jan 2016 14:29:33 -0000
> @@ -203,13 +203,13 @@ A list of possible locations to fetch pa
>  Example 1: fetching from your <a href="../orders.html">CD-ROM</a>,
>  assuming you mounted it on <tt>/mnt/cdrom</tt>
>  <blockquote><pre>
> -$ <b>export PKG_PATH=/mnt/cdrom/$(uname -r)/packages/$(machine -a)/</b>
> +$ <b>export PKG_PATH=/mnt/cdrom/%c/packages/%a/</b>
>  </pre></blockquote>
>  
>  <p>
>  Example 2: fetching from a nearby <a href="../ftp.html">mirror</a>
>  <blockquote><pre>
> -$ <b>export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/</b>
> +$ <b>export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/</b>
>  </pre></blockquote>
>  
>  <p>
> @@ -404,7 +404,7 @@ HTTP, or SCP locations.
>  Let's consider installation via HTTP in the next example:
>  
>  <blockquote><pre>
> -# <b>pkg_add http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/screen-4.0.3p3.tgz</b>
> +# <b>pkg_add <a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz</b>
>  screen-4.0.3p3: complete
>  </pre></blockquote>
>  
> Index: faq/faq9.html
> ===================================================================
> RCS file: /cvs/www/faq/faq9.html,v
> retrieving revision 1.116
> diff -u -p -r1.116 faq9.html
> --- faq/faq9.html 23 Nov 2015 03:16:31 -0000 1.116
> +++ faq/faq9.html 11 Jan 2016 14:29:33 -0000
> @@ -362,7 +362,7 @@ To find out more about the packages and
>  To install the above mentioned package you would issue
>  
>  <blockquote><pre>
> -# export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
> +# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/
>  # pkg_add fedora_base
>  </pre></blockquote>
>  
> Index: faq/pf/example1.html
> ===================================================================
> RCS file: /cvs/www/faq/pf/example1.html,v
> retrieving revision 1.63
> diff -u -p -r1.63 example1.html
> --- faq/pf/example1.html 10 Jan 2016 01:28:23 -0000 1.63
> +++ faq/pf/example1.html 11 Jan 2016 14:29:33 -0000
> @@ -346,7 +346,7 @@ to use (<tt>8.8.8.8@53</tt>, for example
>  installing the tool and choosing a resolver.
>  <p>
>  <blockquote><pre>
> -# <b>export PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)</b>
> +# <b>export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/</b>
>  # <b>pkg_add dnscrypt-proxy</b>
>  # <b>rcctl enable dnscrypt_proxy</b>
>  </pre></blockquote>
> Index: faq/ports/guide.html
> ===================================================================
> RCS file: /cvs/www/faq/ports/guide.html,v
> retrieving revision 1.46
> diff -u -p -r1.46 guide.html
> --- faq/ports/guide.html 21 Dec 2015 16:35:48 -0000 1.46
> +++ faq/ports/guide.html 11 Jan 2016 14:29:33 -0000
> @@ -563,7 +563,7 @@ When dealing with multi-packages, it may
>  >pkg_add(1)</a> and
>  <a href="http://www.openbsd.org/cgi-bin/man.cgi?sektion=1&amp;query=pkg_delete"
>  >pkg_delete(1)</a> directly,
> -setting <tt>PKG_PATH</tt> to <tt>/usr/ports/packages/`arch -s`/all/</tt> in the
> +setting <tt>PKG_PATH</tt> to <tt>/usr/ports/packages/%a/all/</tt> in the
>  environment.
>  
>  <br><br><li>
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Joerg Jung
In reply to this post by Raf Czlonka-2
On Mon, Jan 11, 2016 at 03:40:17PM +0000, Raf Czlonka wrote:

> Hi all,
>
> Given that PKG_PATH and pkg.conf(5)'s installpath, now supports %c, %a,
> etc. sequences, it might be worth advertising it a bit more by changing
> all relevant uname(1), arch(1)/machine(1) occurrences or (hard-coded
> release versions or hardware architectures for that matter) in the
> documentation.
>
> While there, I have also taken the liberty of changing ftp.openbsd.org
> to your.local.mirror and ftp to http in packages(7) to keep it
> consistent with other examples.
>
> Main benefits:
> - as the sequences themselves - not need to hard-code the values
> - no need to run uname, arch/machine is sub-shells any more
> - short and sweet

While I like the reduction below, it seems with upcoming release this
can be further shortened [1].  So might make sense to update the diff
below?

[1] http://marc.info/?l=openbsd-cvs&m=145415350609473&w=2

> Regards,
>
> Raf
>
> Index: share/man/man7/packages.7
> ===================================================================
> RCS file: /cvs/src/share/man/man7/packages.7,v
> retrieving revision 1.40
> diff -u -p -r1.40 packages.7
> --- share/man/man7/packages.7 24 Oct 2015 08:44:49 -0000 1.40
> +++ share/man/man7/packages.7 11 Jan 2016 14:26:49 -0000
> @@ -240,7 +240,7 @@ are supported: pointing
>  .Ev PKG_PATH
>  to a distant package repository, e.g.,
>  .Bd -literal -offset 1n
> -# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
> +# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/
>  .Ed
>  .Pp
>  will let
> Index: faq/faq15.html
> ===================================================================
> RCS file: /cvs/www/faq/faq15.html,v
> retrieving revision 1.116
> diff -u -p -r1.116 faq15.html
> --- faq/faq15.html 23 Nov 2015 03:15:50 -0000 1.116
> +++ faq/faq15.html 11 Jan 2016 14:29:33 -0000
> @@ -203,13 +203,13 @@ A list of possible locations to fetch pa
>  Example 1: fetching from your <a href="../orders.html">CD-ROM</a>,
>  assuming you mounted it on <tt>/mnt/cdrom</tt>
>  <blockquote><pre>
> -$ <b>export PKG_PATH=/mnt/cdrom/$(uname -r)/packages/$(machine -a)/</b>
> +$ <b>export PKG_PATH=/mnt/cdrom/%c/packages/%a/</b>
>  </pre></blockquote>
>  
>  <p>
>  Example 2: fetching from a nearby <a href="../ftp.html">mirror</a>
>  <blockquote><pre>
> -$ <b>export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/</b>
> +$ <b>export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/</b>
>  </pre></blockquote>
>  
>  <p>
> @@ -404,7 +404,7 @@ HTTP, or SCP locations.
>  Let's consider installation via HTTP in the next example:
>  
>  <blockquote><pre>
> -# <b>pkg_add http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/screen-4.0.3p3.tgz</b>
> +# <b>pkg_add <a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz</b>
>  screen-4.0.3p3: complete
>  </pre></blockquote>
>  
> Index: faq/faq9.html
> ===================================================================
> RCS file: /cvs/www/faq/faq9.html,v
> retrieving revision 1.116
> diff -u -p -r1.116 faq9.html
> --- faq/faq9.html 23 Nov 2015 03:16:31 -0000 1.116
> +++ faq/faq9.html 11 Jan 2016 14:29:33 -0000
> @@ -362,7 +362,7 @@ To find out more about the packages and
>  To install the above mentioned package you would issue
>  
>  <blockquote><pre>
> -# export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
> +# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/
>  # pkg_add fedora_base
>  </pre></blockquote>
>  
> Index: faq/pf/example1.html
> ===================================================================
> RCS file: /cvs/www/faq/pf/example1.html,v
> retrieving revision 1.63
> diff -u -p -r1.63 example1.html
> --- faq/pf/example1.html 10 Jan 2016 01:28:23 -0000 1.63
> +++ faq/pf/example1.html 11 Jan 2016 14:29:33 -0000
> @@ -346,7 +346,7 @@ to use (<tt>8.8.8.8@53</tt>, for example
>  installing the tool and choosing a resolver.
>  <p>
>  <blockquote><pre>
> -# <b>export PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)</b>
> +# <b>export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/</b>
>  # <b>pkg_add dnscrypt-proxy</b>
>  # <b>rcctl enable dnscrypt_proxy</b>
>  </pre></blockquote>
> Index: faq/ports/guide.html
> ===================================================================
> RCS file: /cvs/www/faq/ports/guide.html,v
> retrieving revision 1.46
> diff -u -p -r1.46 guide.html
> --- faq/ports/guide.html 21 Dec 2015 16:35:48 -0000 1.46
> +++ faq/ports/guide.html 11 Jan 2016 14:29:33 -0000
> @@ -563,7 +563,7 @@ When dealing with multi-packages, it may
>  >pkg_add(1)</a> and
>  <a href="http://www.openbsd.org/cgi-bin/man.cgi?sektion=1&amp;query=pkg_delete"
>  >pkg_delete(1)</a> directly,
> -setting <tt>PKG_PATH</tt> to <tt>/usr/ports/packages/`arch -s`/all/</tt> in the
> +setting <tt>PKG_PATH</tt> to <tt>/usr/ports/packages/%a/all/</tt> in the
>  environment.
>  
>  <br><br><li>
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Raf Czlonka-2
On Sun, Jan 31, 2016 at 07:28:43PM GMT, Joerg Jung wrote:

> On Mon, Jan 11, 2016 at 03:40:17PM +0000, Raf Czlonka wrote:
> > Hi all,
> >
> > Given that PKG_PATH and pkg.conf(5)'s installpath, now supports %c, %a,
> > etc. sequences, it might be worth advertising it a bit more by changing
> > all relevant uname(1), arch(1)/machine(1) occurrences or (hard-coded
> > release versions or hardware architectures for that matter) in the
> > documentation.
> >
> > While there, I have also taken the liberty of changing ftp.openbsd.org
> > to your.local.mirror and ftp to http in packages(7) to keep it
> > consistent with other examples.
> >
> > Main benefits:
> > - as the sequences themselves - not need to hard-code the values
> > - no need to run uname, arch/machine is sub-shells any more
> > - short and sweet
>
> While I like the reduction below, it seems with upcoming release this
> can be further shortened [1].  So might make sense to update the diff
> below?
>
> [1] http://marc.info/?l=openbsd-cvs&m=145415350609473&w=2

Hi Joerg,

I'm not following openbsd-cvs@ at the moment so thanks for bringing this
to my attention.

However, given that the FAQ is for -release/-stable, and it is still 4
months until the next one, this change only affects packages(7) for now.
Updated diff below - I'll send a revised one when 5.9 gets released in
order to update the FAQ.

Personally, I'd prefer to use a RFC 2606 compliant domain in all of the
relevant places but, until IANA reserves .mirror as TLD, I'm not that
bothered :^)

Regards,

Raf

Index: share/man/man7/packages.7
===================================================================
RCS file: /cvs/src/share/man/man7/packages.7,v
retrieving revision 1.40
diff -u -p -r1.40 packages.7
--- share/man/man7/packages.7 24 Oct 2015 08:44:49 -0000 1.40
+++ share/man/man7/packages.7 11 Jan 2016 14:26:49 -0000
@@ -240,7 +240,7 @@ are supported: pointing
 .Ev PKG_PATH
 to a distant package repository, e.g.,
 .Bd -literal -offset 1n
-# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
+# export PKG_PATH=http://your.local.mirror/
 .Ed
 .Pp
 will let
Index: faq/faq15.html
===================================================================
RCS file: /cvs/www/faq/faq15.html,v
retrieving revision 1.116
diff -u -p -r1.116 faq15.html
--- faq/faq15.html 23 Nov 2015 03:15:50 -0000 1.116
+++ faq/faq15.html 11 Jan 2016 14:29:33 -0000
@@ -203,13 +203,13 @@ A list of possible locations to fetch pa
 Example 1: fetching from your <a href="../orders.html">CD-ROM</a>,
 assuming you mounted it on <tt>/mnt/cdrom</tt>
 <blockquote><pre>
-$ <b>export PKG_PATH=/mnt/cdrom/$(uname -r)/packages/$(machine -a)/</b>
+$ <b>export PKG_PATH=/mnt/cdrom/%c/packages/%a/</b>
 </pre></blockquote>
 
 <p>
 Example 2: fetching from a nearby <a href="../ftp.html">mirror</a>
 <blockquote><pre>
-$ <b>export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/</b>
+$ <b>export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/</b>
 </pre></blockquote>
 
 <p>
@@ -404,7 +404,7 @@ HTTP, or SCP locations.
 Let's consider installation via HTTP in the next example:
 
 <blockquote><pre>
-# <b>pkg_add http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/screen-4.0.3p3.tgz</b>
+# <b>pkg_add <a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz</b>
 screen-4.0.3p3: complete
 </pre></blockquote>
 
Index: faq/faq9.html
===================================================================
RCS file: /cvs/www/faq/faq9.html,v
retrieving revision 1.116
diff -u -p -r1.116 faq9.html
--- faq/faq9.html 23 Nov 2015 03:16:31 -0000 1.116
+++ faq/faq9.html 11 Jan 2016 14:29:33 -0000
@@ -362,7 +362,7 @@ To find out more about the packages and
 To install the above mentioned package you would issue
 
 <blockquote><pre>
-# export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
+# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/
 # pkg_add fedora_base
 </pre></blockquote>
 
Index: faq/pf/example1.html
===================================================================
RCS file: /cvs/www/faq/pf/example1.html,v
retrieving revision 1.63
diff -u -p -r1.63 example1.html
--- faq/pf/example1.html 10 Jan 2016 01:28:23 -0000 1.63
+++ faq/pf/example1.html 11 Jan 2016 14:29:33 -0000
@@ -346,7 +346,7 @@ to use (<tt>8.8.8.8@53</tt>, for example
 installing the tool and choosing a resolver.
 <p>
 <blockquote><pre>
-# <b>export PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)</b>
+# <b>export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/</b>
 # <b>pkg_add dnscrypt-proxy</b>
 # <b>rcctl enable dnscrypt_proxy</b>
 </pre></blockquote>
Index: faq/ports/guide.html
===================================================================
RCS file: /cvs/www/faq/ports/guide.html,v
retrieving revision 1.46
diff -u -p -r1.46 guide.html
--- faq/ports/guide.html 21 Dec 2015 16:35:48 -0000 1.46
+++ faq/ports/guide.html 11 Jan 2016 14:29:33 -0000
@@ -563,7 +563,7 @@ When dealing with multi-packages, it may
 >pkg_add(1)</a> and
 <a href="http://www.openbsd.org/cgi-bin/man.cgi?sektion=1&amp;query=pkg_delete"
 >pkg_delete(1)</a> directly,
-setting <tt>PKG_PATH</tt> to <tt>/usr/ports/packages/`arch -s`/all/</tt> in the
+setting <tt>PKG_PATH</tt> to <tt>/usr/ports/packages/%a/all/</tt> in the
 environment.
 
 <br><br><li>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Stuart Henderson-6
On 2016/02/02 19:48, Raf Czlonka wrote:

> On Sun, Jan 31, 2016 at 07:28:43PM GMT, Joerg Jung wrote:
> > On Mon, Jan 11, 2016 at 03:40:17PM +0000, Raf Czlonka wrote:
> > > Hi all,
> > >
> > > Given that PKG_PATH and pkg.conf(5)'s installpath, now supports %c, %a,
> > > etc. sequences, it might be worth advertising it a bit more by changing
> > > all relevant uname(1), arch(1)/machine(1) occurrences or (hard-coded
> > > release versions or hardware architectures for that matter) in the
> > > documentation.
> > >
> > > While there, I have also taken the liberty of changing ftp.openbsd.org
> > > to your.local.mirror and ftp to http in packages(7) to keep it
> > > consistent with other examples.
> > >
> > > Main benefits:
> > > - as the sequences themselves - not need to hard-code the values
> > > - no need to run uname, arch/machine is sub-shells any more
> > > - short and sweet
> >
> > While I like the reduction below, it seems with upcoming release this
> > can be further shortened [1].  So might make sense to update the diff
> > below?
> >
> > [1] http://marc.info/?l=openbsd-cvs&m=145415350609473&w=2
>
> Hi Joerg,
>
> I'm not following openbsd-cvs@ at the moment so thanks for bringing this
> to my attention.
>
> However, given that the FAQ is for -release/-stable, and it is still 4
> months until the next one, this change only affects packages(7) for now.
> Updated diff below - I'll send a revised one when 5.9 gets released in
> order to update the FAQ.
>
> Personally, I'd prefer to use a RFC 2606 compliant domain in all of the
> relevant places but, until IANA reserves .mirror as TLD, I'm not that
> bothered :^)


> Regards,
>
> Raf
>
> Index: share/man/man7/packages.7
> ===================================================================
> RCS file: /cvs/src/share/man/man7/packages.7,v
> retrieving revision 1.40
> diff -u -p -r1.40 packages.7
> --- share/man/man7/packages.7 24 Oct 2015 08:44:49 -0000 1.40
> +++ share/man/man7/packages.7 11 Jan 2016 14:26:49 -0000
> @@ -240,7 +240,7 @@ are supported: pointing
>  .Ev PKG_PATH
>  to a distant package repository, e.g.,
>  .Bd -literal -offset 1n
> -# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
> +# export PKG_PATH=http://your.local.mirror/

I don't like this "your.local.mirror" at all.. Would it be so bad to
keep using ftp.openbsd.org here but change it to http://?

In any event it needs to be either more or less than just http://hostname/.
I'd sooner keep the path for now as there are still some mirrors with
odd paths.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Raf Czlonka-2
On Tue, Feb 02, 2016 at 09:47:00PM GMT, Stuart Henderson wrote:

> On 2016/02/02 19:48, Raf Czlonka wrote:
> > On Sun, Jan 31, 2016 at 07:28:43PM GMT, Joerg Jung wrote:
> > > On Mon, Jan 11, 2016 at 03:40:17PM +0000, Raf Czlonka wrote:
> > > > Hi all,
> > > >
> > > > Given that PKG_PATH and pkg.conf(5)'s installpath, now supports %c, %a,
> > > > etc. sequences, it might be worth advertising it a bit more by changing
> > > > all relevant uname(1), arch(1)/machine(1) occurrences or (hard-coded
> > > > release versions or hardware architectures for that matter) in the
> > > > documentation.
> > > >
> > > > While there, I have also taken the liberty of changing ftp.openbsd.org
> > > > to your.local.mirror and ftp to http in packages(7) to keep it
> > > > consistent with other examples.
> > > >
> > > > Main benefits:
> > > > - as the sequences themselves - not need to hard-code the values
> > > > - no need to run uname, arch/machine is sub-shells any more
> > > > - short and sweet
> > >
> > > While I like the reduction below, it seems with upcoming release this
> > > can be further shortened [1].  So might make sense to update the diff
> > > below?
> > >
> > > [1] http://marc.info/?l=openbsd-cvs&m=145415350609473&w=2
> >
> > Hi Joerg,
> >
> > I'm not following openbsd-cvs@ at the moment so thanks for bringing this
> > to my attention.
> >
> > However, given that the FAQ is for -release/-stable, and it is still 4
> > months until the next one, this change only affects packages(7) for now.
> > Updated diff below - I'll send a revised one when 5.9 gets released in
> > order to update the FAQ.
> >
> > Personally, I'd prefer to use a RFC 2606 compliant domain in all of the
> > relevant places but, until IANA reserves .mirror as TLD, I'm not that
> > bothered :^)
>
>
> > Regards,
> >
> > Raf
> >
> > Index: share/man/man7/packages.7
> > ===================================================================
> > RCS file: /cvs/src/share/man/man7/packages.7,v
> > retrieving revision 1.40
> > diff -u -p -r1.40 packages.7
> > --- share/man/man7/packages.7 24 Oct 2015 08:44:49 -0000 1.40
> > +++ share/man/man7/packages.7 11 Jan 2016 14:26:49 -0000
> > @@ -240,7 +240,7 @@ are supported: pointing
> >  .Ev PKG_PATH
> >  to a distant package repository, e.g.,
> >  .Bd -literal -offset 1n
> > -# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
> > +# export PKG_PATH=http://your.local.mirror/
>
> I don't like this "your.local.mirror" at all.. Would it be so bad to
> keep using ftp.openbsd.org here but change it to http://?
>
> In any event it needs to be either more or less than just http://hostname/.
> I'd sooner keep the path for now as there are still some mirrors with
> odd paths.

Hi Stuart,

Like I've mentioned above, I'm not particularly fond of it either.

I merely copied what was already in the FAQ - I wish you had kept the
rest of the diff, but here is a shortened version anyway :^)

faq/faq15.html
[...]
-$ <b>export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/</b>
+$ <b>export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/</b>
[...]
-# <b>pkg_add http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/screen-4.0.3p3.tgz</b>
+# <b>pkg_add <a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/screen-4.0.3p3.tgz</b>
[...]
 
faq/faq9.html
[...]
-# export PKG_PATH=http://your.local.mirror/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
+# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/

I only checked the latter (faq9.html) - it has been introduced over 10
years ago and it doesn't seem like anyone complained, so naturally I
assumed it is the "sanctioned" way of doing things.

I don't think I need to explain why I had removed ftp.openbsd.org in the
first place.

Regards,

Raf

P.S. PKG_PATH=http://example.org/ would have been my preference.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Stuart Henderson-6
On 2016/02/02 22:15, Raf Czlonka wrote:
> Like I've mentioned above, I'm not particularly fond of it either.
>
> I merely copied what was already in the FAQ - I wish you had kept the
> rest of the diff, but here is a shortened version anyway :^)

(sorry, trimming a lot here, otherwise it's harder for readers to see
the main points)

> +# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/
>
> I only checked the latter (faq9.html) - it has been introduced over 10
> years ago and it doesn't seem like anyone complained, so naturally I
> assumed it is the "sanctioned" way of doing things.

10 years ago nobody would have predicted anybody we would have 900
vanity TLDs. But with the current state of the root zone it's highly
likely that .mirror will be delegated sometime soon (I'm surprised
it hasn't already gone), I think we should definitely not continue
to use it.

> I don't think I need to explain why I had removed ftp.openbsd.org in the
> first place.

I understand why but as an example it has the big advantage of
actually working as-is.. I'd also be reasonably happy with:

"ftp.<country>.openbsd.org"
"ftp.XX.openbsd.org"
"(your local mirror)"  (because it can't be confused with a valid hostname)

...though what I'd really like is something like "rel.openbsd.org"
that users of releases can point at, issuing http redirects pointing
at an alive server which is reasonably suitable for the user (and
pkg_add would need to cache these rather than hitting it each time).
It wouldn't work with snapshots, but by the time someone is running
snaps they should be able to take care of themselves a bit more...  

> Regards,
>
> Raf
>
> P.S. PKG_PATH=http://example.org/ would have been my preference.

If it was a placeholder for "any random domain" (e.g. in smtpd
config examples), I'd totally agree.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Raf Czlonka-2
On Tue, Feb 02, 2016 at 10:48:47PM GMT, Stuart Henderson wrote:
> On 2016/02/02 22:15, Raf Czlonka wrote:
> > Like I've mentioned above, I'm not particularly fond of it either.
> >
> > I merely copied what was already in the FAQ - I wish you had kept the
> > rest of the diff, but here is a shortened version anyway :^)
>
> (sorry, trimming a lot here, otherwise it's harder for readers to see
> the main points)

Sure, no worries - last time it was simply about your.local.mirror and
the relevant bits were missing :^)

> > +# export PKG_PATH=<a href="http://your.local.mirror/pub/OpenBSD/%c/packages/%a/">http://your.local.mirror/pub/OpenBSD/%c/packages/%a/
> >
> > I only checked the latter (faq9.html) - it has been introduced over 10
> > years ago and it doesn't seem like anyone complained, so naturally I
> > assumed it is the "sanctioned" way of doing things.
>
> 10 years ago nobody would have predicted anybody we would have 900
> vanity TLDs. But with the current state of the root zone it's highly
> likely that .mirror will be delegated sometime soon (I'm surprised
> it hasn't already gone), I think we should definitely not continue
> to use it.

Still, nobody even noticed or complained since these were introduced,
and those files received patches multiple times since then. Even the
*very* lines were altered just over two months ago[0]. BTW, in this
example Theo even changed ftp -> local :^) - and I hadn't "selected"
this particular commit, I used 'cvs blame'.

> > I don't think I need to explain why I had removed ftp.openbsd.org in the
> > first place.
>
> I understand why but as an example it has the big advantage of
> actually working as-is..

If you want to use a "working" example, and since there's no
rel.openbsd.org or any other similar service (which you speak of below)
available, then you'll need to "favour" one mirror over all the other
ones. your.local.mirror is, at least, self-explanatory - people know
exactly what to do. Yes, if .mirror ever goes official, then this would
need changing.

> I'd also be reasonably happy with:
>
> "ftp.<country>.openbsd.org"
> "ftp.XX.openbsd.org"

I get what you're saying. However, the above is, IMVHO, a bad example,
as it implies availability of country coded mirrors and, since there are
only 7 servers which follow this naming convention (3 with eu., 2 with
fr. and 2 with usa.), this can be somewhat misleading.

> "(your local mirror)"  (because it can't be confused with a valid hostname)

I still like the dotted format more :^)

> ...though what I'd really like is something like "rel.openbsd.org"
> that users of releases can point at, issuing http redirects pointing
> at an alive server which is reasonably suitable for the user (and
> pkg_add would need to cache these rather than hitting it each time).
> It wouldn't work with snapshots, but by the time someone is running
> snaps they should be able to take care of themselves a bit more...  

Yes, that would have been the best solution.

However, given that:

- no such thing exists at the moment
- country mirrors are virtually non-existent
- ftp.openbsd.org is, AFAIC, overloaded

what other real *and* good alternative do you suggest?

> > Regards,
> >
> > Raf
> >
> > P.S. PKG_PATH=http://example.org/ would have been my preference.
>
> If it was a placeholder for "any random domain" (e.g. in smtpd
> config examples), I'd totally agree.

On reflection, maybe not the best choice but, bar the 7 examples above +
the primary ftp.openbsd.org, mirror domain names *are* random.

[0] http://cvsweb.openbsd.org/cgi-bin/cvsweb/www/faq/faq9.html.diff?r1=1.115&r2=1.116&f=h

Cheers,

Raf

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Michael McConville-3
Raf Czlonka wrote:
> - ftp.openbsd.org is, AFAIC, overloaded

I haven't been following this thread fully, but I agree that
ftp.openbsd.org shouldn't be used in examples. Many many people use the
default mirror whenever possible.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Luke Small
In reply to this post by Raf Czlonka-2
I suspect that unless there is a solution that doesn't involve lazy new
users to memorize more complicated named mirrors, you are going to run into
this problem over and over again.

>>  Raf Czlonka wrote:
>> - ftp.openbsd.org is, AFAIC, overloaded

> I haven't been following this thread fully, but I agree that> ftp.openbsd.org <ftp://ftp.openbsd.org> shouldn't be used in examples. Many many people use the
> default mirror whenever possible.



-Luke
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Stuart Henderson-6
On 2016/02/03 20:48, Luke Small wrote:
> I suspect that unless there is a solution that doesn't involve lazy new
> users to memorize more complicated named mirrors, you are going to run into
> this problem over and over again.

Why would they need to memorize them? In most cases the one they picked
when they installed OpenBSD will be just fine, if not they can change
pkg.conf to point at a new one from the mirrors list.

> >>  Raf Czlonka wrote:
> >> - ftp.openbsd.org is, AFAIC, overloaded

Whenever I've checked speeds from ftp.openbsd.org they have been fairly
consistent, this isn't the usual expected behaviour of an overloaded
machine. (not super fast, but they have been consistent).

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Luke Small
I didn't know about the miniroot program that edited installpath until I
had a network-assisted upgrade. Every time before, I just did it from disk.
I edited PKG_PATH to do that, from what I recall, I used a text editor and
to do that, I had to memorize the installpath to manually copy it in the
text editor. I am still unaware of a way to copy and paste to an editor
that is capable of running with root privileges.

I just took the claim that the main mirror was burdened at face value.

I wouldn't doubt that the simplest to remember is heavily burdened and the
longest is probably burdened the least.

-Luke

On Wed, Feb 3, 2016 at 9:12 PM, Stuart Henderson <[hidden email]> wrote:

> On 2016/02/03 20:48, Luke Small wrote:
> > I suspect that unless there is a solution that doesn't involve lazy new
> > users to memorize more complicated named mirrors, you are going to run
> into
> > this problem over and over again.
>
> Why would they need to memorize them? In most cases the one they picked
> when they installed OpenBSD will be just fine, if not they can change
> pkg.conf to point at a new one from the mirrors list.
>
> > >>  Raf Czlonka wrote:
> > >> - ftp.openbsd.org is, AFAIC, overloaded
>
> Whenever I've checked speeds from ftp.openbsd.org they have been fairly
> consistent, this isn't the usual expected behaviour of an overloaded
> machine. (not super fast, but they have been consistent).
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] uname, arch/machine -> %c, %a update in PKG_PATH

Michael McConville-3
In reply to this post by Stuart Henderson-6
Stuart Henderson wrote:
> > >>  Raf Czlonka wrote:
> > >> - ftp.openbsd.org is, AFAIC, overloaded
>
> Whenever I've checked speeds from ftp.openbsd.org they have been
> fairly consistent, this isn't the usual expected behaviour of an
> overloaded machine. (not super fast, but they have been consistent).

At the very least, it seems like there are concerns about their
operating costs.