Fix release parsing

This commit is contained in:
Lorenz Meier
2016-07-02 12:00:56 +02:00
parent 972a6f7be8
commit fd17c87eb4
+8 -7
View File
@@ -114,24 +114,25 @@ uint32_t version_tag_to_number(const char *tag)
/* this is a full version and we have enough digits */ /* this is a full version and we have enough digits */
return ver; return ver;
} else if (tag[i] == '-' && i > 3 && type == -1) { } else if (i > 3 && type == -1) {
/* scan until the first number */ /* scan until the first number */
const char *curr = &tag[i - 1]; const char *curr = &tag[i - 1];
// dev: v1.4.0rc3-7-g7e282f57 // dev: v1.4.0rc3-7-g7e282f57
// rc: v1.4.0rc4
while (curr >= &tag[0] && (*curr <= '0' || *curr >= '9')) { while (curr > &tag[0]) {
if (*curr == 'd') { if (*curr == 'v') {
type = FIRMWARE_TYPE_DEV; type = FIRMWARE_TYPE_DEV;
break; break;
} else if (*curr == 'a') { } else if (*curr == 'p') {
type = FIRMWARE_TYPE_ALPHA; type = FIRMWARE_TYPE_ALPHA;
break; break;
} else if (*curr == 'b') { } else if (*curr == 't') {
type = FIRMWARE_TYPE_BETA; type = FIRMWARE_TYPE_BETA;
break; break;
} else if (*curr == 'r') { } else if (*curr == 'r') {
type = FIRMWARE_TYPE_BETA; type = FIRMWARE_TYPE_RC;
break; break;
} }
curr--; curr--;
@@ -147,7 +148,7 @@ uint32_t version_tag_to_number(const char *tag)
} }
/* if the type is still uninitialized, check if there is a single dash in git describe */ /* if the type is still uninitialized, check if there is a single dash in git describe */
if (type == -1 && dashcount == 1) { if (type == -1 && dashcount == 0) {
type = FIRMWARE_TYPE_RELEASE; type = FIRMWARE_TYPE_RELEASE;
} else if (type == -1) { } else if (type == -1) {
type = FIRMWARE_TYPE_DEV; type = FIRMWARE_TYPE_DEV;