aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-05-26 15:12:15 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-06-08 15:06:26 +0000
commit6610c6a9675d486eb17b58121b87dd5a4e04d307 (patch)
tree1f4543c582c747ca1b6ef80cb1efd2af160fc0b5
parent5ce6c5d9b917e789c912ad30c94fa622afe202fe (diff)
downloadalpine_aports-6610c6a9675d486eb17b58121b87dd5a4e04d307.tar.bz2
alpine_aports-6610c6a9675d486eb17b58121b87dd5a4e04d307.tar.xz
alpine_aports-6610c6a9675d486eb17b58121b87dd5a4e04d307.zip
main/apk-tools: backport more patches from upstream
-rw-r--r--main/apk-tools/0001-info-fix-querying-of-removed-but-referenced-packages.patch (renamed from main/apk-tools/info-segfault.patch)19
-rw-r--r--main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch42
-rw-r--r--main/apk-tools/0003-search-add-search-for-reverse-dependencies-in-index.patch221
-rw-r--r--main/apk-tools/0004-package-don-t-leak-signing-key-file-fd.patch (renamed from main/apk-tools/0001-package-don-t-leak-signing-key-file-fd.patch)2
-rw-r--r--main/apk-tools/0005-cache-display-more-than-one-error.patch55
-rw-r--r--main/apk-tools/APKBUILD16
6 files changed, 342 insertions, 13 deletions
diff --git a/main/apk-tools/info-segfault.patch b/main/apk-tools/0001-info-fix-querying-of-removed-but-referenced-packages.patch
index 9479fade30..4df956bf36 100644
--- a/main/apk-tools/info-segfault.patch
+++ b/main/apk-tools/0001-info-fix-querying-of-removed-but-referenced-packages.patch
@@ -1,11 +1,13 @@
1commit 87420aaf295f58847332ba3aa89691a0259baace 1From 87420aaf295f58847332ba3aa89691a0259baace Mon Sep 17 00:00:00 2001
2Author: Timo Teras <timo.teras@iki.fi> 2From: Timo Teras <timo.teras@iki.fi>
3Date: Wed May 5 08:56:06 2010 +0300 3Date: Wed, 5 May 2010 08:56:06 +0300
4Subject: [PATCH 1/5] info: fix querying of removed, but referenced packages
4 5
5 info: fix querying of removed, but referenced packages 6Check that package name has packages associated with it before
6 7dereferencing the pointer. Fixes #345.
7 Check that package name has packages associated with it before 8---
8 dereferencing the pointer. Fixes #345. 9 src/info.c | 2 +-
10 1 files changed, 1 insertions(+), 1 deletions(-)
9 11
10diff --git a/src/info.c b/src/info.c 12diff --git a/src/info.c b/src/info.c
11index 7ca486c..d944fca 100644 13index 7ca486c..d944fca 100644
@@ -20,3 +22,6 @@ index 7ca486c..d944fca 100644
20 apk_error("Not found: %s", argv[i]); 22 apk_error("Not found: %s", argv[i]);
21 return 1; 23 return 1;
22 } 24 }
25--
261.7.1
27
diff --git a/main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch b/main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch
new file mode 100644
index 0000000000..2e20152ddf
--- /dev/null
+++ b/main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch
@@ -0,0 +1,42 @@
1From 47bac8c29c9a3c3fbebfd20e907170f24f9d677c Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Tue, 11 May 2010 09:31:20 +0000
4Subject: [PATCH 2/5] upgrade: reset versioned deps in world when doing upgrade -a
5
6Doing "apk add file.apk" adds a versioned dependency to allow
7downgrading, and sticky version. Most often this is to install
8single packages from newer repository. So it would make sense
9to reset them to non-versioned if doing:
10
11 apk upgrade -a
12
13fixes #346
14---
15 src/upgrade.c | 9 +++++++--
16 1 files changed, 7 insertions(+), 2 deletions(-)
17
18diff --git a/src/upgrade.c b/src/upgrade.c
19index f91e8cc..879e14c 100644
20--- a/src/upgrade.c
21+++ b/src/upgrade.c
22@@ -41,10 +41,15 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg
23 goto err;
24
25 for (i = 0; i < db->world->num; i++) {
26- r = apk_state_lock_dependency(state, &db->world->item[i]);
27+ struct apk_dependency *dep = &db->world->item[i];
28+ if (dep->version && (apk_flags & APK_PREFER_AVAILABLE)) {
29+ dep->result_mask = APK_VERSION_EQUAL | APK_VERSION_LESS | APK_VERSION_GREATER;
30+ dep->version = NULL;
31+ }
32+ r = apk_state_lock_dependency(state, dep);
33 if (r != 0) {
34 apk_error("Unable to upgrade '%s'",
35- db->world->item[i].name->name);
36+ dep->name->name);
37 goto err;
38 }
39 }
40--
411.7.1
42
diff --git a/main/apk-tools/0003-search-add-search-for-reverse-dependencies-in-index.patch b/main/apk-tools/0003-search-add-search-for-reverse-dependencies-in-index.patch
new file mode 100644
index 0000000000..f2947c635a
--- /dev/null
+++ b/main/apk-tools/0003-search-add-search-for-reverse-dependencies-in-index.patch
@@ -0,0 +1,221 @@
1From d9bf4aabff801164b4c54e51b38c5f6eab2da114 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
3Date: Wed, 19 May 2010 16:48:40 +0300
4Subject: [PATCH 3/5] search: add search for reverse dependencies in index
5
6So it'll be easier to rebuild affected packages. Fixes #349.
7---
8 src/search.c | 148 +++++++++++++++++++++++++++++++++++----------------------
9 1 files changed, 91 insertions(+), 57 deletions(-)
10
11diff --git a/src/search.c b/src/search.c
12index 91c2913..e5e5d55 100644
13--- a/src/search.c
14+++ b/src/search.c
15@@ -18,18 +18,14 @@
16 #include "apk_state.h"
17
18 struct search_ctx {
19- int (*action)(struct apk_database *db, int argc, char **argv);
20+ int (*match)(struct apk_package *pkg, const char *str);
21+ int (*print)(struct apk_package *pkg);
22+ int argc;
23+ char **argv;
24 };
25
26-struct search_query_ctx {
27- struct apk_database *db;
28- const char *query;
29-};
30-
31-static int search_list_print(apk_hash_item item, void *ctx)
32+static int print_match(struct apk_package *pkg)
33 {
34- struct apk_package *pkg = (struct apk_package *) item;
35-
36 printf("%s", pkg->name->name);
37 if (apk_verbosity > 0)
38 printf("-%s", pkg->version);
39@@ -41,61 +37,50 @@ static int search_list_print(apk_hash_item item, void *ctx)
40 return 0;
41 }
42
43-static int search_query_print(apk_hash_item item, void *ctx)
44+static int print_rdepends(struct apk_package *pkg)
45 {
46- struct search_query_ctx *ictx = (struct search_query_ctx *) ctx;
47- struct apk_package *pkg = (struct apk_package *) item;
48+ struct apk_name *name, *name0;
49+ struct apk_package *pkg0;
50+ struct apk_dependency *dep;
51+ int i, j, k;
52
53- if (fnmatch(ictx->query, pkg->name->name, 0) != 0)
54+ name = pkg->name;
55+ if (name->rdepends == NULL)
56 return 0;
57- search_list_print(item, ictx->db);
58-
59- return 0;
60-}
61-
62-static int search_list(struct apk_database *db, int argc, char **argv)
63-{
64- int i;
65- struct search_query_ctx ctx;
66-
67- ctx.db = db;
68
69- if (argc == 0)
70- apk_hash_foreach(&db->available.packages, search_list_print, db);
71- else
72- for (i=0; i<argc; i++) {
73- ctx.query = argv[i];
74- apk_hash_foreach(&db->available.packages, search_query_print, &ctx);
75+ printf("%s-%s:", pkg->name->name, pkg->version);
76+ for (i = 0; i < name->rdepends->num; i++) {
77+ name0 = name->rdepends->item[i];
78+ if (name0->pkgs == NULL)
79+ continue;
80+ for (j = 0; j < name0->pkgs->num; j++) {
81+ pkg0 = name0->pkgs->item[j];
82+ if (pkg0->depends == NULL)
83+ continue;
84+ for (k = 0; k < pkg0->depends->num; k++) {
85+ dep = &pkg0->depends->item[k];
86+ if (name == dep->name &&
87+ (apk_version_compare(pkg->version, dep->version)
88+ & dep->result_mask)) {
89+ printf(" %s-%s", pkg0->name->name, pkg0->version);
90+ }
91+ }
92 }
93+ }
94+ printf("\n");
95
96 return 0;
97 }
98
99-static int search_query_desc_print(apk_hash_item item, void *ctx)
100+static int search_pkgname(struct apk_package *pkg, const char *str)
101 {
102- struct search_query_ctx *ictx = (struct search_query_ctx *) ctx;
103- struct apk_package *pkg = (struct apk_package *) item;
104-
105- if( strstr(pkg->description, ictx->query) == NULL )
106- return 0;
107- search_list_print(item, ictx->db);
108-
109- return 0;
110+ return fnmatch(str, pkg->name->name, 0) == 0;
111 }
112
113-static int search_desc(struct apk_database *db, int argc, char **argv)
114+static int search_desc(struct apk_package *pkg, const char *str)
115 {
116- int i;
117- struct search_query_ctx ctx;
118-
119- ctx.db = db;
120-
121- for (i=0; i<argc; i++) {
122- ctx.query = argv[i];
123- apk_hash_foreach(&db->available.packages, search_query_desc_print, &ctx);
124- }
125-
126- return 0;
127+ return strstr(pkg->name->name, str) != NULL ||
128+ strstr(pkg->description, str) != NULL;
129 }
130
131 static int search_parse(void *ctx, struct apk_db_options *dbopts,
132@@ -105,7 +90,10 @@ static int search_parse(void *ctx, struct apk_db_options *dbopts,
133
134 switch (optch) {
135 case 'd':
136- ictx->action = search_desc;
137+ ictx->match = search_desc;
138+ break;
139+ case 'r':
140+ ictx->print = print_rdepends;
141 break;
142 default:
143 return -1;
144@@ -113,23 +101,69 @@ static int search_parse(void *ctx, struct apk_db_options *dbopts,
145 return 0;
146 }
147
148+static int match_packages(apk_hash_item item, void *ctx)
149+{
150+ struct search_ctx *ictx = (struct search_ctx *) ctx;
151+ struct apk_package *pkg = (struct apk_package *) item;
152+ int i;
153+
154+ for (i = 0; i < ictx->argc; i++)
155+ if (ictx->match(pkg, ictx->argv[i]))
156+ break;
157+ if (ictx->argc == 0 || i < ictx->argc)
158+ ictx->print(pkg);
159+
160+ return 0;
161+}
162+
163 static int search_main(void *ctx, struct apk_database *db, int argc, char **argv)
164 {
165 struct search_ctx *ictx = (struct search_ctx *) ctx;
166+ struct apk_name *name;
167+ int rc = 0, i, j, slow_search;
168+
169+ slow_search = ictx->match != NULL || argc == 0;
170+ if (!slow_search) {
171+ for (i = 0; i < argc; i++)
172+ if (strcspn(argv[i], "*?[") != strlen(argv[i])) {
173+ slow_search = 1;
174+ break;
175+ }
176+ }
177+
178+ if (ictx->match == NULL)
179+ ictx->match = search_pkgname;
180+ if (ictx->print == NULL)
181+ ictx->print = print_match;
182+ else if (argc == 0)
183+ return -1;
184
185- if (ictx->action != NULL)
186- return ictx->action(db, argc, argv);
187+ if (slow_search) {
188+ ictx->argc = argc;
189+ ictx->argv = argv;
190+ rc = apk_hash_foreach(&db->available.packages,
191+ match_packages, ictx);
192+ } else {
193+ for (i = 0; i < argc; i++) {
194+ name = apk_db_query_name(db, APK_BLOB_STR(argv[i]));
195+ if (name == NULL || name->pkgs == NULL)
196+ continue;
197+ for (j = 0; j < name->pkgs->num; j++)
198+ ictx->print(name->pkgs->item[j]);
199+ }
200+ }
201
202- return search_list(db, argc, argv);
203+ return rc;
204 }
205
206 static struct apk_option search_options[] = {
207- { 'd', "description", "Search also package descriptions" },
208+ { 'd', "description", "Search also package descriptions" },
209+ { 'r', "rdepends", "Print reverse dependencies of package" },
210 };
211
212 static struct apk_applet apk_search = {
213 .name = "search",
214- .help = "Search package names (and descriptions) by wildcard PATTERN.",
215+ .help = "Search package by PATTERNs or by indexed dependencies.",
216 .arguments = "PATTERN",
217 .open_flags = APK_OPENF_READ | APK_OPENF_NO_STATE,
218 .context_size = sizeof(struct search_ctx),
219--
2201.7.1
221
diff --git a/main/apk-tools/0001-package-don-t-leak-signing-key-file-fd.patch b/main/apk-tools/0004-package-don-t-leak-signing-key-file-fd.patch
index 6ff88a312c..818eeb1e79 100644
--- a/main/apk-tools/0001-package-don-t-leak-signing-key-file-fd.patch
+++ b/main/apk-tools/0004-package-don-t-leak-signing-key-file-fd.patch
@@ -1,7 +1,7 @@
1From fe55da70741621f7bac2cd943b64cc13e25f9427 Mon Sep 17 00:00:00 2001 1From fe55da70741621f7bac2cd943b64cc13e25f9427 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> 2From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
3Date: Wed, 26 May 2010 14:30:08 +0300 3Date: Wed, 26 May 2010 14:30:08 +0300
4Subject: [PATCH] package: don't leak signing key file fd 4Subject: [PATCH 4/5] package: don't leak signing key file fd
5 5
6openssl BIO does not close the fd unless we explicitly tell it to 6openssl BIO does not close the fd unless we explicitly tell it to
7do so. 7do so.
diff --git a/main/apk-tools/0005-cache-display-more-than-one-error.patch b/main/apk-tools/0005-cache-display-more-than-one-error.patch
new file mode 100644
index 0000000000..6e85218b18
--- /dev/null
+++ b/main/apk-tools/0005-cache-display-more-than-one-error.patch
@@ -0,0 +1,55 @@
1From d21303960544b5f11b7d69d0335f0903fb93d180 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Thu, 13 May 2010 09:26:19 +0000
4Subject: [PATCH 5/5] cache: display more than one error
5
6Display all packages that are bad in world rather than only first
7before exiting.
8---
9 src/cache.c | 15 ++++++++-------
10 1 files changed, 8 insertions(+), 7 deletions(-)
11
12diff --git a/src/cache.c b/src/cache.c
13index 85d9777..49a71fa 100644
14--- a/src/cache.c
15+++ b/src/cache.c
16@@ -30,7 +30,7 @@ static int cache_download(struct apk_database *db)
17 struct apk_package *pkg;
18 struct apk_repository *repo;
19 char item[PATH_MAX], cacheitem[PATH_MAX];
20- int i, r = 0;
21+ int i, r = 0, errors = 0;
22
23 if (db->world == NULL)
24 return 0;
25@@ -41,12 +41,13 @@ static int cache_download(struct apk_database *db)
26
27 for (i = 0; i < db->world->num; i++) {
28 r = apk_state_lock_dependency(state, &db->world->item[i]);
29- if (r != 0) {
30- apk_error("Unable to select version for '%s': %d",
31- db->world->item[i].name->name, r);
32- goto err;
33- }
34+ errors += r;
35+ if (r != 0)
36+ apk_error("Unable to select version for '%s'",
37+ db->world->item[i].name->name);
38 }
39+ if (errors)
40+ goto err;
41
42 list_for_each_entry(change, &state->change_list_head, change_list) {
43 pkg = change->newpkg;
44@@ -67,7 +68,7 @@ static int cache_download(struct apk_database *db)
45 err:
46 if (state != NULL)
47 apk_state_unref(state);
48- return r;
49+ return errors;
50 }
51
52 static int cache_clean(struct apk_database *db)
53--
541.7.1
55
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index 836494d51e..07b602dfaf 100644
--- a/main/apk-tools/APKBUILD
+++ b/main/apk-tools/APKBUILD
@@ -1,14 +1,17 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=apk-tools 2pkgname=apk-tools
3pkgver=2.0.2 3pkgver=2.0.2
4pkgrel=2 4pkgrel=6
5pkgdesc="Alpine Package Keeper - package manager for alpine" 5pkgdesc="Alpine Package Keeper - package manager for alpine"
6subpackages="$pkgname-static" 6subpackages="$pkgname-static"
7depends= 7depends=
8makedepends="zlib-dev openssl-dev pkgconfig" 8makedepends="zlib-dev openssl-dev pkgconfig"
9source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 9source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
10 info-segfault.patch 10 0001-info-fix-querying-of-removed-but-referenced-packages.patch
11 0001-package-don-t-leak-signing-key-file-fd.patch 11 0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch
12 0003-search-add-search-for-reverse-dependencies-in-index.patch
13 0004-package-don-t-leak-signing-key-file-fd.patch
14 0005-cache-display-more-than-one-error.patch
12 " 15 "
13 16
14 17
@@ -46,5 +49,8 @@ static() {
46} 49}
47 50
48md5sums="c87cb88f90eb8d7021d37e3b5386863d apk-tools-2.0.2.tar.bz2 51md5sums="c87cb88f90eb8d7021d37e3b5386863d apk-tools-2.0.2.tar.bz2
49aeab86a00119f9945edd6d3c3a8bb9c1 info-segfault.patch 52c590e894c2580cbb092b150fca9af3cf 0001-info-fix-querying-of-removed-but-referenced-packages.patch
50ac2ddef3f82f700c9eb536a54050cca6 0001-package-don-t-leak-signing-key-file-fd.patch" 535c53eaa29dd9722c25b6878cde392d05 0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch
546baca299fbf00b97f78fa8fbd0e82f5b 0003-search-add-search-for-reverse-dependencies-in-index.patch
55175470e6d5b2d20fe02d6fb61f8ec6d1 0004-package-don-t-leak-signing-key-file-fd.patch
560ab64b75b09f37b4d265df3f7b5b7e83 0005-cache-display-more-than-one-error.patch"