diff options
author | Timo Teräs <timo.teras@iki.fi> | 2020-10-06 14:23:14 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2020-10-06 14:27:59 +0300 |
commit | 3fae0c693fa58a8e154a1d3b47497538b6230655 (patch) | |
tree | f3f0f420d2d795c5de678a52a6e420fd1a030534 | |
parent | 7158474f1ba2bd24c6a9b2b1bbd53984414c0343 (diff) | |
download | apk-tools-3fae0c693fa58a8e154a1d3b47497538b6230655.tar.gz apk-tools-3fae0c693fa58a8e154a1d3b47497538b6230655.tar.bz2 apk-tools-3fae0c693fa58a8e154a1d3b47497538b6230655.tar.xz apk-tools-3fae0c693fa58a8e154a1d3b47497538b6230655.zip |
db: make the --repositories-file change more announced
Document the version when changed. And print error with similar note
if the given repositories-file cannot be read.
-rw-r--r-- | doc/apk.8.scd | 5 | ||||
-rw-r--r-- | src/database.c | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/doc/apk.8.scd b/doc/apk.8.scd index 4f087c6..0ca26b1 100644 --- a/doc/apk.8.scd +++ b/doc/apk.8.scd @@ -156,8 +156,9 @@ The following options are available for all commands. *--repositories-file* _REPOFILE_ Override system repositories, see *apk-repositories*(8). Specifying this - option override the normal repositories file and repositories.d directory - processing. + option overrides the normal repositories file and repositories.d directory + processing. The given _REPOFILE_ is relative to the startup directory since + apk 2.12.0_rc2. *--wait* _TIME_ Wait for TIME seconds to get an exclusive repository lock before diff --git a/src/database.c b/src/database.c index e5d8b86..22004bc 100644 --- a/src/database.c +++ b/src/database.c @@ -1406,15 +1406,19 @@ static int add_repos_from_file(void *ctx, int dirfd, const char *file) struct apk_database *db = (struct apk_database *) ctx; apk_blob_t blob; - if (dirfd != db->root_fd) { + if (dirfd != AT_FDCWD && dirfd != db->root_fd) { /* loading from repositories.d; check extension */ if (!file_ends_with_dot_list(file)) return 0; } blob = apk_blob_from_file(dirfd, file); - if (APK_BLOB_IS_NULL(blob)) - return 0; + if (APK_BLOB_IS_NULL(blob)) { + if (dirfd != AT_FDCWD) return 0; + apk_error("failed to read repositories: %s", file); + apk_message("NOTE: --repositories-file is relative to the startup directory since apk 2.12.0_rc2"); + return -ENOENT; + } apk_blob_for_each_segment(blob, "\n", apk_db_add_repository, db); free(blob.ptr); |