diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-01-16 14:37:08 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-01-16 14:37:08 +0000 |
commit | 29001470706fd1112161e294adf3c780e9083977 (patch) | |
tree | 02a3175fc2f4cf94bae721d4ff6e486f9766c001 | |
parent | cf08b748099f6249e81e8e34e576fbb7ffd59650 (diff) | |
parent | edfaac3099a8a2b641523e3f0c9372d0f14f1429 (diff) | |
download | apk-tools-29001470706fd1112161e294adf3c780e9083977.tar.gz apk-tools-29001470706fd1112161e294adf3c780e9083977.tar.bz2 apk-tools-29001470706fd1112161e294adf3c780e9083977.tar.xz apk-tools-29001470706fd1112161e294adf3c780e9083977.zip |
Merge branch 'master' of ssh://dev.alpinelinux.org/gitroot/apk-tools
-rw-r--r-- | src/database.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/database.c b/src/database.c index 4366223..a84f2e6 100644 --- a/src/database.c +++ b/src/database.c @@ -645,15 +645,6 @@ int apk_db_open(struct apk_database *db, const char *root) free(db->root); return -errno; } - - if (apk_repos == NULL) - apk_repos = "/etc/apk/repositories"; - blob = apk_blob_from_file(apk_repos); - if (!APK_BLOB_IS_NULL(blob)) { - apk_blob_for_each_segment(blob, "\n", - apk_db_add_repository, db); - free(blob.ptr); - } } blob = APK_BLOB_STR("etc:-etc/init.d"); @@ -663,6 +654,19 @@ int apk_db_open(struct apk_database *db, const char *root) if (r != 0) return r; + if (root != NULL) { + if (apk_repos == NULL) + apk_repos = "/etc/apk/repositories"; + blob = apk_blob_from_file(apk_repos); + if (!APK_BLOB_IS_NULL(blob)) { + r = apk_blob_for_each_segment(blob, "\n", + apk_db_add_repository, db); + free(blob.ptr); + if (r != 0) + return r; + } + } + if (apk_repository != NULL) apk_db_add_repository(db, APK_BLOB_STR(apk_repository)); |