debian/patches/: Drop all patches merged upstream

This commit is contained in:
Laurent Bigonville 2022-07-10 10:56:23 +02:00
parent 9e5d5b9c96
commit 4ce415be3c
8 changed files with 2 additions and 1295 deletions

3
debian/changelog vendored
View File

@ -23,8 +23,9 @@ nut (2.8.0-1) UNRELEASED; urgency=medium
dependency dependency
* debian/control: BD against libusb-1.0-0-dev instead of libusb-dev * debian/control: BD against libusb-1.0-0-dev instead of libusb-dev
* debian/patches/0001-reproductible-build.patch: Refreshed * debian/patches/0001-reproductible-build.patch: Refreshed
* debian/patches/: Drop all patches merged upstream
-- Laurent Bigonville <bigon@debian.org> Sun, 10 Jul 2022 10:25:16 +0200 -- Laurent Bigonville <bigon@debian.org> Sun, 10 Jul 2022 10:56:06 +0200
nut (2.7.4-14) unstable; urgency=medium nut (2.7.4-14) unstable; urgency=medium

View File

@ -1,45 +0,0 @@
From ad7c2ed213e002bd16678c0d8de30b5e8b186a22 Mon Sep 17 00:00:00 2001
From: Jim Klimov <jim@jimklimov.com>
Date: Sat, 28 Jan 2017 00:52:35 +0100
Subject: [PATCH] Document and pre-set the "maxretry" option in ups.conf.sample
---
conf/ups.conf.sample | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/conf/ups.conf.sample b/conf/ups.conf.sample
index d8faef207..3ea13548b 100644
--- a/conf/ups.conf.sample
+++ b/conf/ups.conf.sample
@@ -40,6 +40,24 @@
#
# Configuration directives
# ------------------------
+#
+# These directives are used by upsdrvctl only and should be specified outside
+# of a driver definition:
+#
+# maxretry: Optional. Specify the number of attempts to start the driver(s),
+# in case of failure, before giving up. A delay of 'retrydelay' is
+# inserted between each attempt. Caution should be taken when using
+# this option, since it can impact the time taken by your system to
+# start.
+#
+# The default is 1 attempt.
+#
+# retrydelay: Optional. Specify the delay between each restart attempt of the
+# driver(s), as specified by 'maxretry'. Caution should be taken
+# when using this option, since it can impact the time taken by your
+# system to start.
+#
+# The default is 5 seconds.
#
# These directives are common to all drivers that support ups.conf:
#
@@ -117,3 +135,6 @@
#
# To find out if your driver supports any extra settings, start it with
# the -h option and/or read the driver's documentation.
+
+# Set maxretry to 3 by default, this should mitigate race with slow devices:
+maxretry = 3

View File

@ -1,76 +0,0 @@
commit 491d088af70a67b6ed1d2a6a6711d83be71dd911
Author: Michal Marek <MichalMarek1@eaton.com>
Date: Mon Oct 30 21:43:45 2017 +0100
configure.ac: Fix systemd shutdown directory detection
The configure script assumes that systemd is installed below ${libdir},
which is not true on many biarch Linux distros with /lib64. Instead of
guessing, use pkg-config to find the path and provide a
--with-systemdshutdowndir option so that make distcheck can override it.
Also, rename the internal variable to systemdshutdowndir to rhyme with
the respective systemd.pc variable.
Signed-off-by: Michal Marek <MichalMarek1@eaton.com>
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,7 @@ DISTCHECK_LIGHT_FLAGS = --with-all=auto
DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \
--with-systemdsystemunitdir='$${prefix}/lib/systemd/system' \
+ --with-systemdshutdowndir='$${prefix}/lib/systemd/system-shutdown' \
--with-hotplug-dir='$${prefix}/etc/hotplug' \
--with-udev-dir='$${prefix}/etc/udev' \
--with-devd-dir='$${prefix}/etc/devd'
--- a/configure.ac
+++ b/configure.ac
@@ -1062,16 +1062,24 @@ AC_ARG_WITH([systemdsystemunitdir],
;;
esac
], [])
-dnl Override installation directory, with the local installation
-dnl prefix. This is needed for 'distcheck*' targets, otherwise
-dnl files will try to get intalled to the actual system directories
if test -n "${systemdsystemunitdir}"; then
- systemdsystemshutdowndir="${libdir}/systemd/system-shutdown"
AC_MSG_RESULT(using ${systemdsystemunitdir})
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "")
+dnl This option is only provided so that make distcheck can override it,
+dnl otherwise we ask pkg-config whenever --with-systemdsystemunitdir is
+dnl given
+AC_ARG_WITH([systemdshutdowndir],
+ AS_HELP_STRING([--with-systemdshutdowndir=DIR], [Directory for systemd shutdown scripts (auto)]),
+ [systemdshutdowndir=${withval}])
+if test -n "${systemdsystemunitdir}"; then
+ case "${systemdshutdowndir}" in
+ yes|auto|"")
+ systemdshutdowndir=`$PKG_CONFIG --variable=systemdshutdowndir systemd`
+ esac
+fi
AC_MSG_CHECKING(whether to install hotplug rules)
AC_ARG_WITH(hotplug-dir,
@@ -1261,7 +1269,7 @@ AC_SUBST(driverexecdir)
AC_SUBST(htmldir)
AC_SUBST(pkgconfigdir)
AC_SUBST(systemdsystemunitdir)
-AC_SUBST(systemdsystemshutdowndir)
+AC_SUBST(systemdshutdowndir)
AC_SUBST(hotplugdir)
AC_SUBST(udevdir)
--- a/scripts/systemd/Makefile.am
+++ b/scripts/systemd/Makefile.am
@@ -7,7 +7,7 @@ systemdsystemunit_DATA = \
nut-monitor.service \
nut-server.service
-systemdsystemshutdown_SCRIPTS = nutshutdown
+systemdshutdown_SCRIPTS = nutshutdown
else
EXTRA_DIST += nut-driver.service.in nut-monitor.service.in \

View File

@ -1,33 +0,0 @@
commit 5d98d5536699222bc93c58c1e6f6df43dc9bfcff
Author: Arnaud Quette <arnaud.quette@free.fr>
Date: Thu Mar 10 14:41:40 2016 +0100
Fix nut-scanner compilation in some environments
Following the commits 5187dab (common: add some string-related functions) and
e767df5 (common: consolidate some string-related functions), the build rules of
nut-scanner were not updated to also use str.c. Since the libcommon.la
dependency was still there, some environments managed to build cleanly, while
other are failing. Update build dependencies to fix this situation
diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am
index 558cb23b..db85c682 100644
--- a/tools/nut-scanner/Makefile.am
+++ b/tools/nut-scanner/Makefile.am
@@ -14,14 +14,14 @@ libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \
scan_avahi.c scan_eaton_serial.c nutscan-serial.c \
../../drivers/serial.c \
../../drivers/bcmxcp_ser.c \
- ../../common/common.c
+ ../../common/common.c ../../common/str.c
libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS)
libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 1:0:0
libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers
nut_scanner_SOURCES = nut-scanner.c
nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include
-nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la
+nut_scanner_LDADD = libnutscan.la
if WITH_SSL
libnutscan_la_CFLAGS += $(LIBSSL_CFLAGS)

View File

@ -1,112 +0,0 @@
From cbf71dbf5d7b62de3709c31c343e0ce672af5f61 Mon Sep 17 00:00:00 2001
From: Laurent Bigonville <bigon@bigon.be>
Date: Tue, 9 Jul 2019 14:00:53 +0200
Subject: [PATCH] Use pkg-config module names instead of listing the libraries
Fixes: #709
---
configure.ac | 1 +
lib/libupsclient.pc.in | 5 +++--
m4/nut_check_libnss.m4 | 5 +++++
m4/nut_check_libopenssl.m4 | 5 +++++
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index ca5212050..0bf69f566 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1677,6 +1677,7 @@ AC_SUBST(TREE_VERSION)
AC_SUBST(NUT_NETVERSION)
AC_SUBST(LIBSSL_CFLAGS)
AC_SUBST(LIBSSL_LIBS)
+AC_SUBST(LIBSSL_REQUIRES)
AC_SUBST(LIBGD_CFLAGS)
AC_SUBST(LIBGD_LDFLAGS)
AC_SUBST(LIBNETSNMP_CFLAGS)
diff --git a/lib/libupsclient.pc.in b/lib/libupsclient.pc.in
index 4ad31fbde..8efce4020 100644
--- a/lib/libupsclient.pc.in
+++ b/lib/libupsclient.pc.in
@@ -9,5 +9,6 @@ nutuser=@RUN_AS_USER@
Name: libupsclient
Description: UPS monitoring with Network UPS Tools
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lupsclient @LIBSSL_LIBS@
-Cflags: -I${includedir} @LIBSSL_CFLAGS@
+Libs: -L${libdir} -lupsclient
+Cflags: -I${includedir}
+Requires: @LIBSSL_REQUIRES@
diff --git a/m4/nut_check_libnss.m4 b/m4/nut_check_libnss.m4
index 7c235318d..7fed727d3 100644
--- a/m4/nut_check_libnss.m4
+++ b/m4/nut_check_libnss.m4
@@ -11,16 +11,19 @@ if test -z "${nut_have_libnss_seen}"; then
dnl save CFLAGS and LIBS
CFLAGS_ORIG="${CFLAGS}"
LIBS_ORIG="${LIBS}"
+ REQUIRES_ORIG="${REQUIRES}"
AC_MSG_CHECKING(for Mozilla NSS version via pkg-config)
NSS_VERSION="`pkg-config --silence-errors --modversion nss 2>/dev/null`"
if test "$?" = "0" -a -n "${NSS_VERSION}"; then
CFLAGS="`pkg-config --silence-errors --cflags nss 2>/dev/null`"
LIBS="`pkg-config --silence-errors --libs nss 2>/dev/null`"
+ REQUIRES="nss"
else
NSS_VERSION="none"
CFLAGS=""
LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4"
+ REQUIRES="nss"
fi
AC_MSG_RESULT(${NSS_VERSION} found)
@@ -67,10 +70,12 @@ if test -z "${nut_have_libnss_seen}"; then
AC_DEFINE(WITH_NSS, 1, [Define to enable SSL support using Mozilla NSS])
LIBSSL_CFLAGS="${CFLAGS}"
LIBSSL_LIBS="${LIBS}"
+ LIBSSL_REQUIRES="${REQUIRES}"
fi
dnl restore original CFLAGS and LIBS
CFLAGS="${CFLAGS_ORIG}"
LIBS="${LIBS_ORIG}"
+ REQUIRES="${REQUIRES_ORIG}"
fi
])
diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4
index 7eb401cd9..d9e9e0237 100644
--- a/m4/nut_check_libopenssl.m4
+++ b/m4/nut_check_libopenssl.m4
@@ -12,16 +12,19 @@ if test -z "${nut_have_libopenssl_seen}"; then
dnl save CFLAGS and LIBS
CFLAGS_ORIG="${CFLAGS}"
LIBS_ORIG="${LIBS}"
+ REQUIRES_ORIG="${REQUIRES}"
AC_MSG_CHECKING(for OpenSSL version via pkg-config)
OPENSSL_VERSION="`pkg-config --silence-errors --modversion openssl 2>/dev/null`"
if test "$?" = "0" -a -n "${OPENSSL_VERSION}"; then
CFLAGS="`pkg-config --silence-errors --cflags openssl 2>/dev/null`"
LIBS="`pkg-config --silence-errors --libs openssl 2>/dev/null`"
+ REQUIRES="openssl"
else
OPENSSL_VERSION="none"
CFLAGS=""
LIBS="-lssl -lcrypto"
+ REQUIRES="openssl"
fi
AC_MSG_RESULT(${OPENSSL_VERSION} found)
@@ -67,10 +70,12 @@ if test -z "${nut_have_libopenssl_seen}"; then
AC_DEFINE(WITH_OPENSSL, 1, [Define to enable SSL support using OpenSSL])
LIBSSL_CFLAGS="${CFLAGS}"
LIBSSL_LIBS="${LIBS}"
+ LIBSSL_REQUIRES="${REQUIRES}"
fi
dnl restore original CFLAGS and LIBS
CFLAGS="${CFLAGS_ORIG}"
LIBS="${LIBS_ORIG}"
+ REQUIRES="${REQUIRES_ORIG}"
fi
])

View File

@ -1,42 +0,0 @@
From a08a2292afc559d6dfb9eede014a941d8f6b511d Mon Sep 17 00:00:00 2001
From: Arnaud Quette <arnaud.quette@free.fr>
Date: Tue, 17 May 2016 09:26:04 +0200
Subject: [PATCH] mge-shut/usbhid-ups: list AEG PROTECT NAS vendor 06da
AEG PROTECT NAS were previously using VendorID / ProductID 0x2b2d / 0xffff, and
are now using 0x06da / 0xffff. Also bump the mge-hid subdriver version to 1.40
---
drivers/mge-hid.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c
index a3f10afa8..26486c994 100644
--- a/drivers/mge-hid.c
+++ b/drivers/mge-hid.c
@@ -37,7 +37,7 @@
#include "usbhid-ups.h"
#include "mge-hid.h"
-#define MGE_HID_VERSION "MGE HID 1.39"
+#define MGE_HID_VERSION "MGE HID 1.40"
/* (prev. MGE Office Protection Systems, prev. MGE UPS SYSTEMS) */
/* Eaton */
@@ -55,6 +55,9 @@
/* AEG */
#define AEG_VENDORID 0x2b2d
+/* Phoenixtec Power Co., Ltd */
+#define PHOENIXTEC 0x06da
+
#ifndef SHUT_MODE
#include "usb-common.h"
@@ -80,6 +83,7 @@ static usb_device_id_t mge_usb_device_table[] = {
/* PROTECT B / NAS */
{ USB_DEVICE(AEG_VENDORID, 0xffff), NULL },
+ { USB_DEVICE(PHOENIXTEC, 0xffff), NULL },
/* Terminating entry */
{ -1, -1, NULL }

View File

@ -1,980 +0,0 @@
From fab323320d5b955ed034b2eea390a9bbb549e8e5 Mon Sep 17 00:00:00 2001
From: Peter Klein <kleinpa00@gmail.com>
Date: Thu, 11 Jun 2020 02:32:13 +0000
Subject: [PATCH] Remove dynamic exception specifications from
clients/nutclient.cpp
These are invalid in c++17 and must be removed for compatibility with
modern compilers.
---
clients/nutclient.cpp | 146 +++++++++++++++----------------
clients/nutclient.h | 195 +++++++++++++++++++++---------------------
2 files changed, 167 insertions(+), 174 deletions(-)
diff --git a/clients/nutclient.cpp b/clients/nutclient.cpp
index b597e0e1e6c1..f5f0b70ef297 100644
--- a/clients/nutclient.cpp
+++ b/clients/nutclient.cpp
@@ -96,18 +96,18 @@
public:
Socket();
- void connect(const std::string& host, int port)throw(nut::IOException);
+ void connect(const std::string& host, int port);
void disconnect();
bool isConnected()const;
void setTimeout(long timeout);
bool hasTimeout()const{return _tv.tv_sec>=0;}
- size_t read(void* buf, size_t sz)throw(nut::IOException);
- size_t write(const void* buf, size_t sz)throw(nut::IOException);
+ size_t read(void* buf, size_t sz);
+ size_t write(const void* buf, size_t sz);
- std::string read()throw(nut::IOException);
- void write(const std::string& str)throw(nut::IOException);
+ std::string read();
+ void write(const std::string& str);
private:
@@ -129,7 +129,7 @@
_tv.tv_sec = timeout;
}
-void Socket::connect(const std::string& host, int port)throw(nut::IOException)
+void Socket::connect(const std::string& host, int port)
{
int sock_fd;
struct addrinfo hints, *res, *ai;
@@ -298,7 +298,7 @@
return _sock!=INVALID_SOCKET;
}
-size_t Socket::read(void* buf, size_t sz)throw(nut::IOException)
+size_t Socket::read(void* buf, size_t sz)
{
if(!isConnected())
{
@@ -325,7 +325,7 @@
return (size_t) res;
}
-size_t Socket::write(const void* buf, size_t sz)throw(nut::IOException)
+size_t Socket::write(const void* buf, size_t sz)
{
if(!isConnected())
{
@@ -352,7 +352,7 @@
return (size_t) res;
}
-std::string Socket::read()throw(nut::IOException)
+std::string Socket::read()
{
std::string res;
char buff[256];
@@ -383,7 +383,7 @@
}
}
-void Socket::write(const std::string& str)throw(nut::IOException)
+void Socket::write(const std::string& str)
{
// write(str.c_str(), str.size());
// write("\n", 1);
@@ -408,13 +408,13 @@
{
}
-bool Client::hasDevice(const std::string& dev)throw(NutException)
+bool Client::hasDevice(const std::string& dev)
{
std::set<std::string> devs = getDeviceNames();
return devs.find(dev) != devs.end();
}
-Device Client::getDevice(const std::string& name)throw(NutException)
+Device Client::getDevice(const std::string& name)
{
if(hasDevice(name))
return Device(this, name);
@@ -422,7 +422,7 @@
return Device(NULL, "");
}
-std::set<Device> Client::getDevices()throw(NutException)
+std::set<Device> Client::getDevices()
{
std::set<Device> res;
@@ -435,13 +435,13 @@
return res;
}
-bool Client::hasDeviceVariable(const std::string& dev, const std::string& name)throw(NutException)
+bool Client::hasDeviceVariable(const std::string& dev, const std::string& name)
{
std::set<std::string> names = getDeviceVariableNames(dev);
return names.find(name) != names.end();
}
-std::map<std::string,std::vector<std::string> > Client::getDeviceVariableValues(const std::string& dev)throw(NutException)
+std::map<std::string,std::vector<std::string> > Client::getDeviceVariableValues(const std::string& dev)
{
std::map<std::string,std::vector<std::string> > res;
@@ -455,7 +455,7 @@
return res;
}
-bool Client::hasDeviceCommand(const std::string& dev, const std::string& name)throw(NutException)
+bool Client::hasDeviceCommand(const std::string& dev, const std::string& name)
{
std::set<std::string> names = getDeviceCommandNames(dev);
return names.find(name) != names.end();
@@ -477,7 +477,7 @@
// Do not connect now
}
-TcpClient::TcpClient(const std::string& host, int port)throw(IOException):
+TcpClient::TcpClient(const std::string& host, int port):
Client(),
_socket(new internal::Socket)
{
@@ -489,14 +489,14 @@
delete _socket;
}
-void TcpClient::connect(const std::string& host, int port)throw(IOException)
+void TcpClient::connect(const std::string& host, int port)
{
_host = host;
_port = port;
connect();
}
-void TcpClient::connect()throw(nut::IOException)
+void TcpClient::connect()
{
_socket->connect(_host, _port);
}
@@ -532,19 +532,18 @@
}
void TcpClient::authenticate(const std::string& user, const std::string& passwd)
- throw(NutException)
{
detectError(sendQuery("USERNAME " + user));
detectError(sendQuery("PASSWORD " + passwd));
}
-void TcpClient::logout()throw(NutException)
+void TcpClient::logout()
{
detectError(sendQuery("LOGOUT"));
_socket->disconnect();
}
-Device TcpClient::getDevice(const std::string& name)throw(NutException)
+Device TcpClient::getDevice(const std::string& name)
{
try
{
@@ -560,7 +559,7 @@
return Device(this, name);
}
-std::set<std::string> TcpClient::getDeviceNames()throw(NutException)
+std::set<std::string> TcpClient::getDeviceNames()
{
std::set<std::string> res;
@@ -576,12 +575,12 @@
return res;
}
-std::string TcpClient::getDeviceDescription(const std::string& name)throw(NutException)
+std::string TcpClient::getDeviceDescription(const std::string& name)
{
return get("UPSDESC", name)[0];
}
-std::set<std::string> TcpClient::getDeviceVariableNames(const std::string& dev)throw(NutException)
+std::set<std::string> TcpClient::getDeviceVariableNames(const std::string& dev)
{
std::set<std::string> set;
@@ -594,7 +593,7 @@
return set;
}
-std::set<std::string> TcpClient::getDeviceRWVariableNames(const std::string& dev)throw(NutException)
+std::set<std::string> TcpClient::getDeviceRWVariableNames(const std::string& dev)
{
std::set<std::string> set;
@@ -607,17 +606,17 @@
return set;
}
-std::string TcpClient::getDeviceVariableDescription(const std::string& dev, const std::string& name)throw(NutException)
+std::string TcpClient::getDeviceVariableDescription(const std::string& dev, const std::string& name)
{
return get("DESC", dev + " " + name)[0];
}
-std::vector<std::string> TcpClient::getDeviceVariableValue(const std::string& dev, const std::string& name)throw(NutException)
+std::vector<std::string> TcpClient::getDeviceVariableValue(const std::string& dev, const std::string& name)
{
return get("VAR", dev + " " + name);
}
-std::map<std::string,std::vector<std::string> > TcpClient::getDeviceVariableValues(const std::string& dev)throw(NutException)
+std::map<std::string,std::vector<std::string> > TcpClient::getDeviceVariableValues(const std::string& dev)
{
std::map<std::string,std::vector<std::string> > map;
@@ -634,13 +633,13 @@
return map;
}
-void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)throw(NutException)
+void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)
{
std::string query = "SET VAR " + dev + " " + name + " " + escape(value);
detectError(sendQuery(query));
}
-void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::vector<std::string>& values)throw(NutException)
+void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::vector<std::string>& values)
{
std::string query = "SET VAR " + dev + " " + name;
for(size_t n=0; n<values.size(); ++n)
@@ -650,7 +649,7 @@
detectError(sendQuery(query));
}
-std::set<std::string> TcpClient::getDeviceCommandNames(const std::string& dev)throw(NutException)
+std::set<std::string> TcpClient::getDeviceCommandNames(const std::string& dev)
{
std::set<std::string> cmds;
@@ -663,32 +662,32 @@
return cmds;
}
-std::string TcpClient::getDeviceCommandDescription(const std::string& dev, const std::string& name)throw(NutException)
+std::string TcpClient::getDeviceCommandDescription(const std::string& dev, const std::string& name)
{
return get("CMDDESC", dev + " " + name)[0];
}
-void TcpClient::executeDeviceCommand(const std::string& dev, const std::string& name)throw(NutException)
+void TcpClient::executeDeviceCommand(const std::string& dev, const std::string& name)
{
detectError(sendQuery("INSTCMD " + dev + " " + name));
}
-void TcpClient::deviceLogin(const std::string& dev)throw(NutException)
+void TcpClient::deviceLogin(const std::string& dev)
{
detectError(sendQuery("LOGIN " + dev));
}
-void TcpClient::deviceMaster(const std::string& dev)throw(NutException)
+void TcpClient::deviceMaster(const std::string& dev)
{
detectError(sendQuery("MASTER " + dev));
}
-void TcpClient::deviceForcedShutdown(const std::string& dev)throw(NutException)
+void TcpClient::deviceForcedShutdown(const std::string& dev)
{
detectError(sendQuery("FSD " + dev));
}
-int TcpClient::deviceGetNumLogins(const std::string& dev)throw(NutException)
+int TcpClient::deviceGetNumLogins(const std::string& dev)
{
std::string num = get("NUMLOGINS", dev)[0];
return atoi(num.c_str());
@@ -696,7 +695,7 @@
std::vector<std::string> TcpClient::get
- (const std::string& subcmd, const std::string& params) throw(NutException)
+ (const std::string& subcmd, const std::string& params)
{
std::string req = subcmd;
if(!params.empty())
@@ -714,7 +713,7 @@
}
std::vector<std::vector<std::string> > TcpClient::list
- (const std::string& subcmd, const std::string& params) throw(NutException)
+ (const std::string& subcmd, const std::string& params)
{
std::string req = subcmd;
if(!params.empty())
@@ -748,13 +747,13 @@
}
}
-std::string TcpClient::sendQuery(const std::string& req)throw(IOException)
+std::string TcpClient::sendQuery(const std::string& req)
{
_socket->write(req);
return _socket->read();
}
-void TcpClient::detectError(const std::string& req)throw(NutException)
+void TcpClient::detectError(const std::string& req)
{
if(req.substr(0,3)=="ERR")
{
@@ -954,47 +953,44 @@
return getName()<dev.getName();
}
-std::string Device::getDescription()throw(NutException)
+std::string Device::getDescription()
{
return getClient()->getDeviceDescription(getName());
}
std::vector<std::string> Device::getVariableValue(const std::string& name)
- throw(NutException)
{
return getClient()->getDeviceVariableValue(getName(), name);
}
std::map<std::string,std::vector<std::string> > Device::getVariableValues()
- throw(NutException)
{
return getClient()->getDeviceVariableValues(getName());
}
-std::set<std::string> Device::getVariableNames()throw(NutException)
+std::set<std::string> Device::getVariableNames()
{
return getClient()->getDeviceVariableNames(getName());
}
-std::set<std::string> Device::getRWVariableNames()throw(NutException)
+std::set<std::string> Device::getRWVariableNames()
{
return getClient()->getDeviceRWVariableNames(getName());
}
-void Device::setVariable(const std::string& name, const std::string& value)throw(NutException)
+void Device::setVariable(const std::string& name, const std::string& value)
{
getClient()->setDeviceVariable(getName(), name, value);
}
void Device::setVariable(const std::string& name, const std::vector<std::string>& values)
- throw(NutException)
{
getClient()->setDeviceVariable(getName(), name, values);
}
-Variable Device::getVariable(const std::string& name)throw(NutException)
+Variable Device::getVariable(const std::string& name)
{
if(getClient()->hasDeviceVariable(getName(), name))
return Variable(this, name);
@@ -1002,7 +998,7 @@
return Variable(NULL, "");
}
-std::set<Variable> Device::getVariables()throw(NutException)
+std::set<Variable> Device::getVariables()
{
std::set<Variable> set;
@@ -1015,7 +1011,7 @@
return set;
}
-std::set<Variable> Device::getRWVariables()throw(NutException)
+std::set<Variable> Device::getRWVariables()
{
std::set<Variable> set;
@@ -1028,12 +1024,12 @@
return set;
}
-std::set<std::string> Device::getCommandNames()throw(NutException)
+std::set<std::string> Device::getCommandNames()
{
return getClient()->getDeviceCommandNames(getName());
}
-std::set<Command> Device::getCommands()throw(NutException)
+std::set<Command> Device::getCommands()
{
std::set<Command> cmds;
@@ -1046,7 +1042,7 @@
return cmds;
}
-Command Device::getCommand(const std::string& name)throw(NutException)
+Command Device::getCommand(const std::string& name)
{
if(getClient()->hasDeviceCommand(getName(), name))
return Command(this, name);
@@ -1054,26 +1050,26 @@
return Command(NULL, "");
}
-void Device::executeCommand(const std::string& name)throw(NutException)
+void Device::executeCommand(const std::string& name)
{
getClient()->executeDeviceCommand(getName(), name);
}
-void Device::login()throw(NutException)
+void Device::login()
{
getClient()->deviceLogin(getName());
}
-void Device::master()throw(NutException)
+void Device::master()
{
getClient()->deviceMaster(getName());
}
-void Device::forcedShutdown()throw(NutException)
+void Device::forcedShutdown()
{
}
-int Device::getNumLogins()throw(NutException)
+int Device::getNumLogins()
{
return getClient()->deviceGetNumLogins(getName());
}
@@ -1141,22 +1137,22 @@
return getName()<var.getName();
}
-std::vector<std::string> Variable::getValue()throw(NutException)
+std::vector<std::string> Variable::getValue()
{
return getDevice()->getClient()->getDeviceVariableValue(getDevice()->getName(), getName());
}
-std::string Variable::getDescription()throw(NutException)
+std::string Variable::getDescription()
{
return getDevice()->getClient()->getDeviceVariableDescription(getDevice()->getName(), getName());
}
-void Variable::setValue(const std::string& value)throw(NutException)
+void Variable::setValue(const std::string& value)
{
getDevice()->setVariable(getName(), value);
}
-void Variable::setValues(const std::vector<std::string>& values)throw(NutException)
+void Variable::setValues(const std::vector<std::string>& values)
{
getDevice()->setVariable(getName(), values);
}
@@ -1225,12 +1221,12 @@
return getName()<cmd.getName();
}
-std::string Command::getDescription()throw(NutException)
+std::string Command::getDescription()
{
return getDevice()->getClient()->getDeviceCommandDescription(getDevice()->getName(), getName());
}
-void Command::execute()throw(NutException)
+void Command::execute()
{
getDevice()->executeCommand(getName());
}
--- a/clients/nutclient.h
+++ b/clients/nutclient.h
@@ -51,9 +51,9 @@
{
public:
NutException(const std::string& msg):_msg(msg){}
- virtual ~NutException() throw() {}
- virtual const char * what() const throw() {return this->_msg.c_str();}
- virtual std::string str() const throw() {return this->_msg;}
+ virtual ~NutException() {}
+ virtual const char * what() const noexcept {return this->_msg.c_str();}
+ virtual std::string str() const noexcept {return this->_msg;}
private:
std::string _msg;
};
@@ -65,7 +65,7 @@
{
public:
SystemException();
- virtual ~SystemException() throw() {}
+ virtual ~SystemException() {}
private:
static std::string err();
};
@@ -78,7 +78,7 @@
{
public:
IOException(const std::string& msg):NutException(msg){}
- virtual ~IOException() throw() {}
+ virtual ~IOException() {}
};
/**
@@ -88,7 +88,7 @@
{
public:
UnknownHostException():IOException("Unknown host"){}
- virtual ~UnknownHostException() throw() {}
+ virtual ~UnknownHostException() {}
};
/**
@@ -98,7 +98,7 @@
{
public:
NotConnectedException():IOException("Not connected"){}
- virtual ~NotConnectedException() throw() {}
+ virtual ~NotConnectedException() {}
};
/**
@@ -108,7 +108,7 @@
{
public:
TimeoutException():IOException("Timeout"){}
- virtual ~TimeoutException() throw() {}
+ virtual ~TimeoutException() {}
};
/**
@@ -132,13 +132,13 @@
* \todo Is his method is global to all connection protocol or is it specific to TCP ?
* \note Actually, authentication fails only if already set, not if bad values are sent.
*/
- virtual void authenticate(const std::string& user, const std::string& passwd)throw(NutException)=0;
+ virtual void authenticate(const std::string& user, const std::string& passwd)=0;
/**
* Disconnect from the NUTD server.
* \todo Is his method is global to all connection protocol or is it specific to TCP ?
*/
- virtual void logout()throw(NutException)=0;
+ virtual void logout()=0;
/**
* Device manipulations.
@@ -151,29 +151,29 @@
* \param name Name of the device.
* \return The device.
*/
- virtual Device getDevice(const std::string& name)throw(NutException);
+ virtual Device getDevice(const std::string& name);
/**
* Retrieve the list of all devices supported by UPSD server.
* \return The set of supported devices.
*/
- virtual std::set<Device> getDevices()throw(NutException);
+ virtual std::set<Device> getDevices();
/**
* Test if a device is supported by the NUTD server.
* \param dev Device name.
* \return true if supported, false otherwise.
*/
- virtual bool hasDevice(const std::string& dev)throw(NutException);
+ virtual bool hasDevice(const std::string& dev);
/**
* Retrieve names of devices supported by NUTD server.
* \return The set of names of supported devices.
*/
- virtual std::set<std::string> getDeviceNames()throw(NutException)=0;
+ virtual std::set<std::string> getDeviceNames()=0;
/**
* Retrieve the description of a device.
* \param name Device name.
* \return Device description.
*/
- virtual std::string getDeviceDescription(const std::string& name)throw(NutException)=0;
+ virtual std::string getDeviceDescription(const std::string& name)=0;
/** \} */
/**
@@ -186,54 +186,54 @@
* \param dev Device name
* \return Variable names
*/
- virtual std::set<std::string> getDeviceVariableNames(const std::string& dev)throw(NutException)=0;
+ virtual std::set<std::string> getDeviceVariableNames(const std::string& dev)=0;
/**
* Retrieve names of read/write variables supported by a device.
* \param dev Device name
* \return RW variable names
*/
- virtual std::set<std::string> getDeviceRWVariableNames(const std::string& dev)throw(NutException)=0;
+ virtual std::set<std::string> getDeviceRWVariableNames(const std::string& dev)=0;
/**
* Test if a variable is supported by a device.
* \param dev Device name
* \param name Variable name
* \return true if the variable is supported.
*/
- virtual bool hasDeviceVariable(const std::string& dev, const std::string& name)throw(NutException);
+ virtual bool hasDeviceVariable(const std::string& dev, const std::string& name);
/**
* Retrieve the description of a variable.
* \param dev Device name
* \param name Variable name
* \return Variable description if provided.
*/
- virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name)throw(NutException)=0;
+ virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name)=0;
/**
* Retrieve values of a variable.
* \param dev Device name
* \param name Variable name
* \return Variable values (usually one) if available.
*/
- virtual std::vector<std::string> getDeviceVariableValue(const std::string& dev, const std::string& name)throw(NutException)=0;
+ virtual std::vector<std::string> getDeviceVariableValue(const std::string& dev, const std::string& name)=0;
/**
* Retrieve values of all variables of a device.
* \param dev Device name
* \return Variable values indexed by variable names.
*/
- virtual std::map<std::string,std::vector<std::string> > getDeviceVariableValues(const std::string& dev)throw(NutException);
+ virtual std::map<std::string,std::vector<std::string> > getDeviceVariableValues(const std::string& dev);
/**
* Intend to set the value of a variable.
* \param dev Device name
* \param name Variable name
* \param value Variable value
*/
- virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)throw(NutException)=0;
+ virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)=0;
/**
* Intend to set the value of a variable.
* \param dev Device name
* \param name Variable name
* \param value Variable value
*/
- virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector<std::string>& values)throw(NutException)=0;
+ virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector<std::string>& values)=0;
/** \} */
/**
@@ -246,27 +246,27 @@
* \param dev Device name
* \return Command names
*/
- virtual std::set<std::string> getDeviceCommandNames(const std::string& dev)throw(NutException)=0;
+ virtual std::set<std::string> getDeviceCommandNames(const std::string& dev)=0;
/**
* Test if a command is supported by a device.
* \param dev Device name
* \param name Command name
* \return true if the command is supported.
*/
- virtual bool hasDeviceCommand(const std::string& dev, const std::string& name)throw(NutException);
+ virtual bool hasDeviceCommand(const std::string& dev, const std::string& name);
/**
* Retrieve the description of a command.
* \param dev Device name
* \param name Command name
* \return Command description if provided.
*/
- virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name)throw(NutException)=0;
+ virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name)=0;
/**
* Intend to execute a command.
* \param dev Device name
* \param name Command name
*/
- virtual void executeDeviceCommand(const std::string& dev, const std::string& name)throw(NutException)=0;
+ virtual void executeDeviceCommand(const std::string& dev, const std::string& name)=0;
/** \} */
/**
@@ -277,15 +277,15 @@
* Log the current user (if authenticated) for a device.
* \param dev Device name.
*/
- virtual void deviceLogin(const std::string& dev)throw(NutException)=0;
+ virtual void deviceLogin(const std::string& dev)=0;
/**
* Retrieve the number of user longged in the specified device.
* \param dev Device name.
* \return Number of logged-in users.
*/
- virtual int deviceGetNumLogins(const std::string& dev)throw(NutException)=0;
- virtual void deviceMaster(const std::string& dev)throw(NutException)=0;
- virtual void deviceForcedShutdown(const std::string& dev)throw(NutException)=0;
+ virtual int deviceGetNumLogins(const std::string& dev)=0;
+ virtual void deviceMaster(const std::string& dev)=0;
+ virtual void deviceForcedShutdown(const std::string& dev)=0;
protected:
Client();
@@ -309,7 +309,7 @@
* \param host Server host name.
* \param port Server port.
*/
- TcpClient(const std::string& host, int port = 3493)throw(nut::IOException);
+ TcpClient(const std::string& host, int port = 3493);
~TcpClient();
/**
@@ -317,13 +317,13 @@
* \param host Server host name.
* \param port Server port.
*/
- void connect(const std::string& host, int port = 3493)throw(nut::IOException);
+ void connect(const std::string& host, int port = 3493);
/**
* Connect to the server.
* Host name and ports must have already set (usefull for reconnection).
*/
- void connect()throw(nut::IOException);
+ void connect();
/**
* Test if the connection is active.
@@ -358,39 +358,37 @@
*/
int getPort()const;
- virtual void authenticate(const std::string& user, const std::string& passwd)throw(NutException);
- virtual void logout()throw(NutException);
+ virtual void authenticate(const std::string& user, const std::string& passwd);
+ virtual void logout();
- virtual Device getDevice(const std::string& name)throw(NutException);
- virtual std::set<std::string> getDeviceNames()throw(NutException);
- virtual std::string getDeviceDescription(const std::string& name)throw(NutException);
-
- virtual std::set<std::string> getDeviceVariableNames(const std::string& dev)throw(NutException);
- virtual std::set<std::string> getDeviceRWVariableNames(const std::string& dev)throw(NutException);
- virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name)throw(NutException);
- virtual std::vector<std::string> getDeviceVariableValue(const std::string& dev, const std::string& name)throw(NutException);
- virtual std::map<std::string,std::vector<std::string> > getDeviceVariableValues(const std::string& dev)throw(NutException);
- virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)throw(NutException);
- virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector<std::string>& values)throw(NutException);
-
- virtual std::set<std::string> getDeviceCommandNames(const std::string& dev)throw(NutException);
- virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name)throw(NutException);
- virtual void executeDeviceCommand(const std::string& dev, const std::string& name)throw(NutException);
-
- virtual void deviceLogin(const std::string& dev)throw(NutException);
- virtual void deviceMaster(const std::string& dev)throw(NutException);
- virtual void deviceForcedShutdown(const std::string& dev)throw(NutException);
- virtual int deviceGetNumLogins(const std::string& dev)throw(NutException);
+ virtual Device getDevice(const std::string& name);
+ virtual std::set<std::string> getDeviceNames();
+ virtual std::string getDeviceDescription(const std::string& name);
+
+ virtual std::set<std::string> getDeviceVariableNames(const std::string& dev);
+ virtual std::set<std::string> getDeviceRWVariableNames(const std::string& dev);
+ virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name);
+ virtual std::vector<std::string> getDeviceVariableValue(const std::string& dev, const std::string& name);
+ virtual std::map<std::string,std::vector<std::string> > getDeviceVariableValues(const std::string& dev);
+ virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value);
+ virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector<std::string>& values);
+
+ virtual std::set<std::string> getDeviceCommandNames(const std::string& dev);
+ virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name);
+ virtual void executeDeviceCommand(const std::string& dev, const std::string& name);
+
+ virtual void deviceLogin(const std::string& dev);
+ virtual void deviceMaster(const std::string& dev);
+ virtual void deviceForcedShutdown(const std::string& dev);
+ virtual int deviceGetNumLogins(const std::string& dev);
protected:
- std::string sendQuery(const std::string& req)throw(nut::IOException);
- static void detectError(const std::string& req)throw(nut::NutException);
+ std::string sendQuery(const std::string& req);
+ static void detectError(const std::string& req);
- std::vector<std::string> get(const std::string& subcmd, const std::string& params = "")
- throw(nut::NutException);
+ std::vector<std::string> get(const std::string& subcmd, const std::string& params = "");
- std::vector<std::vector<std::string> > list(const std::string& subcmd, const std::string& params = "")
- throw(nut::NutException);
+ std::vector<std::vector<std::string> > list(const std::string& subcmd, const std::string& params = "");
static std::vector<std::string> explode(const std::string& str, size_t begin=0);
static std::string escape(const std::string& str);
@@ -455,92 +453,92 @@
/**
* Retrieve the description of the devce if specified.
*/
- std::string getDescription()throw(NutException);
+ std::string getDescription();
/**
* Intend to retrieve the value of a variable of the device.
* \param name Name of the variable to get.
* \return Value of the variable, if available.
*/
- std::vector<std::string> getVariableValue(const std::string& name)throw(NutException);
+ std::vector<std::string> getVariableValue(const std::string& name);
/**
* Intend to retrieve values of all variables of the devices.
* \return Map of all variables values indexed by their names.
*/
- std::map<std::string,std::vector<std::string> > getVariableValues()throw(NutException);
+ std::map<std::string,std::vector<std::string> > getVariableValues();
/**
* Retrieve all variables names supported by the device.
* \return Set of available variable names.
*/
- std::set<std::string> getVariableNames()throw(NutException);
+ std::set<std::string> getVariableNames();
/**
* Retrieve all Read/Write variables names supported by the device.
* \return Set of available Read/Write variable names.
*/
- std::set<std::string> getRWVariableNames()throw(NutException);
+ std::set<std::string> getRWVariableNames();
/**
* Intend to set the value of a variable of the device.
* \param name Variable name.
* \param value New variable value.
*/
- void setVariable(const std::string& name, const std::string& value)throw(NutException);
+ void setVariable(const std::string& name, const std::string& value);
/**
* Intend to set values of a variable of the device.
* \param name Variable name.
* \param value New variable values.
*/
- void setVariable(const std::string& name, const std::vector<std::string>& values)throw(NutException);
+ void setVariable(const std::string& name, const std::vector<std::string>& values);
/**
* Retrieve a Variable object representing the specified variable.
* \param name Variable name.
* \return Variable object.
*/
- Variable getVariable(const std::string& name)throw(NutException);
+ Variable getVariable(const std::string& name);
/**
* Retrieve Variable objects representing all variables available for the device.
* \return Set of Variable objects.
*/
- std::set<Variable> getVariables()throw(NutException);
+ std::set<Variable> getVariables();
/**
* Retrieve Variable objects representing all Read/Write variables available for the device.
* \return Set of Variable objects.
*/
- std::set<Variable> getRWVariables()throw(NutException);
+ std::set<Variable> getRWVariables();
/**
* Retrieve names of all commands supported by the device.
* \return Set of available command names.
*/
- std::set<std::string> getCommandNames()throw(NutException);
+ std::set<std::string> getCommandNames();
/**
* Retrieve objects for all commands supported by the device.
* \return Set of available Command objects.
*/
- std::set<Command> getCommands()throw(NutException);
+ std::set<Command> getCommands();
/**
* Retrieve an object representing a command of the device.
* \param name Command name.
* \return Command object.
*/
- Command getCommand(const std::string& name)throw(NutException);
+ Command getCommand(const std::string& name);
/**
* Intend to execute a command on the device.
* \param name Command name.
*/
- void executeCommand(const std::string& name)throw(NutException);
+ void executeCommand(const std::string& name);
/**
* Login current client's user for the device.
*/
- void login()throw(NutException);
- void master()throw(NutException);
- void forcedShutdown()throw(NutException);
+ void login();
+ void master();
+ void forcedShutdown();
/**
* Retrieve the number of logged user for the device.
* \return Number of users.
*/
- int getNumLogins()throw(NutException);
+ int getNumLogins();
protected:
Device(Client* client, const std::string& name);
@@ -603,23 +601,23 @@
* Intend to retrieve variable value.
* \return Value of the variable.
*/
- std::vector<std::string> getValue()throw(NutException);
+ std::vector<std::string> getValue();
/**
* Intend to retireve variable description.
* \return Variable description if provided.
*/
- std::string getDescription()throw(NutException);
+ std::string getDescription();
/**
* Intend to set a value to the variable.
* \param value New variable value.
*/
- void setValue(const std::string& value)throw(NutException);
+ void setValue(const std::string& value);
/**
* Intend to set (multiple) values to the variable.
* \param value New variable values.
*/
- void setValues(const std::vector<std::string>& values)throw(NutException);
+ void setValues(const std::vector<std::string>& values);
protected:
Variable(Device* dev, const std::string& name);
@@ -683,13 +681,13 @@
* Intend to retireve command description.
* \return Command description if provided.
*/
- std::string getDescription()throw(NutException);
+ std::string getDescription();
/**
* Intend to retrieve command description.
* \return Command description if provided.
*/
- void execute()throw(NutException);
+ void execute();
protected:
Command(Device* dev, const std::string& name);
--
2.33.0

View File

@ -4,10 +4,4 @@
0008-drop-w3c-icons.patch 0008-drop-w3c-icons.patch
# Upstream patches # Upstream patches
#0006-ups-conf-maxretry.patch
#0009-fix-nutshutdown-install.patch
#0010-fix-nutscanner-ftbfs.patch
#0011-use-pkgconfig-module.patch
#0012-add-AEG-PROTECT-NAS-support.patch
#0013-fix-doc-build.patch #0013-fix-doc-build.patch
#0014-Remove-dynamic-exception-specifications-from-clients.patch