summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-11-06 13:29:58 +0200
committerTimo Teras <timo.teras@iki.fi>2009-11-06 13:29:58 +0200
commit4dd183f3c1cd093af0fc1382bd9d822423bbb748 (patch)
treefa3135134f4ef5970c931b660994b75ce80bf274
parentff45ff315294a853f5a65ae81e5a003d91f99d50 (diff)
downloadapk-tools-4dd183f3c1cd093af0fc1382bd9d822423bbb748.tar.gz
apk-tools-4dd183f3c1cd093af0fc1382bd9d822423bbb748.tar.bz2
apk-tools-4dd183f3c1cd093af0fc1382bd9d822423bbb748.tar.xz
apk-tools-4dd183f3c1cd093af0fc1382bd9d822423bbb748.zip
version: add support for version control suffixes
add cvs, svn, git and mercurial tags for creating snapshot packages.
-rw-r--r--src/version.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/version.c b/src/version.c
index 8ac7024..34c5f1a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -73,6 +73,7 @@ static void next_token(int *type, apk_blob_t *blob)
static int get_token(int *type, apk_blob_t *blob)
{
static const char *pre_suffixes[] = { "alpha", "beta", "pre", "rc" };
+ static const char *post_suffixes[] = { "cvs", "svn", "git", "hg", "p" };
int v = 0, i = 0, nt = TOKEN_INVALID;
if (blob->len <= 0) {
@@ -112,10 +113,14 @@ static int get_token(int *type, apk_blob_t *blob)
v = v - ARRAY_SIZE(pre_suffixes);
break;
}
- if (strncmp("p", blob->ptr, 1) == 0) {
- v = 1;
- break;
+ for (v = 0; v < ARRAY_SIZE(post_suffixes); v++) {
+ i = strlen(post_suffixes[v]);
+ if (i <= blob->len &&
+ strncmp(post_suffixes[v], blob->ptr, i) == 0)
+ break;
}
+ if (v < ARRAY_SIZE(post_suffixes))
+ break;
/* fallthrough: invalid suffix */
default:
*type = TOKEN_INVALID;