summaryrefslogtreecommitdiff
path: root/acme2certifier/PKGBUILD
blob: 2a9c69782efb160979d51daf8b5af82aa50a7c9a (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
# Maintainer: Erich Eckner <arch at eckner dot net>

pkgname=acme2certifier
pkgver=0.8.r76.g032de30
_commit="${pkgver##*.g}"
pkgrel=2
pkgdesc='experimental acme server written in python'
arch=('any')
url='https://github.com/grindsa/acme2certifier'
license=('GPL3')
depends=(
  'python-jwcrypto'
  'python-pyopenssl'
  'python-dnspython'
  'python-pytz'
  'python-dateutil'
  'python-requests'
)
makedepends=(
  'git'
#  'python-setuptools'
)
source=(
  "${pkgname}::git+https://github.com/grindsa/${pkgname}.git#commit=${_commit}"
  'systemd.patch'
)
sha512sums=('SKIP'
            '34a402525cd0ca469cb67af25c2611f7f17a4901e4a40cbd66fe0b35e481a9681ab499c72b2805fd6b53219de62ef8418226aeb539b553efb064ab543a530f3f')

pkgver() {
  _commit=$(
    git -C "${pkgname}" rev-parse master
  )
  _version_line=$(
    git -C "${pkgname}" archive ${_commit} -- acme/version.py \
    | tar -Ox \
    | grep -n '^__version__\s*='
  )
  _line="${_version_line%%:*}"
  _line_revision=$(
    git -C "${pkgname}" blame -L"${_line},${_line}" -- acme/version.py \
    | awk '{print $1}'
  )
  _version="${_version_line%\'*}"
  _version="${_version##*\'}"
  printf '%s.r%s.g%s' \
    "${_version}" \
    "$(
      git -C "${pkgname}" rev-list --first-parent --count "${_commit}" ^"${_line_revision}"
    )" \
    "$(
      git -C "${pkgname}" rev-parse --short "${_commit}"
    )"
}

#build() {
#  cd "${srcdir}/${pkgname}"
#  python setup.py build
#}

prepare() {
  cd "${srcdir}/${pkgname}"
  patch -p1 -i "${srcdir}/systemd.patch"
}

package() {
  cd "${srcdir}/${pkgname}"
#  python setup.py install --root="${pkgdir}"
  install -dm755 -o http -g http "${pkgdir}/var/lib/${pkgname}"
  mv acme examples tools "${pkgdir}/var/lib/${pkgname}/"
  chown -R http:http "${pkgdir}/var/lib/${pkgname}"
  install -Dm644 -t "${pkgdir}/usr/share/doc/${pkgname}" docs/*
}