diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-05-15 11:47:11 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-05-15 11:47:11 +0000 |
commit | 32064c35cf17379594f5185bb1cbebe228e32f3c (patch) | |
tree | 2d9b003b35ca2ecc27ca17edc3c61a43e8f38461 /src | |
parent | 7950a2b5a5c1d1da3698f53f520b0acc32ade224 (diff) | |
download | apk-tools-32064c35cf17379594f5185bb1cbebe228e32f3c.tar.gz apk-tools-32064c35cf17379594f5185bb1cbebe228e32f3c.tar.bz2 apk-tools-32064c35cf17379594f5185bb1cbebe228e32f3c.tar.xz apk-tools-32064c35cf17379594f5185bb1cbebe228e32f3c.zip |
add: create csum for virtuals. only add the virtual to world
Diffstat (limited to 'src')
-rw-r--r-- | src/add.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -40,6 +40,14 @@ static int add_parse(void *ctx, int optch, int optindex, const char *optarg) return 0; } +static void md5_str(const char *str, md5sum_t csum) +{ + struct md5_ctx ctx; + md5_init(&ctx); + md5_process(&ctx, str, strlen(str)); + md5_finish(&ctx, csum); +} + static int add_main(void *ctx, int argc, char **argv) { struct add_ctx *actx = (struct add_ctx *) ctx; @@ -61,6 +69,7 @@ static int add_main(void *ctx, int argc, char **argv) goto err; } virtpkg->name = apk_db_get_name(&db, APK_BLOB_STR(actx->virtpkg)); + md5_str(virtpkg->name->name, virtpkg->csum); virtpkg->version = strdup("0"); virtpkg->description = strdup("virtual meta package"); virtdep = (struct apk_dependency) { @@ -103,8 +112,10 @@ static int add_main(void *ctx, int argc, char **argv) apk_deps_add(&pkgs, &dep); } - if (virtpkg) + if (virtpkg) { apk_deps_add(&pkgs, &virtdep); + apk_deps_add(&db.world, &virtdep); + } state = apk_state_new(&db); for (i = 0; i < pkgs->num; i++) { @@ -113,7 +124,8 @@ static int add_main(void *ctx, int argc, char **argv) apk_error("Unable to install '%s'", pkgs->item[i].name->name); goto err; } - apk_deps_add(&db.world, &pkgs->item[i]); + if (!virtpkg) + apk_deps_add(&db.world, &pkgs->item[i]); } r = apk_state_commit(state, &db); err: |