summaryrefslogtreecommitdiffstats
path: root/src/upgrade.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-06-25 11:09:40 +0300
committerTimo Teras <timo.teras@iki.fi>2009-06-25 11:09:40 +0300
commit3a488564753cee51832b6824128249a99eb4613b (patch)
treec246723a247f1ead91937b89a4eef0b047d72da2 /src/upgrade.c
parent4d04bd8a463262059d83f126e604914898de81e9 (diff)
downloadapk-tools-3a488564753cee51832b6824128249a99eb4613b.tar.bz2
apk-tools-3a488564753cee51832b6824128249a99eb4613b.tar.xz
upgrade: add --available option
That will make the upgrade prefer packages available in repositories. This is good if one want's to downgrade packages by removing an experimental repository. Or to force re-install of locally built vs. repository version when the package version are same, but checksum is different. Fixes #51.
Diffstat (limited to 'src/upgrade.c')
-rw-r--r--src/upgrade.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/upgrade.c b/src/upgrade.c
index 81a6d45..59a113d 100644
--- a/src/upgrade.c
+++ b/src/upgrade.c
@@ -16,6 +16,18 @@
#include "apk_database.h"
#include "apk_state.h"
+static int upgrade_parse(void *ctx, int optch, int optindex, const char *optarg)
+{
+ switch (optch) {
+ case 'a':
+ apk_flags |= APK_PREFER_AVAILABLE;
+ break;
+ default:
+ return -1;
+ }
+ return 0;
+}
+
static int upgrade_main(void *ctx, int argc, char **argv)
{
struct apk_database db;
@@ -45,9 +57,16 @@ err:
return r;
}
+static struct option upgrade_options[] = {
+ { "available", no_argument, NULL, 'a' },
+};
+
static struct apk_applet apk_upgrade = {
.name = "upgrade",
- .usage = "",
+ .usage = "[-a|--available]",
+ .num_options = ARRAY_SIZE(upgrade_options),
+ .options = upgrade_options,
+ .parse = upgrade_parse,
.main = upgrade_main,
};