summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Gathoye2019-12-27 18:26:58 +0100
committerWilliam Gathoye2019-12-31 18:30:29 +0100
commiteb71d92c94c1e52b8f288471924c4730a6c65121 (patch)
tree1958b19d9018b6729e847a9daaa7ea8726732113
parentdbdd49ceb247c78e75d8500a5b1a9c8f5018fb00 (diff)
downloadaur-eb71d92c94c1e52b8f288471924c4730a6c65121.tar.gz
Upgrade to 5.18.0
* Fix build number * Fix static source files being rewritten on the run * Fix permissions generated on the fly * Change default directory locations for plugins and static files * Fix directory permissions differ warning reported by namcap * Remove go dependency patch not needed any more
-rw-r--r--.SRCINFO17
-rw-r--r--PKGBUILD63
-rw-r--r--mattermost-ldflags.patch24
-rw-r--r--mattermost.tmpfiles2
4 files changed, 68 insertions, 38 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d50297a97f62..25cbab68216d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = mattermost
pkgdesc = Open source Slack-alternative in Golang and React
- pkgver = 5.17.0
+ pkgver = 5.18.0
pkgrel = 1
url = https://mattermost.com
arch = i686
@@ -13,24 +13,25 @@ pkgbase = mattermost
license = Apache
makedepends = git
makedepends = go-pie
+ makedepends = jq
makedepends = npm
- makedepends = nodejs-lts-erbium
+ makedepends = nodejs
optdepends = mariadb: SQL server storage
optdepends = percona-server: SQL server storage
optdepends = postgresql: SQL server storage
backup = etc/webapps/mattermost/config.json
- source = mattermost-server-5.17.0.tar.gz::https://github.com/mattermost/mattermost-server/archive/v5.17.0.tar.gz
- source = mattermost-webapp-5.17.0.tar.gz::https://github.com/mattermost/mattermost-webapp/archive/v5.17.0.tar.gz
+ source = mattermost-server-5.18.0.tar.gz::https://github.com/mattermost/mattermost-server/archive/v5.18.0.tar.gz
+ source = mattermost-webapp-5.18.0.tar.gz::https://github.com/mattermost/mattermost-webapp/archive/v5.18.0.tar.gz
source = mattermost-ldflags.patch
source = mattermost.service
source = mattermost.sysusers
source = mattermost.tmpfiles
- sha512sums = 40b396991d33137f5d9deda967a0d033658d93caf4b7382439c44447d1e921ccf4fda0dfe77d1ed6214104cc9d88bd78d9c0cfba732d7c15d39b2a6ebe93d6b1
- sha512sums = f78943f2857801b6fbc562faa18dcde651e770e5b318878ad77e505be8016086c3c148734c9d2c7b7e5c3c61684c353e159b75600f0981afbf778b3204fa3841
- sha512sums = 5b761c5715387e6abf3afbe653de218b9a45708d7ffbc699856f53cc3e62760fbd0ce175615f36a4b9090182705c3343d07fca72d12275411080ab516cee3eeb
+ sha512sums = 842c326dad16d2a625b372b4c8c8a39e036dd02b714b25b73be0b511eeba55f844f1f7784bcaec37a45a24fe870a00d9b87ba51891e544389483bfcae1bdd04c
+ sha512sums = 667df6943d4e870eba2f0e5826a8aab0e6f3ea79d1ce7b81ac31f7ccbcc21ace45a0f2b56b3d229079daf83d13ef28abb000b605ad1adfc091002a8939bd33ba
+ sha512sums = 48181d4c06d5e2486c5445ae56f56bb766283954f0a480e59440a98138487d291df59bd366c16ea58ecc5cdf758bad09c1db5b4523709f3aa4f356c7bc9e5e00
sha512sums = 6fc1b41f1ddcc44dab3e1f6bc15b7566e7c33132346b7eb0bc91d9709b4cec89ae969a57a57b6097c75868af21f438c2affda5ba1507f485c8689ab8004efd70
sha512sums = f08d88fd91e91c8b9996cf33699f4a70d69c8c01783cf7add4781ee3c9c6596839e44c5c39f0ff39a836c6d87544eef179f51de0b037ec7f91f86bac8e24d7cc
- sha512sums = e3ffcf4b86e2ecc7166c1abf92cd4de23d81bad405db0121e513a8d81fea05eec9dd508141b14b208c4c13fbc347c56f01ed91326faa01e872ecdedcc18718f9
+ sha512sums = fcde946cddf973b75a906edf8301ccbc2ecbca4adf1df73d13c5343491db5f511b9eb0e1f237087cb508398f2bcdbd46fa03e5b2ac88729cdaed4610512dd3e2
pkgname = mattermost
diff --git a/PKGBUILD b/PKGBUILD
index c6809ee70c33..2f369a03993e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,17 +4,14 @@
# Contributor: Bruno Pagani <archange at archlinux dot org>
pkgname=mattermost
-pkgver=5.17.0
+pkgver=5.18.0
pkgrel=1
pkgdesc='Open source Slack-alternative in Golang and React'
arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64')
url='https://mattermost.com'
license=('AGPL' 'Apache')
-# Had to downgrade to node 12.x LTS, because 13.2 is buggy and crashing due to
-# closing signal handlers several time.
-# src.: https://github.com/nodejs/node/issues/30581
-makedepends=('git' 'go-pie' 'npm' 'nodejs-lts-erbium')
+makedepends=('git' 'go-pie' 'jq' 'npm' 'nodejs')
# Experiencing issues with gifsicle and mozjpeg on non x64 architectures.
if [ "${CARCH}" != 'x86_64' ]; then
makedepends+=('gifsicle' 'mozjpeg')
@@ -34,12 +31,12 @@ source=(
"${pkgname}.tmpfiles"
)
sha512sums=(
- '40b396991d33137f5d9deda967a0d033658d93caf4b7382439c44447d1e921ccf4fda0dfe77d1ed6214104cc9d88bd78d9c0cfba732d7c15d39b2a6ebe93d6b1'
- 'f78943f2857801b6fbc562faa18dcde651e770e5b318878ad77e505be8016086c3c148734c9d2c7b7e5c3c61684c353e159b75600f0981afbf778b3204fa3841'
- '5b761c5715387e6abf3afbe653de218b9a45708d7ffbc699856f53cc3e62760fbd0ce175615f36a4b9090182705c3343d07fca72d12275411080ab516cee3eeb'
+ '842c326dad16d2a625b372b4c8c8a39e036dd02b714b25b73be0b511eeba55f844f1f7784bcaec37a45a24fe870a00d9b87ba51891e544389483bfcae1bdd04c'
+ '667df6943d4e870eba2f0e5826a8aab0e6f3ea79d1ce7b81ac31f7ccbcc21ace45a0f2b56b3d229079daf83d13ef28abb000b605ad1adfc091002a8939bd33ba'
+ '48181d4c06d5e2486c5445ae56f56bb766283954f0a480e59440a98138487d291df59bd366c16ea58ecc5cdf758bad09c1db5b4523709f3aa4f356c7bc9e5e00'
'6fc1b41f1ddcc44dab3e1f6bc15b7566e7c33132346b7eb0bc91d9709b4cec89ae969a57a57b6097c75868af21f438c2affda5ba1507f485c8689ab8004efd70'
'f08d88fd91e91c8b9996cf33699f4a70d69c8c01783cf7add4781ee3c9c6596839e44c5c39f0ff39a836c6d87544eef179f51de0b037ec7f91f86bac8e24d7cc'
- 'e3ffcf4b86e2ecc7166c1abf92cd4de23d81bad405db0121e513a8d81fea05eec9dd508141b14b208c4c13fbc347c56f01ed91326faa01e872ecdedcc18718f9'
+ 'fcde946cddf973b75a906edf8301ccbc2ecbca4adf1df73d13c5343491db5f511b9eb0e1f237087cb508398f2bcdbd46fa03e5b2ac88729cdaed4610512dd3e2'
)
prepare() {
@@ -102,7 +99,6 @@ prepare() {
# Patch go dependencies
sed -r -i go.mod \
- -e "s/willnorris.com\/go\/imageproxy.*/willnorris.com\/go\/imageproxy v0.9.0/" \
-e "/replace/,//d"
# Remove platform specific lines from the Makefile from the line beginning
@@ -150,32 +146,61 @@ build() {
}
package() {
- cd "${srcdir}"/src/github.com/${pkgname}/${pkgname}-server
-
+ # Init directory hierarchy
install -dm755 \
"${pkgdir}"/usr/bin \
"${pkgdir}"/usr/share/webapps \
"${pkgdir}"/etc/webapps \
"${pkgdir}"/usr/share/doc/${pkgname}
+ # Copy mattermost build to destination
+ cd "${srcdir}"/src/github.com/${pkgname}/${pkgname}-server
cp -a dist/${pkgname} "${pkgdir}"/usr/share/webapps/
cd "${pkgdir}"/usr/share/webapps/${pkgname}
- install -dm755 client/plugins
+ # Move logs to right location
rm -rf logs
ln -s /var/log/${pkgname} logs
+ # Readme and docs
+ mv NOTICE.txt README.md "${pkgdir}"/usr/share/doc/${pkgname}
+
+ # Config file management
cp config/default.json config/config.json
+ # Hashtags are needed to escape the Bash escape sequence. jq will consider
+ # it as a comment and won't interpret it.
+ jq '.FileSettings.Directory |= $mmVarLib + "/files/" | # \
+ .ComplianceSettings.Directory |= $mmVarLib + "/compliance/" | # \
+ .PluginSettings.Directory |= $mmVarLib + "/plugins/" | # \
+ .PluginSettings.ClientDirectory |= $mmVarLib + "/client/plugins/"' \
+ --arg mmVarLib '/var/lib/mattermost' \
+ config/config.json > config/config-new.json
+ mv config/config-new.json config/config.json
mv config "${pkgdir}"/etc/webapps/${pkgname}
ln -s /etc/webapps/${pkgname} config
- sed -e 's@"Directory": ".*"@"Directory": "/var/lib/mattermost/"@g' \
- -e 's@tcp(dockerhost:3306)@unix(/run/mysqld/mysqld.sock)@g' \
- -i "${pkgdir}"/etc/webapps/${pkgname}/config.json
-
- mv NOTICE.txt README.md "${pkgdir}"/usr/share/doc/${pkgname}
-
+ # Avoid access denied when Mattermost tries to rewrite its asset data
+ # (root.html, manifest.json and *.css) during runtime. Reuse var tmpfile
+ # directory SELinux security context.
+ # cf. https://github.com/mattermost/mattermost-server/blob/f8d31def8eb463fcd866ebd08f3e6ef7a24e2109/utils/subpath.go#L48
+ # cf. https://wiki.archlinux.org/index.php/Web_application_package_guidelines
+ install -dm700 "${pkgdir}"/var/lib/mattermost/client
+ # We want recursivity as Mattermost wants to modify files in
+ # client/files/code_themes/ as well.
+ # Not recursive: for file in root.html manifest.json *.css; do
+ find client -type f -iname 'root.html' -o -iname 'manifest.json' -o -iname '*.css' | while IFS= read -r fileAndPath; do
+ install -dm700 "${pkgdir}"/var/lib/mattermost/"${fileAndPath%/*}"
+ install -m700 "${fileAndPath}" "${pkgdir}"/var/lib/mattermost/"${fileAndPath%/*}"
+ rm "${fileAndPath}"
+ ln -s /var/lib/mattermost/"${fileAndPath}" "${fileAndPath}"
+ done
+ # As we are using install, only the leaves have their permissions
+ # redefined. Some folders in the hierarchy might not have the right
+ # permissions. Fix this.
+ chmod -R 700 "${pkgdir}"/var/lib/mattermost/
+
+ # Install package config
cd "${srcdir}"
install -Dm755 bin/${pkgname} "${pkgdir}"/usr/share/webapps/${pkgname}/bin/${pkgname}
ln -s /usr/share/webapps/${pkgname}/bin/${pkgname} "${pkgdir}"/usr/bin/${pkgname}
diff --git a/mattermost-ldflags.patch b/mattermost-ldflags.patch
index 43e47c03b57d..0adc81b740d7 100644
--- a/mattermost-ldflags.patch
+++ b/mattermost-ldflags.patch
@@ -1,20 +1,24 @@
---- src/mattermost-server-5.12.0/Makefile 2019-06-14 21:13:52.000000000 +0200
-+++ src/mattermost-server-5.12.0/Makefile.new 2019-07-01 03:04:42.875342812 +0200
-@@ -49,11 +49,20 @@
- GOFLAGS ?= $(GOFLAGS:)
+--- Makefile 2019-12-28 12:38:41.471311251 +0100
++++ Makefile.new 2019-12-28 12:41:37.194305874 +0100
+@@ -48,14 +48,23 @@
+ # Golang Flags
+ export GO111MODULE=on
+ GOPATH ?= $(shell go env GOPATH)
+-GOFLAGS ?= $(GOFLAGS:) -mod=vendor
++GOFLAGS ?= $(GOFLAGS:) -mod=vendor
GO=go
DELVE=dlv
--LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildNumber=$(BUILD_NUMBER)"
+-LDFLAGS += -X "github.com/mattermost/mattermost-server/v5/model.BuildNumber=$(BUILD_NUMBER)"
+
+# We need to use the second flavour of makefile variables and use a dedicated
+# variable here, otherwise this will cause an infinite loop.
+# src.: https://www.gnu.org/software/make/manual/make.html#Flavors
+LDFLAGS_MATTERMOST := $(LDFLAGS)
-+LDFLAGS = -X "github.com/mattermost/mattermost-server/model.BuildNumber=$(BUILD_NUMBER)"
- LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildDate=$(BUILD_DATE)"
- LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildHash=$(BUILD_HASH)"
- LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)"
- LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)"
++LDFLAGS = -X "github.com/mattermost/mattermost-server/v5/model.BuildNumber=$(BUILD_NUMBER)"
+ LDFLAGS += -X "github.com/mattermost/mattermost-server/v5/model.BuildDate=$(BUILD_DATE)"
+ LDFLAGS += -X "github.com/mattermost/mattermost-server/v5/model.BuildHash=$(BUILD_HASH)"
+ LDFLAGS += -X "github.com/mattermost/mattermost-server/v5/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)"
+ LDFLAGS += -X "github.com/mattermost/mattermost-server/v5/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)"
+# The link mode needs to be at the end of the LDFLAGS statement otherwise the
+# build pieces of info won't be populated to the about dialog in the app.
+LDFLAGS += -linkmode external -extldflags '$(LDFLAGS_MATTERMOST)' -s -w
diff --git a/mattermost.tmpfiles b/mattermost.tmpfiles
index 6cb67934c624..be4a1c544f0d 100644
--- a/mattermost.tmpfiles
+++ b/mattermost.tmpfiles
@@ -1,3 +1,3 @@
d /var/log/mattermost 0755 mattermost mattermost -
-d /var/lib/mattermost 0700 mattermost mattermost -
+Z /var/lib/mattermost ~0700 mattermost mattermost -
z /etc/webapps/mattermost/config.json - mattermost mattermost