You are not logged in.
Hello everyone,
I wrote the wiki section PKGBUILD - Declare more mirrors for a file. The code i wrote uses wget, which is not part of the base system, so each PKGBUILD with mirrors declared in this way should declare the wget package within the makedepends array. Do you think it would be better to use "curl" instead of "wget"?
Last edited by grufo (2012-11-24 01:19:17)
Offline
Do you think it would be better to use "curl" instead of "wget"?
Yes.
I do prefer wget myself (I have no idea why really), and it is usually my first go to tool for such things. But when I start distributing a tool I try to make sure I replace wget with curl, or my specific peices with the most general piece that could do the same job.
I don't, however, know why a PKGBUILD would need mirrors. Shouldn't you just stick with the original upstream source?
Last edited by Trilby (2012-11-24 01:21:06)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
grufo wrote:Do you think it would be better to use "curl" instead of "wget"?
Yes
Ok. Any code snippet for curl? How I can determine if a remote file exists without downloading it?
Offline
The wiki user Danielwallace removed my edit writing «just because you can do something doesn't mean you should».
Offline
just because you can do something doesn't mean you should.
That is a good point...
Offline
That is a good point...
The discussion about its intervention continues at danielwallace's Talk Page…
However… Any code snippet to determine if a remote file exists without downloading it with curl?
Offline
Since my wiki edit has been removed, I post it here in the case in which someone wants to know for himself how to declare a list of mirror within a PKGBUILD…
Declare more mirrors for a file
Imagine to have a PKGBUILD header like the following:
pkgname="alsa-driver"
pkgver="1.0.25"
source=("ftp://ftp.alsa-project.org/pub/driver/${pkgname}-${pkgver}.tar.bz2" "alsa-driver.install")
md5sums=("ac56465c262ced60b5eb2d6492d7a923" "60e496c5ed52bcd8e2d44c80ab2b4d10")
install="${pkgname}.install"
but you want to declare some mirrors because the primary server (ftp://ftp.alsa-project.org) is not so stable. In this case you need to declare an array of mirrors in order to detect what mirror works. See this example:
pkgname="alsa-driver"
pkgver="1.0.25"
_findMirror() {
local _mirrors=(
"http://alsa.mirror.fr/driver/${pkgname}-${pkgver}.tar.bz2"
"http://dl.ambiweb.de/mirrors/ftp.alsa-project.org/driver/${pkgname}-${pkgver}.tar.bz2"
"http://gd.tuwien.ac.at/opsys/linux/alsa/driver/${pkgname}-${pkgver}.tar.bz2"
"http://alsa.cybermirror.org/driver/${pkgname}-${pkgver}.tar.bz2"
"ftp://gd.tuwien.ac.at/opsys/linux/alsa/driver/${pkgname}-${pkgver}.tar.bz2"
"ftp://ftp.task.gda.pl/pub/linux/misc/alsa/driver/${pkgname}-${pkgver}.tar.bz2"
"ftp://mirrors.zerg.biz/alsa/driver/${pkgname}-${pkgver}.tar.bz2"
"ftp://ftp.alsa-project.org/pub/driver/${pkgname}-${pkgver}.tar.bz2"
)
for mirr in ${_mirrors[@]}; do
if wget --spider -q $mirr; then
echo -n "$mirr"
return 0
fi
done
return 1
}
source=("$(_findMirror)" "${pkgname}.install")
md5sums=("ac56465c262ced60b5eb2d6492d7a923" "60e496c5ed52bcd8e2d44c80ab2b4d10")
install="${pkgname}.install"
Offline
I don't, however, know why a PKGBUILD would need mirrors. Shouldn't you just stick with the original upstream source?
Well, because it could benefit me, as I'm unable to reach kernel.org (or any mirror) from my work.
But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner
Offline
Trilby wrote:I don't, however, know why a PKGBUILD would need mirrors. Shouldn't you just stick with the original upstream source?
Well, because it could benefit me, as I'm unable to reach kernel.org (or any mirror) from my work.
…or because there are packages, like "imule", "alsa-driver" and others, whose upstream source is often slow or broken…
Last edited by grufo (2012-11-27 12:52:13)
Offline
Maybe submitting patches to get support into makepkg itself would be a better solution?
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Maybe submitting patches to get support into makepkg itself would be a better solution?
Of course.
@Allan
What do you think about it?
Offline