Merge branch 'master' of ssh://dev.alpinelinux.org/gitroot/apk-tools

cute-signatures
Natanael Copa 2009-01-16 14:09:52 +00:00
commit cf08b74809
1 changed files with 13 additions and 2 deletions

View File

@ -1076,7 +1076,7 @@ int apk_db_install_pkg(struct apk_database *db,
struct install_ctx ctx; struct install_ctx ctx;
csum_t csum; csum_t csum;
char file[256]; char file[256];
int r; int r, i;
if (fchdir(db->root_fd) < 0) if (fchdir(db->root_fd) < 0)
return errno; return errno;
@ -1097,9 +1097,20 @@ int apk_db_install_pkg(struct apk_database *db,
/* Install the new stuff */ /* Install the new stuff */
if (newpkg->filename == NULL) { 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), snprintf(file, sizeof(file),
"%s/%s-%s.apk", "%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); bs = apk_bstream_from_url(file);
} else } else
bs = apk_bstream_from_file(newpkg->filename); bs = apk_bstream_from_file(newpkg->filename);