From bdc48b0f87066cf7c54d3be3942567273b6a375a Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 22 Jun 2021 17:53:44 +0200 Subject: [PATCH] TT#127355 Add support for application versions This should make it easier to see the application version in contrast to the system modules version. We initialize this at build time from the package version, and fallback to the module version if the application has no usable version. Change-Id: I4b4e1a926aea517b2b3b46261794e187af0c9865 (cherry picked from commit b90ca3f3acb19cecaa1d2722f009a104531d2829) --- debian/rules | 7 +++++++ lib/NGCP/BulkProcessor/Globals.pm | 2 ++ lib/NGCP/BulkProcessor/LoadConfig.pm | 2 ++ .../BulkProcessor/Projects/Massive/Generator/process.pl | 2 ++ .../Projects/Massive/RegistrationMonitoring/process.pl | 2 ++ 5 files changed, 15 insertions(+) diff --git a/debian/rules b/debian/rules index 8b45f989..7f2ea9cd 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,14 @@ #!/usr/bin/make -f +include /usr/share/dpkg/pkg-info.mk + # Uncomment this to turn on verbose mode. # export DH_VERBOSE=1 %: dh "$@" + +execute_after_dh_install: + find debian/lib*-perl -name process.pl -print0 | \ + xargs -0 sed -i \ + -e 's/^our \$$VERSION = .*/our \$$VERSION = "$(DEB_VERSION)";/' diff --git a/lib/NGCP/BulkProcessor/Globals.pm b/lib/NGCP/BulkProcessor/Globals.pm index 650414df..18427069 100644 --- a/lib/NGCP/BulkProcessor/Globals.pm +++ b/lib/NGCP/BulkProcessor/Globals.pm @@ -36,6 +36,7 @@ our @EXPORT_OK = qw( $system_instance_label $local_ip $local_fqdn + $application_version $application_path $executable_path $working_path @@ -144,6 +145,7 @@ our $system_instance_label = 'some node'; our $local_ip = get_ipaddress(); our $local_fqdn = get_hostfqdn(); +our $application_version = $main::VERSION // $VERSION; our $application_path = get_applicationpath(); our $executable_path = $FindBin::Bin . '/'; #my $remotefilesystem = "MSWin32"; diff --git a/lib/NGCP/BulkProcessor/LoadConfig.pm b/lib/NGCP/BulkProcessor/LoadConfig.pm index ddbdc5e3..d1280e59 100644 --- a/lib/NGCP/BulkProcessor/LoadConfig.pm +++ b/lib/NGCP/BulkProcessor/LoadConfig.pm @@ -8,6 +8,7 @@ use NGCP::BulkProcessor::Globals qw( $system_version $system_instance_label $local_fqdn + $application_version $application_path $working_path $executable_path @@ -172,6 +173,7 @@ sub _splashinfo { my ($configfile) = @_; configurationinfo($system_name . ' ' . $system_version . ' (' . $system_instance_label . ') [' . $local_fqdn . ']',getlogger(__PACKAGE__)); + configurationinfo('application version: ' . $application_version,getlogger(__PACKAGE__)); configurationinfo('application path: ' . $application_path,getlogger(__PACKAGE__)); configurationinfo('working path: ' . $working_path,getlogger(__PACKAGE__)); configurationinfo($cpucount . ' cpu(s), multithreading ' . ($enablemultithreading ? 'enabled' : 'disabled'),getlogger(__PACKAGE__)); diff --git a/lib/NGCP/BulkProcessor/Projects/Massive/Generator/process.pl b/lib/NGCP/BulkProcessor/Projects/Massive/Generator/process.pl index b6f582e1..3d7e9618 100755 --- a/lib/NGCP/BulkProcessor/Projects/Massive/Generator/process.pl +++ b/lib/NGCP/BulkProcessor/Projects/Massive/Generator/process.pl @@ -4,6 +4,8 @@ use strict; ## no critic +our $VERSION = "0.0"; + use File::Basename; use Cwd; use lib Cwd::abs_path(File::Basename::dirname(__FILE__) . '/../../../../../'); diff --git a/lib/NGCP/BulkProcessor/Projects/Massive/RegistrationMonitoring/process.pl b/lib/NGCP/BulkProcessor/Projects/Massive/RegistrationMonitoring/process.pl index 9e42a549..c4adb00a 100644 --- a/lib/NGCP/BulkProcessor/Projects/Massive/RegistrationMonitoring/process.pl +++ b/lib/NGCP/BulkProcessor/Projects/Massive/RegistrationMonitoring/process.pl @@ -2,6 +2,8 @@ use strict; ## no critic +our $VERSION = "0.0"; + use File::Basename; use Cwd; use lib Cwd::abs_path(File::Basename::dirname(__FILE__) . '/../../../../../');