<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ptrcnull</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ptrcnull"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Ptrcnull"/>
	<updated>2026-05-03T03:17:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Include:Upgrading_to_Edge&amp;diff=26635</id>
		<title>Include:Upgrading to Edge</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Include:Upgrading_to_Edge&amp;diff=26635"/>
		<updated>2024-04-16T07:23:11Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: add vaguely threatening message to discourage repo mixing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
An upgrade of Alpine Linux from a stable version to the rolling development version &#039;&#039;edge&#039;&#039; basically requires the same steps as [[Upgrading_Alpine#Upgrading_to_latest_release|Upgrading to latest release]]. &lt;br /&gt;
&lt;br /&gt;
The crucial difference is, that when editing the {{Path|/etc/apk/repositories}} file, all referenced repository versions (such as {{ic|v{{#expr:{{AlpineLatest}}}}}} or {{ic|latest-stable}}) therein need to be pointing to &amp;lt;code&amp;gt;&#039;&#039;&#039;edge&#039;&#039;&#039;&amp;lt;/code&amp;gt; as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://&amp;lt;mirror-server&amp;gt;/alpine/edge/main&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Warning|Do not enable stable and edge repos at the same time. This can break your system. Either use edge &#039;&#039;&#039;or&#039;&#039;&#039; stable. If you mix stable and edge repositories, you&#039;re on your own.}}&lt;br /&gt;
&lt;br /&gt;
After upgrading to edge, the currently installed edge version may be checked with {{Cmd|$ cat /etc/alpine-release}} and referring to the build date that is attached to the release.&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25813</id>
		<title>Release Notes for Alpine 3.19.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25813"/>
		<updated>2023-11-21T03:21:17Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Base System ==&lt;br /&gt;
&lt;br /&gt;
=== iptables-nft ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;/sbin/iptables{,-save,-restore}&amp;lt;/code&amp;gt; symlinks now point to xtables-nft-multi instead of xtables-legacy-multi. This means they use the nftables kernel backend instead of the legacy iptables one.&lt;br /&gt;
&lt;br /&gt;
Since the new iptables- binaries also don&#039;t use the iptables backend, to work with any existing rules and save them, you need to install {{pkg|iptables-legacy}} and use &amp;lt;code&amp;gt;iptables-legacy-save&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Because mixing backends is not supported, you should reboot your system if you have to use the iptables commands after upgrading.&lt;br /&gt;
&lt;br /&gt;
=== netns ===&lt;br /&gt;
&lt;br /&gt;
The OpenRC package contains a patch to make it possible to start most services in netns namespaces. See also [[Netns|netns]].&lt;br /&gt;
&lt;br /&gt;
== Others ==&lt;br /&gt;
&lt;br /&gt;
=== HashiCorp packages ===&lt;br /&gt;
&lt;br /&gt;
Due to the relicensing of HashiCorp software to BUSL-1.1 (a non-Open-Source license) ([https://www.hashicorp.com/blog/hashicorp-adopts-business-source-license link]), [https://www.vaultproject.io/ Vault] was removed from Alpine.&lt;br /&gt;
&lt;br /&gt;
Other packages ({{pkg|consul}}, {{pkg|nomad}}, {{pkg|packer}}, {{pkg|terraform}}) might be affected as well.&lt;br /&gt;
&lt;br /&gt;
[[Category:News]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25812</id>
		<title>Release Notes for Alpine 3.19.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25812"/>
		<updated>2023-11-21T03:20:34Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Base System ==&lt;br /&gt;
&lt;br /&gt;
=== iptables-nft ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;/sbin/iptables{,-save,-restore}&amp;lt;/code&amp;gt; symlinks now point to xtables-nft-multi instead of xtables-legacy-multi. This means they use the nftables kernel backend instead of the legacy iptables one.&lt;br /&gt;
&lt;br /&gt;
Since the new iptables- binaries also don&#039;t use the iptables backend, to work with any existing rules and save them, you need to install {{pkg|iptables-legacy}} and use &amp;lt;code&amp;gt;iptables-legacy-save&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Because mixing backends is not supported, you should reboot your system if you have to use the iptables commands after upgrading.&lt;br /&gt;
&lt;br /&gt;
=== netns ===&lt;br /&gt;
&lt;br /&gt;
The OpenRC package contains a patch to make it possible to start most services in netns namespaces. See also [[Netns|netns]].&lt;br /&gt;
&lt;br /&gt;
== Others ==&lt;br /&gt;
&lt;br /&gt;
=== HashiCorp packages ===&lt;br /&gt;
&lt;br /&gt;
Due to the relicensing of HashiCorp software to BUSL-1.1 (a non-Open-Source license) ([https://www.hashicorp.com/blog/hashicorp-adopts-business-source-license link]), [https://www.vaultproject.io/ Vault] was removed from Alpine. Other packages ({{pkg|consul}}, {{pkg|nomad}}, {{pkg|packer}}, {{pkg|terraform}}) might be affected as well.&lt;br /&gt;
&lt;br /&gt;
[[Category:News]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25811</id>
		<title>Release Notes for Alpine 3.19.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25811"/>
		<updated>2023-11-21T03:09:13Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: note about removal of community/vault&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Base System ==&lt;br /&gt;
&lt;br /&gt;
=== iptables-nft ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;/sbin/iptables{,-save,-restore}&amp;lt;/code&amp;gt; symlinks now point to xtables-nft-multi instead of xtables-legacy-multi. This means they use the nftables kernel backend instead of the legacy iptables one.&lt;br /&gt;
&lt;br /&gt;
Since the new iptables- binaries also don&#039;t use the iptables backend, to work with any existing rules and save them, you need to install {{pkg|iptables-legacy}} and use &amp;lt;code&amp;gt;iptables-legacy-save&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Because mixing backends is not supported, you should reboot your system if you have to use the iptables commands after upgrading.&lt;br /&gt;
&lt;br /&gt;
=== netns ===&lt;br /&gt;
&lt;br /&gt;
The OpenRC package contains a patch to make it possible to start most services in netns namespaces. See also [[Netns|netns]].&lt;br /&gt;
&lt;br /&gt;
== Others ==&lt;br /&gt;
&lt;br /&gt;
=== HashiCorp packages ===&lt;br /&gt;
&lt;br /&gt;
Due to the relicensing of HashiCorp software to BUSL-1.1 (a non-Open-Source license) ([https://www.hashicorp.com/blog/hashicorp-adopts-business-source-license link]), [https://www.vaultproject.io/ Vault] was removed from Alpine.&lt;br /&gt;
&lt;br /&gt;
[[Category:News]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=23033</id>
		<title>User:Ptrcnull</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=23033"/>
		<updated>2023-03-02T00:08:59Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;{{DISPLAYTITLE:User:ptrcnull}}&amp;lt;/span&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
hi! i&#039;m patrycja, also known as &amp;lt;code&amp;gt;ptrcnull&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ptrc&amp;lt;/code&amp;gt; on irc.&lt;br /&gt;
&lt;br /&gt;
i maintain a few packages in aports and contribute to keep alpine edge up-to-date, occasionally fixing random issues and missing dependencies&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=23032</id>
		<title>User:Ptrcnull</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=23032"/>
		<updated>2023-03-02T00:08:34Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:&amp;lt;span style=&amp;quot;opacity:0;position:absolute&amp;quot;&amp;gt;User:ptrcnull&amp;lt;/span&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
hi! i&#039;m patrycja, also known as &amp;lt;code&amp;gt;ptrcnull&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ptrc&amp;lt;/code&amp;gt; on irc.&lt;br /&gt;
&lt;br /&gt;
i maintain a few packages in aports and contribute to keep alpine edge up-to-date, occasionally fixing random issues and missing dependencies&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=23031</id>
		<title>User:Ptrcnull</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=23031"/>
		<updated>2023-03-02T00:07:39Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;{{DISPLAYTITLE:User:ptrcnull}}&amp;lt;/span&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
hi! i&#039;m patrycja, also known as &amp;lt;code&amp;gt;ptrcnull&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ptrc&amp;lt;/code&amp;gt; on irc.&lt;br /&gt;
&lt;br /&gt;
i maintain a few packages in aports and contribute to keep alpine edge up-to-date, occasionally fixing random issues and missing dependencies&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=VirtualBox_guest_additions&amp;diff=22659</id>
		<title>VirtualBox guest additions</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=VirtualBox_guest_additions&amp;diff=22659"/>
		<updated>2022-11-14T21:20:16Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How to install VirtualBox guest additions=&lt;br /&gt;
&lt;br /&gt;
== For Alpine Linux 3.11 and later ==&lt;br /&gt;
&lt;br /&gt;
# install {{Cmd|apk add virtualbox-guest-additions}}&lt;br /&gt;
To enable X11 display auto-resizing:&lt;br /&gt;
{{Cmd|apk add virtualbox-guest-additions-x11&lt;br /&gt;
rc-update add virtualbox-drm-client default}}&lt;br /&gt;
&lt;br /&gt;
== For Alpine Linux 3.10 ==&lt;br /&gt;
&lt;br /&gt;
# install {{Cmd|apk add virtualbox-guest-additions virtualbox-guest-modules-virt}}&lt;br /&gt;
To enable X11 display auto-resizing:&lt;br /&gt;
{{Cmd|apk add virtualbox-guest-additions-x11&lt;br /&gt;
rc-update add virtualbox-drm-client default}}&lt;br /&gt;
&lt;br /&gt;
== For older versions ==&lt;br /&gt;
&lt;br /&gt;
First install [https://pkgs.alpinelinux.org/package/testing/x86/virtualbox-additions-grsec virtualbox-additions-grsec]: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add virtualbox-additions-grsec}}&lt;br /&gt;
&lt;br /&gt;
The following error may occur:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ERROR: unsatisfiable constraints:&lt;br /&gt;
   virtualbox-additions-grsec (missing):&lt;br /&gt;
      required by: world[virtualbox-additions-grsec]}}&lt;br /&gt;
&lt;br /&gt;
If the error occurs, then you need to enable the alpine testing repo:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo &amp;quot;http://nl.alpinelinux.org/alpine/edge/testing&amp;quot; &amp;gt;&amp;gt; /etc/apk/repositories}}&lt;br /&gt;
&lt;br /&gt;
Then update respository indexes from all remote repositories, and install &amp;lt;code&amp;gt;virtualbox-additions-grsec&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk update&lt;br /&gt;
apk add virtualbox-additions-grsec}}&lt;br /&gt;
&lt;br /&gt;
Then add &amp;lt;code&amp;gt;vboxpci&amp;lt;/code&amp;gt;,&amp;lt;code&amp;gt;vboxdrv&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;vboxnetflt&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/etc/modules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo vboxpci &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
echo vboxdrv &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
echo vboxnetflt &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
And reboot to put these changes into effect.&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Python&amp;diff=22638</id>
		<title>APKBUILD examples:Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Python&amp;diff=22638"/>
		<updated>2022-11-01T19:34:36Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: fixup!: remove duplicate testenv&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A lot of Python packages use the &#039;&#039;setuptools&#039;&#039; or &#039;&#039;distutils&#039;&#039; framework. This mean that the build() and the package() section looks a bit different compared to an application which uses &#039;&#039;make&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== pkgname ===&lt;br /&gt;
&lt;br /&gt;
Package name for a Python &#039;&#039;library&#039;&#039; must be prefixed with &#039;&#039;py3-&#039;&#039;.  &lt;br /&gt;
&lt;br /&gt;
For an &#039;executable&#039; (for example, &amp;lt;code&amp;gt;black&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;binwalk&amp;lt;/code&amp;gt;), you generally don&#039;t need to prefix it.  &lt;br /&gt;
&lt;br /&gt;
There’s no exact rule if the prefix should be used for tools and applications written in Python, it varies.&lt;br /&gt;
&lt;br /&gt;
=== arch ===&lt;br /&gt;
&lt;br /&gt;
; noarch : Use for pure Python packages (i.e. without compiled code). Also add python3 to &amp;lt;tt&amp;gt;depends=&amp;lt;/tt&amp;gt;.&lt;br /&gt;
; all (and others) :  Use for packages with native extensions (i.e. with compiled code). &#039;&#039;&#039;Do not&#039;&#039;&#039; add python3 to &amp;lt;tt&amp;gt;depends=&amp;lt;/tt&amp;gt; (it&#039;s auto-detected via dynamic linking to python library).&lt;br /&gt;
&lt;br /&gt;
=== source ===&lt;br /&gt;
&lt;br /&gt;
Most Python packages are published in [https://pypi.python.org/pypi PyPI] (the Python Package Index).&lt;br /&gt;
If the package has a source tarball available in PyPI (that’s true for most packages), and it contains tests (some explicitly remove them from PyPI), you should reference it in &amp;lt;tt&amp;gt;source=&amp;lt;/tt&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
https://files.pythonhosted.org/packages/source/${_pyname%${_pyname#?}}/$_pyname/$_pyname-$pkgver.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;tt&amp;gt;_pyname&amp;lt;/tt&amp;gt; is the real name of the Python package.&lt;br /&gt;
&lt;br /&gt;
Otherwise, use the normal upstream git tarballs.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Package for setuptools/setup.py build ===&lt;br /&gt;
&lt;br /&gt;
If the project has a setup.py, then the APKBUILD is very simple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pkgname=&amp;quot;py3-foo&amp;quot;&lt;br /&gt;
_pyname=&amp;quot;foo&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
depends=&amp;quot;python3&amp;quot;&lt;br /&gt;
makedepends=&amp;quot;python3-dev&amp;quot;&lt;br /&gt;
checkdepends=&amp;quot;py3-pytest&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
build() {&lt;br /&gt;
	python3 setup.py build&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
check() {&lt;br /&gt;
	pytest&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package() {&lt;br /&gt;
	python3 setup.py install --skip-build --root=&amp;quot;$pkgdir&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that PyPI tarballs can contain a generated setup.py that does not exist in the upstream repo - this means you must use the pyproject.toml method if you change sources.&lt;br /&gt;
&lt;br /&gt;
=== Package for pyproject.toml build ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pkgname=&amp;quot;py-foo&amp;quot;&lt;br /&gt;
_pyname=&amp;quot;PyFoo&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
depends=&amp;quot;python3 py3-bar py3-baz&amp;quot;&lt;br /&gt;
makedepends=&amp;quot;py3-gpep517 py3-installer python3-dev py3-wheel&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
build() {&lt;br /&gt;
	mkdir dist&lt;br /&gt;
	gpep517 build-wheel \&lt;br /&gt;
		--wheel-dir dist \&lt;br /&gt;
		--output-fd 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
check() {&lt;br /&gt;
	pytest&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package() {&lt;br /&gt;
	python3 -m installer -d &amp;quot;$pkgdir&amp;quot; \&lt;br /&gt;
		dist/PyFoo-$pkgver-py3-none-any.whl&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Depending on the &amp;lt;code&amp;gt;build-backend&amp;lt;/code&amp;gt; in the pyproject.toml, you might need py3-setuptools or py3-flit-core or py3-poetry-core or py3-hatchling at build time.&lt;br /&gt;
&lt;br /&gt;
Sometimes you might have to pass the path to the built package to run tests:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
check() {&lt;br /&gt;
	python3 -m venv --system-site-packages testenv&lt;br /&gt;
	testenv/bin/python3 -m installer \&lt;br /&gt;
		dist/PyFoo-$pkgver-py3-none-any.whl&lt;br /&gt;
	testenv/bin/python3 -m pytest&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]] [[Category:Python]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Python&amp;diff=22637</id>
		<title>APKBUILD examples:Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Python&amp;diff=22637"/>
		<updated>2022-11-01T19:33:55Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: change the example method of running tests on installed package with pyproject&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A lot of Python packages use the &#039;&#039;setuptools&#039;&#039; or &#039;&#039;distutils&#039;&#039; framework. This mean that the build() and the package() section looks a bit different compared to an application which uses &#039;&#039;make&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== pkgname ===&lt;br /&gt;
&lt;br /&gt;
Package name for a Python &#039;&#039;library&#039;&#039; must be prefixed with &#039;&#039;py3-&#039;&#039;.  &lt;br /&gt;
&lt;br /&gt;
For an &#039;executable&#039; (for example, &amp;lt;code&amp;gt;black&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;binwalk&amp;lt;/code&amp;gt;), you generally don&#039;t need to prefix it.  &lt;br /&gt;
&lt;br /&gt;
There’s no exact rule if the prefix should be used for tools and applications written in Python, it varies.&lt;br /&gt;
&lt;br /&gt;
=== arch ===&lt;br /&gt;
&lt;br /&gt;
; noarch : Use for pure Python packages (i.e. without compiled code). Also add python3 to &amp;lt;tt&amp;gt;depends=&amp;lt;/tt&amp;gt;.&lt;br /&gt;
; all (and others) :  Use for packages with native extensions (i.e. with compiled code). &#039;&#039;&#039;Do not&#039;&#039;&#039; add python3 to &amp;lt;tt&amp;gt;depends=&amp;lt;/tt&amp;gt; (it&#039;s auto-detected via dynamic linking to python library).&lt;br /&gt;
&lt;br /&gt;
=== source ===&lt;br /&gt;
&lt;br /&gt;
Most Python packages are published in [https://pypi.python.org/pypi PyPI] (the Python Package Index).&lt;br /&gt;
If the package has a source tarball available in PyPI (that’s true for most packages), and it contains tests (some explicitly remove them from PyPI), you should reference it in &amp;lt;tt&amp;gt;source=&amp;lt;/tt&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
https://files.pythonhosted.org/packages/source/${_pyname%${_pyname#?}}/$_pyname/$_pyname-$pkgver.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;tt&amp;gt;_pyname&amp;lt;/tt&amp;gt; is the real name of the Python package.&lt;br /&gt;
&lt;br /&gt;
Otherwise, use the normal upstream git tarballs.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Package for setuptools/setup.py build ===&lt;br /&gt;
&lt;br /&gt;
If the project has a setup.py, then the APKBUILD is very simple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pkgname=&amp;quot;py3-foo&amp;quot;&lt;br /&gt;
_pyname=&amp;quot;foo&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
depends=&amp;quot;python3&amp;quot;&lt;br /&gt;
makedepends=&amp;quot;python3-dev&amp;quot;&lt;br /&gt;
checkdepends=&amp;quot;py3-pytest&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
build() {&lt;br /&gt;
	python3 setup.py build&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
check() {&lt;br /&gt;
	pytest&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package() {&lt;br /&gt;
	python3 setup.py install --skip-build --root=&amp;quot;$pkgdir&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that PyPI tarballs can contain a generated setup.py that does not exist in the upstream repo - this means you must use the pyproject.toml method if you change sources.&lt;br /&gt;
&lt;br /&gt;
=== Package for pyproject.toml build ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pkgname=&amp;quot;py-foo&amp;quot;&lt;br /&gt;
_pyname=&amp;quot;PyFoo&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
depends=&amp;quot;python3 py3-bar py3-baz&amp;quot;&lt;br /&gt;
makedepends=&amp;quot;py3-gpep517 py3-installer python3-dev py3-wheel&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
build() {&lt;br /&gt;
	mkdir dist&lt;br /&gt;
	gpep517 build-wheel \&lt;br /&gt;
		--wheel-dir dist \&lt;br /&gt;
		--output-fd 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
check() {&lt;br /&gt;
	pytest&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package() {&lt;br /&gt;
	python3 -m installer -d &amp;quot;$pkgdir&amp;quot; \&lt;br /&gt;
		dist/PyFoo-$pkgver-py3-none-any.whl&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Depending on the &amp;lt;code&amp;gt;build-backend&amp;lt;/code&amp;gt; in the pyproject.toml, you might need py3-setuptools or py3-flit-core or py3-poetry-core or py3-hatchling at build time.&lt;br /&gt;
&lt;br /&gt;
Sometimes you might have to pass the path to the built package to run tests:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
check() {&lt;br /&gt;
	python3 -m venv --system-site-packages testenv&lt;br /&gt;
	testenv/bin/python3 -m installer -d testenv \&lt;br /&gt;
		dist/PyFoo-$pkgver-py3-none-any.whl&lt;br /&gt;
	testenv/bin/python3 -m pytest&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]] [[Category:Python]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Simple&amp;diff=22250</id>
		<title>APKBUILD examples:Simple</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Simple&amp;diff=22250"/>
		<updated>2022-08-20T15:13:33Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Simple APKBUILD with -doc subpackage, using abuild&#039;s default &#039;&#039;doc()&#039;&#039; and &#039;&#039;prepare()&#039;&#039; functions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Contributor: William Pitcock &amp;lt;nenolod@dereferenced.org&amp;gt;&lt;br /&gt;
# Maintainer:&lt;br /&gt;
pkgname=gnuplot&lt;br /&gt;
pkgver=4.4.4&lt;br /&gt;
pkgrel=0&lt;br /&gt;
pkgdesc=&amp;quot;Utility for plotting graphs&amp;quot;&lt;br /&gt;
url=&amp;quot;http://www.gnuplot.info/&amp;quot;&lt;br /&gt;
arch=&amp;quot;all&amp;quot;&lt;br /&gt;
license=&amp;quot;GPL&amp;quot;&lt;br /&gt;
depends=&amp;quot;&amp;quot;&lt;br /&gt;
depends_dev=&amp;quot;cairo-dev pango-dev gd-dev lua-dev readline-dev libpng-dev jpeg-dev&amp;quot;&lt;br /&gt;
makedepends=&amp;quot;$depends_dev&amp;quot;&lt;br /&gt;
install=&amp;quot;&amp;quot;&lt;br /&gt;
subpackages=&amp;quot;$pkgname-doc&amp;quot;&lt;br /&gt;
source=&amp;quot;http://downloads.sourceforge.net/project/$pkgname/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz&amp;quot;&lt;br /&gt;
builddir=&amp;quot;$srcdir/$pkgname-$pkgver&amp;quot;&lt;br /&gt;
&lt;br /&gt;
prepare() {&lt;br /&gt;
        default_prepare&lt;br /&gt;
        # this function can be omitted if no extra steps are needed&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
build() {&lt;br /&gt;
	./configure --prefix=/usr \&lt;br /&gt;
		--sysconfdir=/etc \&lt;br /&gt;
		--mandir=/usr/share/man \&lt;br /&gt;
		--infodir=/usr/share/info \&lt;br /&gt;
		--localstatedir=/var \&lt;br /&gt;
		--disable-wxwidgets \&lt;br /&gt;
		--disable-qt&lt;br /&gt;
	make&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
check() {&lt;br /&gt;
        make check&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package() {&lt;br /&gt;
	make DESTDIR=&amp;quot;$pkgdir&amp;quot; install&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sha512sums=&amp;quot;d65a43b834b1926097...c0b8c6017ffc6d9e011217fb7e86e80  gnuplot-4.4.4.tar.gz&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=22245</id>
		<title>User:Ptrcnull</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=22245"/>
		<updated>2022-08-15T20:35:23Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: add irc handle&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;{{DISPLAYTITLE:ptrcnull}}&amp;lt;/span&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
hi! i&#039;m patrycja, also known as &amp;lt;code&amp;gt;ptrcnull&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ptrc&amp;lt;/code&amp;gt; on irc.&lt;br /&gt;
&lt;br /&gt;
i maintain a few packages in aports and contribute to keep alpine edge up-to-date, occasionally fixing random issues and missing dependencies&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Repositories&amp;diff=22174</id>
		<title>Repositories</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Repositories&amp;diff=22174"/>
		<updated>2022-08-04T08:09:50Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: add info about using testing with stable&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
The Alpine software repositories have three branches:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;main&#039;&#039;&#039; packages are the software that have direct support and updates from the Alpine core and main team. They also have official special documentation, are always available for all releases and will have substitutions if some are not continued from upstream. Commonly these packages are selected due to their responsibility and stability with respect to upstream availability. Packages from &#039;&#039;community&#039;&#039; or (rarely) &#039;&#039;testing&#039;&#039;, that are accepted go to the &#039;&#039;main&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;community&#039;&#039;&#039; packages are those made by users in team with the official developers and close to the Alpine package process. They are supported by those user(s) contributions and could end if the user(s) stops; they may also be removed in a future release due to lack of support by upstream authors. Packages from &#039;&#039;testing&#039;&#039; that are accepted go to the &#039;&#039;community&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;testing&#039;&#039;&#039; packages are where new packages go. These are made by any contributor to Alpine. Testing has no release linked. The &#039;&#039;testing&#039;&#039; repository is only available on &#039;&#039;edge&#039;&#039;. Packages from &#039;&#039;testing&#039;&#039; that are accepted go to the &#039;&#039;community&#039;&#039; branch or (rarely) the &#039;&#039;main&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
To enable a repository, remove the &#039;&#039;&#039;#&#039;&#039;&#039; in front of the URL along with any blank space.&lt;br /&gt;
&lt;br /&gt;
Example: Disabled&lt;br /&gt;
{{cat|/etc/apk/repositories|#http://dl-cdn.alpinelinux.org/alpine/v3.16/community}}&lt;br /&gt;
&lt;br /&gt;
Example: Enabled&lt;br /&gt;
{{cat|/etc/apk/repositories|http://dl-cdn.alpinelinux.org/alpine/v3.16/community}}&lt;br /&gt;
&lt;br /&gt;
To edit the repositories, open the &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; file in a text editor:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# &amp;lt;editor&amp;gt; /etc/apk/repositories}}&lt;br /&gt;
&lt;br /&gt;
The default will look something like:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/apk/repositories|#/media/cdrom/apks&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v3.16/main&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/v3.16/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/main&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/testing}}&lt;br /&gt;
&lt;br /&gt;
You should probably change the url&#039;s from &#039;&#039;&#039;http&#039;&#039;&#039; to &#039;&#039;&#039;https&#039;&#039;&#039;[https://en.wikipedia.org/wiki/HTTPS#Technical].&lt;br /&gt;
&lt;br /&gt;
{{Note|Some Alpine Linux package mirrors may not support HTTPS. If that is the case, you will need to change mirrors or revert back. You can check if your mirror supports HTTPS on https://mirrors.alpinelinux.org }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can avoid having to manually update the version in &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; for each Alpine Linux release by changing &amp;lt;code&amp;gt;v3.16&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;latest-stable&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
{{cat|/etc/apk/repositories|#/media/cdrom/apks&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/latest-stable/main&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/latest-stable/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/main&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/testing}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|Changing the repositories to &amp;lt;code&amp;gt;latest-stable&amp;lt;/code&amp;gt; may initiate unexpected release upgrades.}}&lt;br /&gt;
&lt;br /&gt;
= Release Branches =&lt;br /&gt;
&lt;br /&gt;
There are several release branches for Alpine Linux available at the same time. Each May and November we make a release branch from &#039;&#039;&#039;edge&#039;&#039;&#039;. The &#039;&#039;&#039;main&#039;&#039;&#039; repository is typically supported for 2 years and the &#039;&#039;&#039;community&#039;&#039;&#039; repository is supported until next stable release.&lt;br /&gt;
&lt;br /&gt;
Security fixes beyond that can be made on request when there are patches available.&lt;br /&gt;
&lt;br /&gt;
== Main ==&lt;br /&gt;
&lt;br /&gt;
By default only the &#039;&#039;&#039;main&#039;&#039;&#039; repository is enabled. &#039;&#039;main&#039;&#039; has a support cycle of 2 years. We also try to limit the amount of packages in &#039;&#039;main&#039;&#039; to only include base system packages, in base you can think of packages which are needed by other packages or are needed to setup a basic system. Packages in &#039;&#039;main&#039;&#039; must &#039;&#039;&#039;not&#039;&#039;&#039; have dependencies in other repositories.&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;community&#039;&#039;&#039; repository was introduced with Alpine Linux version [https://alpinelinux.org/posts/Alpine-3.3.0-released.html 3.3.0].  &#039;&#039;community&#039;&#039; has a maximum support cycle of 6 months. After that you will need to update to the new release to continue to have support.&lt;br /&gt;
&lt;br /&gt;
=== Enabling the community repository ===&lt;br /&gt;
&lt;br /&gt;
To enable the repository, edit the file &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; and add (or uncomment) a line that points to the &amp;quot;community&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
Its format is:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;https://&amp;lt;mirror-server&amp;gt;/alpine/&amp;lt;version&amp;gt;/community&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, if your mirror is dl-cdn.alpinelinux.org and you&#039;re on version 3.16, add the following line to the repositories file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;https://dl-cdn.alpinelinux.org/alpine/v3.16/community&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After enabling the community repository, one needs to update the index of available packages with:&lt;br /&gt;
{{Cmd|# apk update}}&lt;br /&gt;
And then it&#039;s possible to install packages from the community repository.&lt;br /&gt;
&lt;br /&gt;
= Edge =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;edge&#039;&#039; is the name given to the current [[Aports tree|development tree]] of Alpine Linux. It consists of an APK repository called &#039;&#039;edge&#039;&#039; and contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis.&lt;br /&gt;
&lt;br /&gt;
{{Warning|&#039;&#039;edge&#039;&#039; is under constant development so be careful using it in production. It is possible that bugs in &#039;&#039;edge&#039;&#039; could cause data loss or could break your system.}}&lt;br /&gt;
&lt;br /&gt;
End users should not use &#039;&#039;edge&#039;&#039; as their main day-to-day workstation or as a productive system. Because &#039;&#039;edge&#039;&#039; is a development branch, many changes are not heavily tested (or tested at all) and packages in &#039;&#039;edge&#039;&#039; can and sometimes do break without warning.&lt;br /&gt;
&lt;br /&gt;
However, testing &#039;&#039;edge&#039;&#039; is a very valuable activity which helps the Alpine Linux development to ensure that the quality of the stable releases is high. Testing &#039;&#039;edge&#039;&#039; is a great way to contribute to the Alpine Linux development.&lt;br /&gt;
&lt;br /&gt;
== Upgrading to edge ==&lt;br /&gt;
&lt;br /&gt;
{{:Include:Upgrading to Edge}}&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;testing&#039;&#039;&#039; repository was introduced with Alpine Linux &#039;&#039;edge&#039;&#039; development. No support (staging only) and only built for &#039;&#039;edge&#039;&#039;. If it stays here long enough it gets moved to unmaintained/purged (gets cleaned up every 6 months).&lt;br /&gt;
&lt;br /&gt;
Before a package can move from &#039;&#039;testing&#039;&#039; to &#039;&#039;main&#039;&#039; or &#039;&#039;community&#039;&#039;, the following requirements must be met:&lt;br /&gt;
&lt;br /&gt;
# Package must work correctly, including the init.d script (if provided) and default configuration.&lt;br /&gt;
# Packaging must be done correctly, with files installed in the right places, e.g. configs are in &amp;lt;code&amp;gt;/etc/&amp;lt;/code&amp;gt; and not in &amp;lt;code&amp;gt;/usr/etc&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Package dependencies are handled correctly. Abuild can (and should) autodetect shared libs, for example &#039;&#039;&#039;sqlite-libs&#039;&#039;&#039; provides &#039;&#039;&#039;so:libsqlite3.so.0&#039;&#039;&#039;. Any package linked to &#039;&#039;&#039;sqlite&#039;&#039;&#039; should have an automatically (by abuild) added &amp;lt;code&amp;gt;depend=so:libsqlite3.so.0&amp;lt;/code&amp;gt; and the user should not have to manually add a &amp;lt;code&amp;gt;depend=&amp;quot;sqlite-libs&amp;quot;&amp;lt;/code&amp;gt; in the APKBUILD.&lt;br /&gt;
# There is a maintainer who claims responsibility for the maintenance of the package and can help fix things if they break in the future.&lt;br /&gt;
&lt;br /&gt;
=== Enabling the testing repository ===&lt;br /&gt;
&lt;br /&gt;
To enable the repository, edit the file &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; and add (or uncomment) a line that points to the &amp;quot;testing&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
Its format is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://&amp;lt;mirror-server&amp;gt;/alpine/edge/testing&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After enabling the testing repository, one needs to update the index of available packages with:&lt;br /&gt;
{{Cmd|# apk update}}&lt;br /&gt;
And then it&#039;s possible to install packages from the testing repository.&lt;br /&gt;
&lt;br /&gt;
=== Using the testing repository on stable branches ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|&#039;&#039;&#039;Only do this if you&#039;re 100% sure what you&#039;re doing!&#039;&#039;&#039; Installing packages from edge that link to something in &#039;&#039;main&#039;&#039; or &#039;&#039;community&#039;&#039; usually will not work. Alpine does not officially support mixing branches this way.}}&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; and add (or uncomment) a line that points to the &amp;quot;testing&amp;quot; directory, while also [[Package_management#Repository_pinning|tagging]] the repository, for example:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/apk/repositories|&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/v3.16/main&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/v3.16/community&lt;br /&gt;
@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In that case, the tag is &amp;lt;code&amp;gt;@testing&amp;lt;/code&amp;gt;, which allows you to pull packages from that repository without potentially messing up your install (too badly):&lt;br /&gt;
&lt;br /&gt;
 $ apk add wireguard-go@testing&lt;br /&gt;
&lt;br /&gt;
== Unmaintained ==&lt;br /&gt;
&lt;br /&gt;
{{Expand|Maybe also move this somewhere else?}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;unmaintained&#039;&#039;&#039; packages are not built.&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Linux in a chroot]]&lt;br /&gt;
* [http://bugs.alpinelinux.org/ Report Bugs]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:Overview&amp;diff=22163</id>
		<title>Alpine Linux:Overview</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:Overview&amp;diff=22163"/>
		<updated>2022-07-31T08:54:36Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: fix link to musl libc&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine uses [https://musl.libc.org/ musl] as its libc, and [https://en.wikipedia.org/wiki/BusyBox BusyBox] as core utilities. These choices tend to make Alpine especially minimalist and secure. &lt;br /&gt;
&lt;br /&gt;
== General overview ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux has one of the &#039;&#039;&#039;fastest boot times&#039;&#039;&#039; of any operating system.&lt;br /&gt;
&lt;br /&gt;
Famous because of its small size, it&#039;s &#039;&#039;&#039;heavily used in containers&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Also well know for &#039;&#039;&#039;wide use in embedded devices&#039;&#039;&#039; and as a &#039;&#039;&#039;base system for many enterprise routers&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The postmarketOS project which is designed to run on mobile devices is based on Alpine Linux.&lt;br /&gt;
&lt;br /&gt;
=== Distinctive ===&lt;br /&gt;
&lt;br /&gt;
Alpine Linux follows the principles of &#039;&#039;&#039;the SSS distro: Simple+Small+Secure&#039;&#039;&#039;: due to usage of [http://musl-libc.org/ muslc] as the minimalist libc, BusyBox simple coreutils (with possibilities to alternate on inflated original packages of each coreutils tools also) and userland binaries compiled as Position Independent Executables (PIE) with stack smashing protection.&lt;br /&gt;
&lt;br /&gt;
=== Efficient ===&lt;br /&gt;
&lt;br /&gt;
Some main reasons:&lt;br /&gt;
&lt;br /&gt;
# Usage of [http://musl-libc.org/ muslc] as the minimalist libc&lt;br /&gt;
# Its own package manager called {{Pkg|apk}}, &lt;br /&gt;
# the {{Pkg|openrc}} init system, script driven set-ups and that’s it!&lt;br /&gt;
# {{Pkg|busybox}} simple coreutils (with possibilities to alternate on inflated original packages of each coreutils tools also)&lt;br /&gt;
&lt;br /&gt;
This provides you with a simple, &#039;&#039;&#039;crystal-clear Linux environment without all the noise&#039;&#039;&#039;, nothing else will get in the way.&lt;br /&gt;
&lt;br /&gt;
=== Secure ===&lt;br /&gt;
&lt;br /&gt;
All userland binaries are compiled as Position Independent Executables (PIE) with stack smashing protection.&lt;br /&gt;
&lt;br /&gt;
== Technical overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;&#039;The OS design&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Alpine uses &#039;&#039;&#039;Linux&#039;&#039;&#039; as OS kernel, and their focus are &#039;&#039;&#039;SSS distribution, Simple Small and Secure&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A variety of architectures are officially supports:&lt;br /&gt;
* &#039;&#039;&#039;x86_64&#039;&#039;&#039;: The popular AMD64 compatible 64-bit x86 based machines, i386 are not recommended for newer/lasted hardware.&lt;br /&gt;
* &#039;&#039;&#039;x86&#039;&#039;&#039;: (i386 pc 32bit) and x86_64 (i686 pc 64bit and amd64)&lt;br /&gt;
* &#039;&#039;&#039;armhf&#039;&#039;&#039;: The newer ARM hard-float for newer, more powerful 32-bit devices alongside 64-bit&lt;br /&gt;
* &#039;&#039;&#039;armv7&#039;&#039;&#039;: The 32-bit ARM only execution state of the ARMv7 devices machines.&lt;br /&gt;
* &#039;&#039;&#039;aarch64&#039;&#039;&#039;: The 64-bit ARM only execution state of the ARMv8 device machines.&lt;br /&gt;
* &#039;&#039;&#039;ppc64le&#039;&#039;&#039;: For 64-bit PowerPC devices with pure little-endian mode, mostly for POWER8 and POWER9.&lt;br /&gt;
* &#039;&#039;&#039;s390x&#039;&#039;&#039;: For IBM Z mainframes, especially IBM Z and IBM LinuxONE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;It can be installed to a hard disk/SSD/other storage medium like any other distro; (sys mode). The storage medium in question can be any block device (USB, Flash, SDD, HDD). Always in start, the base Alpine system and all your changes will be unpacked into a memory-based filesystem. If run some install script process (data mode) will keep your setup on a hard disk/SSD/other storage medium, rather than unpacking into memory. The default setup here is to store your /var partition directly on the hard storage medium. But as in the diskless mode, your root system still comes from a static ISO image. &lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;&#039;The installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In Alpine&#039;s case, &#039;&#039;&#039;the installer consists of the {{Path|/sbin/setup-*}} scripts&#039;&#039;&#039;, which are also part of the {{Pkg|alpine-conf}} package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;&#039;&#039;A base Alpine install will include only needed packages&#039;&#039;&#039; such like {{Pkg|alpine-base}}, {{Pkg|syslinux}}, {{Pkg|linux-lts}} (or another kernel package), and depending of purpose some like {{Pkg|openssh}}/{{Pkg|chrony}}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Alpine&#039;s boot loader case this is {{Pkg|syslinux}}, or its companions &amp;lt;code&amp;gt;isolinux&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;extlinux&amp;lt;/code&amp;gt;. Lasted releases has Grub and [[Alpine and UEFI|UEFI support]].&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;&#039;The init system&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An &amp;quot;init system&amp;quot; includes several different components. First, there is the initramfs loaded by the bootloader. Alpine&#039;s tool for generating these is {{Path|/sbin/mkinitfs}}, part of the {{Pkg|mkinitfs}} package, which is required by Alpine&#039;s kernel packages and by its {{Pkg|syslinux}} package. This tool&#039;s settings are read from {{Path|/etc/mkinitfs/*}}, and it installs the initscript {{Path|/usr/share/mkinitfs/initramfs-init}} into the initramfs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Second, Alpine uses [[Alpine Linux Init System|OpenRC]] to handle the rest of its initscripts. The base framework of this is in the {{Pkg|openrc}} package, which is required by {{Pkg|alpine-conf}}.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&#039;&#039;&#039;The packaging and development system&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The last important distinguishing feature of a Linux distro is its packaging and development systems.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;In Alpine&#039;s case, these are something a hybrid between [https://www.archlinux.org/ ArchLinux]&#039;s, on the one hand, and [http://www.gentoo.org/ Gentoo] and [http://www.freebsd.org/ FreeBSD]&#039;s, on the other. Our package-management and build utilities work much like Arch&#039;s:&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|mkinitfs}}, mentioned above, rebuilds Alpine&#039;s initramfs, like Arch&#039;s &amp;quot;mkinitcpio&amp;quot;&lt;br /&gt;
* &#039;&#039;&#039;apk&#039;&#039;&#039; from {{Pkg|apk-tools}} is Alpine&#039;s package manager, like Arch&#039;s &amp;quot;pacman&amp;quot;; see [[Alpine Linux package management]]&lt;br /&gt;
* {{Pkg|abuild}} is Alpine&#039;s build utility, like Arch&#039;s &amp;quot;makepkg&amp;quot;; see [[Abuild and Helpers]]&lt;br /&gt;
* Alpine&#039;s package-building scripts are named APKBUILD, like Arch&#039;s &amp;quot;PKGBUILD&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;What Alpine borrows from Gentoo and FreeBSD is a tree of all the package-building scripts. We call this our [[Aports tree]], and we keep it as a git repository. (Compare Gentoo&#039;s &amp;quot;Portage&amp;quot; and FreeBSD&#039;s &amp;quot;ports&amp;quot;. You can setup something similar with Arch&#039;s &amp;quot;abs&amp;quot;, but it&#039;s not as tightly integrated with their package manager and build utilities.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;If you&#039;re only planning to install packages on a given system, and not do any development there, then the only pieces of this you&#039;ll need are {{Pkg|mkinitfs}} and {{Pkg|apk-tools}}, both included in a base Alpine install. If you do plan to do development, install {{Pkg|alpine-sdk}}, which includes gcc, git, abuild, and the like, and see [[Developer Documentation]].&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[Comparison with other distros]]&lt;br /&gt;
* [[Tutorials and Howtos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Repositories&amp;diff=22162</id>
		<title>Repositories</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Repositories&amp;diff=22162"/>
		<updated>2022-07-31T08:44:14Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: add note about the mirrors page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
The Alpine software repositories have three branches:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;main&#039;&#039;&#039; packages are the software that have direct support and updates from the Alpine core and main team. They also have official special documentation, are always available for all releases and will have substitutions if some are not continued from upstream. Commonly these packages are selected due to their responsibility and stability with respect to upstream availability. Packages from &#039;&#039;community&#039;&#039; or (rarely) &#039;&#039;testing&#039;&#039;, that are accepted go to the &#039;&#039;main&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;community&#039;&#039;&#039; packages are those made by users in team with the official developers and close to the Alpine package process. They are supported by those user(s) contributions and could end if the user(s) stops; they may also be removed in a future release due to lack of support by upstream authors. Packages from &#039;&#039;testing&#039;&#039; that are accepted go to the &#039;&#039;community&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;testing&#039;&#039;&#039; packages are where new packages go. These are made by any contributor to Alpine. Testing has no release linked. The &#039;&#039;testing&#039;&#039; repository is only available on &#039;&#039;edge&#039;&#039;. Packages from &#039;&#039;testing&#039;&#039; that are accepted go to the &#039;&#039;community&#039;&#039; branch or (rarely) the &#039;&#039;main&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
To enable a repository, remove the &#039;&#039;&#039;#&#039;&#039;&#039; in front of the URL along with any blank space.&lt;br /&gt;
&lt;br /&gt;
Example: Disabled&lt;br /&gt;
{{cat|/etc/apk/repositories|#http://dl-cdn.alpinelinux.org/alpine/v3.16/community}}&lt;br /&gt;
&lt;br /&gt;
Example: Enabled&lt;br /&gt;
{{cat|/etc/apk/repositories|http://dl-cdn.alpinelinux.org/alpine/v3.16/community}}&lt;br /&gt;
&lt;br /&gt;
To edit the repositories, open the &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; file in a text editor:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# &amp;lt;editor&amp;gt; /etc/apk/repositories}}&lt;br /&gt;
&lt;br /&gt;
The default will look something like:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/apk/repositories|#/media/cdrom/apks&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v3.16/main&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/v3.16/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/main&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/testing}}&lt;br /&gt;
&lt;br /&gt;
You should probably change the url&#039;s from &#039;&#039;&#039;http&#039;&#039;&#039; to &#039;&#039;&#039;https&#039;&#039;&#039;[https://en.wikipedia.org/wiki/HTTPS#Technical].&lt;br /&gt;
&lt;br /&gt;
{{Note|Some Alpine Linux package mirrors may not support HTTPS. If that is the case, you will need to change mirrors or revert back. You can check if your mirror supports HTTPS on https://mirrors.alpinelinux.org }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can avoid having to manually update the version in &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; for each Alpine Linux release by changing &amp;lt;code&amp;gt;v3.16&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;latest-stable&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
{{cat|/etc/apk/repositories|#/media/cdrom/apks&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/latest-stable/main&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/latest-stable/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/main&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/testing}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|Changing the repositories to &amp;lt;code&amp;gt;latest-stable&amp;lt;/code&amp;gt; may initiate unexpected release upgrades.}}&lt;br /&gt;
&lt;br /&gt;
= Release Branches =&lt;br /&gt;
&lt;br /&gt;
There are several release branches for Alpine Linux available at the same time. Each May and November we make a release branch from &#039;&#039;&#039;edge&#039;&#039;&#039;. The &#039;&#039;&#039;main&#039;&#039;&#039; repository is typically supported for 2 years and the &#039;&#039;&#039;community&#039;&#039;&#039; repository is supported until next stable release.&lt;br /&gt;
&lt;br /&gt;
Security fixes beyond that can be made on request when there are patches available.&lt;br /&gt;
&lt;br /&gt;
== Main ==&lt;br /&gt;
&lt;br /&gt;
By default only the &#039;&#039;&#039;main&#039;&#039;&#039; repository is enabled. &#039;&#039;main&#039;&#039; has a support cycle of 2 years. We also try to limit the amount of packages in &#039;&#039;main&#039;&#039; to only include base system packages, in base you can think of packages which are needed by other packages or are needed to setup a basic system. Packages in &#039;&#039;main&#039;&#039; must &#039;&#039;&#039;not&#039;&#039;&#039; have dependencies in other repositories.&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;community&#039;&#039;&#039; repository was introduced with Alpine Linux version [https://alpinelinux.org/posts/Alpine-3.3.0-released.html 3.3.0].  &#039;&#039;community&#039;&#039; has a maximum support cycle of 6 months. After that you will need to update to the new release to continue to have support.&lt;br /&gt;
&lt;br /&gt;
=== Enabling the community repository ===&lt;br /&gt;
&lt;br /&gt;
To enable the repository, edit the file &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; and add (or uncomment) a line that points to the &amp;quot;community&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
Its format is:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;https://&amp;lt;mirror-server&amp;gt;/alpine/&amp;lt;version&amp;gt;/community&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, if your mirror is dl-cdn.alpinelinux.org and you&#039;re on version 3.16, add the following line to the repositories file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;https://dl-cdn.alpinelinux.org/alpine/v3.16/community&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After enabling the community repository, one needs to update the index of available packages with:&lt;br /&gt;
{{Cmd|# apk update}}&lt;br /&gt;
And then it&#039;s possible to install packages from the community repository.&lt;br /&gt;
&lt;br /&gt;
= Edge =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;edge&#039;&#039; is the name given to the current [[Aports tree|development tree]] of Alpine Linux. It consists of an APK repository called &#039;&#039;edge&#039;&#039; and contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis.&lt;br /&gt;
&lt;br /&gt;
{{Warning|&#039;&#039;edge&#039;&#039; is under constant development so be careful using it in production. It is possible that bugs in &#039;&#039;edge&#039;&#039; could cause data loss or could break your system.}}&lt;br /&gt;
&lt;br /&gt;
End users should not use &#039;&#039;edge&#039;&#039; as their main day-to-day workstation or as a productive system. Because &#039;&#039;edge&#039;&#039; is a development branch, many changes are not heavily tested (or tested at all) and packages in &#039;&#039;edge&#039;&#039; can and sometimes do break without warning.&lt;br /&gt;
&lt;br /&gt;
However, testing &#039;&#039;edge&#039;&#039; is a very valuable activity which helps the Alpine Linux development to ensure that the quality of the stable releases is high. Testing &#039;&#039;edge&#039;&#039; is a great way to contribute to the Alpine Linux development.&lt;br /&gt;
&lt;br /&gt;
== Upgrading to edge ==&lt;br /&gt;
&lt;br /&gt;
{{:Include:Upgrading to Edge}}&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;testing&#039;&#039;&#039; repository was introduced with Alpine Linux &#039;&#039;edge&#039;&#039; development. No support (staging only) and only built for &#039;&#039;edge&#039;&#039;. If it stays here long enough it gets moved to unmaintained/purged (gets cleaned up every 6 months).&lt;br /&gt;
&lt;br /&gt;
Before a package can move from &#039;&#039;testing&#039;&#039; to &#039;&#039;main&#039;&#039; or &#039;&#039;community&#039;&#039;, the following requirements must be met:&lt;br /&gt;
&lt;br /&gt;
# Package must work correctly, including the init.d script (if provided) and default configuration.&lt;br /&gt;
# Packaging must be done correctly, with files installed in the right places, e.g. configs are in &amp;lt;code&amp;gt;/etc/&amp;lt;/code&amp;gt; and not in &amp;lt;code&amp;gt;/usr/etc&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Package dependencies are handled correctly. Abuild can (and should) autodetect shared libs, for example &#039;&#039;&#039;sqlite-libs&#039;&#039;&#039; provides &#039;&#039;&#039;so:libsqlite3.so.0&#039;&#039;&#039;. Any package linked to &#039;&#039;&#039;sqlite&#039;&#039;&#039; should have an automatically (by abuild) added &amp;lt;code&amp;gt;depend=so:libsqlite3.so.0&amp;lt;/code&amp;gt; and the user should not have to manually add a &amp;lt;code&amp;gt;depend=&amp;quot;sqlite-libs&amp;quot;&amp;lt;/code&amp;gt; in the APKBUILD.&lt;br /&gt;
# There is a maintainer who claims responsibility for the maintenance of the package and can help fix things if they break in the future.&lt;br /&gt;
&lt;br /&gt;
=== Enabling the testing repository ===&lt;br /&gt;
&lt;br /&gt;
To enable the repository, edit the file &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; and add (or uncomment) a line that points to the &amp;quot;testing&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
Its format is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://&amp;lt;mirror-server&amp;gt;/alpine/edge/testing&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After enabling the testing repository, one needs to update the index of available packages with:&lt;br /&gt;
{{Cmd|# apk update}}&lt;br /&gt;
And then it&#039;s possible to install packages from the testing repository.&lt;br /&gt;
&lt;br /&gt;
== Unmaintained ==&lt;br /&gt;
&lt;br /&gt;
{{Expand|Maybe also move this somewhere else?}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;unmaintained&#039;&#039;&#039; packages are not built.&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Linux in a chroot]]&lt;br /&gt;
* [http://bugs.alpinelinux.org/ Report Bugs]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Repositories&amp;diff=22161</id>
		<title>Repositories</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Repositories&amp;diff=22161"/>
		<updated>2022-07-31T08:41:09Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: add example for correct community repository url&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
The Alpine software repositories have three branches:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;main&#039;&#039;&#039; packages are the software that have direct support and updates from the Alpine core and main team. They also have official special documentation, are always available for all releases and will have substitutions if some are not continued from upstream. Commonly these packages are selected due to their responsibility and stability with respect to upstream availability. Packages from &#039;&#039;community&#039;&#039; or (rarely) &#039;&#039;testing&#039;&#039;, that are accepted go to the &#039;&#039;main&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;community&#039;&#039;&#039; packages are those made by users in team with the official developers and close to the Alpine package process. They are supported by those user(s) contributions and could end if the user(s) stops; they may also be removed in a future release due to lack of support by upstream authors. Packages from &#039;&#039;testing&#039;&#039; that are accepted go to the &#039;&#039;community&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;testing&#039;&#039;&#039; packages are where new packages go. These are made by any contributor to Alpine. Testing has no release linked. The &#039;&#039;testing&#039;&#039; repository is only available on &#039;&#039;edge&#039;&#039;. Packages from &#039;&#039;testing&#039;&#039; that are accepted go to the &#039;&#039;community&#039;&#039; branch or (rarely) the &#039;&#039;main&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
To enable a repository, remove the &#039;&#039;&#039;#&#039;&#039;&#039; in front of the URL along with any blank space.&lt;br /&gt;
&lt;br /&gt;
Example: Disabled&lt;br /&gt;
{{cat|/etc/apk/repositories|#http://dl-cdn.alpinelinux.org/alpine/v3.16/community}}&lt;br /&gt;
&lt;br /&gt;
Example: Enabled&lt;br /&gt;
{{cat|/etc/apk/repositories|http://dl-cdn.alpinelinux.org/alpine/v3.16/community}}&lt;br /&gt;
&lt;br /&gt;
To edit the repositories, open the &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; file in a text editor:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# &amp;lt;editor&amp;gt; /etc/apk/repositories}}&lt;br /&gt;
&lt;br /&gt;
The default will look something like:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/apk/repositories|#/media/cdrom/apks&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v3.16/main&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/v3.16/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/main&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/testing}}&lt;br /&gt;
&lt;br /&gt;
You should probably change the url&#039;s from &#039;&#039;&#039;http&#039;&#039;&#039; to &#039;&#039;&#039;https&#039;&#039;&#039;[https://en.wikipedia.org/wiki/HTTPS#Technical].&lt;br /&gt;
&lt;br /&gt;
{{Note|Some Alpine Linux package mirrors may not support HTTPS. If that is the case, you will need to change mirrors or revert back.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can avoid having to manually update the version in &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; for each Alpine Linux release by changing &amp;lt;code&amp;gt;v3.16&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;latest-stable&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
{{cat|/etc/apk/repositories|#/media/cdrom/apks&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/latest-stable/main&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/latest-stable/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/main&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/community&lt;br /&gt;
#http://dl-cdn.alpinelinux.org/alpine/edge/testing}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|Changing the repositories to &amp;lt;code&amp;gt;latest-stable&amp;lt;/code&amp;gt; may initiate unexpected release upgrades.}}&lt;br /&gt;
&lt;br /&gt;
= Release Branches =&lt;br /&gt;
&lt;br /&gt;
There are several release branches for Alpine Linux available at the same time. Each May and November we make a release branch from &#039;&#039;&#039;edge&#039;&#039;&#039;. The &#039;&#039;&#039;main&#039;&#039;&#039; repository is typically supported for 2 years and the &#039;&#039;&#039;community&#039;&#039;&#039; repository is supported until next stable release.&lt;br /&gt;
&lt;br /&gt;
Security fixes beyond that can be made on request when there are patches available.&lt;br /&gt;
&lt;br /&gt;
== Main ==&lt;br /&gt;
&lt;br /&gt;
By default only the &#039;&#039;&#039;main&#039;&#039;&#039; repository is enabled. &#039;&#039;main&#039;&#039; has a support cycle of 2 years. We also try to limit the amount of packages in &#039;&#039;main&#039;&#039; to only include base system packages, in base you can think of packages which are needed by other packages or are needed to setup a basic system. Packages in &#039;&#039;main&#039;&#039; must &#039;&#039;&#039;not&#039;&#039;&#039; have dependencies in other repositories.&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;community&#039;&#039;&#039; repository was introduced with Alpine Linux version [https://alpinelinux.org/posts/Alpine-3.3.0-released.html 3.3.0].  &#039;&#039;community&#039;&#039; has a maximum support cycle of 6 months. After that you will need to update to the new release to continue to have support.&lt;br /&gt;
&lt;br /&gt;
=== Enabling the community repository ===&lt;br /&gt;
&lt;br /&gt;
To enable the repository, edit the file &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; and add (or uncomment) a line that points to the &amp;quot;community&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
Its format is:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;https://&amp;lt;mirror-server&amp;gt;/alpine/&amp;lt;version&amp;gt;/community&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, if your mirror is dl-cdn.alpinelinux.org and you&#039;re on version 3.16, add the following line to the repositories file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;https://dl-cdn.alpinelinux.org/alpine/v3.16/community&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After enabling the community repository, one needs to update the index of available packages with:&lt;br /&gt;
{{Cmd|# apk update}}&lt;br /&gt;
And then it&#039;s possible to install packages from the community repository.&lt;br /&gt;
&lt;br /&gt;
= Edge =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;edge&#039;&#039; is the name given to the current [[Aports tree|development tree]] of Alpine Linux. It consists of an APK repository called &#039;&#039;edge&#039;&#039; and contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis.&lt;br /&gt;
&lt;br /&gt;
{{Warning|&#039;&#039;edge&#039;&#039; is under constant development so be careful using it in production. It is possible that bugs in &#039;&#039;edge&#039;&#039; could cause data loss or could break your system.}}&lt;br /&gt;
&lt;br /&gt;
End users should not use &#039;&#039;edge&#039;&#039; as their main day-to-day workstation or as a productive system. Because &#039;&#039;edge&#039;&#039; is a development branch, many changes are not heavily tested (or tested at all) and packages in &#039;&#039;edge&#039;&#039; can and sometimes do break without warning.&lt;br /&gt;
&lt;br /&gt;
However, testing &#039;&#039;edge&#039;&#039; is a very valuable activity which helps the Alpine Linux development to ensure that the quality of the stable releases is high. Testing &#039;&#039;edge&#039;&#039; is a great way to contribute to the Alpine Linux development.&lt;br /&gt;
&lt;br /&gt;
== Upgrading to edge ==&lt;br /&gt;
&lt;br /&gt;
{{:Include:Upgrading to Edge}}&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;testing&#039;&#039;&#039; repository was introduced with Alpine Linux &#039;&#039;edge&#039;&#039; development. No support (staging only) and only built for &#039;&#039;edge&#039;&#039;. If it stays here long enough it gets moved to unmaintained/purged (gets cleaned up every 6 months).&lt;br /&gt;
&lt;br /&gt;
Before a package can move from &#039;&#039;testing&#039;&#039; to &#039;&#039;main&#039;&#039; or &#039;&#039;community&#039;&#039;, the following requirements must be met:&lt;br /&gt;
&lt;br /&gt;
# Package must work correctly, including the init.d script (if provided) and default configuration.&lt;br /&gt;
# Packaging must be done correctly, with files installed in the right places, e.g. configs are in &amp;lt;code&amp;gt;/etc/&amp;lt;/code&amp;gt; and not in &amp;lt;code&amp;gt;/usr/etc&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Package dependencies are handled correctly. Abuild can (and should) autodetect shared libs, for example &#039;&#039;&#039;sqlite-libs&#039;&#039;&#039; provides &#039;&#039;&#039;so:libsqlite3.so.0&#039;&#039;&#039;. Any package linked to &#039;&#039;&#039;sqlite&#039;&#039;&#039; should have an automatically (by abuild) added &amp;lt;code&amp;gt;depend=so:libsqlite3.so.0&amp;lt;/code&amp;gt; and the user should not have to manually add a &amp;lt;code&amp;gt;depend=&amp;quot;sqlite-libs&amp;quot;&amp;lt;/code&amp;gt; in the APKBUILD.&lt;br /&gt;
# There is a maintainer who claims responsibility for the maintenance of the package and can help fix things if they break in the future.&lt;br /&gt;
&lt;br /&gt;
=== Enabling the testing repository ===&lt;br /&gt;
&lt;br /&gt;
To enable the repository, edit the file &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; and add (or uncomment) a line that points to the &amp;quot;testing&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
Its format is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://&amp;lt;mirror-server&amp;gt;/alpine/edge/testing&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After enabling the testing repository, one needs to update the index of available packages with:&lt;br /&gt;
{{Cmd|# apk update}}&lt;br /&gt;
And then it&#039;s possible to install packages from the testing repository.&lt;br /&gt;
&lt;br /&gt;
== Unmaintained ==&lt;br /&gt;
&lt;br /&gt;
{{Expand|Maybe also move this somewhere else?}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;unmaintained&#039;&#039;&#039; packages are not built.&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Linux in a chroot]]&lt;br /&gt;
* [http://bugs.alpinelinux.org/ Report Bugs]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Enable_Community_Repository&amp;diff=22160</id>
		<title>Enable Community Repository</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Enable_Community_Repository&amp;diff=22160"/>
		<updated>2022-07-31T08:36:17Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: redirect to Repositories#Enabling_the_community_repository&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Repositories#Enabling_the_community_repository]]&lt;br /&gt;
&lt;br /&gt;
{{Delete|This should be covered in: https://wiki.alpinelinux.org/wiki/Repositories}}&lt;br /&gt;
&lt;br /&gt;
Alpine software repositories have main packages and contributions made. Each Alpine release has two branches of repositories. The &#039;&#039;&#039;/community&#039;&#039;&#039; repository of each Alpine release contains community supported packages that were accepted from the &#039;&#039;&#039;/testing&#039;&#039;&#039; repository. Only &#039;&#039;&#039;/main&#039;&#039;&#039; repository of each version of Alpine release are supported for some Main Alpine Developers and Man Powers.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Main packages&#039;&#039;&#039; are the Alpine package software that have direct support and updates from the Alpine core and main team, also have official documentation. Are always available for all releases and will have substitutions if some are not continued from upstream. Commonly those packages are selected due their responsibility and stability respecting upstream availability. Packages from &#039;&#039;testing&#039;&#039; that performs well or are mature goes to &#039;&#039;main&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Community packages&#039;&#039;&#039; are those made by users in team with the official developers and well near integrated to the Alpine packages. Those have supported by those user contributions and could end if the user also ends respect with Alpine work, but may be removed in a future release due lack of support by upstream author. Packages from &#039;&#039;testing&#039;&#039; that are accept goes to &#039;&#039;community&#039;&#039; branch.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Testing&#039;&#039;&#039; packages come into testing or edge repositories and are those made by any contributor on Alpine, the edge, this branch of repository has no release linked or related of Alpine. Those are in &#039;&#039;edge&#039;&#039; and when accepted goes to &#039;&#039;testing&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Using community repositories ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;community&#039;&#039;&#039; repository was introduced with Alpine Linux version 3.3.&lt;br /&gt;
&lt;br /&gt;
To enable the repository, edit the file {{Path|/etc/apk/repositories}} and add (or uncomment) a line that points to the &amp;quot;community&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
Its format is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;https://&amp;lt;mirror-server&amp;gt;/alpine/&amp;lt;version&amp;gt;/community&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Tip|A usable editor is {{Pkg|nano}}, and it can be installed with &amp;lt;code&amp;gt;apk add nano&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
After enabling the community repository, one needs to update the index of available packages with:&lt;br /&gt;
{{Cmd|apk update}}&lt;br /&gt;
And then it&#039;s possible to install packages from the community repository.&lt;br /&gt;
&lt;br /&gt;
=== Adding community repositories with a script ===&lt;br /&gt;
&lt;br /&gt;
The following commands will add the main and community repositories for the Alpine version you&#039;re using. It will overwrite your existing repository settings.&lt;br /&gt;
&lt;br /&gt;
{{cmd|cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF; $(echo)&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/v$(cut -d&#039;.&#039; -f1,2 /etc/alpine-release)/main/&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/v$(cut -d&#039;.&#039; -f1,2 /etc/alpine-release)/community/&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/edge/testing/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
EOF&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Dont forget to run this after:.&lt;br /&gt;
{{Cmd|apk update}}&lt;br /&gt;
&lt;br /&gt;
== Using specific package versions ==&lt;br /&gt;
&lt;br /&gt;
You can specify or pin &amp;quot;sticky&amp;quot; package versions like this:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;apk add packagename=1.2.3-suffix&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;apk add &#039;packagename&amp;lt;1.2.3-suffix&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That will upgrade these packages only until the specified version.&lt;br /&gt;
&lt;br /&gt;
It&#039;s then safe to use &amp;lt;code&amp;gt;apk upgrade&amp;lt;/code&amp;gt; to upgrade all packages, while packages with versions will remain on the specified version.&lt;br /&gt;
&lt;br /&gt;
To set a minimum version just add &amp;lt;code&amp;gt;…&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Warning|Pinning a package to an exact version carries the risk that the package will be dropped from the repo, and at some time can&#039;t be downloaded anymore (e.g. during boot or Dockerfile build).&lt;br /&gt;
&lt;br /&gt;
The official recommendation can be read here, citation below.&lt;br /&gt;
 Alternately, you could simply set a minimum package version&lt;br /&gt;
 instead of an exact version.&lt;br /&gt;
 &lt;br /&gt;
 We don&#039;t at the moment have resources to store all built packages&lt;br /&gt;
 indefinitely in our infrastructure. Thus we currently keep only&lt;br /&gt;
 the latest for each stable branch.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Using testing repositories ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;testing&#039;&#039;&#039; repository was introduced with Alpine Linux edge development. To enable the repository, edit the file {{Path|/etc/apk/repositories}} using an editor ({{Pkg|nano}} for instance) and add a line that points to the &amp;quot;testing&amp;quot; directory, formatted as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;https://&amp;lt;mirror-server&amp;gt;/alpine/edge/testing&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After enabling the testing repository, one needs to obtain the latest index of available packages with:&lt;br /&gt;
{{Cmd|apk update}}&lt;br /&gt;
&lt;br /&gt;
Inexperienced users should not enable this.&lt;br /&gt;
&lt;br /&gt;
=== Using packages from testing (edge) ===&lt;br /&gt;
&lt;br /&gt;
Never pin packages from the &amp;quot;edge&amp;quot; branch of the alpine package repo, as these are in test and may be revoked. (At pkgs.alpinelinux.org/packages, click &amp;quot;edge&amp;quot; and change it to the alpine image version you use, and click &amp;quot;search&amp;quot; again.)&lt;br /&gt;
&lt;br /&gt;
Inexperienced users should not enable this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=22093</id>
		<title>User:Ptrcnull</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=22093"/>
		<updated>2022-07-13T21:59:18Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;{{DISPLAYTITLE:ptrcnull}}&amp;lt;/span&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
hi! i&#039;m patrycja, also known as &amp;lt;code&amp;gt;ptrcnull&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
i maintain a few packages in aports and contribute to keep alpine edge up-to-date, occasionally fixing random issues and missing dependencies&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=22092</id>
		<title>User:Ptrcnull</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Ptrcnull&amp;diff=22092"/>
		<updated>2022-07-13T21:59:07Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: Created page with &amp;quot;&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;{{DISPLAYTITLE:ptrcnull}}&amp;lt;/span&amp;gt;&amp;lt;noinclude&amp;gt;  hi! i&amp;#039;m patrycja, also known as &amp;lt;code&amp;gt;ptrcnull&amp;lt;/code&amp;gt;. i maintain a few packages in aports and contribu...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;display:none&amp;quot;&amp;gt;{{DISPLAYTITLE:ptrcnull}}&amp;lt;/span&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
hi! i&#039;m patrycja, also known as &amp;lt;code&amp;gt;ptrcnull&amp;lt;/code&amp;gt;. i maintain a few packages in aports and contribute to keep alpine edge up-to-date, occasionally fixing random issues and missing dependencies&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How_to_setup_a_Alpine_Linux_mirror&amp;diff=22091</id>
		<title>How to setup a Alpine Linux mirror</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How_to_setup_a_Alpine_Linux_mirror&amp;diff=22091"/>
		<updated>2022-07-13T21:44:39Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: update all branch sizes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This document describes how to set up an Alpine Linux mirror and make it available via http and rsync.&lt;br /&gt;
&lt;br /&gt;
We will:&lt;br /&gt;
* create the dir where we have the mirror&lt;br /&gt;
* set up a cron job to sync with master mirror every hour&lt;br /&gt;
* set up lighttpd for http access&lt;br /&gt;
* set up rsync so other mirrors can rsync from you&lt;br /&gt;
&lt;br /&gt;
Make sure that you have enough disk space.&lt;br /&gt;
&lt;br /&gt;
Current (2022-07-13) disk usage in GB:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!edge&lt;br /&gt;
!v3.0&lt;br /&gt;
!v3.1&lt;br /&gt;
!v3.2&lt;br /&gt;
!v3.3&lt;br /&gt;
!v3.4&lt;br /&gt;
!v3.5&lt;br /&gt;
!v3.6&lt;br /&gt;
!v3.7&lt;br /&gt;
!v3.8&lt;br /&gt;
!v3.9&lt;br /&gt;
!v3.10&lt;br /&gt;
!v3.11&lt;br /&gt;
!v3.12&lt;br /&gt;
!v3.13&lt;br /&gt;
!v3.14&lt;br /&gt;
!v3.15&lt;br /&gt;
!v3.16&lt;br /&gt;
&lt;br /&gt;
!total&lt;br /&gt;
|-&lt;br /&gt;
|324.7&lt;br /&gt;
|16.5&lt;br /&gt;
|17.5&lt;br /&gt;
|14.5&lt;br /&gt;
|20.4&lt;br /&gt;
|24.3&lt;br /&gt;
|26.8&lt;br /&gt;
|44.3&lt;br /&gt;
|42.5&lt;br /&gt;
|58.9&lt;br /&gt;
|72.8&lt;br /&gt;
|91.4&lt;br /&gt;
|125.5&lt;br /&gt;
|147.7&lt;br /&gt;
|148.8&lt;br /&gt;
|165.2&lt;br /&gt;
|183.8&lt;br /&gt;
|196.9&lt;br /&gt;
&lt;br /&gt;
|&#039;&#039;&#039;1722.7&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Script used to calculate the size:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
total=0&lt;br /&gt;
dest=&amp;quot;$(mktemp -d)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
for dir in edge v3.0 v3.1 v3.2 v3.3 v3.4 v3.5 v3.6 v3.7 v3.8 v3.9 v3.10 v3.11 v3.12 v3.13 v3.14 v3.15 v3.16; do&lt;br /&gt;
    old_total=&amp;quot;$total&amp;quot;&lt;br /&gt;
    src=&amp;quot;rsync://rsync.alpinelinux.org/alpine/$dir/&amp;quot;&lt;br /&gt;
    size=`rsync -a -n --stats &amp;quot;$src&amp;quot; &amp;quot;$dest&amp;quot; | grep &#039;^Total file size&#039; | tr -d &#039;,&#039; | awk &#039;{ print $4 }&#039;`&lt;br /&gt;
    total=$(( $old_total + $size ))&lt;br /&gt;
    echo &amp;quot;$dir: $size&amp;quot; | awk &#039;{ print $1 sprintf(&amp;quot;%.1f&amp;quot;, $2/1073741824) }&#039;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;total: $total&amp;quot; | awk &#039;{ print $1 sprintf(&amp;quot;%.1f&amp;quot;, $2/1073741824) }&#039;&lt;br /&gt;
rm -r &amp;quot;$dest&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setting up the cron job ==&lt;br /&gt;
Install rsync which will be used to sync from the master mirror.&lt;br /&gt;
{{Cmd|apk add rsync}}&lt;br /&gt;
&lt;br /&gt;
Save the following file as &#039;&#039;/etc/periodic/hourly/alpine-mirror&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env sh&lt;br /&gt;
&lt;br /&gt;
# make sure we never run 2 rsync at the same time&lt;br /&gt;
lockfile=&amp;quot;/tmp/alpine-mirror.lock&amp;quot;&lt;br /&gt;
if [ -z &amp;quot;$flock&amp;quot; ] ; then&lt;br /&gt;
  exec env flock=1 flock -n $lockfile &amp;quot;$0&amp;quot; &amp;quot;$@&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
src=rsync://rsync.alpinelinux.org/alpine/ &lt;br /&gt;
dest=/var/www/localhost/htdocs/alpine/&lt;br /&gt;
&lt;br /&gt;
# uncomment this to exclude old v2.x branches&lt;br /&gt;
#exclude=&amp;quot;--exclude v2.*&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -p &amp;quot;$dest&amp;quot;&lt;br /&gt;
/usr/bin/rsync \&lt;br /&gt;
        --archive \&lt;br /&gt;
        --update \&lt;br /&gt;
        --hard-links \&lt;br /&gt;
        --delete \&lt;br /&gt;
        --delete-after \&lt;br /&gt;
        --delay-updates \&lt;br /&gt;
        --timeout=600 \&lt;br /&gt;
        $exclude \&lt;br /&gt;
        &amp;quot;$src&amp;quot; &amp;quot;$dest&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(or use [https://gist.github.com/jirutka/288c6fff7c0b8a835d143686207316be this script])&lt;br /&gt;
&lt;br /&gt;
Make it executable:&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;chmod +x /etc/periodic/hourly/alpine-mirror&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Now it will sync every hour. (given cron runs)&lt;br /&gt;
&lt;br /&gt;
== Setting up HTTP access via lighttpd ==&lt;br /&gt;
&lt;br /&gt;
Install the lighttpd server&lt;br /&gt;
{{Cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Enable dir listings by uncommenting the following line in &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039;:&lt;br /&gt;
 dir-listing.activate      = &amp;quot;enable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Also set cache-control to force cache revalidate every 30 mins. Uncomment mod_setenv in &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039;:&lt;br /&gt;
 &amp;quot;mod_setenv&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
Add also the following lines to &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039;:&lt;br /&gt;
 setenv.add-response-header += (           &lt;br /&gt;
         &amp;quot;Cache-Control&amp;quot; =&amp;gt; &amp;quot;must-revalidate&amp;quot;&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
Start lighttpd and make it start at boot:&lt;br /&gt;
{{Cmd|rc-service lighttpd start&lt;br /&gt;
rc-update add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You may wish to consider [[Darkhttpd]] as an alternative to [[Lighttpd]]&lt;br /&gt;
&lt;br /&gt;
If so, simply install, start and auto-start the webserver:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add darkhttpd &amp;amp;&amp;amp; rc-service darkhttpd start &amp;amp;&amp;amp; rc-update add darkhttpd}}&lt;br /&gt;
&lt;br /&gt;
Darkhttpd will, by default, offer directory listings and serve data from /var/www/localhost/htdocs/ &lt;br /&gt;
&lt;br /&gt;
See the main article on [[Darkhttpd]] for more configuration options}}&lt;br /&gt;
&lt;br /&gt;
== Setting up rsyncd ==&lt;br /&gt;
Add the following lines to &#039;&#039;/etc/rsyncd.conf&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[alpine]&lt;br /&gt;
        path = /var/www/localhost/htdocs/alpine&lt;br /&gt;
        comment = My Alpine Linux Mirror&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optionally set a bandwidth limit in &#039;&#039;/etc/conf.d/rsyncd&#039;&#039;. In this example we limit to 500Kbytes/s (approx 5Mbit/s)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSYNC_OPTS=&amp;quot;--bwlimit=500&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mirror statistics ==&lt;br /&gt;
&lt;br /&gt;
Simple bandwidth statistics can be generated with vnstat.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add vnstat}}&lt;br /&gt;
&lt;br /&gt;
edit /etc/vnstat.conf and replace the interface name with the appropriate one.&lt;br /&gt;
&lt;br /&gt;
Start vnstatd&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/vnstatd start }}&lt;br /&gt;
&lt;br /&gt;
copy the following script to /etc/periodic/15min/stats and make sure your crond is running.&lt;br /&gt;
please not that heredoc should be tab indented or the script will fail. A working copy can be found here: http://tpaste.us/RrMv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env sh&lt;br /&gt;
&lt;br /&gt;
output=&amp;quot;/var/www/localhost/htdocs/.stats&amp;quot;&lt;br /&gt;
nic=&amp;quot;eth0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
generate_index() {&lt;br /&gt;
    cat &amp;lt;&amp;lt;-EOF&lt;br /&gt;
    &amp;lt;!doctype html&amp;gt;&lt;br /&gt;
    &amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;meta http-equiv=&amp;quot;cache-control&amp;quot; content=no-cache&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;3000&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;title&amp;gt;Alpine Linux mirror statistics&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;table border=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;summary.png&amp;quot; alt=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;hours.png&amp;quot; alt=&amp;quot;hours&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&amp;lt;td rowspan=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;days.png&amp;quot; alt=&amp;quot;days&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;top10.png&amp;quot; alt=&amp;quot;top10&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;months.png&amp;quot; alt=&amp;quot;months&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt;&lt;br /&gt;
    EOF&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if  [ ! -f &amp;quot;$output&amp;quot;/index.html ]; then&lt;br /&gt;
    mkdir -p $output&lt;br /&gt;
    generate_index &amp;gt; &amp;quot;$output&amp;quot;/index.html&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
for type in hours days months top10 summary hsummary vsummary; do&lt;br /&gt;
    vnstati --${type} -i $nic -o $output/${type}.png&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update mirror from mqtt ==&lt;br /&gt;
&lt;br /&gt;
If you want your mirror to be really uptodate compared to our master mirror you can subscribe to Alpine Linux message server &amp;quot;msg.alpinelinux.org&amp;quot; and check for upload messages.&lt;br /&gt;
Add mqtt-exec to be able to execute processes when specific topics are being send.&lt;br /&gt;
&lt;br /&gt;
{{Cmd| apk add mqtt-exec}}&lt;br /&gt;
&lt;br /&gt;
mqtt-exec supports running multiple time so we need to setup a specific config.&lt;br /&gt;
&lt;br /&gt;
{{Cmd| ln -s /etc/init.d/mqtt-exec /etc/init.d/mqtt-exec.sync-mirror}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd| ln -s /etc/conf.d/mqtt-exec /etc/conf.d/mqtt-exec.sync-mirror}}&lt;br /&gt;
&lt;br /&gt;
edit /etc/conf.d/mqtt-exec.sync-mirror&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mqtt_topics=&amp;quot;rsync/rsync.alpinelinux.org/#&amp;quot;&lt;br /&gt;
exec_user=&amp;quot;buildozer&amp;quot;&lt;br /&gt;
exec_command=&amp;quot;/usr/local/bin/sync-mirror&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following file to /usr/local/bin/sync-mirror and make it executable (dont forget to update the variables).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
src=&amp;quot;rsync://rsync.alpinelinux.org/alpine/&amp;quot;&lt;br /&gt;
dest=&amp;quot;/var/www/localhost/htdocs/alpine/&amp;quot;&lt;br /&gt;
lock=&amp;quot;/tmp/sync-mirror.lock&amp;quot;&lt;br /&gt;
topic=&amp;quot;$1&amp;quot;&lt;br /&gt;
dir=&amp;quot;$2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[ -z &amp;quot;$flock&amp;quot; ] &amp;amp;&amp;amp; exec env flock=1 flock $lock $0 &amp;quot;$@&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$dir&amp;quot; ] &amp;amp;&amp;amp; [ -d &amp;quot;$dest/${dir%/*}&amp;quot; ]; then&lt;br /&gt;
    logger &amp;quot;Syncing directory: $dir&amp;quot;&lt;br /&gt;
    src=&amp;quot;${src}${dir%/}/&amp;quot;&lt;br /&gt;
    dest=&amp;quot;${dest}${dir%/}/&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
    logger &amp;quot;Syncing all directories&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/bin/rsync \&lt;br /&gt;
    --archive \&lt;br /&gt;
    --update \&lt;br /&gt;
    --verbose \&lt;br /&gt;
    --progress \&lt;br /&gt;
    --timeout=600 \&lt;br /&gt;
    --delay-updates \&lt;br /&gt;
    --delete-after \&lt;br /&gt;
    &amp;quot;$src&amp;quot; \&lt;br /&gt;
    &amp;quot;$dest&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally start mqtt-exec and let it listen on msg.alpinelinux.org&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/mqtt-exec.sync-mirror start}}&lt;br /&gt;
&lt;br /&gt;
To make sure you are not missing any packages (in case something goes wrong with MQTT subscription) you can periodically sync all directories by adding the script to cron.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ln -s /usr/local/bin/sync-mirror /etc/periodic/hourly/sync-mirror}}&lt;br /&gt;
&lt;br /&gt;
Now watch your syslog as it should tell you when it will update directories in your local mirror.&lt;br /&gt;
&lt;br /&gt;
== Partial mirror using nginx ==&lt;br /&gt;
&lt;br /&gt;
For a private mirror it might make sense to sync only the newest versions of Alpine to save space, but if you &#039;&#039;do&#039;&#039; point an old Alpine version to your mirror they should still be able to install packages. We can achieve this by using nginx to serve the mirrored content and use regex location matching to redirect requests to a public mirror.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s assume you chose to only mirror Alpine versions up from v3.13. If a client asks your mirror for v.3.10 it should redirect to another mirror.&lt;br /&gt;
&lt;br /&gt;
Your nginx config server block should look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        listen 80;&lt;br /&gt;
        server_name alpine.mydomain.local;&lt;br /&gt;
        root /data/alpine;          # point to where your alpine mirror is located. make sure nginx is allowed to read it&lt;br /&gt;
        autoindex on;               # Enable indexing&lt;br /&gt;
&lt;br /&gt;
        # the following location block will match for v3.0 to v3.12&lt;br /&gt;
        # and will forward it to dl-4.alpinelinux.org.&lt;br /&gt;
        location ~* /(v3\.([1-9]|1[012]))$&lt;br /&gt;
        {&lt;br /&gt;
          return 302 http://dl-cdn.alpinelinux.org/alpine$request_uri;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding sync script could look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env sh&lt;br /&gt;
&lt;br /&gt;
# make sure we never run 2 rsync at the same time&lt;br /&gt;
lockfile=&amp;quot;/tmp/alpine-mirror.lock&amp;quot;&lt;br /&gt;
if [ -z &amp;quot;$flock&amp;quot; ] ; then&lt;br /&gt;
  exec env flock=1 flock -n $lockfile &amp;quot;$0&amp;quot; &amp;quot;$@&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  src=rsync://rsync.alpinelinux.org/alpine/&lt;br /&gt;
  dest=/data/alpine/&lt;br /&gt;
&lt;br /&gt;
  exclude=&amp;quot;--exclude v2.* --exclude v3.0 --exclude v3.1 --exclude v3.2 --exclude v3.3 --exclude v3.4 --exclude v3.5 --exclude v3.6 --exclude v3.7 --exclude v3.8 --exclude v3.9 --exclude v3.10 --exclude v3.11 --exclude v3.12&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  mkdir -p &amp;quot;$dest&amp;quot;&lt;br /&gt;
  /usr/bin/rsync -vvv \&lt;br /&gt;
  --archive \&lt;br /&gt;
  --update \&lt;br /&gt;
  --hard-links \&lt;br /&gt;
  --delete \&lt;br /&gt;
  --delete-after \&lt;br /&gt;
  --delete-excluded \&lt;br /&gt;
  --delay-updates \&lt;br /&gt;
  --timeout=600 \&lt;br /&gt;
  $exclude \&lt;br /&gt;
  &amp;quot;$src&amp;quot; &amp;quot;$dest&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How_to_setup_a_Alpine_Linux_mirror&amp;diff=22090</id>
		<title>How to setup a Alpine Linux mirror</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How_to_setup_a_Alpine_Linux_mirror&amp;diff=22090"/>
		<updated>2022-07-13T21:41:35Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: make the mirrors script work with posix sh&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This document describes how to set up an Alpine Linux mirror and make it available via http and rsync.&lt;br /&gt;
&lt;br /&gt;
We will:&lt;br /&gt;
* create the dir where we have the mirror&lt;br /&gt;
* set up a cron job to sync with master mirror every hour&lt;br /&gt;
* set up lighttpd for http access&lt;br /&gt;
* set up rsync so other mirrors can rsync from you&lt;br /&gt;
&lt;br /&gt;
Make sure that you have enough disk space.&lt;br /&gt;
&lt;br /&gt;
Current (2021-06-10) disk usage in GB:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!edge&lt;br /&gt;
!v3.0&lt;br /&gt;
!v3.1&lt;br /&gt;
!v3.2&lt;br /&gt;
!v3.3&lt;br /&gt;
!v3.4&lt;br /&gt;
!v3.5&lt;br /&gt;
!v3.6&lt;br /&gt;
!v3.7&lt;br /&gt;
!v3.8&lt;br /&gt;
!v3.9&lt;br /&gt;
!v3.10&lt;br /&gt;
!v3.11&lt;br /&gt;
!v3.12&lt;br /&gt;
!v3.13&lt;br /&gt;
!v3.14&lt;br /&gt;
!v3.15&lt;br /&gt;
!v3.16&lt;br /&gt;
&lt;br /&gt;
!total&lt;br /&gt;
|-&lt;br /&gt;
|324.7&lt;br /&gt;
|16.5&lt;br /&gt;
|17.5&lt;br /&gt;
|14.5&lt;br /&gt;
|19.3&lt;br /&gt;
|23.0&lt;br /&gt;
|26.9&lt;br /&gt;
|44.4&lt;br /&gt;
|42.7&lt;br /&gt;
|58.4&lt;br /&gt;
|72.2&lt;br /&gt;
|110.5&lt;br /&gt;
|139.7&lt;br /&gt;
|151.9&lt;br /&gt;
|152.4&lt;br /&gt;
|167.2&lt;br /&gt;
|179.0&lt;br /&gt;
|197.3&lt;br /&gt;
&lt;br /&gt;
|&#039;&#039;&#039;1726&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Script used to calculate the size:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
total=0&lt;br /&gt;
dest=&amp;quot;$(mktemp -d)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
for dir in edge v3.0 v3.1 v3.2 v3.3 v3.4 v3.5 v3.6 v3.7 v3.8 v3.9 v3.10 v3.11 v3.12 v3.13 v3.14 v3.15 v3.16; do&lt;br /&gt;
    old_total=&amp;quot;$total&amp;quot;&lt;br /&gt;
    src=&amp;quot;rsync://rsync.alpinelinux.org/alpine/$dir/&amp;quot;&lt;br /&gt;
    size=`rsync -a -n --stats &amp;quot;$src&amp;quot; &amp;quot;$dest&amp;quot; | grep &#039;^Total file size&#039; | tr -d &#039;,&#039; | awk &#039;{ print $4 }&#039;`&lt;br /&gt;
    total=$(( $old_total + $size ))&lt;br /&gt;
    echo &amp;quot;$dir: $size&amp;quot; | awk &#039;{ print $1 sprintf(&amp;quot;%.1f&amp;quot;, $2/1073741824) }&#039;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;total: $total&amp;quot; | awk &#039;{ print $1 sprintf(&amp;quot;%.1f&amp;quot;, $2/1073741824) }&#039;&lt;br /&gt;
rm -r &amp;quot;$dest&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setting up the cron job ==&lt;br /&gt;
Install rsync which will be used to sync from the master mirror.&lt;br /&gt;
{{Cmd|apk add rsync}}&lt;br /&gt;
&lt;br /&gt;
Save the following file as &#039;&#039;/etc/periodic/hourly/alpine-mirror&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env sh&lt;br /&gt;
&lt;br /&gt;
# make sure we never run 2 rsync at the same time&lt;br /&gt;
lockfile=&amp;quot;/tmp/alpine-mirror.lock&amp;quot;&lt;br /&gt;
if [ -z &amp;quot;$flock&amp;quot; ] ; then&lt;br /&gt;
  exec env flock=1 flock -n $lockfile &amp;quot;$0&amp;quot; &amp;quot;$@&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
src=rsync://rsync.alpinelinux.org/alpine/ &lt;br /&gt;
dest=/var/www/localhost/htdocs/alpine/&lt;br /&gt;
&lt;br /&gt;
# uncomment this to exclude old v2.x branches&lt;br /&gt;
#exclude=&amp;quot;--exclude v2.*&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -p &amp;quot;$dest&amp;quot;&lt;br /&gt;
/usr/bin/rsync \&lt;br /&gt;
        --archive \&lt;br /&gt;
        --update \&lt;br /&gt;
        --hard-links \&lt;br /&gt;
        --delete \&lt;br /&gt;
        --delete-after \&lt;br /&gt;
        --delay-updates \&lt;br /&gt;
        --timeout=600 \&lt;br /&gt;
        $exclude \&lt;br /&gt;
        &amp;quot;$src&amp;quot; &amp;quot;$dest&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(or use [https://gist.github.com/jirutka/288c6fff7c0b8a835d143686207316be this script])&lt;br /&gt;
&lt;br /&gt;
Make it executable:&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;chmod +x /etc/periodic/hourly/alpine-mirror&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Now it will sync every hour. (given cron runs)&lt;br /&gt;
&lt;br /&gt;
== Setting up HTTP access via lighttpd ==&lt;br /&gt;
&lt;br /&gt;
Install the lighttpd server&lt;br /&gt;
{{Cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Enable dir listings by uncommenting the following line in &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039;:&lt;br /&gt;
 dir-listing.activate      = &amp;quot;enable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Also set cache-control to force cache revalidate every 30 mins. Uncomment mod_setenv in &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039;:&lt;br /&gt;
 &amp;quot;mod_setenv&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
Add also the following lines to &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039;:&lt;br /&gt;
 setenv.add-response-header += (           &lt;br /&gt;
         &amp;quot;Cache-Control&amp;quot; =&amp;gt; &amp;quot;must-revalidate&amp;quot;&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
Start lighttpd and make it start at boot:&lt;br /&gt;
{{Cmd|rc-service lighttpd start&lt;br /&gt;
rc-update add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You may wish to consider [[Darkhttpd]] as an alternative to [[Lighttpd]]&lt;br /&gt;
&lt;br /&gt;
If so, simply install, start and auto-start the webserver:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add darkhttpd &amp;amp;&amp;amp; rc-service darkhttpd start &amp;amp;&amp;amp; rc-update add darkhttpd}}&lt;br /&gt;
&lt;br /&gt;
Darkhttpd will, by default, offer directory listings and serve data from /var/www/localhost/htdocs/ &lt;br /&gt;
&lt;br /&gt;
See the main article on [[Darkhttpd]] for more configuration options}}&lt;br /&gt;
&lt;br /&gt;
== Setting up rsyncd ==&lt;br /&gt;
Add the following lines to &#039;&#039;/etc/rsyncd.conf&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[alpine]&lt;br /&gt;
        path = /var/www/localhost/htdocs/alpine&lt;br /&gt;
        comment = My Alpine Linux Mirror&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optionally set a bandwidth limit in &#039;&#039;/etc/conf.d/rsyncd&#039;&#039;. In this example we limit to 500Kbytes/s (approx 5Mbit/s)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSYNC_OPTS=&amp;quot;--bwlimit=500&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mirror statistics ==&lt;br /&gt;
&lt;br /&gt;
Simple bandwidth statistics can be generated with vnstat.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add vnstat}}&lt;br /&gt;
&lt;br /&gt;
edit /etc/vnstat.conf and replace the interface name with the appropriate one.&lt;br /&gt;
&lt;br /&gt;
Start vnstatd&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/vnstatd start }}&lt;br /&gt;
&lt;br /&gt;
copy the following script to /etc/periodic/15min/stats and make sure your crond is running.&lt;br /&gt;
please not that heredoc should be tab indented or the script will fail. A working copy can be found here: http://tpaste.us/RrMv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env sh&lt;br /&gt;
&lt;br /&gt;
output=&amp;quot;/var/www/localhost/htdocs/.stats&amp;quot;&lt;br /&gt;
nic=&amp;quot;eth0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
generate_index() {&lt;br /&gt;
    cat &amp;lt;&amp;lt;-EOF&lt;br /&gt;
    &amp;lt;!doctype html&amp;gt;&lt;br /&gt;
    &amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;meta http-equiv=&amp;quot;cache-control&amp;quot; content=no-cache&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;3000&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;title&amp;gt;Alpine Linux mirror statistics&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;table border=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;summary.png&amp;quot; alt=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;hours.png&amp;quot; alt=&amp;quot;hours&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&amp;lt;td rowspan=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;days.png&amp;quot; alt=&amp;quot;days&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;top10.png&amp;quot; alt=&amp;quot;top10&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;months.png&amp;quot; alt=&amp;quot;months&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt;&lt;br /&gt;
    EOF&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if  [ ! -f &amp;quot;$output&amp;quot;/index.html ]; then&lt;br /&gt;
    mkdir -p $output&lt;br /&gt;
    generate_index &amp;gt; &amp;quot;$output&amp;quot;/index.html&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
for type in hours days months top10 summary hsummary vsummary; do&lt;br /&gt;
    vnstati --${type} -i $nic -o $output/${type}.png&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update mirror from mqtt ==&lt;br /&gt;
&lt;br /&gt;
If you want your mirror to be really uptodate compared to our master mirror you can subscribe to Alpine Linux message server &amp;quot;msg.alpinelinux.org&amp;quot; and check for upload messages.&lt;br /&gt;
Add mqtt-exec to be able to execute processes when specific topics are being send.&lt;br /&gt;
&lt;br /&gt;
{{Cmd| apk add mqtt-exec}}&lt;br /&gt;
&lt;br /&gt;
mqtt-exec supports running multiple time so we need to setup a specific config.&lt;br /&gt;
&lt;br /&gt;
{{Cmd| ln -s /etc/init.d/mqtt-exec /etc/init.d/mqtt-exec.sync-mirror}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd| ln -s /etc/conf.d/mqtt-exec /etc/conf.d/mqtt-exec.sync-mirror}}&lt;br /&gt;
&lt;br /&gt;
edit /etc/conf.d/mqtt-exec.sync-mirror&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mqtt_topics=&amp;quot;rsync/rsync.alpinelinux.org/#&amp;quot;&lt;br /&gt;
exec_user=&amp;quot;buildozer&amp;quot;&lt;br /&gt;
exec_command=&amp;quot;/usr/local/bin/sync-mirror&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following file to /usr/local/bin/sync-mirror and make it executable (dont forget to update the variables).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
src=&amp;quot;rsync://rsync.alpinelinux.org/alpine/&amp;quot;&lt;br /&gt;
dest=&amp;quot;/var/www/localhost/htdocs/alpine/&amp;quot;&lt;br /&gt;
lock=&amp;quot;/tmp/sync-mirror.lock&amp;quot;&lt;br /&gt;
topic=&amp;quot;$1&amp;quot;&lt;br /&gt;
dir=&amp;quot;$2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[ -z &amp;quot;$flock&amp;quot; ] &amp;amp;&amp;amp; exec env flock=1 flock $lock $0 &amp;quot;$@&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$dir&amp;quot; ] &amp;amp;&amp;amp; [ -d &amp;quot;$dest/${dir%/*}&amp;quot; ]; then&lt;br /&gt;
    logger &amp;quot;Syncing directory: $dir&amp;quot;&lt;br /&gt;
    src=&amp;quot;${src}${dir%/}/&amp;quot;&lt;br /&gt;
    dest=&amp;quot;${dest}${dir%/}/&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
    logger &amp;quot;Syncing all directories&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/bin/rsync \&lt;br /&gt;
    --archive \&lt;br /&gt;
    --update \&lt;br /&gt;
    --verbose \&lt;br /&gt;
    --progress \&lt;br /&gt;
    --timeout=600 \&lt;br /&gt;
    --delay-updates \&lt;br /&gt;
    --delete-after \&lt;br /&gt;
    &amp;quot;$src&amp;quot; \&lt;br /&gt;
    &amp;quot;$dest&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally start mqtt-exec and let it listen on msg.alpinelinux.org&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/mqtt-exec.sync-mirror start}}&lt;br /&gt;
&lt;br /&gt;
To make sure you are not missing any packages (in case something goes wrong with MQTT subscription) you can periodically sync all directories by adding the script to cron.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ln -s /usr/local/bin/sync-mirror /etc/periodic/hourly/sync-mirror}}&lt;br /&gt;
&lt;br /&gt;
Now watch your syslog as it should tell you when it will update directories in your local mirror.&lt;br /&gt;
&lt;br /&gt;
== Partial mirror using nginx ==&lt;br /&gt;
&lt;br /&gt;
For a private mirror it might make sense to sync only the newest versions of Alpine to save space, but if you &#039;&#039;do&#039;&#039; point an old Alpine version to your mirror they should still be able to install packages. We can achieve this by using nginx to serve the mirrored content and use regex location matching to redirect requests to a public mirror.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s assume you chose to only mirror Alpine versions up from v3.13. If a client asks your mirror for v.3.10 it should redirect to another mirror.&lt;br /&gt;
&lt;br /&gt;
Your nginx config server block should look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        listen 80;&lt;br /&gt;
        server_name alpine.mydomain.local;&lt;br /&gt;
        root /data/alpine;          # point to where your alpine mirror is located. make sure nginx is allowed to read it&lt;br /&gt;
        autoindex on;               # Enable indexing&lt;br /&gt;
&lt;br /&gt;
        # the following location block will match for v3.0 to v3.12&lt;br /&gt;
        # and will forward it to dl-4.alpinelinux.org.&lt;br /&gt;
        location ~* /(v3\.([1-9]|1[012]))$&lt;br /&gt;
        {&lt;br /&gt;
          return 302 http://dl-cdn.alpinelinux.org/alpine$request_uri;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding sync script could look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env sh&lt;br /&gt;
&lt;br /&gt;
# make sure we never run 2 rsync at the same time&lt;br /&gt;
lockfile=&amp;quot;/tmp/alpine-mirror.lock&amp;quot;&lt;br /&gt;
if [ -z &amp;quot;$flock&amp;quot; ] ; then&lt;br /&gt;
  exec env flock=1 flock -n $lockfile &amp;quot;$0&amp;quot; &amp;quot;$@&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  src=rsync://rsync.alpinelinux.org/alpine/&lt;br /&gt;
  dest=/data/alpine/&lt;br /&gt;
&lt;br /&gt;
  exclude=&amp;quot;--exclude v2.* --exclude v3.0 --exclude v3.1 --exclude v3.2 --exclude v3.3 --exclude v3.4 --exclude v3.5 --exclude v3.6 --exclude v3.7 --exclude v3.8 --exclude v3.9 --exclude v3.10 --exclude v3.11 --exclude v3.12&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  mkdir -p &amp;quot;$dest&amp;quot;&lt;br /&gt;
  /usr/bin/rsync -vvv \&lt;br /&gt;
  --archive \&lt;br /&gt;
  --update \&lt;br /&gt;
  --hard-links \&lt;br /&gt;
  --delete \&lt;br /&gt;
  --delete-after \&lt;br /&gt;
  --delete-excluded \&lt;br /&gt;
  --delay-updates \&lt;br /&gt;
  --timeout=600 \&lt;br /&gt;
  $exclude \&lt;br /&gt;
  &amp;quot;$src&amp;quot; &amp;quot;$dest&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How_to_setup_a_Alpine_Linux_mirror&amp;diff=22089</id>
		<title>How to setup a Alpine Linux mirror</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How_to_setup_a_Alpine_Linux_mirror&amp;diff=22089"/>
		<updated>2022-07-13T21:40:32Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: update edge repo size&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This document describes how to set up an Alpine Linux mirror and make it available via http and rsync.&lt;br /&gt;
&lt;br /&gt;
We will:&lt;br /&gt;
* create the dir where we have the mirror&lt;br /&gt;
* set up a cron job to sync with master mirror every hour&lt;br /&gt;
* set up lighttpd for http access&lt;br /&gt;
* set up rsync so other mirrors can rsync from you&lt;br /&gt;
&lt;br /&gt;
Make sure that you have enough disk space.&lt;br /&gt;
&lt;br /&gt;
Current (2021-06-10) disk usage in GB:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!edge&lt;br /&gt;
!v3.0&lt;br /&gt;
!v3.1&lt;br /&gt;
!v3.2&lt;br /&gt;
!v3.3&lt;br /&gt;
!v3.4&lt;br /&gt;
!v3.5&lt;br /&gt;
!v3.6&lt;br /&gt;
!v3.7&lt;br /&gt;
!v3.8&lt;br /&gt;
!v3.9&lt;br /&gt;
!v3.10&lt;br /&gt;
!v3.11&lt;br /&gt;
!v3.12&lt;br /&gt;
!v3.13&lt;br /&gt;
!v3.14&lt;br /&gt;
!v3.15&lt;br /&gt;
!v3.16&lt;br /&gt;
&lt;br /&gt;
!total&lt;br /&gt;
|-&lt;br /&gt;
|324.7&lt;br /&gt;
|16.5&lt;br /&gt;
|17.5&lt;br /&gt;
|14.5&lt;br /&gt;
|19.3&lt;br /&gt;
|23.0&lt;br /&gt;
|26.9&lt;br /&gt;
|44.4&lt;br /&gt;
|42.7&lt;br /&gt;
|58.4&lt;br /&gt;
|72.2&lt;br /&gt;
|110.5&lt;br /&gt;
|139.7&lt;br /&gt;
|151.9&lt;br /&gt;
|152.4&lt;br /&gt;
|167.2&lt;br /&gt;
|179.0&lt;br /&gt;
|197.3&lt;br /&gt;
&lt;br /&gt;
|&#039;&#039;&#039;1726&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Script used to calculate the size:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
&lt;br /&gt;
total=0&lt;br /&gt;
dest=&amp;quot;$(mktemp -d)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
for dir in edge v3.0 v3.1 v3.2 v3.3 v3.4 v3.5 v3.6 v3.7 v3.8 v3.9 v3.10 v3.11 v3.12 v3.13 v3.14 v3.15 v3.16; do&lt;br /&gt;
    old_total=&amp;quot;$total&amp;quot;&lt;br /&gt;
    src=&amp;quot;rsync://rsync.alpinelinux.org/alpine/$dir/&amp;quot;&lt;br /&gt;
    size=`rsync -a -n --stats &amp;quot;$src&amp;quot; &amp;quot;$dest&amp;quot; | grep &#039;^Total file size&#039; | tr -d &#039;,&#039; | awk &#039;{ print $4 }&#039;`&lt;br /&gt;
    total=$((&amp;quot;$old_total&amp;quot; + &amp;quot;$size&amp;quot;))&lt;br /&gt;
    echo &amp;quot;$dir: $size&amp;quot; | awk &#039;{ print $1 sprintf(&amp;quot;%.1f&amp;quot;, $2/1073741824) }&#039;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;total: $total&amp;quot; | awk &#039;{ print $1 sprintf(&amp;quot;%.1f&amp;quot;, $2/1073741824) }&#039;&lt;br /&gt;
rm -r &amp;quot;$dest&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setting up the cron job ==&lt;br /&gt;
Install rsync which will be used to sync from the master mirror.&lt;br /&gt;
{{Cmd|apk add rsync}}&lt;br /&gt;
&lt;br /&gt;
Save the following file as &#039;&#039;/etc/periodic/hourly/alpine-mirror&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env sh&lt;br /&gt;
&lt;br /&gt;
# make sure we never run 2 rsync at the same time&lt;br /&gt;
lockfile=&amp;quot;/tmp/alpine-mirror.lock&amp;quot;&lt;br /&gt;
if [ -z &amp;quot;$flock&amp;quot; ] ; then&lt;br /&gt;
  exec env flock=1 flock -n $lockfile &amp;quot;$0&amp;quot; &amp;quot;$@&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
src=rsync://rsync.alpinelinux.org/alpine/ &lt;br /&gt;
dest=/var/www/localhost/htdocs/alpine/&lt;br /&gt;
&lt;br /&gt;
# uncomment this to exclude old v2.x branches&lt;br /&gt;
#exclude=&amp;quot;--exclude v2.*&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -p &amp;quot;$dest&amp;quot;&lt;br /&gt;
/usr/bin/rsync \&lt;br /&gt;
        --archive \&lt;br /&gt;
        --update \&lt;br /&gt;
        --hard-links \&lt;br /&gt;
        --delete \&lt;br /&gt;
        --delete-after \&lt;br /&gt;
        --delay-updates \&lt;br /&gt;
        --timeout=600 \&lt;br /&gt;
        $exclude \&lt;br /&gt;
        &amp;quot;$src&amp;quot; &amp;quot;$dest&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(or use [https://gist.github.com/jirutka/288c6fff7c0b8a835d143686207316be this script])&lt;br /&gt;
&lt;br /&gt;
Make it executable:&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;chmod +x /etc/periodic/hourly/alpine-mirror&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Now it will sync every hour. (given cron runs)&lt;br /&gt;
&lt;br /&gt;
== Setting up HTTP access via lighttpd ==&lt;br /&gt;
&lt;br /&gt;
Install the lighttpd server&lt;br /&gt;
{{Cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Enable dir listings by uncommenting the following line in &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039;:&lt;br /&gt;
 dir-listing.activate      = &amp;quot;enable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Also set cache-control to force cache revalidate every 30 mins. Uncomment mod_setenv in &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039;:&lt;br /&gt;
 &amp;quot;mod_setenv&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
Add also the following lines to &#039;&#039;/etc/lighttpd/lighttpd.conf&#039;&#039;:&lt;br /&gt;
 setenv.add-response-header += (           &lt;br /&gt;
         &amp;quot;Cache-Control&amp;quot; =&amp;gt; &amp;quot;must-revalidate&amp;quot;&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
Start lighttpd and make it start at boot:&lt;br /&gt;
{{Cmd|rc-service lighttpd start&lt;br /&gt;
rc-update add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You may wish to consider [[Darkhttpd]] as an alternative to [[Lighttpd]]&lt;br /&gt;
&lt;br /&gt;
If so, simply install, start and auto-start the webserver:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add darkhttpd &amp;amp;&amp;amp; rc-service darkhttpd start &amp;amp;&amp;amp; rc-update add darkhttpd}}&lt;br /&gt;
&lt;br /&gt;
Darkhttpd will, by default, offer directory listings and serve data from /var/www/localhost/htdocs/ &lt;br /&gt;
&lt;br /&gt;
See the main article on [[Darkhttpd]] for more configuration options}}&lt;br /&gt;
&lt;br /&gt;
== Setting up rsyncd ==&lt;br /&gt;
Add the following lines to &#039;&#039;/etc/rsyncd.conf&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[alpine]&lt;br /&gt;
        path = /var/www/localhost/htdocs/alpine&lt;br /&gt;
        comment = My Alpine Linux Mirror&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optionally set a bandwidth limit in &#039;&#039;/etc/conf.d/rsyncd&#039;&#039;. In this example we limit to 500Kbytes/s (approx 5Mbit/s)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSYNC_OPTS=&amp;quot;--bwlimit=500&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mirror statistics ==&lt;br /&gt;
&lt;br /&gt;
Simple bandwidth statistics can be generated with vnstat.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add vnstat}}&lt;br /&gt;
&lt;br /&gt;
edit /etc/vnstat.conf and replace the interface name with the appropriate one.&lt;br /&gt;
&lt;br /&gt;
Start vnstatd&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/vnstatd start }}&lt;br /&gt;
&lt;br /&gt;
copy the following script to /etc/periodic/15min/stats and make sure your crond is running.&lt;br /&gt;
please not that heredoc should be tab indented or the script will fail. A working copy can be found here: http://tpaste.us/RrMv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env sh&lt;br /&gt;
&lt;br /&gt;
output=&amp;quot;/var/www/localhost/htdocs/.stats&amp;quot;&lt;br /&gt;
nic=&amp;quot;eth0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
generate_index() {&lt;br /&gt;
    cat &amp;lt;&amp;lt;-EOF&lt;br /&gt;
    &amp;lt;!doctype html&amp;gt;&lt;br /&gt;
    &amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;meta http-equiv=&amp;quot;cache-control&amp;quot; content=no-cache&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;3000&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;title&amp;gt;Alpine Linux mirror statistics&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;table border=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;summary.png&amp;quot; alt=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;hours.png&amp;quot; alt=&amp;quot;hours&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&amp;lt;td rowspan=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;days.png&amp;quot; alt=&amp;quot;days&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;top10.png&amp;quot; alt=&amp;quot;top10&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;months.png&amp;quot; alt=&amp;quot;months&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt;&lt;br /&gt;
    EOF&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if  [ ! -f &amp;quot;$output&amp;quot;/index.html ]; then&lt;br /&gt;
    mkdir -p $output&lt;br /&gt;
    generate_index &amp;gt; &amp;quot;$output&amp;quot;/index.html&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
for type in hours days months top10 summary hsummary vsummary; do&lt;br /&gt;
    vnstati --${type} -i $nic -o $output/${type}.png&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update mirror from mqtt ==&lt;br /&gt;
&lt;br /&gt;
If you want your mirror to be really uptodate compared to our master mirror you can subscribe to Alpine Linux message server &amp;quot;msg.alpinelinux.org&amp;quot; and check for upload messages.&lt;br /&gt;
Add mqtt-exec to be able to execute processes when specific topics are being send.&lt;br /&gt;
&lt;br /&gt;
{{Cmd| apk add mqtt-exec}}&lt;br /&gt;
&lt;br /&gt;
mqtt-exec supports running multiple time so we need to setup a specific config.&lt;br /&gt;
&lt;br /&gt;
{{Cmd| ln -s /etc/init.d/mqtt-exec /etc/init.d/mqtt-exec.sync-mirror}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd| ln -s /etc/conf.d/mqtt-exec /etc/conf.d/mqtt-exec.sync-mirror}}&lt;br /&gt;
&lt;br /&gt;
edit /etc/conf.d/mqtt-exec.sync-mirror&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mqtt_topics=&amp;quot;rsync/rsync.alpinelinux.org/#&amp;quot;&lt;br /&gt;
exec_user=&amp;quot;buildozer&amp;quot;&lt;br /&gt;
exec_command=&amp;quot;/usr/local/bin/sync-mirror&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following file to /usr/local/bin/sync-mirror and make it executable (dont forget to update the variables).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
src=&amp;quot;rsync://rsync.alpinelinux.org/alpine/&amp;quot;&lt;br /&gt;
dest=&amp;quot;/var/www/localhost/htdocs/alpine/&amp;quot;&lt;br /&gt;
lock=&amp;quot;/tmp/sync-mirror.lock&amp;quot;&lt;br /&gt;
topic=&amp;quot;$1&amp;quot;&lt;br /&gt;
dir=&amp;quot;$2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[ -z &amp;quot;$flock&amp;quot; ] &amp;amp;&amp;amp; exec env flock=1 flock $lock $0 &amp;quot;$@&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$dir&amp;quot; ] &amp;amp;&amp;amp; [ -d &amp;quot;$dest/${dir%/*}&amp;quot; ]; then&lt;br /&gt;
    logger &amp;quot;Syncing directory: $dir&amp;quot;&lt;br /&gt;
    src=&amp;quot;${src}${dir%/}/&amp;quot;&lt;br /&gt;
    dest=&amp;quot;${dest}${dir%/}/&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
    logger &amp;quot;Syncing all directories&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/bin/rsync \&lt;br /&gt;
    --archive \&lt;br /&gt;
    --update \&lt;br /&gt;
    --verbose \&lt;br /&gt;
    --progress \&lt;br /&gt;
    --timeout=600 \&lt;br /&gt;
    --delay-updates \&lt;br /&gt;
    --delete-after \&lt;br /&gt;
    &amp;quot;$src&amp;quot; \&lt;br /&gt;
    &amp;quot;$dest&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally start mqtt-exec and let it listen on msg.alpinelinux.org&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/mqtt-exec.sync-mirror start}}&lt;br /&gt;
&lt;br /&gt;
To make sure you are not missing any packages (in case something goes wrong with MQTT subscription) you can periodically sync all directories by adding the script to cron.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ln -s /usr/local/bin/sync-mirror /etc/periodic/hourly/sync-mirror}}&lt;br /&gt;
&lt;br /&gt;
Now watch your syslog as it should tell you when it will update directories in your local mirror.&lt;br /&gt;
&lt;br /&gt;
== Partial mirror using nginx ==&lt;br /&gt;
&lt;br /&gt;
For a private mirror it might make sense to sync only the newest versions of Alpine to save space, but if you &#039;&#039;do&#039;&#039; point an old Alpine version to your mirror they should still be able to install packages. We can achieve this by using nginx to serve the mirrored content and use regex location matching to redirect requests to a public mirror.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s assume you chose to only mirror Alpine versions up from v3.13. If a client asks your mirror for v.3.10 it should redirect to another mirror.&lt;br /&gt;
&lt;br /&gt;
Your nginx config server block should look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        listen 80;&lt;br /&gt;
        server_name alpine.mydomain.local;&lt;br /&gt;
        root /data/alpine;          # point to where your alpine mirror is located. make sure nginx is allowed to read it&lt;br /&gt;
        autoindex on;               # Enable indexing&lt;br /&gt;
&lt;br /&gt;
        # the following location block will match for v3.0 to v3.12&lt;br /&gt;
        # and will forward it to dl-4.alpinelinux.org.&lt;br /&gt;
        location ~* /(v3\.([1-9]|1[012]))$&lt;br /&gt;
        {&lt;br /&gt;
          return 302 http://dl-cdn.alpinelinux.org/alpine$request_uri;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding sync script could look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env sh&lt;br /&gt;
&lt;br /&gt;
# make sure we never run 2 rsync at the same time&lt;br /&gt;
lockfile=&amp;quot;/tmp/alpine-mirror.lock&amp;quot;&lt;br /&gt;
if [ -z &amp;quot;$flock&amp;quot; ] ; then&lt;br /&gt;
  exec env flock=1 flock -n $lockfile &amp;quot;$0&amp;quot; &amp;quot;$@&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  src=rsync://rsync.alpinelinux.org/alpine/&lt;br /&gt;
  dest=/data/alpine/&lt;br /&gt;
&lt;br /&gt;
  exclude=&amp;quot;--exclude v2.* --exclude v3.0 --exclude v3.1 --exclude v3.2 --exclude v3.3 --exclude v3.4 --exclude v3.5 --exclude v3.6 --exclude v3.7 --exclude v3.8 --exclude v3.9 --exclude v3.10 --exclude v3.11 --exclude v3.12&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  mkdir -p &amp;quot;$dest&amp;quot;&lt;br /&gt;
  /usr/bin/rsync -vvv \&lt;br /&gt;
  --archive \&lt;br /&gt;
  --update \&lt;br /&gt;
  --hard-links \&lt;br /&gt;
  --delete \&lt;br /&gt;
  --delete-after \&lt;br /&gt;
  --delete-excluded \&lt;br /&gt;
  --delay-updates \&lt;br /&gt;
  --timeout=600 \&lt;br /&gt;
  $exclude \&lt;br /&gt;
  &amp;quot;$src&amp;quot; &amp;quot;$dest&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_Reference&amp;diff=21643</id>
		<title>APKBUILD Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_Reference&amp;diff=21643"/>
		<updated>2022-03-19T09:01:07Z</updated>

		<summary type="html">&lt;p&gt;Ptrcnull: change example pkgname prefix from py- to py3-&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;APKBUILDs are the scripts that are created in order to build Alpine packages using the [[abuild]] tool.&lt;br /&gt;
&lt;br /&gt;
See [[aports]] for details on Alpine&#039;s official ports repository.&lt;br /&gt;
&lt;br /&gt;
This page is intended to serve as a reference for creating APKBUILDs; if this is your first time creating a package for Alpine Linux, please see [[Creating an Alpine package]].&lt;br /&gt;
&lt;br /&gt;
= Legend =&lt;br /&gt;
The following notes will assist you in understanding this document.&lt;br /&gt;
&lt;br /&gt;
In description text:&lt;br /&gt;
* If a variable is not prefixed with a &#039;&#039;$&#039;&#039;, it will be represented by italics (i.e., &#039;&#039;srcdir&#039;&#039; ).&lt;br /&gt;
* Functions will also be represented by italics, but will also end with a pair of parentheses (i.e., &#039;&#039;build()&#039;&#039; ).&lt;br /&gt;
* Shell commands will be represented &amp;lt;code&amp;gt;like this&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variables =&lt;br /&gt;
{{Note|Variables that contain a path (e.g. &#039;&#039;$srcdir&#039;&#039; and &#039;&#039;$pkgdir&#039;&#039;) should always be quoted using double quotes (i.e., &#039;&#039;&amp;quot;$srcdir&amp;quot;&#039;&#039;).  This is done to prevent things from breaking, should the user have the APKBUILD in a directory path that contains spaces.}}&lt;br /&gt;
{{Note|All arbitrary variable and function names should be prefixed with an underscore character ( _ ) to avoid name clashes with the internals of abuild (for example, &#039;&#039;_luaversions&#039;&#039;).}}&lt;br /&gt;
&lt;br /&gt;
== abuild-defined variables ==&lt;br /&gt;
The following variables are defined by abuild:&lt;br /&gt;
&lt;br /&gt;
==== startdir ====&lt;br /&gt;
: The directory where the APKBUILD script is.&lt;br /&gt;
==== srcdir ====&lt;br /&gt;
: The directory where sources, from the &#039;&#039;source&#039;&#039; variable, are downloaded to and unpacked to.&lt;br /&gt;
==== pkgdir ====&lt;br /&gt;
: This directory should receive the files for the main package.  For example, a normal [http://en.wikipedia.org/wiki/GNU_build_system autotools] package would have &amp;lt;code&amp;gt;make DESTDIR=&amp;quot;$pkgdir&amp;quot; install&amp;lt;/code&amp;gt; in the &#039;&#039;package()&#039;&#039; function.&lt;br /&gt;
==== subpkgdir ====&lt;br /&gt;
: This directory should receive the files for a subpackage. This variable should only be used from subpackage functions.&lt;br /&gt;
==== builddir ====&lt;br /&gt;
: This variable should point to the directory inside the &#039;&#039;srcdir&#039;&#039; where the main package source is unpacked.  This is typically &#039;&#039;$srcdir/$pkgname-$pkgver&#039;&#039;.  It’s used by the default &#039;&#039;prepare()&#039;&#039; function as a working directory when applying patches.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User-defined variables ==&lt;br /&gt;
The following variables should be defined by the user:&lt;br /&gt;
==== arch ====&lt;br /&gt;
: Package architecture(s) to build for.  Can be one or several seperated by whitespace of: &#039;&#039;&#039;[[x86]], [[x86_64]], [[armv7]], [[armhf]], [[aarch64]], [[ppc64le]], [[s390x]], [[riscv64]], all&#039;&#039;&#039;, or &#039;&#039;&#039;noarch&#039;&#039;&#039;, where &#039;&#039;&#039;all&#039;&#039;&#039; means all architectures, and &#039;&#039;&#039;noarch&#039;&#039;&#039; means it&#039;s architecture-independent (e.g., a pure-python package). Architectures can be negated using the ! character to exclude them from the list of supported architectures. E.g. &#039;&#039;&#039;arch=&amp;quot;all !ppc64le&amp;quot;&#039;&#039;&#039; means that the package is allowed to be built on all architectures but the ppc64le architecture.&lt;br /&gt;
: {{Tip|To determine if your APKBUILD can use &#039;&#039;&#039;noarch&#039;&#039;&#039;: First specify &#039;&#039;&#039;all&#039;&#039;&#039; and then build the package by executing &amp;lt;code&amp;gt;abuild -r&amp;lt;/code&amp;gt;.  Watch the output towards the end for warnings saying that &#039;&#039;&#039;noarch&#039;&#039;&#039; can be used.  If the main package and all subpackages, if you have any subpackages, give a warning saying that &#039;&#039;&#039;noarch&#039;&#039;&#039; can be used, then you can use &#039;&#039;&#039;noarch&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
==== depends ====&lt;br /&gt;
: Run-time dependency package(s) that are not shared-object dependencies.  Shared objects dependencies are auto-detected and should not be specified here. To specify a conflicting package, add the package name prefixed with a &#039;!&#039;.&lt;br /&gt;
&lt;br /&gt;
==== depends_dev ====&lt;br /&gt;
: Run-time dependency package(s) for the &#039;&#039;&#039;$pkgname-dev&#039;&#039;&#039; subpackage.&lt;br /&gt;
&lt;br /&gt;
: {{Note|From ncopa on IRC: To find out if you need to add a package to depends_dev have a look at *requires* in usr/lib/pkgconfig/*.pc. With libtool it gets more complicated, but we should delete the .la files. Also check if there are any  /usr/bin/*-configure #!/bin/bash #!/usr/bin/perl or Python. Sometimes scripts or similar are generated at build time (i.e autoconf automake) then you normally don&#039;t need add those to depends_dev. You can also just add all -dev makedepends to depends_dev but it will slow the build process a little bit (more build dependencies).}}&lt;br /&gt;
&lt;br /&gt;
==== depends_doc ====&lt;br /&gt;
: Run-time dependency package(s) for the &#039;&#039;&#039;$pkgname-doc&#039;&#039;&#039; subpackage.&lt;br /&gt;
&lt;br /&gt;
==== depends_openrc ====&lt;br /&gt;
: Run-time dependency package(s) for the &#039;&#039;&#039;$pkgname-openrc&#039;&#039;&#039; subpackage.&lt;br /&gt;
&lt;br /&gt;
==== depends_libs ====&lt;br /&gt;
: Run-time dependency package(s) for the &#039;&#039;&#039;$pkgname-libs&#039;&#039;&#039; subpackage.&lt;br /&gt;
&lt;br /&gt;
==== depends_static ====&lt;br /&gt;
: Run-time dependency package(s) for the &#039;&#039;&#039;$pkgname-static&#039;&#039;&#039; subpackage.&lt;br /&gt;
&lt;br /&gt;
==== checkdepends ====&lt;br /&gt;
: Dependencies that are only required during the check phase, they are only installed if the check option is enabled&lt;br /&gt;
&lt;br /&gt;
==== giturl ====&lt;br /&gt;
:Git repository from which &amp;lt;code&amp;gt;abuild checkout&amp;lt;/code&amp;gt; checks out. You can checkout a specific branch in git by adding &amp;lt;code&amp;gt;-b $branch&amp;lt;/code&amp;gt;.&lt;br /&gt;
==== install ====&lt;br /&gt;
: There are 6 different types of install scripts.  Install scripts are named &#039;&#039;&#039;$pkgname.action&#039;&#039;&#039;, where &#039;&#039;&#039;action&#039;&#039;&#039; can be:  &#039;&#039;&#039;pre-install, post-install, pre-upgrade, post-upgrade, pre-deinstall&#039;&#039;&#039;, or &#039;&#039;&#039;post-deinstall&#039;&#039;&#039;.  For example, if &#039;&#039;pkgname&#039;&#039; is set to &#039;&#039;&#039;mypackage&#039;&#039;&#039; and &#039;&#039;install&#039;&#039; is set to &#039;&#039;&#039;$pkgname.post-install&#039;&#039;&#039;, then a script named &#039;&#039;&#039;mypackage.post-install&#039;&#039;&#039; must exist along-side the APKBUILD.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;{{Note|Always use &amp;lt;code&amp;gt;/bin/sh&amp;lt;/code&amp;gt; for the command-line interpreter on the [http://en.wikipedia.org/wiki/Shebang_%28Unix%29 shebang line] of your install scripts.}}&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following are the different types of install scripts in detail:&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.pre-install =====&lt;br /&gt;
: This script is executed &#039;&#039;before installing&#039;&#039; the package.  Typical use is when the package needs a group and a user to be created. For example:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
addgroup -S clamav 2&amp;gt;/dev/null&lt;br /&gt;
adduser -S -D -H -s /sbin/nologin -G clamav -g clamav clamav 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|If the script exits with a failure (e.g., if the user already exists), the package will not be installed and &amp;lt;code&amp;gt;apk&amp;lt;/code&amp;gt; will exit with failure, hence the &amp;lt;code&amp;gt;exit 0&amp;lt;/code&amp;gt; at the end.}}&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.post-install =====&lt;br /&gt;
: This script is executed &#039;&#039;after installing&#039;&#039; the package.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.pre-upgrade =====&lt;br /&gt;
: This script is executed &#039;&#039;before upgrading/downgrading/reinstalling&#039;&#039; the package. Note that exiting with failure will not cause apk to exit with failure, but will mark the package as broken.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.post-upgrade =====&lt;br /&gt;
: This script is executed &#039;&#039;after upgrading/downgrading/reinstalling&#039;&#039; the package.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.pre-deinstall =====&lt;br /&gt;
: This script is executed &#039;&#039;before uninstalling&#039;&#039; the package.&lt;br /&gt;
: {{Note|If the script exits with failure, &amp;lt;code&amp;gt;apk&amp;lt;/code&amp;gt; will not uninstall the package.}}&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.post-deinstall =====&lt;br /&gt;
: This script is executed &#039;&#039;after uninstalling&#039;&#039; the package.&lt;br /&gt;
&lt;br /&gt;
==== install_if ====&lt;br /&gt;
:install_if can be used when a package needs to be installed when some packages are already installed or are in the dependency tree. It works in reverse to the &#039;&#039;recommends&#039;&#039; feature, that other package managers provide.&lt;br /&gt;
&lt;br /&gt;
: Typically this is used in a subpackage that should provide files which make sense with another package. For example:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
subpackages=&amp;quot;$pkgname-bash-completion:bashcomp:noarch&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
bashcomp() {&lt;br /&gt;
	pkgdesc=&amp;quot;Bash completions for $pkgname&amp;quot;&lt;br /&gt;
	install_if=&amp;quot;$pkgname=$pkgver-r$pkgrel bash-completion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	install -Dm644 &amp;quot;$builddir&amp;quot;/doc/bash_completion/aria2c \&lt;br /&gt;
		&amp;quot;$subpkgdir&amp;quot;/usr/share/bash-completion/completions/_aria2c&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
From the aria2c APKBUILD. Note that the custom bashcomp() function is only necessary, because the files are not in /usr/share/bash-completion.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:In general, install_if should only be used with &#039;&#039;&#039;at least one versioned constraint&#039;&#039;&#039;. Otherwise, a package that was implicitly installed by install_if and then removed from the binary repositories, will not get purged with &amp;lt;code&amp;gt;apk upgrade&amp;lt;/code&amp;gt;. [https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10720#note_121298]&lt;br /&gt;
&lt;br /&gt;
==== license ====&lt;br /&gt;
: License(s) for the package, for example &amp;lt;code&amp;gt;GPL-3.0-or-later&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BSD-2-Clause&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;MIT&amp;lt;/code&amp;gt; [[Creating_an_Alpine_package#license|(details)]].&lt;br /&gt;
&lt;br /&gt;
==== makedepends ====&lt;br /&gt;
: Build-time dependency package(s).&lt;br /&gt;
==== md5sums/sha256sums/sha512sums ====&lt;br /&gt;
: Checksums for the files/URLs listed in &#039;&#039;source&#039;&#039;.  The checksums are normally generated and updated by executing &amp;lt;code&amp;gt;abuild checksum&amp;lt;/code&amp;gt; and should be the last item in the APKBUILD.&lt;br /&gt;
&lt;br /&gt;
New packages should use only sha512sums.&lt;br /&gt;
&lt;br /&gt;
==== options ====&lt;br /&gt;
: Build-time options for the package.&lt;br /&gt;
&lt;br /&gt;
: {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!archcheck&amp;lt;/code&amp;gt;&lt;br /&gt;
| Do not try to verify that the architecture of the binary files is the same architecture as abuild should build for. One example where it makes sense to set this are packages with firmware files, that get executed on another CPU (such as WiFi firmware).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!check&amp;lt;/code&amp;gt;&lt;br /&gt;
| Do not try to run the &amp;lt;code&amp;gt;check()&amp;lt;/code&amp;gt; function. Please always add a short comment after the &amp;lt;code&amp;gt;!check&amp;lt;/code&amp;gt; about why it&#039;s disabled. [https://github.com/alpinelinux/aports/pull/2322#discussion_r142545300] Creating a very simple check function, that calls &amp;lt;code&amp;gt;program --version&amp;lt;/code&amp;gt; is worse than disabling tests completely because it gives the false impression that the package is thoroughly tested with the testsuite from upstream. [https://github.com/alpinelinux/aports/pull/7326#discussion_r278797457]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;checkroot&amp;lt;/code&amp;gt;&lt;br /&gt;
| Specifies that the package&#039;s test suite will be run in &#039;&#039;fakeroot&#039;&#039;. This is necessary for some test suites which fail when run as non-root.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;net&amp;lt;/code&amp;gt;&lt;br /&gt;
| Allows network access when run in &#039;&#039;rootbld&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!strip&amp;lt;/code&amp;gt;&lt;br /&gt;
| Avoid stripping symbols from binaries.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;suid&amp;lt;/code&amp;gt;&lt;br /&gt;
| Allow [https://en.wikipedia.org/wiki/Setuid setuid] binaries.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!tracedeps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Do not automatically find dependencies (e.g. by using &amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; to find dynamic libraries, which the resulting binary links against).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;chmod-clean&amp;lt;/code&amp;gt;&lt;br /&gt;
| Make all files writable in the src/ directory. Useful for packages that make files read-only in the process of building packages (go modules).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;toolchain&amp;lt;/code&amp;gt;&lt;br /&gt;
| Don&#039;t warn when g++ is in makedepends&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!dbg&amp;lt;/code&amp;gt;&lt;br /&gt;
| Don&#039;t create debugging subpackage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ldpath-recursive&amp;lt;/code&amp;gt;&lt;br /&gt;
| Scan directories recursively when creating .so providers&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!spdx&amp;lt;/code&amp;gt;&lt;br /&gt;
| Do not check if the license= field has a SPDX compliant license&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;textrels&amp;lt;/code&amp;gt;&lt;br /&gt;
| Don&#039;t error out when text relocations are found&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;charset.alias&amp;lt;/code&amp;gt;&lt;br /&gt;
| Don&#039;t error out if /usr/lib/charset.alias is found&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;libtool&amp;lt;/code&amp;gt;&lt;br /&gt;
| Don&#039;t delete libtool .la files&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;!fhs&amp;lt;/code&amp;gt;&lt;br /&gt;
| Don&#039;t enforce checks on path that follow the FHS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== pkgdesc ====&lt;br /&gt;
: A brief, one-line description of what the package does.&lt;br /&gt;
&lt;br /&gt;
: Here&#039;s an example from the OpenSSH client package:&lt;br /&gt;
: &amp;lt;pre&amp;gt;pkgdesc=&amp;quot;Port of OpenBSD&#039;s free SSH release - client&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== pkggroups ====&lt;br /&gt;
: System group(s) to be created during build-time.  System group(s) should also be created in the &#039;&#039;&#039;[[APKBUILD Reference#.24pkgname.pre-install|$pkgname.pre-install]]&#039;&#039;&#039; script, so that the system group(s) are also created prior to package installation for run-time use.&lt;br /&gt;
==== pkgname ====&lt;br /&gt;
: The name of the package.  All letters should be lowercase.&lt;br /&gt;
: {{Note|When creating an APKBUILD of a module or library for another package, we use some common package prefixes, such as: &#039;&#039;lua-&#039;&#039;, &#039;&#039;perl-&#039;&#039;, &#039;&#039;php-&#039;&#039;, and &#039;&#039;py3-&#039;&#039;.  Search aports for other common prefixes.}}&lt;br /&gt;
&lt;br /&gt;
==== pkgrel ====&lt;br /&gt;
: Alpine package release number.  Starts at 0 (zero).  Always increment &#039;&#039;pkgrel&#039;&#039; when making updates to an aport; reset &#039;&#039;pkgrel&#039;&#039; to 0 (zero) when incrementing &#039;&#039;pkgver&#039;&#039;.&lt;br /&gt;
==== pkgusers ====&lt;br /&gt;
: System user(s) to be created during build-time.  System user(s) should also be created in the &#039;&#039;&#039;[[APKBUILD Reference#.24pkgname.pre-install|$pkgname.pre-install]]&#039;&#039;&#039; script, so that the system user(s) are also created prior to package installation for run-time use.&lt;br /&gt;
==== pkgver ====&lt;br /&gt;
: The version of the software being packaged. Format for valid versions: &amp;lt;code&amp;gt;{digit}{.digit}...{letter}{_suf{#}}...{-r#}&amp;lt;/code&amp;gt; [https://git.alpinelinux.org/cgit/apk-tools/tree/src/version.c#n17]&lt;br /&gt;
: A Suffix &amp;lt;code&amp;gt;suf&amp;lt;/code&amp;gt; in the above format can be one of the following to indicate that the release is &#039;&#039;less recent&#039;&#039; than the version without the suffix: &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;beta&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pre&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rc&amp;lt;/code&amp;gt; [https://git.alpinelinux.org/cgit/apk-tools/tree/src/version.c#n75]&lt;br /&gt;
: These are for indicating &#039;&#039;more recent&#039;&#039; releases: &amp;lt;code&amp;gt;cvs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;svn&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;git&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt; [https://git.alpinelinux.org/cgit/apk-tools/tree/src/version.c#n76]&lt;br /&gt;
: All other suffices are invalid. To package a specific git commit, the date of the commit gets appended to the latest release, e.g. &amp;lt;code&amp;gt;1.0.0_git20180204&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== provides ====&lt;br /&gt;
: List of package names (and optionally version info) this package provides.&lt;br /&gt;
&lt;br /&gt;
: If package with a version is provided (provides=&#039;foo=1.2&#039;) apk will consider it as an alternate name and it will automatically consider the package for installation by the alternate name, and conflict with other packages having the same name, or provides.&lt;br /&gt;
&lt;br /&gt;
: If version is not provided (provides=&#039;foo&#039;), apk will consider it as virtual package name. Several package with same non-versioned provides can be installed simultaneously. However, none of them will be installed by default when requested by the virtual name - instead, error message is given and user is asked to choose which package providing the virtual name should be installed.&lt;br /&gt;
==== provider_priority ====&lt;br /&gt;
: A numeric value which is used by apk-tools to break ties when choosing a virtual package to satisfy a dependency. Higher values have higher priority. The primary use case is to specify the primary package that satisfies a virtual (provider).&lt;br /&gt;
==== replaces ====&lt;br /&gt;
: Allow this package to be installed at the same time as the listed packages, even if they have conflicting files. The files from this package will override (&amp;quot;take over&amp;quot;) the conflicting files.&lt;br /&gt;
&lt;br /&gt;
: This can be used to override config files with &amp;quot;policy packages&amp;quot; [https://gitlab.alpinelinux.org/alpine/apk-tools/-/commit/89d003f8c2e5a92655ee778f7bfa5c0e85ddbed4].&lt;br /&gt;
&lt;br /&gt;
: Another use case is renaming packages (or moving files from one package to another): &amp;quot;replaces&amp;quot; will avoid the file conflict error that apk reports if it happens to install the new package before uninstalling the old package [https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10724#note_132872].&lt;br /&gt;
&lt;br /&gt;
: A common misconception is that &amp;quot;replaces&amp;quot; is used to replace packages (like in [https://wiki.archlinux.org/index.php/PKGBUILD#replaces PKGBUILD]). This is not the case, it is only for solving file conflicts. To let apk consider installing one package instead of another one, refer to [[#provides|provides]] (with the version).&lt;br /&gt;
&lt;br /&gt;
==== replaces_priority ====&lt;br /&gt;
: The priority of the replaces. If multiple packages replace files of each other, then the package with the highest &#039;&#039;replaces_priority&#039;&#039; will win.&lt;br /&gt;
&lt;br /&gt;
==== source ====&lt;br /&gt;
: The source variable is not only used to list the remote source files to fetch, it is also used to list the local files that abuild will need in order to build the apk. Examples of such local files include: init.d files, conf.d files, install files (see [[APKBUILD Reference#install|install variable]]), patches, and all other necessary files.&lt;br /&gt;
&lt;br /&gt;
: Here are few things to note:&lt;br /&gt;
&lt;br /&gt;
:* When you are finished adding local and/or remote files to &#039;&#039;source&#039;&#039;, you can execute the following command to add their checksums to the APKBUILD file:&lt;br /&gt;
:: {{Cmd|abuild checksum}}&lt;br /&gt;
:: {{Note|When later updating the content of &#039;&#039;source&#039;&#039;, or updating a file that is listed in &#039;&#039;source&#039;&#039;, you must also update their checksums again with the same command.}}&lt;br /&gt;
&lt;br /&gt;
:* When the remote file is hosted at SourceForge, it&#039;s best to specify the special mirrors link used by SourceForge:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;http://downloads.sourceforge.net/software/software-$pkgver.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: (or similar depending on the package).&lt;br /&gt;
&lt;br /&gt;
:* You can set target filename (eg &#039;save as...&#039;) by prefixing the URI with &#039;&#039;filename::&#039;&#039;. This is useful when the remote filename is not specified in the URI (ie, does not end in &#039;/software-1.0.tar.gz&#039;), such as:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;http://oss.example.org/?get=software&amp;amp;ver=1.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: or when the filename is braindead, like githubs&#039; download tags:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;https://github.com/software/software/archive/v$pkgver.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: The above two examples needs a target filename prefix:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;$pkgname-$pkgver.tar.gz::http://oss.example.org/?get=software&amp;amp;ver=$pkgver&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: and:&lt;br /&gt;
:: &amp;lt;pre&amp;gt;$pkgname-$pkgver.tar.gz::https://github.com/software/software/archive/v$pkgver.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* abuild currently supports the following protocols for remote file retrieval:&lt;br /&gt;
:** http&lt;br /&gt;
:** https&lt;br /&gt;
:** ftp&lt;br /&gt;
&lt;br /&gt;
:* abuild currently supports the following archive types/archive file extensions:&lt;br /&gt;
:** .tar (only in Alpine &amp;gt;= 2.5)&lt;br /&gt;
:** .tar.gz / .tgz&lt;br /&gt;
:** .tar.bz2&lt;br /&gt;
:** .tar.lz (only in Alpine &amp;gt;=3.7)&lt;br /&gt;
:** .tar.lzma&lt;br /&gt;
:** .tar.xz&lt;br /&gt;
:** .zip&lt;br /&gt;
&lt;br /&gt;
:* &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt; should only include variables that change often like &amp;lt;code&amp;gt;pkgver&amp;lt;/code&amp;gt; or a commit ID. CI will warn you if you include &amp;lt;code&amp;gt;pkgname&amp;lt;/code&amp;gt; in source. Other variables like for example &amp;lt;code&amp;gt;_pkgname&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;_pyname&amp;lt;/code&amp;gt; do not belong in &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt; either.&lt;br /&gt;
&lt;br /&gt;
==== subpackages ====&lt;br /&gt;
: Subpackages built from this APKBUILD.  abuild will parse this variable and try to find a subpackage split function.  The split function must &#039;&#039;move&#039;&#039; files that do not belong in the main package, from &#039;&#039;$pkgdir&#039;&#039; to &#039;&#039;$subpkgdir&#039;&#039;.  Files and directories can also be &#039;&#039;copied&#039;&#039; from &#039;&#039;$startdir&#039;&#039; and &#039;&#039;$srcdir&#039;&#039; to &#039;&#039;$subpkgdir&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
: The split function can be specified in 1 of 3 different methods:&lt;br /&gt;
:# subpkgname:&#039;&#039;&#039;splitfunc&#039;&#039;&#039;&lt;br /&gt;
:# $pkgname-&#039;&#039;&#039;splitfunc&#039;&#039;&#039;&lt;br /&gt;
:# &#039;&#039;&#039;splitfunc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
: {{Note|Split function names &#039;&#039;&#039;cannot&#039;&#039;&#039; use hyphens; use the first method above if the subpackage name contains a hyphen (-) character, like this: &#039;&#039;subpkg-name:subpkg_name&#039;&#039;, where &amp;lt;code&amp;gt;subpkg-name&amp;lt;/code&amp;gt; is the name of the &#039;&#039;&#039;subpackage&#039;&#039;&#039; and &amp;lt;code&amp;gt;subpkg_name&amp;lt;/code&amp;gt; is the name of the &#039;&#039;&#039;subpackage&#039;s split function&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
: {{Tip|For more information, see the [[APKBUILD_examples:Subpackages|Subpackages example]].}}&lt;br /&gt;
&lt;br /&gt;
==== triggers ====&lt;br /&gt;
: Apk-tools can &amp;quot;monitor&amp;quot; directories and execute a trigger if any package installed/uninstalled any file in the monitored dir. The triggers are always executed after the apk action (install, uninstall, upgrade).&lt;br /&gt;
&lt;br /&gt;
: The triggers are specified in the format: &#039;&#039;scriptname&#039;&#039;=&#039;&#039;pathlist&#039;&#039; where &#039;&#039;scriptname&#039;&#039; is the (sub)package name + .trigger suffix and pathlist is : separated list of the dirs to monitor.&lt;br /&gt;
&lt;br /&gt;
: The &#039;&#039;&#039;triggers&#039;&#039;&#039; variable must include the triggers for subpackages too if they have any.&lt;br /&gt;
&lt;br /&gt;
: It is possible to use wildcards (*) in the dir list.&lt;br /&gt;
&lt;br /&gt;
==== url ====&lt;br /&gt;
: The homepage for the package.  This is to help users find upstream documentation and other information regarding the package.&lt;br /&gt;
&lt;br /&gt;
==== langdir ====&lt;br /&gt;
: Path to where the language files are located for the &#039;&#039;&#039;-lang&#039;&#039;&#039; subpackage, defaults to &#039;&#039;&#039;/usr/share/locale&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== pcprefix ====&lt;br /&gt;
: Prefix all provides derived from parsing pkg-config Requires: with the value in this variable, example: &#039;&#039;&#039;&#039;pcprefix=&amp;quot;foo:&amp;quot;&#039;&#039;&#039; will produce &#039;&#039;&#039;pc:foo:bar&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== sonameprefix ====&lt;br /&gt;
: Prefix all provides derived from parsing shared objects with the value in this variable, example: &#039;&#039;&#039;sonameprefix=&amp;quot;foo&amp;quot;&#039;&#039;&#039; will produce &#039;&#039;&#039;so:foo:bar.so.X&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Functions =&lt;br /&gt;
{{Note|All functions that are not &#039;&#039;prepare()&#039;&#039;, &#039;&#039;build()&#039;&#039;, &#039;&#039;check()&#039;&#039; and &#039;&#039;package()&#039;&#039; should consider the current working directory as undefined, and should therefore use the [[APKBUILD Reference#abuild-defined_variables|abuild-defined directory variables]] to their advantage.}}&lt;br /&gt;
&lt;br /&gt;
 sanitycheck() -&amp;gt; clean()-&amp;gt; fetch() -&amp;gt; verify() -&amp;gt; unpack() -&amp;gt; prepare() -&amp;gt; mkusers() -&amp;gt; build() -&amp;gt; check() -&amp;gt; package() -&amp;gt; subpackages() -&amp;gt; language packs -&amp;gt; apk -&amp;gt; cleanup()&lt;br /&gt;
&lt;br /&gt;
== abuild-defined functions ==&lt;br /&gt;
The following functions are provided by abuild and can be overridden, but it is strongly discouraged on code review for some functions:&lt;br /&gt;
&lt;br /&gt;
==== fetch() ====&lt;br /&gt;
: Downloads remote sources listed in &#039;&#039;source&#039;&#039; to &#039;&#039;SRCDEST&#039;&#039; (&#039;&#039;SRCDEST&#039;&#039; is configured in &#039;&#039;/etc/abuild.conf&#039;&#039;) and creates symlinks in &#039;&#039;$srcdir&#039;&#039;.&lt;br /&gt;
==== unpack() ====&lt;br /&gt;
: unpack() will call default_unpack().&lt;br /&gt;
&lt;br /&gt;
: [https://github.com/alpinelinux/abuild/blob/v3.1.0/abuild.in#L403 default_unpack()] unpacks .tar, .tgz, .tar.gz, .tar.lz (only available in Alpine &amp;gt;=3.7), .tar.bz2, .tar.lzma, .tar.xz, and .zip archives from a symlink in &#039;&#039;$srcdir&#039;&#039; associated with &#039;&#039;$SRCDEST&#039;&#039; (or distfiles folder) resulting in an unpacked folder in &#039;&#039;$srcdir&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== dev() ====&lt;br /&gt;
: Subpackage function for the &#039;&#039;&#039;$pkgname-dev&#039;&#039;&#039; package is used to collect developer files and folders for use in other packages in the compilation process nothing more.  Without specifying a custom &#039;&#039;dev()&#039;&#039; function, abuild will call its internal &#039;&#039;dev()&#039;&#039; function, which in turn calls default_dev().&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;[https://github.com/alpinelinux/abuild/blob/v3.1.0/abuild.in#L1605 default_dev()]&#039;&#039; will move any &#039;&#039;include&#039;&#039; folder and folders containing &#039;&#039;*.[acho]&#039;&#039; (static archive, c source, c header file, object file), &#039;&#039;*.prl&#039;&#039; file extension patterns in &#039;&#039;&amp;quot;$pkgdir&amp;quot;/{lib,usr}&#039;&#039; to &#039;&#039;&amp;quot;$subpkgdir&amp;quot;/{lib,usr}&#039;&#039; recursively; and &#039;&#039;*.so&#039;&#039; files from &#039;&#039;&amp;quot;$pkgdir&amp;quot;/{lib,usr/lib}&#039;&#039; to &#039;&#039;&amp;quot;$subpkgdir&amp;quot;/{lib,usr/lib}&#039;&#039;.  It will also scan and move &#039;&#039;usr/{include,lib/{pkgconfig,cmake,qt*/mkspecs},share/{aclocal,gettext,vala/vapi,gir-[0-9]*,qt*/mkspecs},bin/*-config}}&#039;&#039; developer only folders in &#039;&#039;$pkgdir&#039;&#039; and transfer them to &#039;&#039;$subpkgdir&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
: In general, default_dev() will support packages that share pkg-config, C programming language API, shared and static libraries, Autotools, gettext, Vala programming language bindings, Python GObject introspection, a provided custom pkg-config like command (*-config), Qt, and CMake.  If you have packages that have C++, other languages, other build system, etc; you need to manually move those developer files only if they are to be used in other packages.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Important&#039;&#039;&#039;: For default_dev() to be called as in no dev(), you need to explicitly add subpackages=&amp;quot;$pkgname-dev&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== doc() ====&lt;br /&gt;
: Subpackage function for the &#039;&#039;&#039;$pkgname-doc&#039;&#039;&#039; package whose job is only to collect documentation folders from $pkgdir nothing more.  Without specifying a custom &#039;&#039;doc()&#039;&#039; function, abuild will call its internal &#039;&#039;doc()&#039;&#039; function, which in turn calls default_doc().&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;[https://github.com/alpinelinux/abuild/blob/v3.1.0/abuild.in#L1519 default_doc()]&#039;&#039; will move &#039;&#039;&amp;quot;$pkgdir&amp;quot;/usr/share/{doc,man,info,html,sgml,licenses,gtk-doc,ri,help}&#039;&#039; to &#039;&#039;$subpkgdir&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
: Overriding this function is strongly discouraged.  Packaging docs should be done in the package() function while letting abuild automatically collect the doc folders.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Important&#039;&#039;&#039;: For default_doc() to be called as in no doc(), you need to explicitly add subpackages=&amp;quot;$pkgname-doc&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== openrc() ====&lt;br /&gt;
: Subpackage function for the &#039;&#039;&#039;$pkgname-openrc&#039;&#039;&#039; package whose job is to collect OpenRC service files that are in /etc/init.d and /etc/conf.d.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;[https://github.com/alpinelinux/abuild/blob/v3.1.0/abuild.in#L1661 default_openrc()]&#039;&#039; will move &#039;&#039;&amp;quot;$pkgdir&amp;quot;/etc/{conf,init}.d&#039;&#039; to &#039;&#039;$subpkgdir&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
: Overriding this function is strongly discouraged. Packaging OpenRC service definitions should be in the package() function while letting abuild automatically collect the openrc folders.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Important&#039;&#039;&#039;: for default_openrc() to be called as in no openrc(), you need to explicitly add subpackages=&amp;quot;$pkgname-openrc&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== static() ====&lt;br /&gt;
: Subpackage function for the &#039;&#039;&#039;$pkgname-static&#039;&#039;&#039; package whose job is to collect static libraries that are stored in /lib and /usr/lib.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;[https://github.com/alpinelinux/abuild/blob/v3.4.0_rc4/abuild.in#L1748 default_static()]&#039;&#039; will move all static libraries (files ending with .a) from &#039;&#039;&amp;quot;$pkgdir&amp;quot;/lib&#039;&#039; and &#039;&#039;&amp;quot;$pkgdir&amp;quot;/usr/lib&#039;&#039; to their equivalents in &#039;&#039;$subpkgdir&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
: Overriding this function is strongly discouraged. Packaging static libraries should be done in the package() function while letting abuild automatically collect the static libraries.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Important&#039;&#039;&#039;: for default_static() to be called as in no static(), you need to explicitly add subpackages=&amp;quot;$pkgname-static&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== snapshot() ====&lt;br /&gt;
: &#039;&#039;&#039;Optional&#039;&#039;&#039;.  For live APKBUILDs or those with a _cvs, _svn, _git, _hg in their version number, you should create a snapshot function only if there is no download link to an archive file (.zip, .tar.gz, ...) to the commit/hash/tag.  The purpose of the snapshot function is to create an archive of the source code so that the package source code is deterministic, and it doesn&#039;t waste time to fetch the source code but bypasses the download step after snapshotting.  Those that download the source code from a git repository will follow head or the latest change to the source code.  It is better to archive the source code as a zip / tar.gz / tar.bz2 up to the commit or the tag which you are trying to build a package.  If it is not deterministic or not every part of the code frozen in time for every dependency and the main project, then the patches will fail or the package may fail to compile when you revisit the package months or years to backport a patch.&lt;br /&gt;
&lt;br /&gt;
: The default [https://github.com/alpinelinux/abuild/blob/v3.1.0/abuild.in#L2310 snapshot()] function has variables associated with it:&lt;br /&gt;
:* $disturl - the base-url of the place to autoupload the snapshot&lt;br /&gt;
:* $svnurl - Subversion repository &lt;br /&gt;
:* $giturl - Git repository&lt;br /&gt;
&lt;br /&gt;
: The default snapshot() can only support one repository.  It is better to override it if there are multiple repositories involved in your package.  CVS, Mercurial (hg), and alternative version control systems must override the default snapshot().&lt;br /&gt;
&lt;br /&gt;
: See [[APKBUILD_examples:Git_checkout]] to how to use it with git.  It takes 2-3 general steps.  Clone the repository; check it out at a specific revision/commit or tag; then you use an archiver to dump it in the &#039;&#039;$SRCDEST&#039;&#039; variable which points to the distfiles folder and the base path to the full path to the archive that you want to create.  You do this for every internal dependency that the package pulls.&lt;br /&gt;
&lt;br /&gt;
: After you have created your snapshot function, you use &amp;lt;code&amp;gt;abuild snapshot&amp;lt;/code&amp;gt; to run it.  &lt;br /&gt;
&lt;br /&gt;
: The archives produced by the snapshot will be saved in &#039;&#039;/var/cache/distfiles&#039;&#039; or whatever you set for &#039;&#039;$SRCDEST&#039;&#039;.  You may need to create symlinks to the archive if the archive is not saved to the Alpine server.&lt;br /&gt;
&lt;br /&gt;
: After you snapshot it, you need to produce the checksums with &amp;lt;code&amp;gt;abuild checksum&amp;lt;/code&amp;gt; to use it in the APKBUILD creation process.&lt;br /&gt;
&lt;br /&gt;
: This feature is available since Alpine &amp;gt;=2.6.&lt;br /&gt;
&lt;br /&gt;
==== default_prepare() ====&lt;br /&gt;
&lt;br /&gt;
:  Before build preparation it handles set of patches inside &amp;lt;code&amp;gt;$srcdir&amp;lt;/code&amp;gt; and prints failed ones.&lt;br /&gt;
&lt;br /&gt;
== User-defined functions ==&lt;br /&gt;
The following functions should be defined by the user: &lt;br /&gt;
&lt;br /&gt;
==== prepare() ====&lt;br /&gt;
: {{note|Please adjust old APKBUILDs, which still have a &#039;&#039;prepare()&#039;&#039; function that does the same as the &#039;&#039;default_prepare()&#039;&#039; when you edit them anyway.}}&lt;br /&gt;
: &#039;&#039;&#039;&#039;&#039;Optional&#039;&#039;.&#039;&#039;&#039;  Used for build preparation: patches, etc, should be applied here. When you don&#039;t specify a custom &#039;&#039;prepare()&#039;&#039;, the built-in &#039;&#039;default_prepare()&#039;&#039; from abuild will be used. It applies patches already (always prepare them in the &amp;lt;code&amp;gt;-p1&amp;lt;/code&amp;gt; format), so &#039;&#039;&#039;usually it makes sense to not create a custom &#039;&#039;prepare()&#039;&#039; function at all!&#039;&#039;&#039; If you do create one, call &#039;&#039;default_prepare()&#039;&#039; inside it:&lt;br /&gt;
&lt;br /&gt;
: Before default_prepare gets called, you can define &#039;&#039;patch_args&#039;&#039; to supply the argument to the patch command in global scope then throw away prepare() so it is unnecessary to use the old template code floating around to patch.  patch_args and autopatching is only available in Alpine &amp;gt;=3.4.  See [[Creating_an_Alpine_package#Patches]] to fix the patch that uses a different patch level (-pX).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
prepare() {&lt;br /&gt;
    default_prepare&lt;br /&gt;
    # your custom code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== build() ====&lt;br /&gt;
: &#039;&#039;&#039;Required.&#039;&#039;&#039;  This is the compilation stage.  This function will be called as the current user (unless the &#039;&#039;package()&#039;&#039; function is missing - for compatibility reasons).  If no compilation is needed, this function can contain a single line: &amp;lt;code&amp;gt;return 0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: To enable or disable CFLAGS, CXXFLAGS, CMake with option, or configure option per arch, use the CARCH variable:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local cmakeoptions=&lt;br /&gt;
case &amp;quot;$CARCH&amp;quot; in&lt;br /&gt;
        aarch64*|arm*|ppc64le|x86|s390x) cmakeoptions=&amp;quot;$cmakeoptions -DWITH_OPENMP=OFF&amp;quot; ;;&lt;br /&gt;
        x86_64)                          cmakeoptions=&amp;quot;$cmakeoptions -DWITH_OPENMP=ON&amp;quot; ;;&lt;br /&gt;
        *)                               msg &amp;quot;Unable to determine architecture from (CARCH=$CARCH)&amp;quot; ; return 1 ;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The block can be used in other parts of the APKBUILD even in global.&lt;br /&gt;
&lt;br /&gt;
==== check() ====&lt;br /&gt;
: &#039;&#039;&#039;Required if functionality exists.&#039;&#039;&#039; This function is called right after the build stage.  It should check that the packaged thing is actually working, typically by running (integration) tests, if provided by upstream.  If there’s no (easy) way how to test the package, you can declare that it does not want to use &#039;&#039;check()&#039;&#039; by adding &amp;quot;!check&amp;quot; into the &#039;&#039;options&#039;&#039; variable (&amp;lt;code&amp;gt;options=&amp;quot;!check&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
: default_check() does nothing.  You need to manually explicitly call the unit tests or test suite yourself.  When you run the test, the program should return with an exit code of 0, indicating the tests were a success.  Unit tests or test suites will do feature tests, per function correctness check, fuzz testing, benchmarks.&lt;br /&gt;
&lt;br /&gt;
: A package may also require additional testing frameworks packages that are external dependencies.  You should add those to the &#039;&#039;checkdepends=&#039;&#039; in Alpine &amp;gt;=3.6 or &#039;&#039;makedepends=&#039;&#039; for older for backporters.  If the testing framework is not available, you need to create a package for it.  If it requires a specific version of a testing framework, consider making it an internal dependency or a new package with a package name containing the major and minor version number like the python packages.&lt;br /&gt;
&lt;br /&gt;
: Generally speaking, you should define the check functions for libraries, large programs like web browsers, or compilers and interpreters, cryptographic/security/anonymity stuff, mission critical stuff, PCI compliance/money/accounting software, server software with a lot of stakeholders or consumers.  Soon for the new policy change will have virtually &#039;&#039;&#039;all packages with testing capabilities be required to have a working and defined check() function&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
: There are times when the unit tests do not work, just because the test itself is broken, new unimplemented feature, external factors not taken into consideration, unbundling path differences, breakage caused by ccache, missing test dependency or version mismatch dependency as in python2 vs python3, test scripts only work for particular language implementation like only supporting python2 but not python3 having used the 2to3 conversion script.  If a unit test is known not to work, you may need to patch it to omit that test or fix it; but, certain tests should not be disabled if it is important.  You may need to alter the references to uncompiled internal dependencies to work with the external dependencies instead.  For ccache, you can either disable it or remove it from the PATH environmental variable before running tests.&lt;br /&gt;
&lt;br /&gt;
{{Note|Tests for graphical applications and toolkits might work on a X11 user setup but will fail on the server unless run with xvfb-run.}}&lt;br /&gt;
&lt;br /&gt;
: If you don&#039;t add the &#039;&#039;check()&#039;&#039; and the &#039;&#039;options=&#039;&#039;, this is what you will see:&lt;br /&gt;
&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; WARNING: py-webtest*: APKBUILD does not run any tests!&lt;br /&gt;
    Alpine policy will soon require that packages have any relevant testsuites run during the build process.&lt;br /&gt;
    To fix, either define a check() function, or declare !check in $options to indicate the package does not have a testsuite.&lt;br /&gt;
&lt;br /&gt;
: If you do not do a check or disable it, you must state there is no testsuite in comment form (#) next to options=&amp;quot;!check&amp;quot; for the code reviewers.&lt;br /&gt;
&lt;br /&gt;
: To run test suite with autotools do:&lt;br /&gt;
&lt;br /&gt;
  make check&lt;br /&gt;
&lt;br /&gt;
: To run the test suite with python setuptools:&lt;br /&gt;
&lt;br /&gt;
  python2 setup.py test&lt;br /&gt;
  python3 setup.py test&lt;br /&gt;
&lt;br /&gt;
: For python it should be &#039;&#039;&#039;test&#039;&#039;&#039; not check.  Check for python setuptools will check the packaging metadata fields[https://docs.python.org/3/distutils/examples.html#checking-a-package] only but not run the unit tests.  There should be verbose output also.  The dependencies for the tests are found in test_require in the setup.py.&lt;br /&gt;
&lt;br /&gt;
: If it says &amp;lt;code&amp;gt;Ran 0 tests in 0.000s&amp;lt;/code&amp;gt; that is not acceptable.  check() will say it was good but it is not actually correct.  It needs to run the test suite with an alternative method like &amp;lt;code&amp;gt;tox -e py27,py36&amp;lt;/code&amp;gt; if you see a tox.ini file.&lt;br /&gt;
&lt;br /&gt;
: You want to do it for each implementation to ensure that the API calls are correct per implementation but ncopa said it was just fine with python3.&lt;br /&gt;
&lt;br /&gt;
: If there is a circular dependency for the checkdepends=, you need to disable the check and put the reason next to &amp;lt;code&amp;gt;options=&amp;quot;!check&amp;quot;&amp;lt;/code&amp;gt; that there is a circular dependency.  You should disable it for the package that package that is least important or least security risk.  The other solution is to make the conflicting dependency an internal dependency but making sure that it doesn&#039;t pull it at check time.  This way they can both preform tests properly.&lt;br /&gt;
&lt;br /&gt;
==== package() ====&lt;br /&gt;
: &#039;&#039;&#039;Required.&#039;&#039;&#039;  This is the packaging stage.  Here, the built application and support files should be installed into &#039;&#039;&#039;$pkgdir&#039;&#039;&#039;.  If this is a metapackage, this function can contain a single line: &amp;lt;code&amp;gt;mkdir -p &amp;quot;$pkgdir&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|Building in fakeroot will reduce performance for parallel builds dramatically.  It is for this reason that we split the build and package process into two separate functions.}}&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
The [[APKBUILD examples]] page will assist you in understanding how to create an APKBUILD.&lt;br /&gt;
&lt;br /&gt;
= Version =&lt;br /&gt;
&lt;br /&gt;
This document assumes abuild for Alpine Edge.  For older releases of abuild, some of these features may not be available if you are using an older release.  A link to the implementation is linked for researchers and backporters.&lt;br /&gt;
&lt;br /&gt;
For more information see [[APKBUILD_versions]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Ptrcnull</name></author>
	</entry>
</feed>