summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0f1c544e045f58bc17512e813d5513e6c358dff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Maintainer:  dreieck


_pkgname='optimal-congress'
_vcssuffix='-git'
pkgname="${_pkgname}${_vcssuffix}"
pkgver=0.7.3+5.r87.20241123.fedb797
pkgrel=1
pkgdesc="Command line tool to find an optional, personal chedule for the 37th Chaos Communication Congress (37C3) 2023."
arch=(
  'any'
)
url="https://github.com/top-on/optimal-congress"
license=(
  'MIT'
)
depends=(
  'python>=3.10'
  'python-pydantic>=2.5.2'
  'python-typer>=0.9.0'
  'python-pytz>=2023.3.post1'
  'python-pulp>=2.7.0'
  'python-pandas'
  'python-pandera>=0.18.0'
  'python-requests'
  'python-rich'
)
makedepends=(
  'git'
  'python-poetry'
  'python-build'
  'python-installer'
  'python-wheel'
)
optdepends=()
provides=(
  "${_pkgname}=${pkgver}"
  "python-${_pkgname//-/_}=${pkgver}"
)
conflicts=(
  "${_pkgname}"
  "python-${_pkgname//-/_}"
)
source=(
  "${_pkgname}::git+${url}.git"  # Official upstream source
)
sha256sums=(
  'SKIP'
)

prepare() {
  cd "${srcdir}/${_pkgname}"

  git log > git.log
}

pkgver() {
  cd "${srcdir}/${_pkgname}"

  _ver="$(git describe  --tags | sed 's|^[vV]||' | sed 's|-g[0-9a-fA-F]*$||' | tr '-' '+')"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Version could not be determined."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}

build() {
  cd "${srcdir}/${_pkgname}"

  python -m build --wheel --no-isolation
}

package() {
  cd "${srcdir}/${_pkgname}"

  python -m installer --destdir="${pkgdir}" dist/*.whl

  install -D -m644 -v CHANGELOG.md "${pkgdir}/usr/share/doc/${_pkgname}/CHANGELOG.md"
  install -D -m644 -v README.md "${pkgdir}/usr/share/doc/${_pkgname}/README.md"
  install -D -m644 -v git.log "${pkgdir}/usr/share/doc/${_pkgname}/git.log"
  install -D -m644 -v LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" "${pkgdir}/usr/share/doc/${_pkgname}/LICENSE"
}