[aur-general] Support for source mirror lists in PKGBUILD

Jerome Leclanche adys.wh at gmail.com
Thu Oct 31 16:32:49 EDT 2013


On Thu, Oct 31, 2013 at 5:46 PM, Ido Rosen <ido at kernel.org> wrote:
> Hi everyone,
>   What's the current recommended way to support multiple mirrors for the
> same source file in a PKGBUILD?  For example, I have xyz-123.tar.gz that
> can be downloaded from any of "http://a.example.com/xyz-123.tar.gz"  "
> http://b.example.com/xyz-123.tar.gz"
> "http://c.example.com/xyz-123.tar.gz"...but
> one of these may be down at any given time.
>
> If there's no support for this in the sources array itself, we should
> strongly consider adding it.  For example, an ad-hoc way:
>
> _pick_source_mirror() {
>   # ... do something smart in here
> }
> source=(
>     "xyz-123::$(_pick_source_mirror(
>         http://a.example.com/xyz-123.tar.gz
>         http://b.example.com/xyz-123.tar.gz
>         http://c.example.com/xyz-123.tar.gz
>     ))"
> )
>
> A less ad-hoc way:
> source() {
> #...some code that returns a list of URLs/files
> }
>
> Another way:
> source=(...files without mirrors as usual...)
> sourcemirrored=( xyz-123::($mirroraURL $mirrorbURL $mirrorcURL) )
>
> Mirrored sources seem like a common enough phenomenon that it's worth
> special treatment to make the source PKGBUILD variable more versatile if
> they're not currently supported.  Thoughts?
>
> Ido

What about reusing the "filename" feature; if it sees multiple times
the same files it treats it as a mirror, eg.
"file.tar.gz::http://example.com/file.tar.gz"
"file.tar.gz::http://mirror.example.com/file.tar.gz"

J. Leclanche


More information about the aur-general mailing list