community/zigbee2mqtt: upgrade to 1.30.4

This commit is contained in:
Jakub Jirutka 2023-05-09 01:10:00 +02:00
parent 3ec90b2d59
commit b17155d6a2
4 changed files with 25 additions and 112 deletions

View File

@ -1,9 +1,8 @@
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=zigbee2mqtt
pkgver=1.28.2_git20221105
_gitrev=c2e95bdb6a84ac4c13e136fbeedac9efbc8882bb
pkgrel=2
pkgver=1.30.4
pkgrel=0
pkgdesc="Zigbee to MQTT bridge"
url="https://www.zigbee2mqtt.io/"
# armhf: some tests timeout and I don't care about armhf
@ -26,21 +25,27 @@ subpackages="
$pkgname-dbg::noarch
$pkgname-openrc
"
source="https://github.com/Koenkk/zigbee2mqtt/archive/$_gitrev/$pkgname-$_gitrev.tar.gz
source="https://github.com/Koenkk/zigbee2mqtt/archive/$pkgver/$pkgname-$pkgver.tar.gz
dont-build-on-start.patch
ungit.patch
full-filename-in-value-ref.patch
pan_id-secret.patch
configuration.yaml
$pkgname.initd
$pkgname.confd
"
builddir="$srcdir/$pkgname-$_gitrev"
options="net"
build() {
npm ci --foreground-scripts --no-fund
# Rebuild serialport native bindings.
cd node_modules/@serialport/bindings-cpp
rm -rf prebuilds
npm exec --yes prebuildify@5 -- --napi --force --strip --verbose
rm -rf build src
cd - >/dev/null
npm run build
}
@ -98,14 +103,12 @@ package() {
rm -rf jszip/dist
rm -rf mqtt/dist
rm -rf pako/dist
local dir; for dir in @serialport/bindings unix-dgram; do
cd $dir
rm -rf build/node_gyp_bins
rm -rf src
rm -rf build/Release/obj.target build/Release/.deps
strip build/Release/*.node
cd - >/dev/null
done
cd unix-dgram
rm -rf build/node_gyp_bins
rm -rf src
rm -rf build/Release/obj.target build/Release/.deps
strip build/Release/*.node
}
dbg() {
@ -117,11 +120,10 @@ dbg() {
}
sha512sums="
4c00042671259ad9b425ce8f5a7ba38f3e66f6e6e864fd0a4062cbf4f26083e5434c409bfbb26a3affbd75acc7a9a3bbb0fdccabece33ff532858cd46c1f198a zigbee2mqtt-c2e95bdb6a84ac4c13e136fbeedac9efbc8882bb.tar.gz
a3c55be73d033bb8345a1042839876be95e449d5e2cbd7168e224b983129657077c7ee5653f35c2d06528c7056af3a1fc47b82d4e8866afd39dcf99c2dc00de6 dont-build-on-start.patch
84f6b6febf0a4b88891c02d3b8e687202bd3d62cd0d94c369663d4ec64afb42345d717a0e2d818b2cb352075395184f0dc0fd76dd875e35e3740001d433af9d0 zigbee2mqtt-1.30.4.tar.gz
8775de86a7a00e69cd6ec275f87458cd3b842547e2fc91dde9c1e74b61c751c798bf7d94274129ffbef2eac5c5954cfb0da0c37c5df141aa52a3d895dba823ac dont-build-on-start.patch
dcb9c4cacdc3799d008ffc68868d83f64941bb5a00b555103868f1236e3a395c68d486fcaa6d7174422ec065994bf925a7aeed9537e07fe32e5093076eafcaba ungit.patch
5c1416cb4caedf15751fe9a87fbc1def449fd645095262fb8fb8cad4d9141321bb85d009305f4f858c9cb7d78206d4485342c6f8831bb7a137721b6a93dda23b full-filename-in-value-ref.patch
59fcca6de0d0fcdec8c3bc4f6f3f39d1b6a0bedb90dbbbae5ab6853f65cdd72efde9060265c673a963e6c7db98b762acc690e44320df99ef27c7a5dcaff407e3 pan_id-secret.patch
30eb7ca0a65a99fd04d227853dba5f2d64d409948706cfc934f85217490d40fb06763404fa755817ca462905e130f6eaa42fbe81216247856f57154bca54b017 pan_id-secret.patch
9e963f3d8dd25149f4532d5dbe31217e22a1e468344272ddcf4f64eaf68c069f85a3979cbe388503b7701a06fdb451d02c610726ad0540cc630496e351e0bc0c configuration.yaml
24f9e1bd6f6a25bd3b4a74930b79349dfe7772e8a056a8d16e461ecdfb8ad637e0169a8e4386b8113aa133e9973e4d53f755ead6e87ee7743c26f15f1ceee7e9 zigbee2mqtt.initd
aa1b1de7f2df5d335d57cade1ee625efe7d337e1afef84308be4b8626224af20ad6805882065c90c240a311abed550d4a8be01baa52750ac81d3c888554a26e9 zigbee2mqtt.confd

View File

@ -7,7 +7,7 @@
-const os = require('os');
const path = require('path');
-const {exec} = require('child_process');
-const rimraf = require('rimraf');
-const {rimrafSync} = require('rimraf');
require('source-map-support').install();
let controller;
@ -40,7 +40,7 @@
-async function build(reason) {
- return new Promise((resolve, reject) => {
- process.stdout.write(`Building Zigbee2MQTT... (${reason})`);
- rimraf.sync('dist');
- rimrafSync('dist');
- const env = {...process.env};
- const _600mb = 629145600;
- if (_600mb > os.totalmem() && !env.NODE_OPTIONS) {

View File

@ -1,89 +0,0 @@
Patch-Source: https://github.com/Koenkk/zigbee2mqtt/commit/a2f8534823c0bbd25e2c51586ed2efcea7680f98
--
From a2f8534823c0bbd25e2c51586ed2efcea7680f98 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 13 Nov 2022 15:17:59 +0100
Subject: [PATCH] Allow to specify full file name in value reference '!'
(#14955)
* Extract parsing of value reference '!' in settings into a function
* Allow to specify full file name in value reference '!'
This `network_key: '!secret network_key'` is really confusing because
it looks like a YAML tag named 'secret' and a value "network_key".
When we write `network_key: '!secret.yaml network_key'` instead, it's
a little clearer what's going on. Also, it's more consistent with file
references in 'devices' and 'groups'.
---
lib/util/settings.ts | 29 ++++++++++++++++++++---------
test/settings.test.js | 2 +-
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/lib/util/settings.ts b/lib/util/settings.ts
index 98346b8df0..aabbf5af1c 100644
--- a/lib/util/settings.ts
+++ b/lib/util/settings.ts
@@ -187,6 +187,20 @@ function loadSettingsWithDefaults(): void {
_settingsWithDefaults.whitelist && _settingsWithDefaults.passlist.push(..._settingsWithDefaults.whitelist);
}
+function parseValueRef(text: string): {filename: string, key: string} | null {
+ const match = /!(.*) (.*)/g.exec(text);
+ if (match) {
+ let filename = match[1];
+ // This is mainly for backward compatibility.
+ if (!filename.endsWith('.yaml') && !filename.endsWith('.yml')) {
+ filename += '.yaml';
+ }
+ return {filename, key: match[2]};
+ } else {
+ return null;
+ }
+}
+
function write(): void {
const settings = getInternalSettings();
const toWrite: KeyValue = objectAssignDeep({}, settings);
@@ -203,9 +217,9 @@ function write(): void {
['frontend', 'auth_token'],
]) {
if (actual[path[0]] && actual[path[0]][path[1]]) {
- const match = /!(.*) (.*)/g.exec(actual[path[0]][path[1]]);
- if (match) {
- yaml.updateIfChanged(data.joinPath(`${match[1]}.yaml`), match[2], toWrite[path[0]][path[1]]);
+ const ref = parseValueRef(actual[path[0]][path[1]]);
+ if (ref) {
+ yaml.updateIfChanged(data.joinPath(ref.filename), ref.key, toWrite[path[0]][path[1]]);
toWrite[path[0]][path[1]] = actual[path[0]][path[1]];
}
}
@@ -314,12 +328,9 @@ function read(): Settings {
// Read !secret MQTT username and password if set
// eslint-disable-next-line
const interpetValue = (value: any): any => {
- const re = /!(.*) (.*)/g;
- const match = re.exec(value);
- if (match) {
- const file = data.joinPath(`${match[1]}.yaml`);
- const key = match[2];
- return yaml.read(file)[key];
+ const ref = parseValueRef(value);
+ if (ref) {
+ return yaml.read(data.joinPath(ref.filename))[ref.key];
} else {
return value;
}
diff --git a/test/settings.test.js b/test/settings.test.js
index e7dbaffb30..68a05e1f0a 100644
--- a/test/settings.test.js
+++ b/test/settings.test.js
@@ -199,7 +199,7 @@ describe('Settings', () => {
mqtt: {
server: '!secret server',
user: '!secret username',
- password: '!secret password',
+ password: '!secret.yaml password',
},
advanced: {
network_key: '!secret network_key',

View File

@ -24,15 +24,15 @@ index aabbf5af1..c7933bd66 100644
]) {
if (actual[path[0]] && actual[path[0]][path[1]]) {
@@ -352,6 +353,10 @@ function read(): Settings {
s.advanced.network_key = interpetValue(s.advanced.network_key);
s.advanced.network_key = interpretValue(s.advanced.network_key);
}
+ if (s.advanced?.pan_id) {
+ s.advanced.pan_id = interpetValue(s.advanced.pan_id);
+ s.advanced.pan_id = interpretValue(s.advanced.pan_id);
+ }
+
if (s.frontend?.auth_token) {
s.frontend.auth_token = interpetValue(s.frontend.auth_token);
s.frontend.auth_token = interpretValue(s.frontend.auth_token);
}
diff --git a/test/settings.test.js b/test/settings.test.js
index 68a05e1f0..6d558b191 100644