diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-10-06 14:54:54 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-10-06 14:54:54 +0300 |
commit | f5674b95824126a5f8545103edd76e000a2a3c56 (patch) | |
tree | 606a48749a7d0dcc95911840d7b7fd4a551ed2f2 | |
parent | 6ea922cc870c27c25fb377d75a570de676175e5e (diff) | |
download | apk-tools-f5674b95824126a5f8545103edd76e000a2a3c56.tar.gz apk-tools-f5674b95824126a5f8545103edd76e000a2a3c56.tar.bz2 apk-tools-f5674b95824126a5f8545103edd76e000a2a3c56.tar.xz apk-tools-f5674b95824126a5f8545103edd76e000a2a3c56.zip |
db: use per-pkg architecture (if available) to form download url
Allows one arch index files to refer to other arch packages. Mostly
useful with noarch packages, but could be used e.g. to ship build
with some of packages optimized for specific cpu generation and
share most packages with the standard build.
-rw-r--r-- | src/database.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/database.c b/src/database.c index 25b076d..8d633b4 100644 --- a/src/database.c +++ b/src/database.c @@ -589,16 +589,20 @@ int apk_repo_format_cache_index(apk_blob_t to, struct apk_repository *repo) int apk_repo_format_real_url(struct apk_database *db, struct apk_repository *repo, struct apk_package *pkg, char *buf, size_t len) { + apk_blob_t arch; int r; + if (pkg && pkg->arch) arch = *pkg->arch; + else arch = *db->arch; + if (pkg != NULL) r = snprintf(buf, len, "%s%s" BLOB_FMT "/" PKG_FILE_FMT, repo->url, repo->url[strlen(repo->url)-1] == '/' ? "" : "/", - BLOB_PRINTF(*db->arch), PKG_FILE_PRINTF(pkg)); + BLOB_PRINTF(arch), PKG_FILE_PRINTF(pkg)); else r = snprintf(buf, len, "%s%s" BLOB_FMT "/%s", repo->url, repo->url[strlen(repo->url)-1] == '/' ? "" : "/", - BLOB_PRINTF(*db->arch), apkindex_tar_gz); + BLOB_PRINTF(arch), apkindex_tar_gz); if (r >= len) return -ENOBUFS; return 0; |