summaryrefslogtreecommitdiff
path: root/libre/parabola-hackers/PKGBUILD
blob: 0d152bf9fc9c01c1543e0f1ca67cb5ef0aa45f1f (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
90
91
92
93
94
95
96
# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
# Contributor: bill-auger <bill-auger@programmer.net>


pkgbase=parabola-hackers
pkgname=(parabola-hackers parabola-hackers-nshd)
pkgver=20210719
pkgrel=1
pkgdesc='Programs for doing magic with hackers.git'
url='https://git.parabola.nu/packages/parabola-hackers.git/'
license=('GPL')
arch=('armv7h' 'i686' 'x86_64')

makedepends=('go' 'git')
source=("parabola-hackers::git://git.parabola.nu/packages/parabola-hackers.git#tag=v${pkgver}")
_go_sources=("git.lukeshu.com/go/libgnulinux#branch=master"
             "git.lukeshu.com/go/libnslcd#branch=master"
             "git.lukeshu.com/go/libsystemd#commit=0a43955"
             "github.com/pkg/errors#tag=v0.8.0"
             "go.googlesource.com/sys#commit=bb9c189"
             "gopkg.in/check.v1#commit=20d25e2"
             "gopkg.in/yaml.v2#commit=5420a8b")
for _src in ${_go_sources[*]}; do
  source+=("gopkg-$(sed -e 's/#.*//' -e 's/\//_/g' <<<"$_src")::git+https://$_src")
done
sha256sums=(SKIP)
sha256sums+=( $(echo ${_go_sources[*]/*/SKIP}) )


prepare() {
  # verify versioning
  local go_pkg_ver=$(grep VERSION "$srcdir"/$pkgbase/config.mk | awk '{print $3}')
  local err_msg="VERSION in config.mk does not match the git tag (aka: pkgver)"
  [[ "$go_pkg_ver" == "$pkgver" ]] || ! echo "$err_msg" || return 1

  # install golang deps
  mv -Tv gopkg-go.googlesource.com_sys "$srcdir/$pkgbase"/go/src/golang.org/x/sys
  for gopkg in gopkg-*; do
    mv -Tv "$gopkg" "$srcdir/$pkgbase"/go/src/"$(sed 's/_/\//g' <<<"${gopkg#gopkg-}")"
  done

  # load git submodules
  cd "$srcdir/$pkgbase"
  git submodule update --init
}

build() {
  cd "$srcdir/$pkgbase"
  make
}

check() {
  # FIXME:
  # On armv7h the tests fail with:
  #   FAIL gopkg.in/yaml.v2 [build failed]
  # On x86_64 the tests fail with:
  #   FAIL: TestSCMCredentials (0.00s)
  #     fatal error: checkptr: pointer arithmetic result points to invalid allocation
  #   FAIL golang.org/x/sys/unix 0.288s
  cd "$srcdir/$pkgbase"
  # make check
  make check || :
}

package_parabola-hackers() {
  backup=(etc/$pkgbase.yml)
  depends=('ruby' 'colordiff')

  cd "$srcdir/$pkgbase"
  make DESTDIR="${pkgdir}" install

  # cleanup 'parabola-hackers-nshd' files
  find "$pkgdir" -type f \( -name 'nshd*' -o -name shadow \) -delete
  find "$pkgdir" -type d -empty -exec rmdir -p --ignore-fail-on-non-empty -- {} +
}

package_parabola-hackers-nshd() {
  pkgdesc='NSS and PAM integration for parabola-hackers'
  license=(AGPL3 Apache custom:BSD2 custom:BSD3 GPL LGPL2.1 WTFPL2)
  depends=("parabola-hackers=$pkgver" 'nss-pam-ldapd')
  backup=(etc/nshd/shadow)
  install=parabola-hackers-nshd.install
  replaces=(nshd)
  conflicts=(nshd)

  cd "$srcdir/$pkgbase"
  make DESTDIR="${pkgdir}" install

  # cleanup 'parabola-hackers' files
  find "$pkgdir" -type f -not \( -name 'nshd*' -o -name shadow \) -delete
  find "$pkgdir" -type d -empty -exec rmdir -p --ignore-fail-on-non-empty -- {} +

  # install licenses
  install -d "${pkgdir}/usr/share/licenses/${pkgname}"
  cp LICENSES.txt LICENSE.bsd* "${pkgdir}/usr/share/licenses/${pkgname}"
}