diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-02-28 14:56:08 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-02-28 14:56:08 +0200 |
commit | 2e8fe783a11bcd6ccc7f1a08d8b38eb76d87dc35 (patch) | |
tree | e0c267032223eb04182b37125fd4664d56a58e86 /src/add.c | |
parent | fd812dc722cad1bcdbf98799a036e94c88b1b9b0 (diff) | |
download | apk-tools-2e8fe783a11bcd6ccc7f1a08d8b38eb76d87dc35.tar.gz apk-tools-2e8fe783a11bcd6ccc7f1a08d8b38eb76d87dc35.tar.bz2 apk-tools-2e8fe783a11bcd6ccc7f1a08d8b38eb76d87dc35.tar.xz apk-tools-2e8fe783a11bcd6ccc7f1a08d8b38eb76d87dc35.zip |
add: allow specifying repository tag with added virtual packages
Diffstat (limited to 'src/add.c')
-rw-r--r-- | src/add.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -69,21 +69,31 @@ static int add_main(void *ctx, struct apk_database *db, int argc, char **argv) apk_dependency_array_copy(&world, db->world); if (actx->virtpkg) { + apk_blob_t b = APK_BLOB_STR(actx->virtpkg); + if (non_repository_check(db)) return -1; + apk_blob_pull_dep(&b, db, &virtdep); + if (APK_BLOB_IS_NULL(b) || + virtdep.result_mask != APK_DEPMASK_REQUIRE || + virtdep.version != &apk_null_blob) { + apk_error("%s: bad package specifier"); + return -1; + } + virtpkg = apk_pkg_new(); if (virtpkg == NULL) { apk_error("Failed to allocate virtual meta package"); return -1; } - virtpkg->name = apk_db_get_name(db, APK_BLOB_STR(actx->virtpkg)); + virtpkg->name = virtdep.name; apk_blob_checksum(APK_BLOB_STR(virtpkg->name->name), apk_checksum_default(), &virtpkg->csum); virtpkg->version = apk_blob_atomize(APK_BLOB_STR("0")); virtpkg->description = strdup("virtual meta package"); virtpkg->arch = apk_blob_atomize(APK_BLOB_STR("noarch")); - apk_dep_from_pkg(&virtdep, db, virtpkg); + virtpkg->repos |= db->repo_tags[virtdep.repository_tag].allowed_repos; virtpkg = apk_db_pkg_add(db, virtpkg); } |