From 216021b633b79789c256a0a724cca53448d477e5 Mon Sep 17 00:00:00 2001 From: DarkFeather Date: Fri, 10 May 2019 16:21:14 -0500 Subject: [PATCH] Shifting tracking of package metadata mostly to git; cleaning depends; efficiency update in testing --- .gitignore | 2 +- Makefile | 8 +++++--- PKGBUILD | 30 ++++++++++++++---------------- README | 2 ++ tests/test_unit.py | 8 +++----- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index d690fe7..10a053b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ HelloWorld HelloWorld.class HelloWorld.exe -tests/__pycache__/* +tests/__pycache__ *.tar.xz pkg/ src/ diff --git a/Makefile b/Makefile index 10e1628..6b946e3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ -compile: c cs java bash php perl python pkgdirname != basename `git config remote.origin.url` | sed 's/.git$$//' +compile: c cs java bash php perl python + @echo Done + install: clean mkdir -p ${pkgdir}/opt/aninix/${pkgdirname}/ rsync -avzp HelloWorld* ${pkgdir}/opt/aninix/${pkgdirname}/ @@ -8,8 +10,8 @@ install: clean test: compile python3 -m pytest -clean: - cat .gitignore | xargs -n 1 rm -Rf +clean: + cat .gitignore | xargs rm -Rf diff: @echo Nothing to do. diff --git a/PKGBUILD b/PKGBUILD index 1f517e3..e2ea33f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,23 +1,22 @@ -# Maintainer: Shikoba Kage -pkgname=helloworld -pkgver=0.1.4310ab732341ac3317c9aa706b3058b8e7162486 -pkgver() { - printf "0.1.""$(git rev-parse HEAD)" -} +pkgname="$(git config remote.origin.url | rev | cut -f 1 -d '/' | rev | sed 's/.git$//' | tr '[[:upper:]]' '[[:lower:]]')" +pkgver="$(git describe --tag --abbrev=0)"."$(git rev-parse --short HEAD)" pkgrel=1 +pkgrel() { + git log "$(git describe --tag --abbrev=0)"..HEAD | grep -c commit +} epoch= -pkgdesc="AniNIX::HelloWorld \\\\ Sample HelloWorld Source" +pkgdesc="$(head -n 1 README)" arch=("x86_64") -url="https://aninix.net/foundation/HelloWorld" +url="https://aninix.net/foundation/${pkgname}" license=('custom') groups=() -depends=('bash>=4.4') -makedepends=('make>=4.2' 'mono>5.0.0' 'php' 'perl' 'java-environment' 'python>=3.7' 'gcc') +depends=('bash>=4.4' 'php' 'perl' 'java-environment' 'python>=3.7') +makedepends=('make>=4.2' 'mono>5.0.0' 'gcc') checkdepends=() optdepends=() -provides=('helloworld') +provides=("${pkgname}") conflicts=() -replaces=('aninix-helloworld') +replaces=() backup=() options=() install= @@ -32,13 +31,12 @@ prepare() { } build() { - git config remote.origin.url + make -C .. } check() { - cd "${srcdir}/.." - chmod a+r "${srcdir}/../pkg" - make test + chmod -R u+r ../pkg + make -C .. test } package() { diff --git a/README b/README index 54412a8..591d2ad 100644 --- a/README +++ b/README @@ -1 +1,3 @@ +AniNIX::HelloWorld \\ Sample HelloWorld Source + This project is enabled for AniNIX::Foundation. You can check it out remotely with the git package. It is intended to display example source for all of our projects. diff --git a/tests/test_unit.py b/tests/test_unit.py index 1a634f2..a2dfe6b 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -2,28 +2,26 @@ import os import re import shutil -# c cs java bash php perl python - def CheckOutput(output): return output == 'Hello world!\n' def test_c(): print(os.getcwd()) - fh = os.popen("make c &>/dev/null; ./HelloWorld", mode='r', buffering=-1) + fh = os.popen("./HelloWorld", mode='r', buffering=-1) output = fh.read() retcode = fh.close() assert retcode == None and CheckOutput(output) def test_cs(): print(os.getcwd()) - fh = os.popen("make cs &>/dev/null; mono ./HelloWorld.exe", mode='r', buffering=-1) + fh = os.popen("mono ./HelloWorld.exe", mode='r', buffering=-1) output = fh.read() retcode = fh.close() assert retcode == None and CheckOutput(output) def test_java(): print(os.getcwd()) - fh = os.popen("make java &>/dev/null; java HelloWorld", mode='r', buffering=-1) + fh = os.popen("java HelloWorld", mode='r', buffering=-1) output = fh.read() retcode = fh.close() assert retcode == None and CheckOutput(output)