version: add support for version control suffixes

add cvs, svn, git and mercurial tags for creating snapshot
packages.
cute-signatures
Timo Teras 2009-11-06 13:29:58 +02:00
parent ff45ff3152
commit 4dd183f3c1
1 changed files with 8 additions and 3 deletions

View File

@ -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 int get_token(int *type, apk_blob_t *blob)
{ {
static const char *pre_suffixes[] = { "alpha", "beta", "pre", "rc" }; 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; int v = 0, i = 0, nt = TOKEN_INVALID;
if (blob->len <= 0) { if (blob->len <= 0) {
@ -112,10 +113,14 @@ static int get_token(int *type, apk_blob_t *blob)
v = v - ARRAY_SIZE(pre_suffixes); v = v - ARRAY_SIZE(pre_suffixes);
break; break;
} }
if (strncmp("p", blob->ptr, 1) == 0) { for (v = 0; v < ARRAY_SIZE(post_suffixes); v++) {
v = 1; i = strlen(post_suffixes[v]);
break; if (i <= blob->len &&
strncmp(post_suffixes[v], blob->ptr, i) == 0)
break;
} }
if (v < ARRAY_SIZE(post_suffixes))
break;
/* fallthrough: invalid suffix */ /* fallthrough: invalid suffix */
default: default:
*type = TOKEN_INVALID; *type = TOKEN_INVALID;