summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Westhaus2019-07-28 03:42:02 -0400
committerKyle Westhaus2019-07-28 03:42:02 -0400
commit8323f169c08fa5ddc92dabed47cfc8db30f3c118 (patch)
tree35f9bdc0d57ffed5165c1b581e101acd5f13d962
parente5c6ed413574359bc49892be031c5b317af3c198 (diff)
downloadaur-8323f169c08fa5ddc92dabed47cfc8db30f3c118.tar.gz
Updates description, source/checksum info, and git version regex; adds service files; and documents complex build options
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD37
-rw-r--r--dgraph-zero.service11
-rw-r--r--dgraph.service13
4 files changed, 61 insertions, 8 deletions
diff --git a/.SRCINFO b/.SRCINFO
index ef7002a9ec5b..d8b0c021a9de 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = dgraph-git
- pkgdesc = Low latency, high throughput, native and distributed graph database
- pkgver = v1.0.12.rc3.r628.gcf7c1e630
+ pkgdesc = Fast, transactional, distributed graph database
+ pkgver = 1.0.12.rc3.r628.gcf7c1e630
pkgrel = 1
url = https://github.com/dgraph-io/dgraph
arch = x86_64
@@ -12,7 +12,11 @@ pkgbase = dgraph-git
conflicts = dgraph
conflicts = dgraph-bin
source = dgraph-git::git+https://github.com/dgraph-io/dgraph
+ source = dgraph.service
+ source = dgraph-zero.service
sha256sums = SKIP
+ sha256sums = 94449db0bbd30aca993dbc6486fbec615e2cada7cd3d91e6b99d6a426a5d7ace
+ sha256sums = 402c5a022615f47d26db47f375f242638d04abbed3bfd22f86067f8f19031f83
pkgname = dgraph-git
diff --git a/PKGBUILD b/PKGBUILD
index 3bf8cd04d0a3..64269e532bac 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,31 +4,53 @@
# Contributor: John Trengrove <john at retrofilter dot com>
pkgname=dgraph-git
-pkgver=v1.0.12.rc3.r628.gcf7c1e630
+pkgver=1.0.12.rc3.r628.gcf7c1e630
pkgrel=1
-pkgdesc='Low latency, high throughput, native and distributed graph database'
+pkgdesc='Fast, transactional, distributed graph database'
arch=('x86_64')
url='https://github.com/dgraph-io/dgraph'
license=('APACHE' 'custom:DCL')
makedepends=('go' 'git')
provides=('dgraph')
conflicts=('dgraph' 'dgraph-bin')
-source=("$pkgname::git+$url")
-sha256sums=('SKIP')
+source=("$pkgname::git+$url"
+ 'dgraph.service'
+ 'dgraph-zero.service')
+sha256sums=('SKIP'
+ '94449db0bbd30aca993dbc6486fbec615e2cada7cd3d91e6b99d6a426a5d7ace'
+ '402c5a022615f47d26db47f375f242638d04abbed3bfd22f86067f8f19031f83')
prepare() {
+ # sets up a fresh temporary go path and symlinks the source repo to appear under
+ # the proper directory structure to avoid dependency manager weirdness
+ # see https://wiki.archlinux.org/index.php/Go_package_guidelines#Old_Go_projects_(for_Go_%3C1.11)
mkdir -p "$srcdir/tmpgopath/src/github.com/dgraph-io/"
ln -rTsf "$srcdir/$pkgname" "$srcdir/tmpgopath/src/github.com/dgraph-io/dgraph"
}
pkgver() {
cd "$srcdir/$pkgname"
- git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+ # cuts off 'v' prefix and uses most recent un-annotated tag reachable from the
+ # last commit
+ # see https://wiki.archlinux.org/index.php/VCS_package_guidelines#Git
+ git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
build() {
+ # the upstream repo provides a Makefile, but this PKGBUILD ignores it so that
+ # further build options can be specified, as seen below
+ # see https://wiki.archlinux.org/index.php/Go_package_guidelines#Building and
+ # `go help build`
cd "$srcdir"
-
+ # enables PIE security mode, without having to target go-pie as a dependency
+ # strips build paths from binary for reproducible builds
+ # passes flags to go tool link
+ # see `go tool link --help`
+ # surrounding an option with single quotes ensures that it will be passed
+ # as a single argument regardless of any spaces
+ # '-X' options mark the binary so that it reports proper version information
+ # '-extldflags' passes options to the external linking tool to enable RELRO, without
+ # overwriting default linker flags
GOPATH="$(pwd)/tmpgopath" go install \
-buildmode=pie \
-gcflags "all=-trimpath=$PWD" \
@@ -43,6 +65,9 @@ package() {
for binary in dgraph; do
install -Dm755 "tmpgopath/bin/$binary" "$pkgdir/usr/bin/$binary"
done
+ install -Dm644 dgraph.service "$pkgdir/usr/lib/systemd/system/dgraph.service"
+ install -Dm644 dgraph-zero.service "$pkgdir/usr/lib/systemd/system/dgraph-zero.service"
+ install -d "$pkgdir/var/lib/dgraph/data"
}
# vim:set ts=2 sw=2 et:
diff --git a/dgraph-zero.service b/dgraph-zero.service
new file mode 100644
index 000000000000..319ffad67139
--- /dev/null
+++ b/dgraph-zero.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Dgraph database controller
+
+[Service]
+ExecStart=/usr/bin/dgraph zero -w /var/lib/dgraph/data/zw
+Restart=on-failure
+RestartSec=1
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/dgraph.service b/dgraph.service
new file mode 100644
index 000000000000..8f91a80ae3fd
--- /dev/null
+++ b/dgraph.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Dgraph database
+Requires=dgraph-zero.service
+After=dgraph-zero.service
+
+[Service]
+ExecStart=/usr/bin/dgraph alpha --lru_mb 2048 -w /var/lib/dgraph/data/w -p /var/lib/dgraph/data/p --zero localhost:5080
+Restart=on-failure
+RestartSec=1
+
+[Install]
+WantedBy=multi-user.target
+