[aur-general] [RFC] command in PKGBUILD to select archlinux mirror to download from
Hi there I'm look for a way to set the PKGBUILD's source=() to fetch file from archlinux repository without needing to set "ftp.archlinux.org" (which is throttled in 50Kb/s) or any other specific mirror (in order to avoid slow connection in distant geographic locations). FYI, some PKGBUILDs in AUR need to fetch from archlinux repository, like lib32-pam, lib32-avahi, lib32-smbclient. So, a solution for this issue might might provide better experience for end-user from AUR unsupported. One too much lazy solution (but works) is to grep one server from mirrorlist (e.g.: first) and get specifically the prefix of the URL, which will be completed in the source array: _srcurl=`grep -m 1 ^Server /etc/pacman.d/mirrorlist` _srcurl=${_srcurl/Server = /} _srcurl=${_srcurl/\/\$repo\/os\/\$arch/} source=($_srcurl/foo/bar) Any other idea? Comments are welcome.
On Thu, Feb 5, 2015 at 5:34 PM, Rafael Ferreira <rafael.f.f1@gmail.com> wrote:
One too much lazy solution (but works) is to grep one server from mirrorlist (e.g.: first) and get specifically the prefix of the URL, which will be completed in the source array: _srcurl=`grep -m 1 ^Server /etc/pacman.d/mirrorlist` _srcurl=${_srcurl/Server = /} _srcurl=${_srcurl/\/\$repo\/os\/\$arch/} source=($_srcurl/foo/bar)
Any other idea? Comments are welcome.
We all started with bash at some point. Use quotes for all these lines, and don't use backticks but the more convenient bourne $(). _srcurl="$(grep -m 1 "^Server" /etc/pacman.d/mirrorlist)" _srcurl="${_srcurl#*= }" _srcurl="${_srcurl/\/\$repo\/os\/\$arch/}" Now, I'm nost sure why you have to download anything from arch's mirrors in a PKGBUILD. It feels like it doesn't belong into something that would potentially be delivered from there, and the question hence it seems a bit off.... If you need multilib packages, just put them into the depends=() array? cheers! mar77i
2015-02-05 14:52 GMT-02:00 Martti Kühne <mysatyre@gmail.com>:
We all started with bash at some point. Use quotes for all these lines, and don't use backticks but the more convenient bourne $(). _srcurl="$(grep -m 1 "^Server" /etc/pacman.d/mirrorlist)" _srcurl="${_srcurl#*= }" _srcurl="${_srcurl/\/\$repo\/os\/\$arch/}"
Thanks for the bash suggestions!
Now, I'm nost sure why you have to download anything from arch's mirrors in a PKGBUILD. It feels like it doesn't belong into something that would potentially be delivered from there, and the question hence it seems a bit off.... If you need multilib packages, just put them into the depends=() array?
cheers! mar77i
The reason for that is: some of the lib32 PKGBUILDS in AUR aren't set to build from source, mostly, if not all of them, because simply won't build 32bit in 64bit system. So, the PKGBUILD gets the 32bit package from Arch's repository to install in /usr/lib32. Also, in lib32-pam's case, the source array uses the tarball "pam_unix2-2.9.1.tar.bz2" stored in Arch repository, just like ''pam' package. So, as you might notice, it is not simply a matter of multilib packages in depends array, but the need for fetching 32bit packages or tarballs as source for build the desired lib32 package. Cheers, Rafael
On 2015-02-05 15:25, Rafael Ferreira wrote:
2015-02-05 14:52 GMT-02:00 Martti Kühne <mysatyre@gmail.com>:
We all started with bash at some point. Use quotes for all these lines, and don't use backticks but the more convenient bourne $(). _srcurl="$(grep -m 1 "^Server" /etc/pacman.d/mirrorlist)" _srcurl="${_srcurl#*= }" _srcurl="${_srcurl/\/\$repo\/os\/\$arch/}"
Thanks for the bash suggestions!
Now, I'm nost sure why you have to download anything from arch's mirrors in a PKGBUILD. It feels like it doesn't belong into something that would potentially be delivered from there, and the question hence it seems a bit off.... If you need multilib packages, just put them into the depends=() array?
cheers! mar77i
The reason for that is: some of the lib32 PKGBUILDS in AUR aren't set to build from source, mostly, if not all of them, because simply won't build 32bit in 64bit system. So, the PKGBUILD gets the 32bit package from Arch's repository to install in /usr/lib32.
Also, in lib32-pam's case, the source array uses the tarball "pam_unix2-2.9.1.tar.bz2" stored in Arch repository, just like ''pam' package.
So, as you might notice, it is not simply a matter of multilib packages in depends array, but the need for fetching 32bit packages or tarballs as source for build the desired lib32 package.
Cheers, Rafael
Why can't you download the source tarball and build from there? -- Hugo Osvaldo Barrera A: Because we read from top to bottom, left to right. Q: Why should I start my reply below the quoted text?
2015-02-05 23:44 GMT-02:00 Hugo Osvaldo Barrera <hugo@barrera.io>:
Why can't you download the source tarball and build from there?
In 'lib32-pam' (as well as 'pam') case, the tarball pam_unix2-2.9.1.tar.bz2 was stored in Arch Linux repository for some reason (maybe the upstream gone offline). So, lib32-pam is built from source code, but one tarball is fetched from Arch Linux server. Some other lib32 packages simply won't build. While my desire is to build from source code, some depend on software not much multilib-friendly, like python. Example of packages that depend on python is avahi [1]. In these case, maintainers (including myself) have no option but to provide the lib32 package built from Arch's 32bit package, available in the mirrors. So, a nice workaround might bring a better solution for end-user around the world. [1] https://projects.archlinux.org/svntogit/packages.git/plain/trunk/PKGBUILD?h=... Cheers, Rafael
On 05.02.2015 17:34, Rafael Ferreira wrote:
I'm look for a way to set the PKGBUILD's source=() to fetch file from archlinux repository without needing to set "ftp.archlinux.org" (which is throttled in 50Kb/s) or any other specific mirror (in order to avoid slow connection in distant geographic locations).
ftp.archlinux.org has been shut down by it's sponsor. The sources and other directories are now available on https://sources.archlinux.org (no ftp any more) which is not throttled and likely won't be. sources.archlinux.org is currently hosted in Germany, but it has decent bandwidth. You shouldn't worry about geographical locations for stuff like this IMHO, but if you really do use mirror.kernel.org. They have geobalancers and they mirror the sources and other directories. Do you worry about geographical locations of other mirrors (as in the project's upstream)?
FYI, some PKGBUILDs in AUR need to fetch from archlinux repository, like lib32-pam, lib32-avahi, lib32-smbclient.
Repackaging i686 packages to multilib ones sounds wrong. We used to do that before multilib, but it's really just a hack and it's highly unlikely that it's really impossible to build a proper multilib package. For kicks I took the [extra] avahi PKGBUILD, added some exports and rm/mkdir/ln magic taken from lib32-openssl (or nearly any lib32 package I created back when we introduced multilib), changed the deps and added some --disable-foo flags to configure for stuff that's not needed in a multilib environment. Took around 10 minutes, the file list looks good and the libraries are indeed 32bit. Granted, it does currently depend on lib32-qt4 and lib32-gtk rather than optdep, but that's cosmetics. Package and PKGBUILD here, feel free to clean it up some more (link valid for 10 days): https://paste.xinu.at/m-PKHfPF/ As for lib32-pam that only seems to pull the source tarball which, as mentioned above, is now on https://sources.archlinux.org. lib32-smbclient can likely also be built properly, but it has a few deps and I'm not in the mood to build that much right now. Feel free to consider it an exercise. If you notice any more lib32 packages that repackage an i686 package please tell the maintainer to build it properly. Thank you.
participants (4)
-
Florian Pritz
-
Hugo Osvaldo Barrera
-
Martti Kühne
-
Rafael Ferreira