aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-02-01 12:44:16 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-02-01 12:44:16 +0000
commit38212b9de530fcf77e3b4332571e0e589a9e4cfa (patch)
tree3b64ff7bd18095fec65c8337fff8b4322ae4f29a
parent4d5e04af35ed168014c15bcd2ebf59b87d654016 (diff)
downloadaports-38212b9de530fcf77e3b4332571e0e589a9e4cfa.tar.bz2
aports-38212b9de530fcf77e3b4332571e0e589a9e4cfa.tar.xz
main/apk-tools: fix bug with --repository
-rw-r--r--main/apk-tools/0001-db-fix-bug-with-repository.patch65
-rw-r--r--main/apk-tools/APKBUILD6
2 files changed, 69 insertions, 2 deletions
diff --git a/main/apk-tools/0001-db-fix-bug-with-repository.patch b/main/apk-tools/0001-db-fix-bug-with-repository.patch
new file mode 100644
index 0000000000..95009f485b
--- /dev/null
+++ b/main/apk-tools/0001-db-fix-bug-with-repository.patch
@@ -0,0 +1,65 @@
+From ddd386157cf718382670e4adbcfc44029240e33f Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 1 Feb 2012 13:31:37 +0100
+Subject: [PATCH] db: fix bug with --repository
+
+The 'r' variable is overwritten and no longer holds the repository
+number.
+---
+ src/database.c | 18 +++++++++---------
+ 1 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/src/database.c b/src/database.c
+index e2961df..0fe17fe 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -1762,7 +1762,7 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository)
+ struct apk_bstream *bs = NULL;
+ struct apk_repository *repo;
+ apk_blob_t brepo, btag;
+- int r, targz = 1, tag_id = 0;
++ int repo_num, r, targz = 1, tag_id = 0;
+ char buf[PATH_MAX];
+
+ if (db->num_repos >= APK_MAX_REPOS)
+@@ -1780,8 +1780,8 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository)
+ tag_id = apk_db_get_tag_id(db, btag);
+ }
+
+- r = db->num_repos++;
+- repo = &db->repos[r];
++ repo_num = db->num_repos++;
++ repo = &db->repos[repo_num];
+ *repo = (struct apk_repository) {
+ .url = apk_blob_cstr(brepo),
+ };
+@@ -1795,20 +1795,20 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository)
+ apk_cache_format_index(APK_BLOB_BUF(buf), repo);
+ bs = apk_bstream_from_file(db->cache_fd, buf);
+ } else {
+- db->local_repos |= BIT(r);
++ db->local_repos |= BIT(repo_num);
+ bs = apk_repo_file_open(repo, db->arch, apkindex_tar_gz, buf, sizeof(buf));
+ }
+- if (bs != NULL)
+- r = load_index(db, bs, targz, r);
+- else
++ if (bs != NULL) {
++ r = load_index(db, bs, targz, repo_num);
++ } else
+ r = -ENOENT;
+
+ if (r != 0) {
+ apk_warning("Ignoring %s: %s", buf, apk_error_str(r));
+- db->bad_repos |= BIT(r);
++ db->bad_repos |= BIT(repo_num);
+ r = 0;
+ } else {
+- db->repo_tags[tag_id].allowed_repos |= BIT(r);
++ db->repo_tags[tag_id].allowed_repos |= BIT(repo_num);
+ }
+
+ return 0;
+--
+1.7.9
+
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index 4312ccbfb9..ad452fda96 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.2.4
-pkgrel=0
+pkgrel=1
pkgdesc="Alpine Package Keeper - package manager for alpine"
subpackages="$pkgname-static lua-apk:luaapk"
depends=
makedepends="zlib-dev openssl-dev lua-dev"
source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
+ 0001-db-fix-bug-with-repository.patch
"
url="http://git.alpinelinux.org/cgit/apk-tools/"
@@ -54,4 +55,5 @@ luaapk() {
mv "$pkgdir"/usr/lib "$subpkgdir"/usr/lib/
}
-md5sums="62dcd3a18f8018d72146b6725cee338a apk-tools-2.2.4.tar.bz2"
+md5sums="62dcd3a18f8018d72146b6725cee338a apk-tools-2.2.4.tar.bz2
+51a9e484817e7191e622737a3b4969bd 0001-db-fix-bug-with-repository.patch"