Make deb package versions a bit smarter
This commit is contained in:
parent
bc413b6dae
commit
2793090d07
3
Makefile
3
Makefile
@ -229,8 +229,7 @@ deb: kuroko libkuroko.so
|
||||
--license "MIT" \
|
||||
--category "devel" \
|
||||
-d "libc6 (>= $(LIBCMIN))" \
|
||||
--version $(VERSION) \
|
||||
--iteration 0 \
|
||||
--version $(shell ./kuroko tools/deb-ver.krk) \
|
||||
--directories $(libdir)/kuroko
|
||||
rm -r $(DESTDIR)
|
||||
|
||||
|
26
tools/deb-ver.krk
Normal file
26
tools/deb-ver.krk
Normal file
@ -0,0 +1,26 @@
|
||||
'''
|
||||
Generates a version string suitable for a Debian package
|
||||
'''
|
||||
|
||||
import kuroko
|
||||
import os
|
||||
|
||||
let version = kuroko.hexversion
|
||||
|
||||
# Extract version number components
|
||||
let major = (version >> 24) & 0xFF
|
||||
let minor = (version >> 16) & 0xFF
|
||||
let patch = (version >> 8) & 0xFF
|
||||
let level = (version >> 4) & 0xF
|
||||
let serial = version & 0xF
|
||||
|
||||
# Map prerelease levels to strings
|
||||
let levels = {0xa: 'a', 0xb: 'b', 0xc: 'rc'}
|
||||
level = f'~{levels.get(level)}{serial}' if level in levels else ''
|
||||
|
||||
# Figure out what the package revision number should be;
|
||||
# set this if you want something other than 1.
|
||||
let revision = os.environ.get('KRK_PACKAGE_REVISION','1')
|
||||
|
||||
# Print a final version number
|
||||
print(f'{major}.{minor}.{patch}{level}-{revision}')
|
Loading…
Reference in New Issue
Block a user