[arch-commits] Commit in consul/trunk (PKGBUILD)

Thore Bödecker foxxx0 at archlinux.org
Mon May 18 17:34:07 UTC 2020


    Date: Monday, May 18, 2020 @ 17:34:07
  Author: foxxx0
Revision: 629570

upgpkg: consul 1.7.3-1

rework according to latest golang packaging guidelines,
avoid using any upstream makefile / scripting blackmagic foo.
just plain `go build` and `go test`.
also: update to latest upstream release 1.7.3

Modified:
  consul/trunk/PKGBUILD

----------+
 PKGBUILD |   66 ++++++++++++++++++++++++++-----------------------------------
 1 file changed, 29 insertions(+), 37 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-05-18 17:33:54 UTC (rev 629569)
+++ PKGBUILD	2020-05-18 17:34:07 UTC (rev 629570)
@@ -2,7 +2,7 @@
 # Maintainer: Felix Yan <felixonmars at archlinux.org>
 
 pkgname=consul
-pkgver=1.7.2
+pkgver=1.7.3
 pkgrel=1
 pkgdesc="A tool for service discovery, monitoring and configuration."
 arch=('x86_64')
@@ -9,7 +9,7 @@
 url="https://www.consul.io"
 license=('MPL2')
 depends=('glibc')
-makedepends=('git' 'go-pie' 'go-bindata-assetfs' 'go-bindata-hashicorp' 'procps-ng' 'zip' 'yarn' 'bower' 'nodejs-lts-dubnium' 'npm' 'zip' 'gox' 'go-tools')
+makedepends=('git' 'go' 'go-bindata-assetfs' 'go-bindata-hashicorp' 'procps-ng' 'zip' 'yarn' 'bower' 'nodejs-lts-dubnium' 'npm' 'zip' 'gox' 'go-tools')
 source=("${pkgname}-${pkgver}.tar.gz::https://github.com/hashicorp/consul/archive/v${pkgver}.tar.gz"
         'consul.service'
         'consul.default'
@@ -17,22 +17,28 @@
         'example.json'
         'fix-build-version-info.patch'
         'unparallelize-or-disable-flaky-tests.patch'
-        'fix-test.patch'
-        'consul-ldflags.patch'
         )
 install=consul.install
 backup=('etc/default/consul')
-sha512sums=('d13d7750c745aeeb2577ed334bfef1ac8a4e0c6f671a6705c0b8978217d071ebcf32455c0bfc83a77fd03caef68a6e256d95b48d5406deaaaba263f1a97b23c2'
+sha512sums=('6cbc4f3fce613b3f8ac220038cd013ce14801ccc6c999b12e42f2149277f845531932243b063fbd83d92b84ed75000c47636f7883bd04079c0b82c642e021c01'
             'c70b9d1556f6c7ecb2e915ab685f289cef0e31198bd2e50c74a0483bbfb387beec67334f539a90adbf68b61b07946e98b300ab8a8e26e53b35f4ab4894adeb04'
             'ec5a800529a297c709fa383c094ecf106351cf0f8ac7b613b972d415d77fe001088902d7ab805e63e78a8e6360323fec1b795db5a4446df1e21b9b4ed31e7079'
             'ef872aedb2bc022a29292b7972a792b22e684c1ccb904a2b2cfec6d8966c28fb19be1452ce060821c419f1b646b236ba2e783175595e4bb6926d164c27a15c87'
             'c4292b8f56ee955ed7385a49843fd90d6434029891b3e1e724cb2fc841514c06e2554a26d3937c114371b18c2168c4e64319eb2cbd726ee8b35870df19089348'
             'c6e06dbf5954277ba472ba5bbaf0da5b9a22a49b02ef59cc16057025cab65e9065855f191f2910a3051a6877e4a8a9c392a98b811b911cee8c6fa5c39853ce7a'
-            'b59b2733d598ae6648c198f26f23961d4c1ea8c693a1a5b1c16a0951400c3bb9a9d2d5efe4f0a5cca9ae3b1f225a8eb4133c9011c4125589e936c7dcdc4b2495'
-            'f03821a42857cb19479b5a8d2c5dbb46e355f0e459caf89d3be7a5527961dffe9ffaebc9cf8e98d801c84cc4b38ec6c62330abc97347f3b5ca30e188f26d6982'
-            '15eb20feaa281b5dda46445582ee7bf83f14e599b75ee2eb2b7c18aefa27df597dbcfed55b3bdc1b9917eca6bdbc3134390ffdb6e4924df2a46f4c442efc5b91')
+            'b59b2733d598ae6648c198f26f23961d4c1ea8c693a1a5b1c16a0951400c3bb9a9d2d5efe4f0a5cca9ae3b1f225a8eb4133c9011c4125589e936c7dcdc4b2495')
 
+export CGO_LDFLAGS="${LDFLAGS}"
+export CGO_CFLAGS="${CFLAGS}"
+export CGO_CPPFLAGS="${CPPFLAGS}"
+export CGO_CXXFLAGS="${CXXFLAGS}"
+# consul is incompatible with -buildmode=pie
+export GOFLAGS="-trimpath -modcacherw"
 
+export GOOS='linux'
+export GOARCH='amd64'
+export XC_OSARCH='linux/amd64'
+
 prepare() {
   cd "${srcdir}/${pkgname}-${pkgver}"
 
@@ -43,43 +49,29 @@
     fi
   done
 
-  cd "${srcdir}"
-  mkdir -p 'src/github.com/hashicorp'
-  mv "${pkgname}-${pkgver}" "src/github.com/hashicorp/${pkgname}"
-
-  export GOPATH="${srcdir}"
+  mkdir -p build
 }
 
 build() {
-  cd "${srcdir}/src/github.com/hashicorp/${pkgname}"
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  go build -o build './...'
+}
 
-  export GOOS='linux'
-  export GOARCH='amd64'
-  export XC_OSARCH='linux/amd64'
+check() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
 
-  make linux
-}
+  # prevent e.g. syslog tests
+  export TRAVIS='true'
 
-# The test suite is horribly broken and will show approx. 60-80% test failures.
-# Upstream hasn't been helpful in debugging this and just points to their binary releases.
-# From now this package will ship without tests as I'm sick and tired of this BS.
+  # some tests need the built `consul` binary in $PATH
+  export PATH="${PWD}/build:${PATH}"
 
-#check() {
-#  cd "${srcdir}/src/github.com/hashicorp/${pkgname}"
-#
-#  # prevent e.g. syslog tests
-#  export TRAVIS='true'
-#  # weird race conditions when being run overparallelized
-#  export GOMAXPROCS="1"
-#  export GOTEST_FLAGS="-p 1 -parallel 1"
-#  export GOOS='linux'
-#  export GOARCH='amd64'
-#
-#  make -j1 test
-#}
+  # weird race conditions when being run overparallelized
+  go test -v -p 2 -parallel 2 './...'
+}
 
 package() {
-  cd "${srcdir}/src/github.com/hashicorp/${pkgname}"
+  cd "${srcdir}/${pkgname}-${pkgver}"
 
   install -D -d -m750 -o 208 -g 208 "${pkgdir}/var/lib/consul"
   install -D -d -m750 -o   0 -g 208 "${pkgdir}/etc/consul.d"
@@ -86,7 +78,7 @@
 
   install -D -m644 "${srcdir}/consul.default" "${pkgdir}/etc/default/consul"
   install -D -m644 -o 0 -g 0 "${srcdir}/example.json" "${pkgdir}/usr/share/doc/consul/config.example.json"
-  install -Dm755 "bin/consul" "${pkgdir}/usr/bin/consul"
+  install -Dm755 "build/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"



More information about the arch-commits mailing list