diff options
author | Sören Tempel <soeren+git@soeren-tempel.net> | 2019-09-23 22:00:05 +0200 |
---|---|---|
committer | Sören Tempel <soeren+git@soeren-tempel.net> | 2019-09-23 22:01:08 +0200 |
commit | 9cd253251a5e91dc33b258dcf618dae804183993 (patch) | |
tree | b0cb506ece008a1c8a0e5bab97e8f78af8cd2b2e /testing/hy | |
parent | 53780266cbbe881545922dcf255a5cf7af526f41 (diff) | |
download | aports-9cd253251a5e91dc33b258dcf618dae804183993.tar.bz2 aports-9cd253251a5e91dc33b258dcf618dae804183993.tar.xz |
testing/hy: use upstream patch for get_version.py
Diffstat (limited to 'testing/hy')
-rw-r--r-- | testing/hy/0001-get_version.py-allow-specifying-version-in-environme.patch | 51 | ||||
-rw-r--r-- | testing/hy/APKBUILD | 12 |
2 files changed, 57 insertions, 6 deletions
diff --git a/testing/hy/0001-get_version.py-allow-specifying-version-in-environme.patch b/testing/hy/0001-get_version.py-allow-specifying-version-in-environme.patch new file mode 100644 index 0000000000..6c09b38537 --- /dev/null +++ b/testing/hy/0001-get_version.py-allow-specifying-version-in-environme.patch @@ -0,0 +1,51 @@ +From 31041f1713f9a22176b3610a9b619db52004ddb0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> +Date: Mon, 23 Sep 2019 20:35:48 +0200 +Subject: [PATCH] get_version.py: allow specifying version in environment + variable + +While packaging hy for Alpine Linux I noticed that the VERSIONFILE is +ignored if hy is build in a git repository. On Alpine the packages are +build in the package repository resulting in a wrong hy version. This +change allows specifying the version in an environment variable which is +preferred over git-describe(1) and the VERSIONFILE. +--- + get_version.py | 27 +++++++++++++++------------ + 1 file changed, 15 insertions(+), 12 deletions(-) + +diff --git a/get_version.py b/get_version.py +index 759336d..9224f59 100644 +--- a/get_version.py ++++ b/get_version.py +@@ -5,16 +5,19 @@ import os, subprocess, runpy + os.chdir(os.path.split(os.path.abspath(__file__))[0]) + VERSIONFILE = os.path.join("hy", "version.py") + +-try: +- __version__ = (subprocess.check_output +- (["git", "describe", "--tags", "--dirty"]) +- .decode('ASCII').strip() +- .replace('-', '+', 1).replace('-', '.')) +- with open(VERSIONFILE, "wt") as o: +- o.write("__version__ = {!r}\n".format(__version__)) ++if "HY_VERSION" in os.environ: ++ __version__ = os.environ["HY_VERSION"] ++else: ++ try: ++ __version__ = (subprocess.check_output ++ (["git", "describe", "--tags", "--dirty"]) ++ .decode('ASCII').strip() ++ .replace('-', '+', 1).replace('-', '.')) ++ with open(VERSIONFILE, "wt") as o: ++ o.write("__version__ = {!r}\n".format(__version__)) + +-except (subprocess.CalledProcessError, OSError): +- if os.path.exists(VERSIONFILE): +- __version__ = runpy.run_path(VERSIONFILE)['__version__'] +- else: +- __version__ = "unknown" ++ except (subprocess.CalledProcessError, OSError): ++ if os.path.exists(VERSIONFILE): ++ __version__ = runpy.run_path(VERSIONFILE)['__version__'] ++ else: ++ __version__ = "unknown" diff --git a/testing/hy/APKBUILD b/testing/hy/APKBUILD index e12239ade6..351cf9c369 100644 --- a/testing/hy/APKBUILD +++ b/testing/hy/APKBUILD @@ -11,12 +11,12 @@ depends="python3 py3-funcparserlib py3-astor py3-rply py3-clint" makedepends="py3-setuptools" checkdepends="python3-tests py3-pytest py3-pytest-runner py3-setuptools py3-tox" source="$pkgname-$pkgver.tar.gz::https://github.com/hylang/$pkgname/archive/$pkgver.tar.gz - do-not-invoke-git-describe.patch" + 0001-get_version.py-allow-specifying-version-in-environme.patch" -prepare() { - default_prepare - echo "__version__ = '$pkgver'" > "$builddir"/hy/version.py -} +# By default setup.py tries to determine the hy version using +# git-describe(1). Unfourtunatly, this will return the version +# of the aports repository on Alpine. +export HY_VERSION="$pkgver" build() { python3 setup.py build @@ -37,4 +37,4 @@ package() { } sha512sums="18601bf47df2120f8833a1ae211c416dc90825f31cd50b259adfe0585089a623d0fea13512b2935b093e14d8595c93bc1610939d5f1d664f6acf7ddf7e341542 hy-0.17.0.tar.gz -75256a4f35f97b71abc0bf111bfd6c7d7a4173dde346fb293eceecbc8fe3c550c00265625663f446771b8336711e8821da1179dc32da32d10c85a802d190efff do-not-invoke-git-describe.patch" +4676ff5b4a48f6b3aff7667688a6eca96419fc6c61deb66b53d94b1a4618460f9274b6380c20b3182827474aa9b6158864eadc803cb400557a23fc6150344d2b 0001-get_version.py-allow-specifying-version-in-environme.patch" |