summaryrefslogtreecommitdiff
path: root/org.handhelds.familiar/packages/familiar/familiar-version.bb
blob: ba1c73afee6de458c1fb7302f24a2b98a104ee63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
PACKAGE_ARCH = "all"

def get_sanitized_version(s):

	max_version_component = "99"
	pre_separators = ["-rc", "-pre"]

	ver = s

	for sep in pre_separators:
		if not sep in s:
			continue

		version = s.split(sep)[0][1:]
		vcomps = version.split(".")
		vcomps.reverse()

		vcomps_new = []
		done = False
		for i in vcomps:
			if done:
				vcomps_new.insert(0, i)
				continue
			if int(i) < 1:
				vcomps_new.insert(0, max_version_component)
				continue
			vcomps_new.insert(0, "%i" % (int(i) - 1))
			done = True

		ver = "v" + ".".join(vcomps_new) + "+" +  s.replace("-", "")
	
	return ver

PV = "${@get_sanitized_version(bb.data.getVar('DISTRO_VERSION', d, 1))}"

do_install() {
	mkdir -p ${D}${sysconfdir}
	echo "Familiar ${DISTRO_VERSION}" > ${D}${sysconfdir}/familiar-version
}