diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-01-12 10:27:09 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-01-12 10:27:09 +0200 |
commit | 2372692660c80e79f1161f6ea99dd5eeea60a6d4 (patch) | |
tree | dc5a20313156fd48d586754dde916c98463436cb /src | |
parent | 1de86529a9a35e3dbd2927e54254ad39c4aacd95 (diff) | |
download | apk-tools-2372692660c80e79f1161f6ea99dd5eeea60a6d4.tar.gz apk-tools-2372692660c80e79f1161f6ea99dd5eeea60a6d4.tar.bz2 apk-tools-2372692660c80e79f1161f6ea99dd5eeea60a6d4.tar.xz apk-tools-2372692660c80e79f1161f6ea99dd5eeea60a6d4.zip |
add: fail if repository tag does not exist
Diffstat (limited to 'src')
-rw-r--r-- | src/add.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -107,13 +107,21 @@ static int add_main(void *ctx, struct apk_database *db, int argc, char **argv) } apk_dep_from_pkg(&dep, db, pkg); } else { + struct apk_repository_tag *tag; apk_blob_t b = APK_BLOB_STR(argv[i]); + apk_blob_pull_dep(&b, db, &dep); if (APK_BLOB_IS_NULL(b)) { - apk_error("'%s' is not a valid dependency, format is name(@tag)([<>=]version)", + apk_error("'%s' is not a valid dependency, format is name(@tag)([<>=]version)", argv[i]); return -1; } + tag = &db->repo_tags[dep.repository_tag]; + if (!tag->allowed_repos) { + apk_error("Repository tag '" BLOB_FMT "' is not defined", + BLOB_PRINTF(*tag->name)); + return -1; + } } if (virtpkg == NULL) { |