Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,28 @@ what you could and could not test.
`utf82ansi.py`). The prebuilt `libXmlRpc`/`libxmlparser` in `lib/` are
regenerated by `.github/workflows/update-prebuilt-libraries.yml` after a merge.
Never commit `build/`.
- **Daemon versions:** a user-visible change to `rfd` or `hs485d` bumps
`src/<daemon>/version.sh` and `src/<daemon>/generated-<daemon>-version.h`
together, either in the same pull request or in a collected bump.
- **Component versions:** every program and library under `src/` has a
version, kept in `version.sh` (the daemons, `hss_led`, `ssdpd`, `eq3configd`,
`eq3configcmd`, `crypttool`, `SetInterfaceClock`, `hs485dLoader`,
`libhsscomm`, `libelvutils`, `libLanDeviceUtils`, `libUnifiedLanComm`,
`libeq3config`), in `MODULE_VERSION` (`eq3_char_loop`, `bcm2835_raw_uart`),
in the Tcl package version (`tclrega`, `tclrpc`, `tcl_homematic`) or in the
library's version header (`XMLRPC_VERSION_NUMBER` in `xmlrpc_version.h` of
`libXmlRpc`, `XMLPARSER_VERSION_NUMBER` in `xmlparser_version.h` of
`libxmlparser`, kept equal to `@version` in `xmlParser.h`).
A user-visible change raises it (a fix the patch level, a new function the
minor version), either in the same pull request or in a collected bump.
CMake generates the header from `version.sh` with `openccu_version_header()`;
only `rfd` and `hs485d` keep a committed
`src/<daemon>/generated-<daemon>-version.h`, which is bumped together with
`version.sh`. Never give the shared libraries a CMake `VERSION` or
`SOVERSION`: their SONAME must stay the plain `lib<name>.so`, which ReGaHss
and the OpenCCU packaging load. Each library returns its version from
`<lib>_version()` (declared in `<lib>_version.h`); a program's `--version`
(and `-v` where the option is free) prints its own version and the versions
of the OpenCCU-Base libraries whose functions it calls, read from the loaded
libraries (check with `nm -D --undefined-only`, not only the link line).
A program links only the OpenCCU-Base libraries whose functions it calls.
- **Daemon changelogs:** a pull request with a user-visible change to `rfd` or
`hs485d` (including changes of the libraries they are built with) adds an
entry to `src/<daemon>/CHANGELOG.md` under `## Unreleased` (create the
Expand Down
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,29 @@ function(openccu_stage_target target_name dest_subdir)

endfunction()

# Generates generated-<name>-version.h with "#define <macro> "<version>"" from
# the version.sh of the calling directory and lets <target> include it.
function(openccu_version_header target name macro)
set(_text "${CMAKE_CURRENT_BINARY_DIR}/${name}-version.txt")
set(_header "${CMAKE_CURRENT_BINARY_DIR}/generated-${name}-version.h")
add_custom_command(
OUTPUT "${_header}"
BYPRODUCTS "${_text}"
COMMAND "${CMAKE_COMMAND}" -E env sh "${CMAKE_CURRENT_SOURCE_DIR}/version.sh"
> "${_text}"
COMMAND "${CMAKE_COMMAND}"
"-DINPUT=${_text}"
"-DOUTPUT=${_header}"
"-DMACRO_NAME=${macro}" -P "${CMAKE_SOURCE_DIR}/cmake/WriteVersionHeader.cmake"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/version.sh"
"${CMAKE_SOURCE_DIR}/cmake/WriteVersionHeader.cmake"
VERBATIM
)
add_custom_target(${name}-version-header DEPENDS "${_header}")
add_dependencies(${target} ${name}-version-header)
target_include_directories(${target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
endfunction()

include(cmake/Components.cmake)

message(STATUS "OpenCCU platform : ${TARGET_PLATFORM}")
Expand Down
3 changes: 2 additions & 1 deletion src/SetInterfaceClock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ target_include_directories(SetInterfaceClock PRIVATE
"${CMAKE_SOURCE_DIR}/src/libelvutils"
"${CMAKE_SOURCE_DIR}/src/libxmlparser"
)
target_link_libraries(SetInterfaceClock PRIVATE XmlRpc hsscomm xmlparser elvutils pthread crypto)
target_link_libraries(SetInterfaceClock PRIVATE XmlRpc elvutils pthread crypto)
openccu_version_header(SetInterfaceClock SetInterfaceClock SETINTERFACECLOCK_VERSION)
openccu_stage_target(SetInterfaceClock bin)
17 changes: 17 additions & 0 deletions src/SetInterfaceClock/SetInterfaceClock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
//
#include <ctime>
#include <stdio.h>
#include <string.h>
#include <XmlRpc.h>
#include <TimeZoneInfo.h>
#include <SyslogLogger.h>
#include <fstream>
#include <iostream>
#include "generated-SetInterfaceClock-version.h"
#include "xmlrpc_version.h"
#include "elvutils_version.h"


void printUsage();
Expand All @@ -23,8 +27,20 @@ std::string readPortFromFile(const char* filename);

using namespace XmlRpc;

static void printVersion()
{
printf("SetInterfaceClock %s (%s)\n", SETINTERFACECLOCK_VERSION, __DATE__);
printf(" libXmlRpc %s\n", xmlrpc_version());
printf(" libelvutils %s\n", elvutils_version());
}

int main(int argc, char* argv[])
{
if(argc == 2 && (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0)) {
printVersion();
return 0;
}

Logger* log = (Logger*)new SyslogLogger("SetInterfaceClock");
log->SetLevel((Logger::LogLevel)1);

Expand Down Expand Up @@ -102,6 +118,7 @@ std::string readPortFromFile(const char* filename) {

void printUsage() {
std::string msg;
msg.append("\nSetInterfaceClock " SETINTERFACECLOCK_VERSION " (" __DATE__ ")\n");
msg.append("\nSetInterfaceClock [IP:Port]\n");
msg.append("- Calls xml-rpc method SetInterfaceClock. -\n");
msg.append("Paremeters:\n");
Expand Down
9 changes: 9 additions & 0 deletions src/SetInterfaceClock/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

MAJOR="1"
MINOR="0"
PATCH="0"

VERSION="$MAJOR.$MINOR.$PATCH"

echo $VERSION
1 change: 1 addition & 0 deletions src/crypttool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ target_compile_options(crypttool PRIVATE -Wall)
target_include_directories(crypttool PRIVATE "${CMAKE_SOURCE_DIR}/src/libelvutils")
target_link_libraries(crypttool PRIVATE crypto pthread elvutils)

openccu_version_header(crypttool crypttool CRYPTTOOL_VERSION)
openccu_stage_target(crypttool bin)

add_custom_command(TARGET crypttool POST_BUILD
Expand Down
15 changes: 15 additions & 0 deletions src/crypttool/crypttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@
#include "openssl/evp.h"

#include "crypttoolconfig.h"
#include "generated-crypttool-version.h"
#include "elvutils_version.h"

const char* defaultKey = "Markus is awesome";

static void printVersion()
{
printf("crypttool %s (%s)\n", CRYPTTOOL_VERSION, __DATE__);
printf(" libelvutils %s\n", elvutils_version());
}

static void usage(const char* procname)
{
printf("crypttool %s (%s)\n\n", CRYPTTOOL_VERSION, __DATE__);
printf("%s [-k key] [-t key_type] [-e] [-d] [-s] [-S] [-v] [-r] [-g] [-y] [-l loglevel] [-f path/to/configFile]\n", procname);
printf(" Actions: (Default action is to encrypt with the current user key)\n");
printf(" -d: decrypt\n");
Expand All @@ -46,6 +55,7 @@ static void usage(const char* procname)
printf(" -i: key index for -S\n");
printf(" -y: log to syslog instead of console\n");
printf(" -l: set log level\n");
printf(" --version: show the versions of crypttool and its libraries\n");
printf(" -f: path to crypttool configuration file\n");

if(logger)
Expand Down Expand Up @@ -265,6 +275,11 @@ int get_index(crypttoolconfig& crypttoolconfig, int key_type)

int main(int argc, char* argv[])
{
if(argc == 2 && (strcmp(argv[1], "--version") == 0)) {
printVersion();
return 0;
}

int key_type = -1;
int key_index = -1;
char* key = NULL;
Expand Down
9 changes: 9 additions & 0 deletions src/crypttool/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

MAJOR="1"
MINOR="0"
PATCH="0"

VERSION="$MAJOR.$MINOR.$PATCH"

echo $VERSION
1 change: 1 addition & 0 deletions src/eq3configcmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ target_compile_features(eq3configcmd PRIVATE cxx_std_11)
target_compile_definitions(eq3configcmd PRIVATE _TIME_BITS=64 _FILE_OFFSET_BITS=64)
target_include_directories(eq3configcmd PRIVATE "${CMAKE_SOURCE_DIR}/src/libeq3config")
target_link_libraries(eq3configcmd PRIVATE eq3config pthread crypto rt)
openccu_version_header(eq3configcmd eq3configcmd EQ3CONFIGCMD_VERSION)
openccu_stage_target(eq3configcmd bin)
11 changes: 10 additions & 1 deletion src/eq3configcmd/eq3configcmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@
#include <iomanip>
#include <string>
#include <stdlib.h>
#include <string.h>

#include <CommandManager.h>
#include "generated-eq3configcmd-version.h"
#include "eq3config_version.h"

void printUsage();
void removeLeadingPathseperators(std::string& filename);

int main(int argc, char** argv)
{
if(argc == 2 && (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0)) {
std::cout << "eq3configcmd " EQ3CONFIGCMD_VERSION " (" __DATE__ ")" << std::endl
<< " libeq3config " << eq3config_version() << std::endl;
return 0;
}

if(argc >= 1) {
//Parse command line args...
//First must be the commandName
Expand Down Expand Up @@ -64,7 +73,7 @@ int main(int argc, char** argv)

void printUsage() {
std::cout << std::endl
<< "eq3configcmd, (c) 2013 eQ-3 Entwicklung GmbH" << std::endl
<< "eq3configcmd " EQ3CONFIGCMD_VERSION " (" __DATE__ "), (c) 2013 eQ-3 Entwicklung GmbH" << std::endl
<< std::endl
<< "Usage:" << std::endl
<< "\t eq3configcmd <command> [<args>]" << std::endl << std::endl
Expand Down
9 changes: 9 additions & 0 deletions src/eq3configcmd/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

MAJOR="1"
MINOR="0"
PATCH="0"

VERSION="$MAJOR.$MINOR.$PATCH"

echo $VERSION
1 change: 1 addition & 0 deletions src/eq3configd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ target_include_directories(eq3configd PRIVATE
)
target_link_libraries(eq3configd PRIVATE pthread crypto elvutils)

openccu_version_header(eq3configd eq3configd EQ3CONFIGD_VERSION)
openccu_stage_target(eq3configd bin)
15 changes: 15 additions & 0 deletions src/eq3configd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <md5.h>

#include "include/udpframe.h"
#include "generated-eq3configd-version.h"
#include "elvutils_version.h"
#include "include/networkconfig.h"

#include <openssl/evp.h>
Expand Down Expand Up @@ -57,14 +59,22 @@ const uint8_t UDP_CRYPT_RANDOM_SIZE = 16;
const uint8_t UDP_CRYPT_SIGNATURE_SIZE = 16;
const uint8_t UDP_CRYPT_SIGNATURE[UDP_CRYPT_SIGNATURE_SIZE] = "eQ-3__UDP-Crypt";

static void printVersion()
{
printf("eq3configd %s (%s)\n", EQ3CONFIGD_VERSION, __DATE__);
printf(" libelvutils %s\n", elvutils_version());
}

static void usage(const char* procname)
{
printf("eq3configd %s (%s)\n\n", EQ3CONFIGD_VERSION, __DATE__);
Comment thread
jens-maus marked this conversation as resolved.
Resolved
printf("%s [-c] [-l loglevel]\n", procname);

printf(" Options:\n");
printf(" -t: device type identifier to publish\n");
printf(" -c: log to console instead of syslog\n");
printf(" -l: set log level\n");
printf(" -v, --version: show the versions of eq3configd and its libraries\n");
}

int main(int argc, char* argv[])
Expand All @@ -84,6 +94,11 @@ int main(int argc, char* argv[])
Logger::LogLevel loglevel=Logger::LOG_INFO;
std::string deviceType = "";

if(argc == 2 && (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0)) {
printVersion();
return 0;
}

// analyse commandline parameters
for(int i = 1; i < argc; i++)
{
Expand Down
9 changes: 9 additions & 0 deletions src/eq3configd/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

MAJOR="1"
MINOR="0"
PATCH="0"

VERSION="$MAJOR.$MINOR.$PATCH"

echo $VERSION
8 changes: 8 additions & 0 deletions src/hs485d/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ Changes not yet released are collected under `Unreleased` and get the
version and date with the next version bump (`version.sh` and
`generated-hs485d-version.h`).

## Unreleased

* add the option `-v` / `--version`, which prints the version of hs485d and the
versions of the OpenCCU-Base libraries it uses (libXmlRpc, libxmlparser,
libhsscomm, libelvutils, libLanDeviceUtils, libUnifiedLanComm), as reported
by the loaded libraries. The libraries now have versions of their own.
([#294](https://github.com/OpenCCU/OpenCCU-Base/pull/294))

## 1.4.0 (2026-11-01)

* add the RPC method `restoreConfigToDevice`, which writes the configuration
Expand Down
22 changes: 22 additions & 0 deletions src/hs485d/hs485d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ char buffer[128];
#include <md5.h>

#include "generated-hs485d-version.h"
#include "xmlrpc_version.h"
#include "xmlparser_version.h"
#include "hsscomm_version.h"
#include "elvutils_version.h"
#include "landeviceutils_version.h"
#include "unifiedlancomm_version.h"

using namespace XmlRpc;

Expand All @@ -82,6 +88,17 @@ static void sigterm_handler(int sig)
run=false;
}

static void printVersion()
{
std::cout << "hs485d " << HS485D_VERSION << " (" << __DATE__ << ")" << std::endl
<< " libXmlRpc " << xmlrpc_version() << std::endl
<< " libxmlparser " << xmlparser_version() << std::endl
<< " libhsscomm " << hsscomm_version() << std::endl
<< " libelvutils " << elvutils_version() << std::endl
<< " libLanDeviceUtils " << landeviceutils_version() << std::endl
<< " libUnifiedLanComm " << unifiedlancomm_version() << std::endl;
}

static void usage(const char* procname)
{
std::cout << "HS485D " << HS485D_VERSION << " (" << __DATE__ << ")" << std::endl
Expand All @@ -96,6 +113,7 @@ static void usage(const char* procname)
<< " -s: HM2 LGW serial number" << std::endl
<< " -i: HM2 LGW Interface Number. (From /etc/config/hs485d.conf) Use 0 for [Interface 0]" << std::endl
<< " -k: Encryption Key. (Only valid for HM2 LGW.)" << std::endl
<< " -v, --version: show the versions of hs485d and its libraries" << std::endl
<< std::endl
<< "Examples for HM2 Wired LGW:" << std::endl
<< std::endl
Expand Down Expand Up @@ -146,6 +164,10 @@ int main(int argc, char* argv[])
const struct rlimit rl={RLIM_INFINITY, RLIM_INFINITY};
setrlimit(RLIMIT_CORE, &rl);
#endif
if(argc == 2 && (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0)) {
printVersion();
return 0;
}
for(int i=1;i<argc;i++)
{
if(strcmp(argv[i], "-p")==0&&argc>i+1){
Expand Down
3 changes: 2 additions & 1 deletion src/hs485dLoader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ target_include_directories(hs485dLoader PRIVATE
"${CMAKE_SOURCE_DIR}/src/libelvutils"
"${CMAKE_SOURCE_DIR}/src/libxmlparser"
)
target_link_libraries(hs485dLoader PRIVATE pthread m c elvutils xmlparser)
target_link_libraries(hs485dLoader PRIVATE pthread m c elvutils)

openccu_version_header(hs485dLoader hs485dLoader HS485DLOADER_VERSION)
openccu_stage_target(hs485dLoader bin)
Loading