Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
libpkg: add a snap(shot) version prefix
Kyle Evans committed 5 years ago
commit 42576dc870db2e099dee595a480d8de879ab1d90
parent 5334500
2 files changed +11 -6
modified libpkg/pkg_version.c
@@ -149,11 +149,13 @@ static const struct stage {
	size_t namelen;
	int value;
} stages[] = {
-
	{ "pl",    2,  0        },
-
	{ "alpha", 5, 'a'-'a'+1 },
-
	{ "beta",  4, 'b'-'a'+1 },
-
	{ "pre",   3, 'p'-'a'+1 },
-
	{ "rc",    2, 'r'-'a'+1 },
+
	{ "pl",    2,  0            },
+
	{ "snap",  4,  1            },
+
#define	ABASE	2	/* Last special early-sorted prefix + 1 */
+
	{ "alpha", 5, 'a'-'a'+ABASE },
+
	{ "beta",  4, 'b'-'a'+ABASE },
+
	{ "pre",   3, 'p'-'a'+ABASE },
+
	{ "rc",    2, 'r'-'a'+ABASE },
};

static const char *
@@ -216,7 +218,7 @@ get_component(const char *position, version_component *component)
		/* unhandled above */
		if (c) {
			/* use the first letter and skip following */
-
			component->a = c - 'a' + 1;
+
			component->a = c - 'a' + ABASE;
			do {
				++pos;
			} while (isalpha(*pos));
modified tests/frontend/version.sh
@@ -17,6 +17,9 @@ version_body() {
	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.beta1 1.pre1
	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.pre1 1.rc1
	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.rc1 1
+

+
	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.pl1 1.snap1
+
	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.snap1 1.alpha1
}

compare_body() {