Compare commits

...
Sign in to create a new pull request.

6 commits

Author SHA1 Message Date
Damian Wrobel
15ec1dda57 Update to the latest available version 2020-09-08 20:13:48 +02:00
Damian Wrobel
55787ff92c Update to the latest available version 2020-08-31 14:28:46 +02:00
Damian Wrobel
cacbbab134 Update to the latest available version 2020-07-01 23:04:10 +02:00
Damian Wrobel
2200fc5b26 Update to the latest available version 2020-04-23 11:11:55 +02:00
Damian Wrobel
b79478bacf Update to the latest available version 2020-04-09 20:50:31 +02:00
Damian Wrobel
98bd1747f7 Update to the latest available version
- Drop patches upstream merged
2020-04-01 18:50:56 +02:00
7 changed files with 34 additions and 356 deletions

6
.gitignore vendored
View file

@ -1 +1,7 @@
/wmbusmeters-0.9.27.tar.gz
/wmbusmeters-0.9.28.tar.gz
/wmbusmeters-0.9.29.tar.gz
/wmbusmeters-0.9.30.tar.gz
/wmbusmeters-0.9.32.tar.gz
/wmbusmeters-0.9.35.tar.gz
/wmbusmeters-0.9.36.tar.gz

View file

@ -1 +1 @@
SHA512 (wmbusmeters-0.9.27.tar.gz) = 4c5845805c0ba3fefdc65c8aec8ca2433a9722c6e9d82b7bfad5e717309d4066a77402b3ada4242ec774edd25f11f348843c56c05737dac0bcea6d125c067eee
SHA512 (wmbusmeters-0.9.36.tar.gz) = 82a330490e5252e42282f69d0db5f313a27e736cd481e8edd2fc564af32943b2e1560c3c939f284f218656e08aef9363b016305fcf14d899bc1d2f673c69bdfb

View file

@ -1,45 +0,0 @@
From d840804b31a632cf1e984d949897836a5395b031 Mon Sep 17 00:00:00 2001
From: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
Date: Mon, 2 Mar 2020 10:07:04 +0100
Subject: [PATCH] Fix accessing empty string
Fixes the following crash:
(gdb) bt
#0 0x00005555555738d0 in abort@plt ()
#1 0x0000555555589888 in std::__replacement_assert (__file=<optimized out>, __line=<optimized out>, __function=<optimized out>, __condition=<optimized out>) at /usr/include/c++/9/x86_64-redhat-linux/bits/c++config.h:2533
#2 0x00005555555d1e37 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::front (this=0x7ffff7a226d0) at /usr/include/c++/9/bits/basic_string.h:1123
#3 0x00005555555ce8c5 in doesIdMatchExpression (id=..., match=...) at src/util.cc:513
#4 0x00005555555cea92 in doesIdMatchExpressions (id=..., mes=...) at src/util.cc:560
#5 0x000055555558aa56 in MeterCommonImplementation::isTelegramForMe (this=0x555555661c28, t=0x7ffff7a227b0) at src/meters.cc:188
#6 0x000055555558c0e0 in MeterCommonImplementation::handleTelegram (this=0x555555661c28, input_frame=...) at src/meters.cc:289
#7 0x000055555558c87a in MeterCommonImplementation::<lambda(std::vector<unsigned char, std::allocator<unsigned char> >)>::operator() (__closure=<optimized out>, input_frame=...) at /usr/include/c++/9/bits/stl_algobase.h:465
#8 std::_Function_handler<bool(std::vector<unsigned char, std::allocator<unsigned char> >), MeterCommonImplementation::MeterCommonImplementation(WMBus*, MeterInfo&, MeterType, int)::<lambda(std::vector<unsigned char, std::allocator<unsigned char> >)> >::_M_invoke(const std::_Any_data &, std::vector<unsigned char, std::allocator<unsigned char> > &&) (__functor=..., __args#0=...) at /usr/include/c++/9/bits/std_function.h:285
#9 0x00005555555da01f in std::function<bool (std::vector<unsigned char, std::allocator<unsigned char> >)>::operator()(std::vector<unsigned char, std::allocator<unsigned char> >) const (__args#0=..., this=0x7ffff7a22c70) at /usr/include/c++/9/bits/std_function.h:685
#10 WMBusCommonImplementation::handleTelegram (this=this@entry=0x555555661b40, frame=...) at src/wmbus.cc:3328
#11 0x00005555555fbf7b in WMBusRTLWMBUS::processSerialData (this=0x555555661ad0) at /usr/include/c++/9/bits/stl_algobase.h:465
#12 0x00005555555cb001 in std::function<void ()>::operator()() const (this=<optimized out>) at /usr/include/c++/9/bits/std_function.h:685
#13 SerialCommunicationManagerImp::eventLoop (this=0x5555556617c0) at src/serial.cc:795
#14 0x00007ffff7f554e2 in ?? ()
#15 0x0000000000000000 in ?? ()
Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
---
src/util.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util.cc b/src/util.cc
index bcacb16..22f7b31 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -510,7 +510,7 @@ bool doesIdMatchExpression(string id, string match)
}
bool wildcard_used = false;
- if (match.front() == '*')
+ if (match.length() && match.front() == '*')
{
wildcard_used = true;
match.erase(0,1);
--
2.24.1

View file

@ -1,66 +0,0 @@
From a8562de6c0a5d80332a83b92f88b48688beabd39 Mon Sep 17 00:00:00 2001
From: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
Date: Fri, 28 Feb 2020 18:20:22 +0100
Subject: [PATCH] Fix compilation error on gcc 10.x
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes the following compilation error:
In file included from src/config.h:21,
from src/cmdline.h:21,
from src/cmdline.cc:18:
src/units.h:42:11: error: extended character ° is not valid in an identifier
42 | X(C,c,°C,Temperature,"celsius") \
| ^
src/units.h:43:11: error: extended character ° is not valid in an identifier
43 | X(F,f,°F,Temperature,"fahrenheit") \
| ^
make: *** [Makefile:93: build/cmdline.o] Error 1
Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
---
src/units.h | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/units.h b/src/units.h
index a1c0384..ac0c7ce 100644
--- a/src/units.h
+++ b/src/units.h
@@ -33,19 +33,19 @@
X(Time,Hour) \
#define LIST_OF_UNITS \
- X(KWH,kwh,kWh,Energy,"kilo Watt hour") \
- X(GJ,gj,GJ,Energy,"Giga Joule") \
- X(M3,m3,m3,Volume,"cubic meter") \
- X(L,l,l,Volume,"litre") \
- X(KW,kw,kW,Power,"kilo Watt") \
- X(M3H,m3h,m3/h,Flow,"cubic meters per hour") \
- X(C,c,°C,Temperature,"celsius") \
- X(F,f,°F,Temperature,"fahrenheit") \
- X(RH,rh,RH,RelativeHumidity,"relative humidity") \
- X(HCA,hca,hca,HCA,"heat cost allocation") \
- X(TXT,txt,txt,Text,"text") \
- X(Second,s,s,Time,"second") \
- X(Hour,h,h,Time,"hour")
+ X(KWH,kwh,"kWh",Energy,"kilo Watt hour") \
+ X(GJ,gj,"GJ",Energy,"Giga Joule") \
+ X(M3,m3,"m3",Volume,"cubic meter") \
+ X(L,l,"l",Volume,"litre") \
+ X(KW,kw,"kW",Power,"kilo Watt") \
+ X(M3H,m3h,"m3/h",Flow,"cubic meters per hour") \
+ X(C,c,"°C",Temperature,"celsius") \
+ X(F,f,"°F",Temperature,"fahrenheit") \
+ X(RH,rh,"RH",RelativeHumidity,"relative humidity") \
+ X(HCA,hca,"hca",HCA,"heat cost allocation") \
+ X(TXT,txt,"txt",Text,"text") \
+ X(Second,s,"s",Time,"second") \
+ X(Hour,h,"h",Time,"hour")
enum class Unit
{
--
2.24.1

View file

@ -1,203 +0,0 @@
From 7d74511dcb26381f5cab0b6c5be15cd6d4126b63 Mon Sep 17 00:00:00 2001
From: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
Date: Sun, 1 Mar 2020 20:41:19 +0100
Subject: [PATCH] Make easier to packaging wmbumeters for linux
Makefile:
- Allow to disable stripping of executables as this prevents from
properly creating debug information sub packages,
- Don't invoke any git commands when building from released
tarball. Moreover, when creating an rpm package with additional
patches then the created git repository is the one in which rpm
applies patches and not the original one.
- Allow to pass CXXFLAGS and LDFLAGS as distributions requires all
packages to be compiled with the same set of flags.
- Support to override DESTDIR when installing files.
- Allow to pass additional arguments (EXTRA_INSTALL_OPTION)
for install.sh script from Makefile.
Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
---
Makefile | 27 ++++++++++++++++-----------
install.sh | 30 +++++++++++++++---------------
uninstall.sh | 6 +++---
3 files changed, 34 insertions(+), 29 deletions(-)
diff --git a/Makefile b/Makefile
index 290e753..5f5671f 100644
--- a/Makefile
+++ b/Makefile
@@ -20,14 +20,16 @@
# make DEBUG=true
# make DEBUG=true HOST=arm
+DESTDIR?=/
+
ifeq "$(HOST)" "arm"
CXX=arm-linux-gnueabihf-g++
- STRIP=arm-linux-gnueabihf-strip
+ STRIP?=arm-linux-gnueabihf-strip
BUILD=build_arm
DEBARCH=armhf
else
CXX=g++
- STRIP=strip
+ STRIP?=strip
#--strip-unneeded --remove-section=.comment --remove-section=.note
BUILD=build
DEBARCH=amd64
@@ -47,10 +49,10 @@ endif
$(shell mkdir -p $(BUILD))
-COMMIT_HASH:=$(shell git log --pretty=format:'%H' -n 1)
-TAG:=$(shell git describe --tags)
-CHANGES:=$(shell git status -s | grep -v '?? ')
-TAG_COMMIT_HASH:=$(shell git show-ref --tags | grep $(TAG) | cut -f 1 -d ' ')
+COMMIT_HASH?=$(shell git log --pretty=format:'%H' -n 1)
+TAG?=$(shell git describe --tags)
+CHANGES?=$(shell git status -s | grep -v '?? ')
+TAG_COMMIT_HASH?=$(shell git show-ref --tags | grep $(TAG) | cut -f 1 -d ' ')
ifeq ($(COMMIT),$(TAG_COMMIT))
# Exactly on the tagged commit. The version is the tag!
@@ -81,7 +83,10 @@ endif
$(info Building $(VERSION))
-CXXFLAGS := $(DEBUG_FLAGS) -fPIC -fmessage-length=0 -std=c++11 -Wall -Wno-unused-function -I$(BUILD)
+CXXFLAGS ?= $(DEBUG_FLAGS) -fPIC -fmessage-length=0 -std=c++11 -Wall -Wno-unused-function
+CXXFLAGS += -I$(BUILD)
+
+LDFLAGS ?= $(DEBUG_LDFLAGS)
$(BUILD)/%.o: src/%.cc $(wildcard src/%.h)
$(CXX) $(CXXFLAGS) $< -c -E > $@.src
@@ -139,7 +144,7 @@ all: $(BUILD)/wmbusmeters $(BUILD)/testinternals
dist: wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb
install: $(BUILD)/wmbusmeters
- @./install.sh $(BUILD)/wmbusmeters /
+ @./install.sh $(BUILD)/wmbusmeters $(DESTDIR) $(EXTRA_INSTALL_OPTIONS)
uninstall:
@./uninstall.sh /
@@ -162,7 +167,7 @@ wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb:
$(BUILD)/main.o: $(BUILD)/short_manual.h
$(BUILD)/wmbusmeters: $(METER_OBJS) $(BUILD)/main.o $(BUILD)/short_manual.h
- $(CXX) -o $(BUILD)/wmbusmeters $(METER_OBJS) $(BUILD)/main.o $(DEBUG_LDFLAGS) -lpthread
+ $(CXX) -o $(BUILD)/wmbusmeters $(METER_OBJS) $(BUILD)/main.o $(LDFLAGS) -lpthread
$(BUILD)/short_manual.h: README.md
echo 'R"MANUAL(' > $(BUILD)/short_manual.h
@@ -172,10 +177,10 @@ $(BUILD)/short_manual.h: README.md
echo ')MANUAL";' >> $(BUILD)/short_manual.h
$(BUILD)/testinternals: $(METER_OBJS) $(BUILD)/testinternals.o
- $(CXX) -o $(BUILD)/testinternals $(METER_OBJS) $(BUILD)/testinternals.o $(DEBUG_LDFLAGS) -lpthread
+ $(CXX) -o $(BUILD)/testinternals $(METER_OBJS) $(BUILD)/testinternals.o $(LDFLAGS) -lpthread
$(BUILD)/fuzz: $(METER_OBJS) $(BUILD)/fuzz.o
- $(CXX) -o $(BUILD)/fuzz $(METER_OBJS) $(BUILD)/fuzz.o $(DEBUG_LDFLAGS) -lpthread
+ $(CXX) -o $(BUILD)/fuzz $(METER_OBJS) $(BUILD)/fuzz.o $(LDFLAGS) -lpthread
clean:
rm -rf build/* build_arm/* build_debug/* build_arm_debug/* *~
diff --git a/install.sh b/install.sh
index 2a1b12a..966f389 100755
--- a/install.sh
+++ b/install.sh
@@ -205,34 +205,34 @@ fi
####################################################################
##
-## Create /etc/systemd/system/wmbusmeters.service
+## Create /lib/systemd/system/wmbusmeters.service
##
SYSTEMD_NEEDS_RELOAD=false
-if [ -f "$ROOT"/etc/systemd/system/wmbusmeters.service ]
+if [ -f "$ROOT"/lib/systemd/system/wmbusmeters.service ]
then
- echo systemd: removing "$ROOT"/etc/systemd/system/wmbusmeters.service
+ echo systemd: removing "$ROOT"/lib/systemd/system/wmbusmeters.service
echo systemd: backup stored here: ~/old.wmbusmeters.service.backup
- cp "$ROOT"/etc/systemd/system/wmbusmeters.service ~/old.wmbusmeters@.service.backup
- rm "$ROOT"/etc/systemd/system/wmbusmeters.service
+ cp "$ROOT"/lib/systemd/system/wmbusmeters.service ~/old.wmbusmeters@.service.backup
+ rm "$ROOT"/lib/systemd/system/wmbusmeters.service
SYSTEMD_NEEDS_RELOAD=true
fi
-if [ -f "$ROOT"/etc/systemd/system/wmbusmeters@.service ]
+if [ -f "$ROOT"/lib/systemd/system/wmbusmeters@.service ]
then
- echo systemd: removing "$ROOT"/etc/systemd/system/wmbusmeters@.service
+ echo systemd: removing "$ROOT"/lib/systemd/system/wmbusmeters@.service
echo systemd: backup stored here: ~/old.wmbusmeters@.service.backup
- cp "$ROOT"/etc/systemd/system/wmbusmeters@.service ~/old.wmbusmeters@.service.backup
- rm "$ROOT"/etc/systemd/system/wmbusmeters@.service
+ cp "$ROOT"/lib/systemd/system/wmbusmeters@.service ~/old.wmbusmeters@.service.backup
+ rm "$ROOT"/lib/systemd/system/wmbusmeters@.service
SYSTEMD_NEEDS_RELOAD=true
fi
-if [ ! -f "$ROOT"/etc/systemd/system/wmbusmeters@.service ]
+if [ ! -f "$ROOT"/lib/systemd/system/wmbusmeters@.service ]
then
- mkdir -p "$ROOT"/etc/systemd/system/
+ mkdir -p "$ROOT"/lib/systemd/system/
# Create service file
- cat <<EOF > "$ROOT"/etc/systemd/system/wmbusmeters@.service
+ cat <<EOF > "$ROOT"/lib/systemd/system/wmbusmeters@.service
[Unit]
Description="wmbusmeters service on %I"
After=network.target
@@ -265,9 +265,9 @@ PIDFile=/var/run/wmbusmeters/wmbusmeters-%i.pid
WantedBy=multi-user.target
EOF
- echo systemd: installed "$ROOT"/etc/systemd/system/wmbusmeters@.service
+ echo systemd: installed "$ROOT"/lib/systemd/system/wmbusmeters@.service
else
- echo systemd: "$ROOT"/etc/systemd/system/wmbusmeters@.service unchanged
+ echo systemd: "$ROOT"/lib/systemd/system/wmbusmeters@.service unchanged
fi
@@ -308,7 +308,7 @@ fi
if [ "$SYSTEMD_NEEDS_RELOAD" = "true" ]
then
- D=$(diff "$ROOT"/etc/systemd/system/wmbusmeters@.service ~/old.wmbusmeters@.service.backup)
+ D=$(diff "$ROOT"/lib/systemd/system/wmbusmeters@.service ~/old.wmbusmeters@.service.backup)
if [ "$D" != "" ]
then
echo
diff --git a/uninstall.sh b/uninstall.sh
index 5030027..4b62f93 100755
--- a/uninstall.sh
+++ b/uninstall.sh
@@ -52,10 +52,10 @@ then
echo conf dir: removed "$ROOT"/etc/wmbusmeters.d
fi
-if [ -f "$ROOT"/etc/systemd/system/wmbusmeters.service ]
+if [ -f "$ROOT"/lib/systemd/system/wmbusmeters.service ]
then
- rm "$ROOT"/etc/systemd/system/wmbusmeters.service
- echo systemd: removed "$ROOT"/etc/systemd/system/wmbusmeters.service
+ rm "$ROOT"/lib/systemd/system/wmbusmeters.service
+ echo systemd: removed "$ROOT"/lib/systemd/system/wmbusmeters.service
fi
if [ -f "$ROOT"/etc/udev/rules.d/99-wmbus-usb-serial.rules ]
--
2.24.1

View file

@ -1,26 +0,0 @@
From 21463d51e68c887ac5f78fa75229b1e72df8c8f6 Mon Sep 17 00:00:00 2001
From: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
Date: Tue, 3 Mar 2020 10:21:33 +0100
Subject: [PATCH] Make wmbusmeters.d directory accessible for the owner
Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index 966f389..34929bb 100755
--- a/install.sh
+++ b/install.sh
@@ -197,7 +197,7 @@ if [ ! -d "$ROOT"/etc/wmbusmeters.d ]
then
# Create the configuration directory
mkdir -p "$ROOT"/etc/wmbusmeters.d
- chmod -R 655 "$ROOT"/etc/wmbusmeters.d
+ chmod -R 755 "$ROOT"/etc/wmbusmeters.d
echo conf dir: created "$ROOT"/etc/wmbusmeters.d
else
echo conf dir: "$ROOT"/etc/wmbusmeters.d unchanged
--
2.24.1

View file

@ -1,38 +1,28 @@
Name: wmbusmeters
%global forgeurl https://github.com/weetmuts/%{name}
%global tag 0.9.27
%global tag 0.9.36
%global the_binary rtl_wmbus
Version: %{tag}
%forgemeta
Release: 6%{?dist}
Release: 1%{?dist}
Summary: Read the wireless mbus protocol to acquire utility meter readings
License: GPLv3+
Url: %{forgeurl}
Source0: %{forgesource}
# Default configuration file
# Stores all logs in journald
Source1: %{name}.conf
Source1: file://%{name}.conf
# Systemd service file
Source2: %{name}@.service
# Upstream reference: https://github.com/weetmuts/wmbusmeters/pull/87
Patch0: %{name}-Make-easier-to-packaging-wmbumeters-for-linux.patch
# Fixes compilation error on gcc >= 10.x
# Upstream reference: https://github.com/weetmuts/wmbusmeters/pull/85
Patch1: %{name}-Fix-compilation-error-on-gcc-10.x.patch
# Fixes crash
# Upstream reference: https://github.com/weetmuts/wmbusmeters/pull/86
Patch2: %{name}-Fix-accessing-empty-string.patch
# Make wmbusmeters.d directory accessible for the owner
# Upstream reference: https://github.com/weetmuts/wmbusmeters/pull/88
Patch3: %{name}-Make-wmbusmeters.d-directory-accessible-for-the-owne.patch
Source2: file://%{name}@.service
BuildRequires: /usr/bin/git
BuildRequires: gcc-c++
BuildRequires: systemd-rpm-macros
BuildRequires: ncurses-devel
Requires: /usr/bin/rtl_wmbus
@ -68,6 +58,9 @@ install -m 0755 -d %{buildroot}/%{_rundir}/%{name}/
# Fix systemd unit dir location
mv %{buildroot}/lib %{buildroot}/%{_prefix}
# We are installing template version
rm -f %{buildroot}%{_unitdir}/%{name}.service
# Install default configuration file
install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}.conf
@ -98,6 +91,25 @@ install -p -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}@.service
%changelog
* Tue Sep 08 2020 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.36-1
- Update to the latest available version
* Mon Aug 31 2020 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.35-1
- Update to the latest available version
* Wed Jul 01 2020 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.32-1
- Update to the latest available version
* Thu Apr 23 2020 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.30-1
- Update to the latest available version
* Fri Apr 03 2020 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.29-1
- Update to the latest available version
* Tue Mar 24 2020 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.28-1
- Update to the latest available version
- Drop patches upstream merged
* Mon Mar 23 2020 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.27-6
- Remove -v from the forgemeta
- Remove instead of exclude logrotate.d directory