Update zigbee2mqtt and nodejs eclass

Signed-off-by: INODE64 <web@inode64.com>
This commit is contained in:
INODE64 2023-11-20 15:28:43 +01:00
parent db9fcf5076
commit c472f98d1d
6 changed files with 96 additions and 144 deletions

View File

@ -1,10 +1,7 @@
AUX zigbee2mqtt 632 BLAKE2B 5cb0d8852f0755fa43444eba7d39a536c0c4f79325fef66338228d92530397e6294ce72c0c4d9d4b6f6bbfb0044b77746e6daf9d2dc7b269211cefaed7a99189 SHA512 0a26ef5e136b5536fa4b5d7fe9953b76e5c2fedf433abe91877e78701bb661744ce4dccb642911a28270e9740b7c7af78e75e8c0914c804d1cf0e76698999d70
AUX zigbee2mqtt.conf 176 BLAKE2B f1003f37135e10a32c3fe7b387da9f4194cae82339edf77928c2d55e08dcac1f212d27f5bd41a0f20887847fd98f569aaf0ca5f17504be1f3c8d87d38c2f5b87 SHA512 105e618af8ee335a591d791c701ffdbdccc4e967d29433a9d9f6997f5f6c3f50eb3dfe56a3fcd617b0a52ed1380fb889747ef70a148c07d6871c7e3c2beb9dab
AUX zigbee2mqtt.service 870 BLAKE2B d680edf72f182e2545d15063786d281bbf31d8e8cb899b0aa103da6dd8180b8afd7d5bef21c760991c27db98151bb48bd569b26318477ddcb71e8a90cbf193af SHA512 f02d59509f632c458cd9e95ecd97421df3aba8a78bac41d55075d8f054e4f3293b414885d0c1337a38a179496e5e2851c00170ca36f8546a6a37d2473811a46a
DIST zigbee2mqtt-1.30.1-node_modules.tar.xz 18782028 BLAKE2B ee85f5de70a6913b164c73420a5ff01761d5ed3e417951e57f391234e66cd5de76dc459fda84452e1615c544f064d89d156bb580137503a45237b4aae4e23a0b SHA512 d4454ef828c66974d1210b7cc1df7526e3e324addc4e420de13314a13070132e3b7958bf2e8fdac50648ed21f06340f5335fc5b947ee1815dea3035f38954876
DIST zigbee2mqtt-1.30.1.tar.gz 483028 BLAKE2B 9c297c85a08ef911ad13b2722adecda6e01f0c5689a5225e3e4b0998c6a6626fe0ded2d64df0479c72971fc5f92f79cb65bdc3f8ecd1583b78d94168de1fcdba SHA512 b38accbaea044c0e5b28a4cef0652d90d7691ca936e82bdd82b39d8f77719ac750c067dcb58b9a9d2251dd821e81ed62eed8bbab3c232f516a7a6247fa575d58
DIST zigbee2mqtt-1.30.2-node_modules.tar.xz 18136688 BLAKE2B cb29dc59ded0b98d2603472694ccec74ffcfcd8ada2a089f05f41b991e81d6946afd41ee01005c37d1910b19789519bb1c6be8401287a21c921edd2e21033a09 SHA512 d09cc8ebae428687a956513f8a2b5748c47183230034d9d9eda3429f167b108840252050ddae021698d3fabbe7c04fe8fdb1fffbd8724863beda5d03b28c03f9
DIST zigbee2mqtt-1.30.2.tar.gz 483544 BLAKE2B 7fe963d1c15dd36af81943db031d36459ea3c106ccb1513eef2ed15148d9ec57d4f84e8ac30a703565e791079897d312b30bf03cb56f07f63769c3422d473516 SHA512 2a27f8ffbb125934a7c75440018d3cb7f3da6c47fbfc0e5850e0ab1c7a5b918dce1d7064b15e91efaf088308760cd73a588b21b1d7a10f14458dbc7d9a2ef62c
EBUILD zigbee2mqtt-1.30.1.ebuild 1449 BLAKE2B bf9ef636fd7dbf2c4520cc3410bfcd69fb2bd8f0f4e852d31acf343e0ea824c674c0982f24ed57ddd3dee2506d8fc45993d99282b4929c8f54e0812318dec709 SHA512 354be668847923e8caf61dd4284505cc151f86f0385471537e14b94f4e3c0fe32f41a36e9d002d3862cf69d743e8b29603476bdccb421c112b531946442fcf2d
EBUILD zigbee2mqtt-1.30.2.ebuild 1449 BLAKE2B c5ef0bc09c4c78769557dbf0544a17d20d4fcc2ba846f76958c471762ad9b705c2cae60319fbee03d530b95d9942300f675773d4371cb1a5fdd10d83db5baf81 SHA512 dd3ea49c82007b993dc330130646bf6b585edae932358b5272061cac13f03eaf1527591c533ed3b4030da06798c22fbc7669ddc69eb725db5946488d06c933b3
DIST zigbee2mqtt-1.33.2-node_modules.tar.xz 17115112 BLAKE2B 1f60034e5651a00b705a9d8e16b3151b9c28a1458ee2ffff8f6367ec4d9839e8178c82c2c5e3c3249674ec2bda73548a66590baa59c071532b8db3b13166aa5b SHA512 e2b393d9f084917bac3157c85fe39d0bffed6930a5714f811aca771e65b9cdec980dfa107380431bfcc2d0d1ff73da4e49cebb3a5df81f681279b08925351f38
DIST zigbee2mqtt-1.33.2.tar.gz 566167 BLAKE2B eaf1f023f0925571a793324d272937a46a7ffab0582ba15eba9e38ab6e8484cf0612e3ee457dccd6da16443481a6273171bd8615dd5864a83a0af9c122d8689d SHA512 986a0eeca4e72fd9da39c909a2f47e64f23fed96970b5fdaa226a69c4316ebb9e158b9ca8f94e84d0450ec688e30533e50d6a9d4033b8aeb48dddd08191491fc
EBUILD zigbee2mqtt-1.33.2.ebuild 1789 BLAKE2B a099d20877b0003fa802be8e008ffc1754428b11ca41f317819a007a499c1ee1f5875cab6094a43579c78d0aa87d6b6b1d8cc86ada911b5a06364e2c199cc4a0 SHA512 cd6715a6a3e2e79af05d7a99f892f4fa2377ffd5e166f6af1d8df9861c12a1ba6b418d942001d428e884ccdae24e1755c9e8d0e797a92a046fd5ac84cfbb6412
MISC metadata.xml 480 BLAKE2B dc80fdb17a73b1f63ef970674d5bb1a950b14d6d318276ad3303157dd93fbba9165a9e2b70a0380cbf70b77ecf31ed856698f7887ae0bc09a5d71c66ff7d4b42 SHA512 e7cbfb9fb939af0066a1a779af9af60df9a45d7b42b16706f6dcd321e4bd5b9b432120321b9cfe0d28809cd207f8aba36f9119c07b6adefe109acd207a15e51d

View File

@ -1,59 +0,0 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
if [[ ${PV} == *9999* ]]; then
EGIT_REPO_URI="https://github.com/Koenkk/zigbee2mqtt"
EGIT_BRANCH="dev"
inherit git-r3
else
SRC_URI="https://github.com/Koenkk/zigbee2mqtt/archive/${PV}.tar.gz -> ${P}.tar.gz
https://raw.githubusercontent.com/inode64/inode64-overlay/main/dist/${P}-node_modules.tar.xz"
fi
inherit nodejs-mod systemd tmpfiles
DESCRIPTION="It bridges events and allows you to control your Zigbee devices via MQTT"
HOMEPAGE="https://www.zigbee2mqtt.io/"
COMMIT="cdf62ea5601f74af19b1626b72afc88edbd8e4ab"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
RDEPEND="
acct-group/zigbee2mqtt
acct-user/zigbee2mqtt
app-misc/mosquitto
"
NODEJS_EXTRA_FILES="scripts"
src_install() {
echo "${COMMIT}" > dist/.hash
echo -e "\nadvanced:" >>data/configuration.yaml
echo -e " network_key: GENERATE" >>data/configuration.yaml
echo -e " pan_id: GENERATE" >>data/configuration.yaml
echo -e " log_directory: /var/log/${PN}" >>data/configuration.yaml
nodejs-mod_src_install
keepdir /var/log/${PN}
insinto /var/lib/${PN}
doins data/configuration.yaml
dotmpfiles "${FILESDIR}"/zigbee2mqtt.conf
doinitd "${FILESDIR}"/${PN}
systemd_dounit "${FILESDIR}/${PN}.service"
dodir /etc/env.d
echo 'CONFIG_PROTECT="/var/lib/${PN}"' >>"${ED}"/etc/env.d/90${PN} || die
}
pkg_postinst() {
tmpfiles_process zigbee2mqtt.conf
}

View File

@ -16,9 +16,9 @@ inherit nodejs-mod systemd tmpfiles
DESCRIPTION="It bridges events and allows you to control your Zigbee devices via MQTT"
HOMEPAGE="https://www.zigbee2mqtt.io/"
COMMIT="eb878d3d8ee47f77e27c771452e2d2c77ca83bb5"
COMMIT="9996c931e25a0a3e72d9bb1aa89ed9c36eec8a89"
LICENSE="GPL-3"
LICENSE="0BSD Apache-2.0 BSD-2 CC-BY-4.0 GPL-3 ISC MIT PYTHON"
SLOT="0"
KEYWORDS="~amd64"
@ -30,6 +30,16 @@ RDEPEND="
NODEJS_EXTRA_FILES="scripts"
pkg_pretend() {
if ! grep -q "CONFIG_PROTECT=\"/var/lib/${PN}\"" "${EROOT}/etc/env.d/90${PN}" 2>/dev/null; then
eerror "Bad CONFIG_PROTECT"
eerror "update ${EROOT}/etc/env.d/90${PN} to include CONFIG_PROTECT=\"/var/lib/${PN}\""
eerror ""
eerror ""
die "Bad CONFIG_PROTECT"
fi
}
src_install() {
echo "${COMMIT}" > dist/.hash
@ -51,7 +61,7 @@ src_install() {
systemd_dounit "${FILESDIR}/${PN}.service"
dodir /etc/env.d
echo 'CONFIG_PROTECT="/var/lib/${PN}"' >>"${ED}"/etc/env.d/90${PN} || die
echo "CONFIG_PROTECT=\"/var/lib/${PN}"\" >>"${ED}"/etc/env.d/90${PN} || die
}
pkg_postinst() {

View File

@ -6,12 +6,12 @@
# Fco. Javier Félix <web@inode64.com>
# @AUTHOR:
# Fco. Javier Félix <web@inode64.com>
# @SUPPORTED_EAPIS: 7 8
# @SUPPORTED_EAPIS: 8
# @BLURB: An eclass for build NodeJS projects
# @DESCRIPTION:
# An eclass providing functions to build NodeJS projects
#
# Changelog:
# Credits and ideas from:
# Initial version from:
# https://github.com/gentoo/gentoo/pull/930/files
# https://github.com/samuelbernardo/ssnb-overlay/blob/master/eclass/npm.eclass
@ -30,8 +30,8 @@
# tar --create --auto-compress --file foo-1-node_modules.tar.xz foo-1/node_modules/
case ${EAPI} in
7 | 8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_NODEJS_MOD_ECLASS} ]]; then
@ -40,7 +40,7 @@ _NODEJS_MOD_ECLASS=1
inherit nodejs
if has nodejs-pack ${INHERITED}; then
eerror "nodejs-mod and nodejs-pack eclass are incompatible"
die "nodejs-mod and nodejs-pack eclass are incompatible"
fi
RDEPEND+=" net-libs/nodejs:="
@ -53,7 +53,7 @@ nodejs-mod_src_prepare() {
if [[ ! -e package.json ]]; then
eerror "Unable to locate package.json"
eerror "Consider not inheriting the nodejs eclass."
eerror "Consider not inheriting the NodeJS eclass."
die "FATAL: Unable to find package.json"
fi
@ -62,7 +62,7 @@ nodejs-mod_src_prepare() {
# @FUNCTION: nodejs-mod_src_compile
# @DESCRIPTION:
# General function for compiling a nodejs module
# General function for compiling a NodeJS module
nodejs-mod_src_compile() {
debug-print-function "${FUNCNAME}" "${@}"
@ -71,7 +71,7 @@ nodejs-mod_src_compile() {
find node_modules/ -name binding.gyp -exec dirname {} \; | while read -r dir; do
pushd "${dir}" >/dev/null || die
# shellcheck disable=SC2046
npm_config_nodedir=/usr/ /usr/$(get_libdir)/node_modules/npm/bin/node-gyp-bin/node-gyp rebuild --verbose
npm_config_nodedir=/usr/ /usr/$(get_libdir)/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose
popd >/dev/null || die
done
fi
@ -84,7 +84,7 @@ nodejs-mod_src_compile() {
# @FUNCTION: nodejs-mod_src_test
# @DESCRIPTION:
# General function for testing a nodejs module
# General function for testing a NodeJS module
nodejs-mod_src_test() {
debug-print-function "${FUNCNAME}" "${@}"

View File

@ -6,12 +6,12 @@
# Fco. Javier Félix <web@inode64.com>
# @AUTHOR:
# Fco. Javier Félix <web@inode64.com>
# @SUPPORTED_EAPIS: 7 8
# @SUPPORTED_EAPIS: 8
# @BLURB: An eclass for build NodeJS projects
# @DESCRIPTION:
# An eclass providing functions to build NodeJS packages
#
# Changelog:
# Credits and ideas from:
# Initial version from:
# https://github.com/gentoo/gentoo/pull/930/files
# https://github.com/samuelbernardo/ssnb-overlay/blob/master/eclass/npm.eclass
@ -19,8 +19,8 @@
# https://github.com/Tatsh/tatsh-overlay/blob/master/eclass/yarn.eclass
case ${EAPI} in
7 | 8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_NODEJS_PACK_ECLASS} ]]; then
@ -29,14 +29,11 @@ _NODEJS_PACK_ECLASS=1
inherit nodejs
if has nodejs-mod ${INHERITED}; then
eerror "nodejs-mod and nodejs-pack eclass are incompatible"
die "nodejs-mod and nodejs-pack eclass are incompatible"
fi
RDEPEND+=" net-libs/nodejs"
# Do not complain about CFLAGS etc since nodejs-pack projects do not use them.
QA_FLAGS_IGNORED='.*'
# Upstream does not support stripping go packages
RESTRICT="test strip"
@ -57,7 +54,7 @@ nodejs-pack_src_prepare() {
# @FUNCTION: nodejs-pack_src_compile
# @DESCRIPTION:
# General function for compiling a nodejs module
# General function for compiling a NodeJS module
nodejs-pack_src_compile() {
debug-print-function "${FUNCNAME}" "${@}"
@ -78,7 +75,7 @@ nodejs-pack_src_install() {
install \
"$(nodejs_package)-$(nodejs_version).tgz" || die "install failed"
pushd "${ED}/$(_NODEJS_MODULES)" >/dev/null || die
pushd "${ED}/$(nodejs_modules)" >/dev/null || die
nodejs_remove_dev
popd >/dev/null || die
}

View File

@ -6,12 +6,12 @@
# Fco. Javier Félix <web@inode64.com>
# @AUTHOR:
# Fco. Javier Félix <web@inode64.com>
# @SUPPORTED_EAPIS: 7 8
# @SUPPORTED_EAPIS: 8
# @BLURB: An eclass for build NodeJS projects
# @DESCRIPTION:
# An eclass providing functions to build NodeJS projects
#
# Changelog:
# Credits and ideas from:
# Initial version from:
# https://github.com/gentoo/gentoo/pull/930/files
# https://github.com/samuelbernardo/ssnb-overlay/blob/master/eclass/npm.eclass
@ -30,20 +30,20 @@
# tar --create --auto-compress --file foo-1-node_modules.tar.xz foo-1/node_modules/
case ${EAPI} in
7 | 8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_NODEJS_ECLASS} ]]; then
_NODEJS_ECLASS=1
# @ECLASS_VARIABLE: NODEJS_MANAGEMENT
# @ECLASS_VARIABLE: NODEJS_MANAGER
# @PRE_INHERIT
# @DEFAULT_UNSET
# @DESCRIPTION:
# Specify a package management
# Specify a NodeJS package manager to use. ( npm | yarn )
# The default is set to "npm".
: "${NODEJS_MANAGEMENT:=npm}"
: "${NODEJS_MANAGER:=npm}"
# @ECLASS_VARIABLE: NODEJS_FILES
# @INTERNAL
@ -58,17 +58,24 @@ NODEJS_FILES="babel.config.js babel.config.json cli.js dist index.js lib node_mo
# Can be either files, or directories.
# Example: NODEJS_EXTRA_FILES="rigger.js modules"
case ${NODEJS_MANAGEMENT} in
npm)
BDEPEND+=" net-libs/nodejs[npm]"
;;
yarn)
BDEPEND+=" sys-apps/yarn"
;;
*)
eerror "Unknown value for \${NODEJS_MANAGEMENT}"
die "Value ${NODEJS_MANAGEMENT} is not supported"
;;
# @VARIABLE: MYNPMARGS
# @DEFAULT_UNSET
# @DESCRIPTION:
# User-controlled environment variable containing arguments to be passed to npm
case ${NODEJS_MANAGER} in
npm)
BDEPEND+=" net-libs/nodejs[npm]"
;;
yarn)
BDEPEND+=" sys-apps/yarn"
;;
*)
eerror "Unknown value for \${NODEJS_MANAGER}"
die "Value ${NODEJS_MANAGER} is not supported"
;;
esac
# @FUNCTION: nodejs_version
@ -99,10 +106,10 @@ nodejs_has_build() {
node -p "if (require('./package.json').scripts.build === undefined) { process.exit(1) }" &>/dev/null
}
# @FUNCTION: _NODEJS_MODULES
# @FUNCTION: nodejs_modules
# @DESCRIPTION:
# Returns location where to install nodejs
_NODEJS_MODULES() {
# Returns location where to install NodeJS
nodejs_modules() {
# shellcheck disable=SC2046
echo /usr/$(get_libdir)/node_modules/$(nodejs_package)
}
@ -111,7 +118,7 @@ _NODEJS_MODULES() {
# @DESCRIPTION:
# Returns true (0) if is a package
nodejs_has_package() {
[[ -d "${S}"/package ]] || return 1
[[ -d "${S}"/package ]]
}
# @FUNCTION: nodejs_docs
@ -146,7 +153,7 @@ nodejs_remove_dev() {
# shellcheck disable=SC2185
find -type f -iregex '.*/\(readme\(.*\)?\|changelog\|roadmap\|security\|release\|contributors\|todo\|authors\)$' -delete || die
# Remove typscript files
# Remove TypeScript files
# shellcheck disable=SC2185
find -type f -iregex '.*\.\(tsx?\|jsx\|map\)$' -delete || die
# shellcheck disable=SC2185
@ -206,40 +213,40 @@ nodejs_remove_dev() {
enpm() {
debug-print-function "${FUNCNAME}" "${@}"
local mynpmflags_local mynpmflagstype npmflags
local mynpmargs_local mynpmargstype npmargs
# Make the array a local variable since <=portage-2.1.6.x does not support
# global arrays (see bug #297255). But first make sure it is initialised.
[[ -z ${mynpmflags} ]] && declare -a mynpmflags=()
mynpmflagstype=$(declare -p mynpmflags 2>&-)
if [[ "${mynpmflagstype}" != "declare -a mynpmflags="* ]]; then
die "mynpmflags must be declared as array"
[[ -z ${mynpmargs} ]] && declare -a mynpmargs=()
mynpmargstype=$(declare -p mynpmargs 2>&-)
if [[ "${mynpmargstype}" != "declare -a mynpmargs="* ]]; then
die "mynpmargs must be declared as array"
fi
mynpmflags_local=("${mynpmflags[@]}")
mynpmargs_local=("${mynpmargs[@]}")
npmflags=(
npmargs=(
--color false
--foreground-scripts
--offline
--progress false
--verbose
"${mynpmflags_local[@]}"
"${mynpmargs_local[@]}"
)
case ${NODEJS_MANAGEMENT} in
npm)
npmflags+=(
--audit false
)
npm "$@" "${npmflags[@]}"
;;
yarn)
npmflags+=(
--cache-folder "${S}/.cache"
)
yarn "$@" "${npmflags[@]}"
;;
case ${NODEJS_MANAGER} in
npm)
npmargs+=(
--audit false
)
npm "$@" "${npmargs[@]}"
;;
yarn)
npmargs+=(
--cache-folder "${S}/.cache"
)
yarn "$@" "${npmargs[@]}"
;;
esac
}
@ -252,16 +259,16 @@ enpm_clean() {
local nodejs_files f
einfo "Clean files"
case ${NODEJS_MANAGEMENT} in
npm)
enpm prune --omit=dev || die
;;
yarn)
enpm install production || die
# TODO
#enpm autoclean --init || die
#enpm autoclean --force || die
;;
case ${NODEJS_MANAGER} in
npm)
enpm prune --omit=dev || die
;;
yarn)
enpm install production || die
# TODO
#enpm autoclean --init || die
#enpm autoclean --force || die
;;
esac
nodejs_files="${NODEJS_FILES} ${NODEJS_EXTRA_FILES}"
@ -278,7 +285,7 @@ enpm_clean() {
# @FUNCTION: enpm_install
# @DESCRIPTION:
# Install the files and folders necessary for the execution of nodejs
# Install the files and folders necessary for the execution of NodeJS
enpm_install() {
debug-print-function "${FUNCNAME}" "${@}"
@ -293,11 +300,11 @@ enpm_install() {
nodejs_files="${NODEJS_FILES} ${NODEJS_EXTRA_FILES} $(nodejs_package).js"
dodir "$(_NODEJS_MODULES)" || die "Could not create DEST folder"
dodir "$(nodejs_modules)" || die "Could not create DEST folder"
for f in ${nodejs_files}; do
if [[ -e "${S}/${f}" ]]; then
cp -r "${S}/${f}" "${ED}/$(_NODEJS_MODULES)"
cp -r "${S}/${f}" "${ED}/$(nodejs_modules)"
fi
done
}