On Thu, Oct 31, 2013 at 5:04 PM, Dave Reisner <d@falconindy.com> wrote:
On Thu, Oct 31, 2013 at 04:51:38PM -0400, Ido Rosen wrote:
On Thu, Oct 31, 2013 at 4:45 PM, Dave Reisner <d@falconindy.com> wrote:
On Thu, Oct 31, 2013 at 08:32:49PM +0000, Jerome Leclanche wrote:
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
This can't work. If the first source fails to download, makepkg will abort.
What about just detecting if source is an array/list (keep current behavior), or a dictionary/lookup table (new fancy mirror behavior)? If it's a dictionary/lookup table, then try all mirrors before failing a source download.
For examples of how to create lookup tables in bash, see
http://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash. ..
bash4's associative arrays define a 1:1 mapping of string to string. You cannot have multiple elements in the "value." Not to mention that we won't be changing the format of the 'source' variable any time soon.
Okay, that leaves either Jerome's suggestion (if duplicate filenames are detected, treat them as mirrors and don't fail/abort as long as one of them works); supporting source() as a function instead of just as an array; or creating a new variable that can handle mirrors...or doing nothing.