aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/apk-tools/0001-fetch-fix-fetching-of-packages-with-arch.patch104
-rw-r--r--main/apk-tools/APKBUILD6
2 files changed, 108 insertions, 2 deletions
diff --git a/main/apk-tools/0001-fetch-fix-fetching-of-packages-with-arch.patch b/main/apk-tools/0001-fetch-fix-fetching-of-packages-with-arch.patch
new file mode 100644
index 0000000000..40f934e417
--- /dev/null
+++ b/main/apk-tools/0001-fetch-fix-fetching-of-packages-with-arch.patch
@@ -0,0 +1,104 @@
+From 91c4cc6c188bc20eddcd40e9b9b30f20dc2f36cf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Thu, 7 Apr 2011 14:14:27 +0300
+Subject: [PATCH] fetch: fix fetching of packages with arch
+
+---
+ src/apk_database.h | 3 +++
+ src/database.c | 36 ++++++++++++++++++++----------------
+ src/fetch.c | 4 +---
+ 3 files changed, 24 insertions(+), 19 deletions(-)
+
+diff --git a/src/apk_database.h b/src/apk_database.h
+index 988a668..68bba08 100644
+--- a/src/apk_database.h
++++ b/src/apk_database.h
+@@ -183,6 +183,9 @@ int apk_db_add_repository(apk_database_t db, apk_blob_t repository);
+ struct apk_repository *apk_db_select_repo(struct apk_database *db,
+ struct apk_package *pkg);
+ int apk_repository_update(struct apk_database *db, struct apk_repository *repo);
++int apk_repo_format_filename(char *buf, size_t len,
++ const char *repourl, apk_blob_t *arch,
++ const char *pkgfile);
+
+ int apk_db_cache_active(struct apk_database *db);
+ void apk_cache_format_index(apk_blob_t to, struct apk_repository *repo);
+diff --git a/src/database.c b/src/database.c
+index 8e9cb0d..1376ec3 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -489,14 +489,7 @@ int apk_cache_download(struct apk_database *db, const char *url, apk_blob_t *arc
+ char fullurl[PATH_MAX];
+ int r;
+
+- if (arch != NULL)
+- snprintf(fullurl, sizeof(fullurl), "%s%s" BLOB_FMT "/%s",
+- url, url[strlen(url)-1] == '/' ? "" : "/",
+- BLOB_PRINTF(*arch), item);
+- else
+- snprintf(fullurl, sizeof(fullurl), "%s%s/%s",
+- url, url[strlen(url)-1] == '/' ? "" : "/",
+- item);
++ apk_repo_format_filename(fullurl, sizeof(fullurl), url, arch, item);
+ apk_message("fetch %s", fullurl);
+
+ if (apk_flags & APK_SIMULATE)
+@@ -1529,6 +1522,24 @@ struct apk_package *apk_db_get_file_owner(struct apk_database *db,
+ return dbf->diri->pkg;
+ }
+
++int apk_repo_format_filename(char *buf, size_t len,
++ const char *repourl, apk_blob_t *arch,
++ const char *item)
++{
++ int n;
++
++ if (arch != NULL)
++ n = snprintf(buf, len, "%s%s" BLOB_FMT "/%s",
++ repourl, repourl[strlen(repourl)-1] == '/' ? "" : "/",
++ BLOB_PRINTF(*arch), item);
++ else
++ n = snprintf(buf, len, "%s%s%s",
++ repourl, repourl[strlen(repourl)-1] == '/' ? "" : "/",
++ item);
++
++ return n;
++}
++
+ static int apk_repo_is_remote(struct apk_repository *repo)
+ {
+ return repo->csum.type != APK_CHECKSUM_NONE;
+@@ -1541,14 +1552,7 @@ static struct apk_bstream *apk_repo_file_open(struct apk_repository *repo,
+ {
+ const char *url = repo->url;
+
+- if (arch != NULL)
+- snprintf(buf, buflen, "%s%s" BLOB_FMT "/%s",
+- url, url[strlen(url)-1] == '/' ? "" : "/",
+- BLOB_PRINTF(*arch), file);
+- else
+- snprintf(buf, buflen, "%s%s/%s",
+- url, url[strlen(url)-1] == '/' ? "" : "/",
+- file);
++ apk_repo_format_filename(buf, buflen, url, arch, file);
+
+ if ((apk_flags & APK_NO_NETWORK) && apk_repo_is_remote(repo))
+ return NULL;
+diff --git a/src/fetch.c b/src/fetch.c
+index 09e3b9d..72b481d 100644
+--- a/src/fetch.c
++++ b/src/fetch.c
+@@ -120,9 +120,7 @@ static int fetch_package(struct fetch_ctx *fctx,
+ if (apk_flags & APK_SIMULATE)
+ return 0;
+
+- snprintf(url, sizeof(url), "%s%s%s", repo->url,
+- repo->url[strlen(repo->url)-1] == '/' ? "" : "/",
+- pkgfile);
++ apk_repo_format_filename(url, sizeof(url), repo->url, pkg->arch, pkgfile);
+
+ if (fctx->flags & FETCH_STDOUT) {
+ fd = STDOUT_FILENO;
+--
+1.7.4.4
+
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index f1a8624ac6..31aa71a53c 100644
--- a/main/apk-tools/APKBUILD
+++ b/main/apk-tools/APKBUILD
@@ -1,12 +1,13 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apk-tools
pkgver=2.1.0_rc1
-pkgrel=0
+pkgrel=1
pkgdesc="Alpine Package Keeper - package manager for alpine"
subpackages="$pkgname-static"
depends=
makedepends="zlib-dev openssl-dev pkgconfig"
source="http://git.alpinelinux.org/cgit/$pkgname.git/snapshot/$pkgname-$pkgver.tar.bz2
+ 0001-fetch-fix-fetching-of-packages-with-arch.patch
"
url="http://git.alpinelinux.org/cgit/apk-tools/"
@@ -48,4 +49,5 @@ static() {
"$subpkgdir"/sbin/apk.static
}
-md5sums="cc3ee58fa9672bc003cadc2b20bf33d2 apk-tools-2.1.0_rc1.tar.bz2"
+md5sums="cc3ee58fa9672bc003cadc2b20bf33d2 apk-tools-2.1.0_rc1.tar.bz2
+c868a4d8a997294d0ca570586f78f3ab 0001-fetch-fix-fetching-of-packages-with-arch.patch"