https-dns-proxy: add version information to binary
authorStan Grishin <stangri@melmac.ca>
Mon, 24 Oct 2022 21:39:06 +0000 (21:39 +0000)
committerStan Grishin <stangri@melmac.ca>
Mon, 24 Oct 2022 21:46:51 +0000 (21:46 +0000)
* add patches/020-cmakelists-add-version.patch (thanks @baranyaib90)
  to add version information to the binary and fix https://github.com/aarond10/https_dns_proxy/issues/149
* modify Makefile to add version information for the binary
* rename patches/010-fix-cmakelists.patch for better readability
* revert back to service restart in WAN/WAN6 trigger
* update test.sh to test both init script and binary versions

Signed-off-by: Stan Grishin <stangri@melmac.ca>
net/https-dns-proxy/Makefile
net/https-dns-proxy/files/https-dns-proxy.init
net/https-dns-proxy/patches/010-cmakelists-remove-cflags.patch [new file with mode: 0644]
net/https-dns-proxy/patches/010-fix-cmakelists.patch [deleted file]
net/https-dns-proxy/patches/020-cmakelists-add-version.patch [new file with mode: 0644]
net/https-dns-proxy/test.sh

index 5d60de344e68ef26eb7c9fef20ef3c8ed18edd90..cbd8094e48d98a98dbc30f91b4f720e8104d00dd 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=https-dns-proxy
 PKG_VERSION:=2022-10-15
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy/
@@ -16,7 +16,7 @@ PKG_LICENSE_FILES:=LICENSE
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
 
-CMAKE_OPTIONS += -DCLANG_TIDY_EXE=
+CMAKE_OPTIONS += -DCLANG_TIDY_EXE= -DGIT_VERSION=$(PKG_VERSION)-$(PKG_RELEASE)
 
 define Package/https-dns-proxy
        SECTION:=net
index 1b1045d18575c3111b3e97d000d87e44baf68f0b..401c5ff408f70eb6476901c3962c270cfb6ce383 100755 (executable)
@@ -262,7 +262,7 @@ service_triggers() {
        local wan wan6 i
        local wan6_trigger
        config_load "$packageName"
-       config_get_bool wan6_trigger   'config' 'wan6_trigger' '0'
+       config_get_bool wan6_trigger 'config' 'wan6_trigger' '0'
        . /lib/functions/network.sh
        network_flush_cache
        network_find_wan wan
@@ -272,7 +272,7 @@ service_triggers() {
                wan6="${wan6:-wan6}"
        fi
        for i in "$wan" "$wan6"; do
-               [ -n "$i" ] && procd_add_interface_trigger "interface.*" "$i" "/etc/init.d/${packageName}" start
+               [ -n "$i" ] && procd_add_interface_trigger "interface.*" "$i" "/etc/init.d/${packageName}" restart
        done
        procd_add_config_trigger "config.change" "$packageName" "/etc/init.d/${packageName}" reload
 }
diff --git a/net/https-dns-proxy/patches/010-cmakelists-remove-cflags.patch b/net/https-dns-proxy/patches/010-cmakelists-remove-cflags.patch
new file mode 100644 (file)
index 0000000..a765a5b
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -25,9 +25,9 @@ if (NOT CMAKE_INSTALL_BINDIR)
+   set(CMAKE_INSTALL_BINDIR bin)
+ endif()
+-set(CMAKE_C_FLAGS "-Wall -Wextra --pedantic -Wno-strict-aliasing -Wno-variadic-macros")
+-set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
+-set(CMAKE_C_FLAGS_RELEASE "-O2")
++#set(CMAKE_C_FLAGS "-Wall -Wextra --pedantic -Wno-strict-aliasing -Wno-variadic-macros")
++#set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
++#set(CMAKE_C_FLAGS_RELEASE "-O2")
+ if ((CMAKE_C_COMPILER_ID MATCHES GNU   AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9) OR
+     (CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10))
diff --git a/net/https-dns-proxy/patches/010-fix-cmakelists.patch b/net/https-dns-proxy/patches/010-fix-cmakelists.patch
deleted file mode 100644 (file)
index a765a5b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -25,9 +25,9 @@ if (NOT CMAKE_INSTALL_BINDIR)
-   set(CMAKE_INSTALL_BINDIR bin)
- endif()
--set(CMAKE_C_FLAGS "-Wall -Wextra --pedantic -Wno-strict-aliasing -Wno-variadic-macros")
--set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
--set(CMAKE_C_FLAGS_RELEASE "-O2")
-+#set(CMAKE_C_FLAGS "-Wall -Wextra --pedantic -Wno-strict-aliasing -Wno-variadic-macros")
-+#set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
-+#set(CMAKE_C_FLAGS_RELEASE "-O2")
- if ((CMAKE_C_COMPILER_ID MATCHES GNU   AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9) OR
-     (CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10))
diff --git a/net/https-dns-proxy/patches/020-cmakelists-add-version.patch b/net/https-dns-proxy/patches/020-cmakelists-add-version.patch
new file mode 100644 (file)
index 0000000..8debfe9
--- /dev/null
@@ -0,0 +1,51 @@
+From 2ca80486ba6a4e5acbdf0ff581d9754af17fa33b Mon Sep 17 00:00:00 2001
+From: baranyaib90 <5031516+baranyaib90@users.noreply.github.com>
+Date: Mon, 24 Oct 2022 22:53:37 +0200
+Subject: [PATCH] Allow external setting of GIT_VERSION
+
+---
+ CMakeLists.txt | 34 ++++++++++++++++++----------------
+ 1 file changed, 18 insertions(+), 16 deletions(-)
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -36,22 +36,24 @@ endif()
+ # VERSION
+-find_package(Git)
+-if(Git_FOUND)
+-  execute_process(
+-    COMMAND "${GIT_EXECUTABLE}" show --date=format:%Y.%m.%d --format=%ad-%h --no-patch
+-    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+-    OUTPUT_VARIABLE GIT_VERSION
+-    OUTPUT_STRIP_TRAILING_WHITESPACE)
+-  message(STATUS "Version: ${GIT_VERSION}")
++if(NOT GIT_VERSION)
++  find_package(Git)
++  if(Git_FOUND)
++    execute_process(
++      COMMAND "${GIT_EXECUTABLE}" show --date=format:%Y.%m.%d --format=%ad-%h --no-patch
++      WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
++      OUTPUT_VARIABLE GIT_VERSION
++      OUTPUT_STRIP_TRAILING_WHITESPACE)
++    message(STATUS "Version: ${GIT_VERSION}")
+-  # May not update version in some cases (example: git commit --amend)
+-  set_property(GLOBAL APPEND
+-    PROPERTY CMAKE_CONFIGURE_DEPENDS
+-    "${CMAKE_SOURCE_DIR}/.git/index")
+-else()
+-  set(GIT_VERSION "UNKNOWN")
+-  message(WARNING "Could not find git command! Version is set to: ${GIT_VERSION}")
++    # May not update version in some cases (example: git commit --amend)
++    set_property(GLOBAL APPEND
++      PROPERTY CMAKE_CONFIGURE_DEPENDS
++      "${CMAKE_SOURCE_DIR}/.git/index")
++  else()
++    set(GIT_VERSION "UNKNOWN")
++    message(WARNING "Could not find git command! Version is set to: ${GIT_VERSION}")
++  endif()
+ endif()
+ # LIBRARY DEPENDENCIES
index 45469ed96e71a76c538eb670c1408e49eb76a3ad..443b747a086452b3647ccb646bbe5f0b5c52b96e 100644 (file)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-/etc/init.d/"$1" version 2>&1 | grep "$2"
+/etc/init.d/"$1" version 2>&1 | grep "$2" && "$1" -V 2>&1 | grep "$2"