summaryrefslogtreecommitdiff
path: root/src/version.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-06-16 09:59:21 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-06-16 09:59:21 +0000
commit20a1217e866f9fe15c4de3ed28144084509e4ffa (patch)
tree2bc0c87439ef575dfd565fc081a51d501f4737ce /src/version.c
parentd8b1b851c713937bdb1a756f9419e3f97516d479 (diff)
downloadapk-tools-20a1217e866f9fe15c4de3ed28144084509e4ffa.tar.gz
apk-tools-20a1217e866f9fe15c4de3ed28144084509e4ffa.tar.bz2
apk-tools-20a1217e866f9fe15c4de3ed28144084509e4ffa.tar.xz
apk-tools-20a1217e866f9fe15c4de3ed28144084509e4ffa.zip
add: support for forced versions
Support version numbers specified with packages. For example: apk add 'busybox<1.14' apk add 'squid=>3.0'
Diffstat (limited to 'src/version.c')
-rw-r--r--src/version.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/version.c b/src/version.c
index 57437aa..c270f68 100644
--- a/src/version.c
+++ b/src/version.c
@@ -146,6 +146,24 @@ const char *apk_version_op_string(int mask)
}
}
+int apk_version_result_mask(const char *str)
+{
+ int r = 0;
+ switch (*str) {
+ case '<':
+ r = APK_VERSION_LESS;
+ str++;
+ break;
+ case '>':
+ r = APK_VERSION_GREATER;
+ str++;
+ break;
+ }
+ if (*str == '=')
+ r |= APK_VERSION_EQUAL;
+ return r;
+}
+
int apk_version_validate(apk_blob_t ver)
{
int t = TOKEN_DIGIT;