mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2025-03-19 00:21:40 +00:00
added community/consul
This commit is contained in:
parent
2492d25d9a
commit
a9202b7fc3
10 changed files with 324 additions and 0 deletions
27
community/consul/0001-fix-ARM-build.patch
Normal file
27
community/consul/0001-fix-ARM-build.patch
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
From 3f7dd8f6fa2a9e6bd1b57830df24fb83f6b4a951 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kevin Mihelich <kevin@archlinuxarm.org>
|
||||||
|
Date: Wed, 23 May 2018 19:47:32 -0600
|
||||||
|
Subject: [PATCH] fix ARM build
|
||||||
|
|
||||||
|
---
|
||||||
|
GNUmakefile | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/GNUmakefile b/GNUmakefile
|
||||||
|
index 124e9cb4..dd7ef190 100644
|
||||||
|
--- a/GNUmakefile
|
||||||
|
+++ b/GNUmakefile
|
||||||
|
@@ -57,8 +57,8 @@ changelogfmt:
|
||||||
|
|
||||||
|
# linux builds a linux package independent of the source platform
|
||||||
|
linux:
|
||||||
|
- mkdir -p pkg/linux_amd64/
|
||||||
|
- GOOS=linux GOARCH=amd64 go build -buildmode=pie -ldflags '$(GOLDFLAGS)' -tags '$(GOTAGS)' -o pkg/linux_amd64/consul
|
||||||
|
+ mkdir -p pkg/$(GOOS)_$(GOARCH)
|
||||||
|
+ GOOS=linux GOARCH=$(GOARCH) go build -buildmode=pie -ldflags '$(GOLDFLAGS)' -tags '$(GOTAGS)' -o pkg/$(GOOS)_$(GOARCH)/consul
|
||||||
|
|
||||||
|
# dist builds binaries for all platforms and packages them for distribution
|
||||||
|
dist:
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
102
community/consul/PKGBUILD
Normal file
102
community/consul/PKGBUILD
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
# $Id$
|
||||||
|
# Maintainer: Thore Bödecker <foxxx0@archlinux.org>
|
||||||
|
# Maintainer: Felix Yan <felixonmars@archlinux.org>
|
||||||
|
|
||||||
|
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
|
||||||
|
# - patch to fix ARM build
|
||||||
|
# - use GOARCH in packaging path
|
||||||
|
|
||||||
|
pkgname=consul
|
||||||
|
pkgver=1.1.0
|
||||||
|
pkgrel=2
|
||||||
|
pkgdesc="A tool for service discovery, monitoring and configuration."
|
||||||
|
arch=('x86_64')
|
||||||
|
_gocli_commit='65fcae5817c8600da98ada9d7edf26dd1a84837b' # HEAD
|
||||||
|
url="https://www.consul.io"
|
||||||
|
license=('MPL2')
|
||||||
|
depends=('glibc')
|
||||||
|
makedepends=('git' 'go-pie' 'procps-ng' 'syslog-ng' 'zip')
|
||||||
|
source=("$pkgname-$pkgver.tar.gz::https://github.com/hashicorp/consul/archive/v$pkgver.tar.gz"
|
||||||
|
"git+https://github.com/mitchellh/cli#commit=${_gocli_commit}"
|
||||||
|
'consul.service'
|
||||||
|
'consul.default'
|
||||||
|
'consul.sysusers'
|
||||||
|
'example.json'
|
||||||
|
'disable-broken-api-test.patch'
|
||||||
|
'force-pie-build.patch'
|
||||||
|
'fix-build-version-info.patch'
|
||||||
|
'0001-fix-ARM-build.patch')
|
||||||
|
install=consul.install
|
||||||
|
sha512sums=('80c16a42fc58930234cb277bfdd21c3f1d9f7fe1cf2fea6284056a47f602a40a15ddd447779e83fc5b42502ca8a507a819f5ad7d11689c0bcbb0da739b217721'
|
||||||
|
'SKIP'
|
||||||
|
'c70b9d1556f6c7ecb2e915ab685f289cef0e31198bd2e50c74a0483bbfb387beec67334f539a90adbf68b61b07946e98b300ab8a8e26e53b35f4ab4894adeb04'
|
||||||
|
'ec5a800529a297c709fa383c094ecf106351cf0f8ac7b613b972d415d77fe001088902d7ab805e63e78a8e6360323fec1b795db5a4446df1e21b9b4ed31e7079'
|
||||||
|
'ef872aedb2bc022a29292b7972a792b22e684c1ccb904a2b2cfec6d8966c28fb19be1452ce060821c419f1b646b236ba2e783175595e4bb6926d164c27a15c87'
|
||||||
|
'c4292b8f56ee955ed7385a49843fd90d6434029891b3e1e724cb2fc841514c06e2554a26d3937c114371b18c2168c4e64319eb2cbd726ee8b35870df19089348'
|
||||||
|
'ad5b5ea1fd4ec443c98a89da9fb581d32894c4583dec3707ce9096ed45706bc800f8eb20e5a0c68f6de437d228e09a97bad5815b5bba9b18ae339bcf9a42f8f7'
|
||||||
|
'2c7323b889e9a040f8e2732aa192fbef87bb5eb81072a06a48f536cbdd93d7d219ea17b61e89dfebf915e85861cbb60dd889cb03a14e0a8197b081595e2a2783'
|
||||||
|
'e2fa5674343cd26e17bf08d0a4f2bd923870617511aed49fdc98aaa88a7590916b67e886301385988fdea93747f380f6a7322d1eac3ba14cf81b4baff452cb12'
|
||||||
|
'dc85ba1cab2f77dd9b7cf0032866ee7a09df1644f888656ea74d1af2ec03bf487837c2e05a36cd9248712938f398bc31142d9e2dde7e53a4fa117d48d9c5b656')
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
export GOPATH="${srcdir}"
|
||||||
|
export PATH="$PATH:$GOPATH/bin"
|
||||||
|
mkdir -p "src/github.com/mitchellh"
|
||||||
|
mkdir -p "src/github.com/hashicorp"
|
||||||
|
|
||||||
|
mv "${pkgname}-${pkgver}" "src/github.com/hashicorp/${pkgname}"
|
||||||
|
mv "cli" "src/github.com/mitchellh/cli"
|
||||||
|
|
||||||
|
cd "src/github.com/hashicorp/${pkgname}"
|
||||||
|
|
||||||
|
# force pie build
|
||||||
|
patch -p1 -N -l -i "${srcdir}/force-pie-build.patch"
|
||||||
|
|
||||||
|
# use proper release build version string (w/o '-dev' suffix)
|
||||||
|
patch -p1 -N -l -i "${srcdir}/fix-build-version-info.patch"
|
||||||
|
|
||||||
|
# fix ARM build
|
||||||
|
patch -p1 -i "${srcdir}/0001-fix-ARM-build.patch"
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cd "src/github.com/hashicorp/${pkgname}"
|
||||||
|
# TODO: debug failing tests
|
||||||
|
# + TestTombstoneGC
|
||||||
|
#rm ./agent/consul/state/tombstone_gc_test.go
|
||||||
|
# + TestAPI_ClientTLSOptions
|
||||||
|
#patch -p0 ./api/api_test.go < "${srcdir}/disable-broken-api-test.patch"
|
||||||
|
# + TestSyslogFilter (need to start syslog-ng within the chroot container)
|
||||||
|
#rm ./logger/syslog_test.go
|
||||||
|
#make test
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "src/github.com/hashicorp/${pkgname}"
|
||||||
|
# build local arch only, from: https://github.com/hashicorp/consul/#developing-consul
|
||||||
|
# note! this will result in a development build! do not use for production
|
||||||
|
# CONSUL_DEV=1 make
|
||||||
|
|
||||||
|
# this will limit the build targets but still result in official "zip" release
|
||||||
|
# XC_OS='linux' XC_ARCH='amd64' make
|
||||||
|
|
||||||
|
# this will build only for linux/amd64
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
make linux
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "src/github.com/hashicorp/${pkgname}"
|
||||||
|
|
||||||
|
install -D -d -m750 -o 208 -g 208 "${pkgdir}/var/lib/consul"
|
||||||
|
install -D -d -m750 -o 0 -g 208 "${pkgdir}/etc/consul.d"
|
||||||
|
|
||||||
|
install -D -m644 "${srcdir}/consul.default" "${pkgdir}/etc/default/consul"
|
||||||
|
install -D -m640 -o 0 -g 208 "${srcdir}/example.json" "${pkgdir}/etc/consul.d/example.json"
|
||||||
|
install -Dm755 pkg/linux_$(go env GOARCH)/consul "${pkgdir}/usr/bin/consul"
|
||||||
|
|
||||||
|
install -Dm644 "${srcdir}/consul.service" "${pkgdir}/usr/lib/systemd/system/consul.service"
|
||||||
|
install -Dm644 "${srcdir}/consul.sysusers" "${pkgdir}/usr/lib/sysusers.d/consul.conf"
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim:set ts=2 sw=2 et:
|
1
community/consul/consul.default
Normal file
1
community/consul/consul.default
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CONSUL_FLAGS=""
|
9
community/consul/consul.install
Normal file
9
community/consul/consul.install
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
post_upgrade() {
|
||||||
|
# improved permissions since 0.9.3-1
|
||||||
|
if [ "$(vercmp "$2" "0.9.3")" -lt 0 ]; then
|
||||||
|
chown 0:208 /etc/consul.d
|
||||||
|
chmod 0750 /etc/consul.d
|
||||||
|
echo -en "----\nThe directory permissions for /etc/consul.d/ have been fixed.\n----\n"
|
||||||
|
fi
|
||||||
|
true
|
||||||
|
}
|
16
community/consul/consul.service
Normal file
16
community/consul/consul.service
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Consul Agent
|
||||||
|
Requires=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=consul
|
||||||
|
Group=consul
|
||||||
|
EnvironmentFile=-/etc/default/consul
|
||||||
|
Restart=on-failure
|
||||||
|
ExecStart=/usr/bin/consul agent $CONSUL_FLAGS -config-dir=/etc/consul.d
|
||||||
|
ExecReload=/usr/bin/kill -HUP $MAINPID
|
||||||
|
KillSignal=SIGINT
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
1
community/consul/consul.sysusers
Normal file
1
community/consul/consul.sysusers
Normal file
|
@ -0,0 +1 @@
|
||||||
|
u consul 208 - /var/lib/consul
|
118
community/consul/disable-broken-api-test.patch
Normal file
118
community/consul/disable-broken-api-test.patch
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
--- ./api/api_test.go 2017-09-08 18:43:36.000000000 +0200
|
||||||
|
+++ /tmp/api_test.go 2017-09-13 16:20:25.950467396 +0200
|
||||||
|
@@ -253,115 +253,6 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-func TestAPI_ClientTLSOptions(t *testing.T) {
|
||||||
|
- t.Parallel()
|
||||||
|
- // Start a server that verifies incoming HTTPS connections
|
||||||
|
- _, srvVerify := makeClientWithConfig(t, nil, func(conf *testutil.TestServerConfig) {
|
||||||
|
- conf.CAFile = "../test/client_certs/rootca.crt"
|
||||||
|
- conf.CertFile = "../test/client_certs/server.crt"
|
||||||
|
- conf.KeyFile = "../test/client_certs/server.key"
|
||||||
|
- conf.VerifyIncomingHTTPS = true
|
||||||
|
- })
|
||||||
|
- defer srvVerify.Stop()
|
||||||
|
-
|
||||||
|
- // Start a server without VerifyIncomingHTTPS
|
||||||
|
- _, srvNoVerify := makeClientWithConfig(t, nil, func(conf *testutil.TestServerConfig) {
|
||||||
|
- conf.CAFile = "../test/client_certs/rootca.crt"
|
||||||
|
- conf.CertFile = "../test/client_certs/server.crt"
|
||||||
|
- conf.KeyFile = "../test/client_certs/server.key"
|
||||||
|
- conf.VerifyIncomingHTTPS = false
|
||||||
|
- })
|
||||||
|
- defer srvNoVerify.Stop()
|
||||||
|
-
|
||||||
|
- // Client without a cert
|
||||||
|
- t.Run("client without cert, validation", func(t *testing.T) {
|
||||||
|
- client, err := NewClient(&Config{
|
||||||
|
- Address: srvVerify.HTTPSAddr,
|
||||||
|
- Scheme: "https",
|
||||||
|
- TLSConfig: TLSConfig{
|
||||||
|
- Address: "consul.test",
|
||||||
|
- CAFile: "../test/client_certs/rootca.crt",
|
||||||
|
- },
|
||||||
|
- })
|
||||||
|
- if err != nil {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- // Should fail
|
||||||
|
- _, err = client.Agent().Self()
|
||||||
|
- if err == nil || !strings.Contains(err.Error(), "bad certificate") {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
- })
|
||||||
|
-
|
||||||
|
- // Client with a valid cert
|
||||||
|
- t.Run("client with cert, validation", func(t *testing.T) {
|
||||||
|
- client, err := NewClient(&Config{
|
||||||
|
- Address: srvVerify.HTTPSAddr,
|
||||||
|
- Scheme: "https",
|
||||||
|
- TLSConfig: TLSConfig{
|
||||||
|
- Address: "consul.test",
|
||||||
|
- CAFile: "../test/client_certs/rootca.crt",
|
||||||
|
- CertFile: "../test/client_certs/client.crt",
|
||||||
|
- KeyFile: "../test/client_certs/client.key",
|
||||||
|
- },
|
||||||
|
- })
|
||||||
|
- if err != nil {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- // Should succeed
|
||||||
|
- _, err = client.Agent().Self()
|
||||||
|
- if err != nil {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
- })
|
||||||
|
-
|
||||||
|
- // Client without a cert
|
||||||
|
- t.Run("client without cert, no validation", func(t *testing.T) {
|
||||||
|
- client, err := NewClient(&Config{
|
||||||
|
- Address: srvNoVerify.HTTPSAddr,
|
||||||
|
- Scheme: "https",
|
||||||
|
- TLSConfig: TLSConfig{
|
||||||
|
- Address: "consul.test",
|
||||||
|
- CAFile: "../test/client_certs/rootca.crt",
|
||||||
|
- },
|
||||||
|
- })
|
||||||
|
- if err != nil {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- // Should succeed
|
||||||
|
- _, err = client.Agent().Self()
|
||||||
|
- if err != nil {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
- })
|
||||||
|
-
|
||||||
|
- // Client with a valid cert
|
||||||
|
- t.Run("client with cert, no validation", func(t *testing.T) {
|
||||||
|
- client, err := NewClient(&Config{
|
||||||
|
- Address: srvNoVerify.HTTPSAddr,
|
||||||
|
- Scheme: "https",
|
||||||
|
- TLSConfig: TLSConfig{
|
||||||
|
- Address: "consul.test",
|
||||||
|
- CAFile: "../test/client_certs/rootca.crt",
|
||||||
|
- CertFile: "../test/client_certs/client.crt",
|
||||||
|
- KeyFile: "../test/client_certs/client.key",
|
||||||
|
- },
|
||||||
|
- })
|
||||||
|
- if err != nil {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- // Should succeed
|
||||||
|
- _, err = client.Agent().Self()
|
||||||
|
- if err != nil {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
- })
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
func TestAPI_SetQueryOptions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
c, s := makeClient(t)
|
7
community/consul/example.json
Normal file
7
community/consul/example.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"data_dir": "/var/lib/consul",
|
||||||
|
"disable_update_check": true,
|
||||||
|
"log_level": "INFO",
|
||||||
|
"node_name": "example.localdomain",
|
||||||
|
"server": true
|
||||||
|
}
|
32
community/consul/fix-build-version-info.patch
Normal file
32
community/consul/fix-build-version-info.patch
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
--- a/version/version.go 2018-05-11 20:57:42.000000000 +0200
|
||||||
|
+++ b/version/version.go 2018-05-22 14:05:53.639672108 +0200
|
||||||
|
@@ -1,7 +1,6 @@
|
||||||
|
package version
|
||||||
|
|
||||||
|
import (
|
||||||
|
- "fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
@@ -27,21 +26,6 @@
|
||||||
|
// for displaying to humans.
|
||||||
|
func GetHumanVersion() string {
|
||||||
|
version := Version
|
||||||
|
- if GitDescribe != "" {
|
||||||
|
- version = GitDescribe
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- release := VersionPrerelease
|
||||||
|
- if GitDescribe == "" && release == "" {
|
||||||
|
- release = "dev"
|
||||||
|
- }
|
||||||
|
- if release != "" {
|
||||||
|
- version += fmt.Sprintf("-%s", release)
|
||||||
|
- if GitCommit != "" {
|
||||||
|
- version += fmt.Sprintf(" (%s)", GitCommit)
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
// Strip off any single quotes added by the git information.
|
||||||
|
return strings.Replace(version, "'", "", -1)
|
||||||
|
}
|
11
community/consul/force-pie-build.patch
Normal file
11
community/consul/force-pie-build.patch
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
--- a/GNUmakefile 2018-05-22 13:25:37.236071564 +0200
|
||||||
|
+++ b/GNUmakefile 2018-05-22 13:26:44.852192711 +0200
|
||||||
|
@@ -58,7 +58,7 @@
|
||||||
|
# linux builds a linux package independent of the source platform
|
||||||
|
linux:
|
||||||
|
mkdir -p pkg/linux_amd64/
|
||||||
|
- GOOS=linux GOARCH=amd64 go build -ldflags '$(GOLDFLAGS)' -tags '$(GOTAGS)' -o pkg/linux_amd64/consul
|
||||||
|
+ GOOS=linux GOARCH=amd64 go build -buildmode=pie -ldflags '$(GOLDFLAGS)' -tags '$(GOTAGS)' -o pkg/linux_amd64/consul
|
||||||
|
|
||||||
|
# dist builds binaries for all platforms and packages them for distribution
|
||||||
|
dist:
|
Loading…
Reference in a new issue