fix(linux): Improve version number

This change modifies the reported version number for km-config:
if km-config is installed from a debian package, the package
version will be output as well, e.g.:
`km-config version 14.0.252-beta (package version 14.0.252-1+bionic1)`

Otherwise the output will be identical to before:
`km-config version 14.0.252-beta-local`.

This change also modifies the script that sets the version number so
that builds on Jenkins are now detected in addition to TC.

This fixes #4579.
This commit is contained in:
Eberhard Beilharz 2021-03-03 19:13:20 +01:00
parent 194b6cd054
commit 33bf5750b0
No known key found for this signature in database
GPG key ID: 64A39A9E98B53105
7 changed files with 18 additions and 5 deletions

7
linux/.gitignore vendored
View file

@ -90,3 +90,10 @@ keyman-config/keyman_config/version.py
keyman-config/locale/*/LC_MESSAGES/
test.sh
debianpackage/
*.deb
*.build
*.buildinfo
*.changes
*.tar.xz
*.tar.gz
*.dsc

View file

@ -9,6 +9,7 @@ export PYBUILD_INSTALL_ARGS=--install-scripts=/usr/share/keyman-config/
override_dh_auto_build:
make man
sed -i -e "s/^__pkgversion__ = \"\"/__pkgversion__ = \"$(shell dpkg-parsechangelog --show-field Version)\"/g" keyman_config/version.py
make compile-po
dh_auto_build $@

View file

@ -9,6 +9,7 @@ from .version import __versionwithtag__
from .version import __majorversion__
from .version import __releaseversion__
from .version import __tier__
from .version import __pkgversion__
def _(txt):

View file

@ -9,3 +9,4 @@ __versionwithtag__ = "_VERSIONWITHTAG_"
__majorversion__ = "_MAJORVERSION_"
__releaseversion__ = "_RELEASEVERSION_"
__tier__ = "_TIER_"
__pkgversion__ = ""

View file

@ -3,13 +3,17 @@
import argparse
import logging
from keyman_config import __versionwithtag__
from keyman_config import __versionwithtag__, __pkgversion__
from keyman_config.handle_install import download_and_install_package
if __name__ == '__main__':
if __pkgversion__:
versionstring = "%s (package version %s)" % (__versionwithtag__, __pkgversion__)
else:
versionstring = "%s" % __versionwithtag__
parser = argparse.ArgumentParser(description='Keyman keyboards installation and information')
parser.add_argument('--version', action='version', version='%(prog)s version ' + __versionwithtag__)
parser.add_argument('--version', action='version', version='%(prog)s version ' + versionstring)
parser.add_argument('-v', '--verbose', action='store_true', help='verbose logging')
parser.add_argument('-vv', '--veryverbose', action='store_true', help='very verbose logging')
parser.add_argument('-i', '--install', action='store', nargs='?', help='install .kmp package')

View file

@ -61,7 +61,6 @@ for proj in ${projects}; do
cd ${proj}-${version}
echo $(pwd)
cp debian/changelog ../${proj}-changelog
#TODO separate source builds and dputs for each of $dists?
for dist in ${distributions}; do
cp ../${proj}-changelog debian/changelog
dch -v ${version}-${packageversion}~${dist} "source package for PPA"

View file

@ -73,12 +73,12 @@ function findVersion() {
VERSION_TAG=
fi
if [ -z "${TEAMCITY_VERSION-}" ]; then
if [ -z "${TEAMCITY_VERSION-}" -a -z "${JENKINS_HOME-}" ]; then
# Local dev machine, not TeamCity
VERSION_TAG="$VERSION_TAG-local"
VERSION_ENVIRONMENT=local
else
# On TeamCity; are we running a pull request build or a master/beta/stable build?
# On TeamCity: are we running a pull request build or a master/beta/stable build?
if [ ! -z "${TEAMCITY_PR_NUMBER-}" ]; then
VERSION_ENVIRONMENT=test
# Note TEAMCITY_PR_NUMBER can also be 'master', 'beta', or 'stable-x.y'