diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-01-16 13:59:36 +0200 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-01-16 13:59:36 +0200 |
commit | 3e6fc1389f1cdd06bf18b8fd6cd741c8b9e3e1f2 (patch) | |
tree | c152bd82b0fbb5e573a944534d670a54a5a3bbc6 /src/add.c | |
parent | 6354a278883161704c7f8650a3bdde77f163c6ad (diff) | |
download | apk-tools-3e6fc1389f1cdd06bf18b8fd6cd741c8b9e3e1f2.tar.gz apk-tools-3e6fc1389f1cdd06bf18b8fd6cd741c8b9e3e1f2.tar.bz2 apk-tools-3e6fc1389f1cdd06bf18b8fd6cd741c8b9e3e1f2.tar.xz apk-tools-3e6fc1389f1cdd06bf18b8fd6cd741c8b9e3e1f2.zip |
add: --upgrade|-u to control if upgrading is preferred or not
Diffstat (limited to 'src/add.c')
-rw-r--r-- | src/add.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -14,7 +14,7 @@ #include "apk_applet.h" #include "apk_database.h" -#define FLAG_INITDB 0x001 +#define FLAG_INITDB 0x0001 struct add_ctx { unsigned int flags; @@ -28,6 +28,9 @@ static int add_parse(void *ctx, int optch, int optindex, const char *optarg) case 0x10000: actx->flags |= FLAG_INITDB; break; + case 'u': + apk_upgrade = 1; + break; default: return -1; } @@ -73,8 +76,8 @@ static int add_main(void *ctx, int argc, char **argv) dep = (struct apk_dependency) { .name = pkg->name, - .version_mask = APK_VERSION_RESULT_MASK(APK_VERSION_EQUAL), - .version = pkg->version, + .min_version = pkg->version, + .max_version = pkg->version, }; } else { dep = (struct apk_dependency) { @@ -91,11 +94,12 @@ err: static struct option add_options[] = { { "initdb", no_argument, NULL, 0x10000 }, + { "upgrade", no_argument, NULL, 'u' }, }; static struct apk_applet apk_add = { .name = "add", - .usage = "[--initdb] apkname...", + .usage = "[--initdb] [--upgrade|-u] apkname...", .context_size = sizeof(struct add_ctx), .num_options = ARRAY_SIZE(add_options), .options = add_options, |