From a1ee5f0e6ac73ea9cc57706114ed0b43d6c691fe Mon Sep 17 00:00:00 2001 From: Max Rees Date: Tue, 27 Aug 2019 19:05:42 -0500 Subject: user/mosquitto: new package In the future: * cunit may be added to run unit tests. * libwebsockets may be added for websocket support. --- user/mosquitto/APKBUILD | 78 +++++++++++++++++++++++++++++++++ user/mosquitto/disable-flaky-test.patch | 11 +++++ user/mosquitto/mosquitto.initd | 36 +++++++++++++++ user/mosquitto/mosquitto.pre-install | 7 +++ user/mosquitto/openrc-conf.patch | 20 +++++++++ user/mosquitto/python3.patch | 48 ++++++++++++++++++++ 6 files changed, 200 insertions(+) create mode 100644 user/mosquitto/APKBUILD create mode 100644 user/mosquitto/disable-flaky-test.patch create mode 100644 user/mosquitto/mosquitto.initd create mode 100644 user/mosquitto/mosquitto.pre-install create mode 100644 user/mosquitto/openrc-conf.patch create mode 100644 user/mosquitto/python3.patch (limited to 'user') diff --git a/user/mosquitto/APKBUILD b/user/mosquitto/APKBUILD new file mode 100644 index 000000000..a94142ca6 --- /dev/null +++ b/user/mosquitto/APKBUILD @@ -0,0 +1,78 @@ +# Contributor: Pedro Filipe +# Contributor: Natanael Copa +# Maintainer: Max Rees +pkgname=mosquitto +pkgver=1.6.4 +pkgrel=0 +pkgdesc="An Open Source MQTT Broker" +url="https://mosquitto.org/" +arch="all" +license="EPL-1.0 AND EDL-1.0 AND MIT AND BSD-3-Clause" +depends="" +makedepends="c-ares-dev openssl-dev util-linux-dev" +checkdepends="python3" +subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-openrc + $pkgname-clients" +install="$pkgname.pre-install" +source="http://mosquitto.org/files/source/$pkgname-$pkgver.tar.gz + mosquitto.initd + disable-flaky-test.patch + openrc-conf.patch + python3.patch" + +# secfixes: +# 1.5.6-r0: +# - CVE-2018-12546 +# - CVE-2018-12550 +# - CVE-2018-12551 +# 1.5.3-r0: +# - CVE-2018-12543 +# 1.4.15-r0: +# - CVE-2017-7652 +# - CVE-2017-7651 +# 1.4.13-r0: +# - CVE-2017-9868 +# 1.4.12-r0: +# - CVE-2017-7650 + +build() { + make \ + WITH_ADNS=no \ + WITH_MEMORY_TRACKING=no \ + WITH_SRV=yes \ + prefix=/usr +} + +check() { + # Unit tests require cunit, so skip them. + make -j1 -C test/broker test + make -j1 -C test/lib test +} + +package() { + make prefix=/usr DESTDIR="$pkgdir" install + + # C++ bindings are deprecated, so don't install them. + make -C lib/cpp prefix=/usr DESTDIR="$pkgdir" uninstall + rm "$pkgdir"/usr/lib/pkgconfig/libmosquittopp.pc + + mv "$pkgdir"/usr/sbin/mosquitto "$pkgdir"/usr/bin + mv "$pkgdir"/etc/mosquitto/mosquitto.conf.example \ + "$pkgdir"/etc/mosquitto/mosquitto.conf + + install -Dm755 "$srcdir"/mosquitto.initd \ + "$pkgdir"/etc/init.d/mosquitto +} + +clients() { + pkgdesc="Mosquitto command line MQTT clients" + + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/mosquitto_[ps]ub "$subpkgdir"/usr/bin/ +} + +sha512sums="9faf035660965769f687eb85f9672f891d6ecf1069f665c039b3c25f0e1cc64653909b16d94101d31f81d016a2b3ff85585d66dad1f48afb8003cffbf67c52b6 mosquitto-1.6.4.tar.gz +681fddc737b3ef3e6c052f0c854a730df290352640a18a63e23ef83d14c425558aff87805d1eb95e44de101b5df48872173af9f5414464ffa8cf727ea2c0491e mosquitto.initd +3886171e36f759a717aa6626d5b8dbd392963c737d5de28b4d52b81359008927b99ff7a0ca82f56a0e5deaed4585571759ba9216336a664fd346845837c2bc18 disable-flaky-test.patch +b07f9bec2751ab32c43f53e74d8fca18dbf2d7ce7f8fab562dbcf75de19609ba6219d735ac504697404e0ed36613a14074e3a19e735297195877798f778d337a openrc-conf.patch +078197e6c3e59b664f5fdd1e4a4f669c9a76ab84fe4a5d8602ac80406b85c4e1cce29d9372e76d995155b74abb438d0dc0cdcdb98251fb904122073c4088d76a python3.patch" diff --git a/user/mosquitto/disable-flaky-test.patch b/user/mosquitto/disable-flaky-test.patch new file mode 100644 index 000000000..8fd51c403 --- /dev/null +++ b/user/mosquitto/disable-flaky-test.patch @@ -0,0 +1,11 @@ +--- mosquitto-1.6.4/test/broker/Makefile 2019-08-01 19:50:01.000000000 +0000 ++++ mosquitto-1.6.4/test/broker/Makefile 2019-08-28 00:03:54.430562623 +0000 +@@ -193,7 +193,7 @@ endif + ./10-listener-mount-point.py + + 11 : +- ./11-message-expiry.py ++ #./11-message-expiry.py + ./11-persistent-subscription.py + ./11-persistent-subscription-v5.py + ./11-persistent-subscription-no-local.py diff --git a/user/mosquitto/mosquitto.initd b/user/mosquitto/mosquitto.initd new file mode 100644 index 000000000..818931213 --- /dev/null +++ b/user/mosquitto/mosquitto.initd @@ -0,0 +1,36 @@ +#!/sbin/openrc-run +MOSQUITTO_CFG="${MOSQUITTO_CFG:-/etc/mosquitto/${RC_SVCNAME}.conf}" + +command="/usr/bin/mosquitto" +command_args="-c '${MOSQUITTO_CFG}' $command_args" +command_args_background="--daemon" +pidfile="$(awk '$1 == "pid_file" {print $2}' "${MOSQUITTO_CFG}" || true)" + +extra_started_commands="reload" +description_reload="Reload configuration" + +start_pre() { + if ! [ -e "$MOSQUITTO_CFG" ]; then + eerror "$MOSQUITTO_CFG does not exist" + return 1 + fi + + if [ -z "$pidfile" ]; then + eerror "${MOSQUITTO_CFG} is missing the pid_file option" + return 1 + fi + + MOSQUITTO_LOG="$(awk '$1 " " $2 == "log_dest file" {print $3}' "${MOSQUITTO_CFG}")" + if [ -n "$MOSQUITTO_LOG" ]; then + MOSQUITTO_USER="$(awk '$1 == "user" {print $2}' "${MOSQUITTO_CFG}")" + MOSQUITTO_USER="${MOSQUITTO_USER:-mosquitto}" + checkpath -fm 660 -o "${MOSQUITTO_USER}" \ + "${MOSQUITTO_LOG}" || return 1 + fi +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + start-stop-daemon --signal HUP --pidfile "${pidfile}" + eend $? +} diff --git a/user/mosquitto/mosquitto.pre-install b/user/mosquitto/mosquitto.pre-install new file mode 100644 index 000000000..ac36da04c --- /dev/null +++ b/user/mosquitto/mosquitto.pre-install @@ -0,0 +1,7 @@ +#!/bin/sh + +groupadd -r mosquitto 2>/dev/null +useradd -c mosquitto -s /sbin/nologin -g mosquitto \ + -m -d /var/empty -k /etc/skel -r mosquitto 2>/dev/null + +exit 0 diff --git a/user/mosquitto/openrc-conf.patch b/user/mosquitto/openrc-conf.patch new file mode 100644 index 000000000..d1c5ee04b --- /dev/null +++ b/user/mosquitto/openrc-conf.patch @@ -0,0 +1,20 @@ +--- mosquitto-1.6.4/mosquitto.conf 2019-08-01 14:50:01.000000000 -0500 ++++ mosquitto-1.6.4/mosquitto.conf 2019-08-27 18:16:52.290542736 -0500 +@@ -158,7 +158,7 @@ + # This should be set to /var/run/mosquitto.pid if mosquitto is + # being run automatically on boot with an init script and + # start-stop-daemon or similar. +-#pid_file ++pid_file /var/run/mosquitto.pid + + # Set to true to queue messages with QoS 0 when a persistent client is + # disconnected. These messages are included in the limit imposed by +@@ -585,7 +585,7 @@ + # Note that if the broker is running as a Windows service it will default to + # "log_dest none" and neither stdout nor stderr logging is available. + # Use "log_dest none" if you wish to disable logging. +-#log_dest stderr ++log_dest file /var/log/mosquitto.log + + # Types of messages to log. Use multiple log_type lines for logging + # multiple types of messages. diff --git a/user/mosquitto/python3.patch b/user/mosquitto/python3.patch new file mode 100644 index 000000000..f348cbc3e --- /dev/null +++ b/user/mosquitto/python3.patch @@ -0,0 +1,48 @@ +--- mosquitto-1.6.4/test/broker/09-extended-auth-change-username.py.old 2019-08-01 19:50:01.000000000 +0000 ++++ mosquitto-1.6.4/test/broker/09-extended-auth-change-username.py 2019-08-27 22:20:08.560518752 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Check whether an extended auth plugin can change the username of a client. + +--- mosquitto-1.6.4/test/broker/09-extended-auth-multistep-reauth.py.old 2019-08-01 19:50:01.000000000 +0000 ++++ mosquitto-1.6.4/test/broker/09-extended-auth-multistep-reauth.py 2019-08-27 22:22:11.530519618 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + from mosq_test_helper import * + +--- mosquitto-1.6.4/test/broker/09-extended-auth-multistep.py.old 2019-08-01 19:50:01.000000000 +0000 ++++ mosquitto-1.6.4/test/broker/09-extended-auth-multistep.py 2019-08-27 22:20:37.030518952 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + from mosq_test_helper import * + +--- mosquitto-1.6.4/test/broker/09-extended-auth-single.py.old 2019-08-01 19:50:01.000000000 +0000 ++++ mosquitto-1.6.4/test/broker/09-extended-auth-single.py 2019-08-27 22:21:42.250519412 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Multi tests for extended auth with a single step. + # * Error in plugin +--- mosquitto-1.6.4/test/broker/09-extended-auth-single2.py.old 2019-08-01 19:50:01.000000000 +0000 ++++ mosquitto-1.6.4/test/broker/09-extended-auth-single2.py 2019-08-27 22:21:02.220519130 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Multi tests for extended auth with a single step - multiple plugins at once. + # * Error in plugin +--- mosquitto-1.6.4/test/broker/09-extended-auth-unsupported.py.old 2019-08-01 19:50:01.000000000 +0000 ++++ mosquitto-1.6.4/test/broker/09-extended-auth-unsupported.py 2019-08-27 22:21:20.360519257 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Test whether an unsupported extended auth is rejected. + -- cgit v1.2.3-70-g09d2