From 35d4e92ab0ebcd79cb9906f83804f563dfb5ea0f Mon Sep 17 00:00:00 2001 From: glasseyes Date: Wed, 19 Sep 2018 23:08:26 +0700 Subject: [PATCH] [linux] set the version of keyman-config --- linux/keyman-config/Makefile | 29 ++++++++++--------- linux/keyman-config/README.md | 2 +- .../{version.py => version.py.in} | 2 +- linux/scripts/build.sh | 3 ++ linux/scripts/dist.sh | 26 +++-------------- linux/scripts/reconf.sh | 16 ++++++++-- 6 files changed, 39 insertions(+), 39 deletions(-) rename linux/keyman-config/keyman_config/{version.py => version.py.in} (89%) diff --git a/linux/keyman-config/Makefile b/linux/keyman-config/Makefile index 4695aa371d..c4e7869e94 100644 --- a/linux/keyman-config/Makefile +++ b/linux/keyman-config/Makefile @@ -1,8 +1,6 @@ #!/usr/bin/make -VERSION=`cat ../VERSION` - -default: man +default: clean version man python3 setup.py build install: # run as sudo @@ -30,21 +28,24 @@ uninstall: # run as sudo rm -f /usr/local/bin/km-package-uninstall clean: - -rm -rf dist make_deb build + -rm -rf dist make_deb build keyman_config/version.py -devdist: +devdist: version python3 setup.py egg_info -b.`TZ=UTC git log -1 --pretty=format:%cd --date=format-local:%Y%m%d%H%M` sdist -dist: clean +dist: clean version python3 setup.py sdist -deb: clean devdist man - -mkdir make_deb - cd make_deb && tar xf ../dist/keyman_config-$(VERSION).tar.gz && \ - mv keyman_config-$(VERSION) keyman-config-$(VERSION) && \ - tar cfz keyman-config_$(VERSION).orig.tar.gz keyman-config-$(VERSION) && \ - cd keyman-config-$(VERSION) && cp -a ../../debian . - cd make_deb/keyman-config-$(VERSION) && debuild -us -uc +deb: dist + VERSION=$(shell echo `basename dist/*.gz .tar.gz|cut -d "-" -f2` > /tmp/keyman_version) + @echo VERSION is $(shell cat /tmp/keyman_version) + @mkdir -p make_deb + cd make_deb && tar xf ../dist/keyman_config-$(shell cat /tmp/keyman_version).tar.gz && \ + mv keyman_config-$(shell cat /tmp/keyman_version) keyman-config-$(shell cat /tmp/keyman_version) && \ + tar cfz keyman-config_$(shell cat /tmp/keyman_version).orig.tar.gz keyman-config-$(shell cat /tmp/keyman_version) && \ + cd keyman-config-$(shell cat /tmp/keyman_version) && cp -a ../../debian . + cd make_deb/keyman-config-$(shell cat /tmp/keyman_version) && debuild -us -uc + rm /tmp/keyman_version man: mkdir -p debian/man @@ -55,3 +56,5 @@ man: help2man -N ./km-package-list-installed -o debian/man/km-package-list-installed.1 -n "List installed Keyman keyboard packages" -I maninc/km-package-list-installed.inc help2man -N ./km-package-uninstall -o debian/man/km-package-uninstall.1 -n "Uninstall a Keyman keyboard package" -I maninc/km-package-uninstall.inc +version: + cd .. && ./scripts/reconf.sh keyman-config diff --git a/linux/keyman-config/README.md b/linux/keyman-config/README.md index b82c9dbb17..7b1e45a13e 100644 --- a/linux/keyman-config/README.md +++ b/linux/keyman-config/README.md @@ -13,7 +13,7 @@ You will also need kmflcomp either from a package or built and installed locally run the script `./createkeymandirs.sh` to create the directories for these programs to install the packages to -### Installing manually +### Installing manually from the repo `make && sudo make install` will install locally to /usr/local `python3 setup.py --help install` will give you more install options diff --git a/linux/keyman-config/keyman_config/version.py b/linux/keyman-config/keyman_config/version.py.in similarity index 89% rename from linux/keyman-config/keyman_config/version.py rename to linux/keyman-config/keyman_config/version.py.in index ebc937c887..0a5697622a 100644 --- a/linux/keyman-config/keyman_config/version.py +++ b/linux/keyman-config/keyman_config/version.py.in @@ -4,4 +4,4 @@ # 1) we don't load dependencies by storing it in __init__.py # 2) we can import it in setup.py for the same reason # 3) we can import it into your module module -__version__ = '10.99.1' \ No newline at end of file +__version__ = "_VERSION_" \ No newline at end of file diff --git a/linux/scripts/build.sh b/linux/scripts/build.sh index 92227982ae..938d110396 100755 --- a/linux/scripts/build.sh +++ b/linux/scripts/build.sh @@ -54,6 +54,9 @@ done if [[ "${CONFIGUREONLY}" == "no" ]]; then cd keyman-config + if [ ! -f keyman_config/version.py ]; then + echo "The version of keyman-config has not been configured before building. First run 'make reconf'" + fi make clean make cd $BASEDIR diff --git a/linux/scripts/dist.sh b/linux/scripts/dist.sh index 68725c2086..c2de81ebbc 100755 --- a/linux/scripts/dist.sh +++ b/linux/scripts/dist.sh @@ -7,12 +7,10 @@ # origdist = create Debian orig.tar.gz # proj = only make tarball for this project -# this manages the release version for keyman-config -# so need to change this to get it from git -# using the function? - set -e +version + BASEDIR=`pwd` autotool_projects="kmflcomp libkmfl ibus-kmfl" extra_project="keyman-config" @@ -64,25 +62,9 @@ done # dist for keyman-config if [ "${extra_project}" == "keyman-config" ]; then - cd kmflcomp - baseversion=`cat VERSION` - echo "baseversion: ${baseversion}" - if [ -e configure ]; then - distversion=`./configure --version|grep kmfl|grep -Po 'kmflcomp configure \K[^a-z]*'` - else - distversion=`cat VERSION`.`TZ=UTC git log -1 --pretty=format:%cd --date=format-local:%Y%m%d%H%M` - fi - echo "distversion: ${distversion}" - - cd ../keyman-config + cd keyman-config rm -rf dist - if [ "${distversion}" == "${baseversion}" ]; then - python3 setup.py sdist - else - datever=${distversion##*.} - echo "datever: ${datever}" - python3 setup.py egg_info -b.${datever} sdist - fi + python3 setup.py sdist make man cp dist/*.tar.gz ../dist fi diff --git a/linux/scripts/reconf.sh b/linux/scripts/reconf.sh index 71c121e586..cb0ebbf5e9 100755 --- a/linux/scripts/reconf.sh +++ b/linux/scripts/reconf.sh @@ -15,23 +15,29 @@ set -e # maybe make it a function to get the minor number? JENKINS=${JENKINS:="no"} +oldvers=`cat VERSION` . $(dirname "$0")/version.sh version -oldvers=`cat VERSION` echo "version: ${newvers}" BASEDIR=`pwd` autotool_projects="kmflcomp libkmfl ibus-kmfl" +extra_project="keyman-config" if [ "$1" != "" ]; then - autotool_projects="$1" if [ ! -d "$1" ]; then echo "project $1 does not exist" exit 1 fi + if [ "$1" == "keyman-config" ]; then + autotool_projects="" + else + autotool_projects="$1" + extra_project="" + fi fi echo "${newvers}" > VERSION @@ -46,5 +52,11 @@ for proj in ${autotool_projects}; do fi done +if [ "${extra_project}" == "keyman-config" ]; then + cd keyman-config/keyman_config + sed "s/_VERSION_/${newvers}/g" version.py.in > version.py +fi +cd $BASEDIR + # reset VERSION file echo "${oldvers}" > VERSION