index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Xavier Chantry <shiningxc@gmail.com> | 2009-08-19 18:35:32 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-09-06 15:53:54 -0500 |
commit | 65c1f06be5a9c4bdb197b61563da7c2e28162392 (patch) | |
tree | cc715dc8a677a2568700a16dcac047f500c1a20e /src | |
parent | 5b27e78ba015a48baf2d3c8687fdf3084781f9c9 (diff) |
-rw-r--r-- | src/pacman/pacman.c | 17 |
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 5fab247d..6e5147c5 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -897,7 +897,22 @@ static int _parseconfig(const char *file, const char *givensection, } } else if(strcmp(key, "Server") == 0) { /* let's attempt a replacement for the current repo */ - char *server = strreplace(ptr, "$repo", section); + char *temp = strreplace(ptr, "$repo", section); + /* let's attempt a replacement for the arch */ + const char *arch = alpm_option_get_arch(); + char *server; + if(arch) { + server = strreplace(temp, "$arch", arch); + free(temp); + } else { + if(strstr(temp, "$arch")) { + pm_printf(PM_LOG_ERROR, _("The mirror '%s' contains the $arch" + " variable, but no Architecture is defined.\n"), ptr); + ret = 1; + goto cleanup; + } + server = temp; + } if(alpm_db_setserver(db, server) != 0) { /* pm_errno is set by alpm_db_setserver */ |