Adjust the Template
Learn how to adjust APKBUILD templates that have been generated by newapkbuild.
We'll cover the following...
Preface
Let’s continue from our previous lesson. After newapkbuild is run, the following APKBUILD gets generated:
# Contributor:# Maintainer:pkgname=guesser-gamepkgver=0.1.0pkgrel=0pkgdesc="An easy funny game, which the computer will guess the number you have in mind"url="https://github.com/mwpnava/Python-Code/tree/master/My_own_Python_package"arch="all"license="MIT"depends="python3"makedepends="py3-setuptools"checkdepends="py3-pytest"install=""subpackages="$pkgname-dev $pkgname-doc"source="https://files.pythonhosted.org/packages/f6/1d/eab54180ecc38b0d58491ec1015a313c56f3d3d0676610de02fe130eadd7/guesser_game-$pkgver.tar.gz"builddir="$srcdir/"build() {python3 setup.py build}check() {pytest}package() {python3 setup.py install --prefix=/usr --root="$pkgdir"}
We now have to adjust parts of the APKBUILD for it to correctly generate an .apk package for us. The easiest way to do this is by checking if the package simply gets built when we run the following command to generate the .apk package:
abuild -r
Run the command above in the terminal below:
As we can see, the build fails with the following error message:
====================================== test session starts ======================================platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-0.13.1rootdir: /src/guesser-game/src/guesser_game-0.1.0collected 0 items===================================== no tests ran in 0.01s =====================================>>> ERROR: guesser-game: check failed
Apparently, guesser-game has no tests, so the check() phase of the APKBUILD fails to run. We can fix this by removing the check() function from the APKBUILD and adding options="!check" to it. This ensures abuild doesn’t try to run any nonexistent tests. We can try this by running the following command again:
# Add options="!check" to the variable section of the APKBUILD first:nano APKBUILDabuild -r
Run ...