[arch-commits] Commit in beats/trunk (PKGBUILD golang-crypto.patch)

Massimiliano Torromeo mtorromeo at archlinux.org
Fri Sep 14 15:31:13 UTC 2018


    Date: Friday, September 14, 2018 @ 15:31:13
  Author: mtorromeo
Revision: 380909

upgpkg: beats 6.4.0-1

Added:
  beats/trunk/golang-crypto.patch
Modified:
  beats/trunk/PKGBUILD

---------------------+
 PKGBUILD            |   63 ++++++++++++++++--------
 golang-crypto.patch |  131 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 174 insertions(+), 20 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2018-09-14 14:10:00 UTC (rev 380908)
+++ PKGBUILD	2018-09-14 15:31:13 UTC (rev 380909)
@@ -3,7 +3,7 @@
 
 pkgbase=beats
 pkgname=(filebeat packetbeat metricbeat heartbeat-elastic auditbeat)
-pkgver=6.3.2
+pkgver=6.4.0
 pkgrel=1
 pkgdesc='Data shippers for Elasticsearch'
 arch=('x86_64')
@@ -13,8 +13,8 @@
 makedepends=('go-pie' 'git' 'libpcap' 'rsync' 'python')
 optdepends=('elasticsearch: for standalone installation'
             'python: for migration script')
-options=('!strip')
 source=("https://github.com/elastic/beats/archive/v$pkgver/beats-$pkgver.tar.gz"
+        "golang-crypto.patch" # golang/crypto patch
         "filebeat.sysusers"
         "filebeat.service"
         "packetbeat.service"
@@ -26,7 +26,8 @@
         "metricbeat-tmpfile.conf"
         "heartbeat-tmpfile.conf"
         "auditbeat-tmpfile.conf")
-sha256sums=('2eb116df314ab780f75da928ac41f379c677b5251a584b04e99817190f95d1ed'
+sha256sums=('970718690fba96efec8ea54fa24939b7216434f55465273a31e3850d3af08ee3'
+            '75583a195b43d7345449bbac60359bf54661ccbd699386a6e59bb483c6054338'
             '33feb3690f8b31563cc1e2da557c2aa326501ce9ccd7e0a142036902bfdb05ff'
             '4d5394cfe3299c9a6af5ac34c1ad4bcdc2e79162379cccbf00fb414eb28253c0'
             '9f4e33fc768d3500fa3428dcbfda241c6473a2cae8cc4dbadf8f61ca9f2bbec5'
@@ -40,10 +41,18 @@
             'dcdf1be6acda30cc3e8949b5affbc1fe7b0a1efc2a08dfe2f878d6eb6de84d38')
 
 prepare() {
-    cd beats-$pkgver
+    export GOPATH="$srcdir"/gopath
+    mkdir -p "$GOPATH"
+    go get golang.org/x/sys/cpu
 
+    cd "$srcdir"/beats-$pkgver/vendor/golang.org/x/crypto
+    patch -p1 -i "$srcdir"/golang-crypto.patch
+
+    cd "$srcdir"/beats-$pkgver
+
     # Avoid installing extraneous configs
     sed '/[- ]win/d ; /[- ]darwin/d ; /[- ]binary/d' -i */Makefile
+
     # Install the Linux config as default
     sed -r 's#/([a-z]+)-linux.yml#/\1.yml#' -i */Makefile
 
@@ -51,29 +60,40 @@
     LANG=C _t="$(date -r Makefile +'%Y-%m-%d %k:%M:%S')"
     touch -m -d "$_t" */Makefile
 
+    # Use version instead of commit id
+    sed -ri "s/^COMMIT_ID=.*/COMMIT_ID=$pkgver/" libbeat/scripts/Makefile
+
     # Workaround to place extracted release into GOPATH
-    mkdir -p "$srcdir"/gopath/src/github.com/elastic
+    mkdir -p "$GOPATH"/src/github.com/elastic
     ln -sf "$srcdir"/beats-$pkgver \
-        "$srcdir"/gopath/src/github.com/elastic/beats
+        "$GOPATH"/src/github.com/elastic/beats
 }
 
 build() {
     export GOPATH="$srcdir"/gopath
+    export PATH="$GOPATH/bin:$PATH"
 
-    cd "$srcdir"/beats-$pkgver/libbeat
+    cd "$GOPATH"/src/github.com/elastic/beats
+    git init # git root required by one of the build scripts
+
+    cd libbeat
     make fields
 
     for beat in ${pkgname[@]}; do
         beat="${beat%-elastic}"
         msg2 "Building $beat..."
-        cd "$srcdir"/beats-$pkgver/$beat
+        cd ../$beat
         make
 
+        if [ ! -d _meta/kibana ]; then
+            make kibana
+            mv _meta/kibana{.generated,}
+        fi
+
         case "$beat" in
             filebeat|metricbeat|auditbeat)
                 cp _meta/fields.common.yml _meta/fields.generated.yml
                 python ../metricbeat/scripts/fields_collector.py >> _meta/fields.generated.yml
-                make kibana
                 ;;
 
             packetbeat)
@@ -87,9 +107,6 @@
 
         cat ../libbeat/_meta/fields.generated.yml _meta/fields.generated.yml > fields.yml
     done
-
-    cd "$srcdir"/beats-$pkgver/filebeat
-    make modules
 }
 
 _do_package_beat() {
@@ -99,11 +116,10 @@
 
     install -dm755 "$pkgdir"/{etc,usr/share,usr/share/licenses,var/lib}/$_pkgname
 
-    cd beats-$pkgver/$_pkgname
-    make install-home HOME_PREFIX="$pkgdir"/usr/share/$_pkgname
+    cd "$srcdir"/beats-$pkgver
+    install -Dm644 NOTICE.txt "$pkgdir"/usr/share/licenses/$pkgname/NOTICE.txt
 
-    rm "$pkgdir"/usr/share/$_pkgname/LICENSE.txt
-    mv "$pkgdir"/usr/share/{,licenses/}$_pkgname/NOTICE.txt
+    cd $_pkgname
 
     cp $_pkgname.{yml,reference.yml} "$pkgdir"/etc/$_pkgname
     install -Dm644 fields.yml "$pkgdir"/etc/$_pkgname/fields.yml
@@ -114,6 +130,17 @@
                    "$pkgdir"/usr/lib/systemd/system/$_pkgname.service
     install -Dm644 "$srcdir"/$_pkgname-tmpfile.conf \
                    "$pkgdir"/usr/lib/tmpfiles.d/$_pkgname.conf
+
+    cp -R _meta/kibana "$pkgdir"/usr/share/$_pkgname/
+
+    if [ -d module ]; then
+        cp -R module "$pkgdir"/usr/share/$_pkgname/
+        rm -rf "$pkgdir"/usr/share/$_pkgname/module/*/{,info/}_meta
+    fi
+
+    if [ -d modules.d ]; then
+        cp -R modules.d "$pkgdir"/etc/$_pkgname/
+    fi
 }
 
 package_filebeat() {
@@ -122,7 +149,6 @@
     _do_package_beat
 
     cd "$srcdir"/beats-$pkgver/$pkgname
-    cp -R modules.d "$pkgdir"/etc/$pkgname/
     install -Dm644 "$srcdir"/$pkgname.sysusers \
                    "$pkgdir"/usr/lib/sysusers.d/$pkgname.conf
 }
@@ -140,9 +166,6 @@
     replaces=('topbeat')
 
     _do_package_beat
-
-    cd "$srcdir"/beats-$pkgver/$pkgname
-    cp -R modules.d "$pkgdir"/etc/$pkgname/
 }
 
 package_heartbeat-elastic() {

Added: golang-crypto.patch
===================================================================
--- golang-crypto.patch	                        (rev 0)
+++ golang-crypto.patch	2018-09-14 15:31:13 UTC (rev 380909)
@@ -0,0 +1,131 @@
+From ae8bce0030810cf999bb2b9868ae5c7c58e6343b Mon Sep 17 00:00:00 2001
+From: Andreas Auernhammer <aead at mail.de>
+Date: Mon, 30 Apr 2018 19:54:52 +0200
+Subject: [PATCH] crypto/{blake2b,blake2s,argon2,chacha20poly1305}: replace CPU
+ feature detection
+
+This change removes package specific CPU-feature detection code and
+replaces it with x/sys/cpu.
+
+Fixes golang/go#24843
+
+Change-Id: I150dd7b3aeb8eef428c91f9b1df741ceb8a87a24
+Reviewed-on: https://go-review.googlesource.com/110355
+Run-TryBot: Ilya Tocar <ilya.tocar at intel.com>
+TryBot-Result: Gobot Gobot <gobot at golang.org>
+Reviewed-by: Brad Fitzpatrick <bradfitz at golang.org>
+---
+ blake2b/blake2bAVX2_amd64.go               | 26 ++++-----
+ blake2b/blake2bAVX2_amd64.s                | 12 -----
+ blake2b/blake2b_amd64.go                   |  7 ++-
+ blake2b/blake2b_amd64.s                    |  9 ----
+ 11 files changed, 41 insertions(+), 182 deletions(-)
+
+diff --git a/blake2b/blake2bAVX2_amd64.go b/blake2b/blake2bAVX2_amd64.go
+index 8c41cf6c7..4d31dd0fd 100644
+--- a/blake2b/blake2bAVX2_amd64.go
++++ b/blake2b/blake2bAVX2_amd64.go
+@@ -6,21 +6,14 @@
+
+ package blake2b
+
++import "golang.org/x/sys/cpu"
++
+ func init() {
+-	useAVX2 = supportsAVX2()
+-	useAVX = supportsAVX()
+-	useSSE4 = supportsSSE4()
++	useAVX2 = cpu.X86.HasAVX2
++	useAVX = cpu.X86.HasAVX
++	useSSE4 = cpu.X86.HasSSE41
+ }
+
+-//go:noescape
+-func supportsSSE4() bool
+-
+-//go:noescape
+-func supportsAVX() bool
+-
+-//go:noescape
+-func supportsAVX2() bool
+-
+ //go:noescape
+ func hashBlocksAVX2(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
+
+@@ -31,13 +24,14 @@ func hashBlocksAVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
+ func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
+
+ func hashBlocks(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
+-	if useAVX2 {
++	switch {
++	case useAVX2:
+ 		hashBlocksAVX2(h, c, flag, blocks)
+-	} else if useAVX {
++	case useAVX:
+ 		hashBlocksAVX(h, c, flag, blocks)
+-	} else if useSSE4 {
++	case useSSE4:
+ 		hashBlocksSSE4(h, c, flag, blocks)
+-	} else {
++	default:
+ 		hashBlocksGeneric(h, c, flag, blocks)
+ 	}
+ }
+diff --git a/blake2b/blake2bAVX2_amd64.s b/blake2b/blake2bAVX2_amd64.s
+index 784bce6a9..5593b1b3d 100644
+--- a/blake2b/blake2bAVX2_amd64.s
++++ b/blake2b/blake2bAVX2_amd64.s
+@@ -748,15 +748,3 @@ noinc:
+
+ 	MOVQ BP, SP
+ 	RET
+-
+-// func supportsAVX2() bool
+-TEXT ·supportsAVX2(SB), 4, $0-1
+-	MOVQ runtime·support_avx2(SB), AX
+-	MOVB AX, ret+0(FP)
+-	RET
+-
+-// func supportsAVX() bool
+-TEXT ·supportsAVX(SB), 4, $0-1
+-	MOVQ runtime·support_avx(SB), AX
+-	MOVB AX, ret+0(FP)
+-	RET
+diff --git a/blake2b/blake2b_amd64.go b/blake2b/blake2b_amd64.go
+index 2ab7c30fc..30e2fcd58 100644
+--- a/blake2b/blake2b_amd64.go
++++ b/blake2b/blake2b_amd64.go
+@@ -6,13 +6,12 @@
+
+ package blake2b
+
++import "golang.org/x/sys/cpu"
++
+ func init() {
+-	useSSE4 = supportsSSE4()
++	useSSE4 = cpu.X86.HasSSE41
+ }
+
+-//go:noescape
+-func supportsSSE4() bool
+-
+ //go:noescape
+ func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
+
+diff --git a/blake2b/blake2b_amd64.s b/blake2b/blake2b_amd64.s
+index 64530740b..578e947b3 100644
+--- a/blake2b/blake2b_amd64.s
++++ b/blake2b/blake2b_amd64.s
+@@ -279,12 +279,3 @@ noinc:
+
+ 	MOVQ BP, SP
+ 	RET
+-
+-// func supportsSSE4() bool
+-TEXT ·supportsSSE4(SB), 4, $0-1
+-	MOVL $1, AX
+-	CPUID
+-	SHRL $19, CX  // Bit 19 indicates SSE4 support
+-	ANDL $1, CX  // CX != 0 if support SSE4
+-	MOVB CX, ret+0(FP)
+-	RET



More information about the arch-commits mailing list