summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-01-16 14:09:52 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-01-16 14:09:52 +0000
commitcf08b748099f6249e81e8e34e576fbb7ffd59650 (patch)
treee0693fe7e247bdf94010b7590fddcf0c1dae14bc
parent61341384b338e4591eba1c3caa823b0582f47259 (diff)
parent82b9cb31fd6bbddc5878cc5bbebdf04b7f2d5649 (diff)
downloadapk-tools-cf08b748099f6249e81e8e34e576fbb7ffd59650.tar.gz
apk-tools-cf08b748099f6249e81e8e34e576fbb7ffd59650.tar.bz2
apk-tools-cf08b748099f6249e81e8e34e576fbb7ffd59650.tar.xz
apk-tools-cf08b748099f6249e81e8e34e576fbb7ffd59650.zip
Merge branch 'master' of ssh://dev.alpinelinux.org/gitroot/apk-tools
-rw-r--r--src/database.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/database.c b/src/database.c
index 92b87b7..4366223 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1076,7 +1076,7 @@ int apk_db_install_pkg(struct apk_database *db,
struct install_ctx ctx;
csum_t csum;
char file[256];
- int r;
+ int r, i;
if (fchdir(db->root_fd) < 0)
return errno;
@@ -1097,9 +1097,20 @@ int apk_db_install_pkg(struct apk_database *db,
/* Install the new stuff */
if (newpkg->filename == NULL) {
+ for (i = 0; i < APK_MAX_REPOS; i++)
+ if (newpkg->repos & BIT(i))
+ break;
+
+ if (i >= APK_MAX_REPOS) {
+ apk_error("%s-%s: not present in any repository",
+ newpkg->name->name, newpkg->version);
+ return -1;
+ }
+
snprintf(file, sizeof(file),
"%s/%s-%s.apk",
- db->repos[0].url, newpkg->name->name, newpkg->version);
+ db->repos[i].url,
+ newpkg->name->name, newpkg->version);
bs = apk_bstream_from_url(file);
} else
bs = apk_bstream_from_file(newpkg->filename);