From 180a86d39a0c0963f7a886263ee971e3b92e303b Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sun, 26 May 2019 15:58:16 +0200 Subject: [PATCH] pvecfg: adapt version and release semantic Wit commit a74ba607d4b02c5734c5480de62700f52f96ac71 we switched over to using the dpkg-dev provided helpers to set package version, architecture and such in the buildsystem. But unlike other repositories we used the version also for giving it back over the API through the during build generated PVE::pvecfg module, which wasn't fully updated to the new style. This patch does that, and also cleans up semantics a bit, the following two changed: release is now the Debian release, instead of the "package release" (i.e., the -X part of a full package version). version is now simply the full (pve-manager) version, e.g., 6.0-1 or the currently for testing used 6.0-0+1 This allows to do everything we used this information for even in a slightly easier way (no string concat needed anymore), and fits also with the terminology we often used in our public channels (mailing lists, forum, website) Remove some cruft as we touch things. Signed-off-by: Thomas Lamprecht --- Makefile | 5 +++-- PVE/API2/Nodes.pm | 15 ++++++++++++--- PVE/APLInfo.pm | 4 ++-- PVE/Makefile | 2 +- PVE/Report.pm | 2 +- PVE/Service/pveproxy.pm | 5 ++--- PVE/pvecfg.pm.in | 16 +++++++--------- www/manager6/Workspace.js | 2 +- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 68470c00..be8cc56f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,8 @@ include /usr/share/dpkg/pkg-info.mk include /usr/share/dpkg/architecture.mk include defines.mk -export VERSION=${DEB_VERSION_UPSTREAM} +export PVERELEASE=${DEB_VERSION_UPSTREAM} +export VERSION=${DEB_VERSION_UPSTREAM_REVISION} DESTDIR= @@ -13,7 +14,7 @@ GITVERSION:=$(shell git rev-parse HEAD) # possibly set via debian/rules(.env) REPOID?=$(shell git rev-parse --short=8 HEAD) -DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb +DEB=${PACKAGE}_${VERSION}_${DEB_BUILD_ARCH}.deb all: ${SUBDIRS} set -e && for i in ${SUBDIRS}; do ${MAKE} -C $$i; done diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm index 83df9956..4136f6ed 100644 --- a/PVE/API2/Nodes.pm +++ b/PVE/API2/Nodes.pm @@ -218,9 +218,18 @@ __PACKAGE__->register_method ({ returns => { type => "object", properties => { - version => { type => 'string' }, - release => { type => 'string' }, - repoid => { type => 'string' }, + version => { + type => 'string', + description => 'The current installed pve-manager package version', + }, + release => { + type => 'string', + description => 'The current installed Proxmox VE Release', + }, + repoid => { + type => 'string', + description => 'The short git commit hash ID from which this version was build', + }, }, }, code => sub { diff --git a/PVE/APLInfo.pm b/PVE/APLInfo.pm index fe945506..99c02348 100644 --- a/PVE/APLInfo.pm +++ b/PVE/APLInfo.pm @@ -222,8 +222,8 @@ sub update { logmsg($logfd, "starting update"); my $ua = LWP::UserAgent->new; - my $version = PVE::pvecfg::version(); - $ua->agent("PVE/$version"); + my $release = PVE::pvecfg::release(); + $ua->agent("PVE/$release"); if ($proxy) { $ua->proxy(['http', 'https'], $proxy); diff --git a/PVE/Makefile b/PVE/Makefile index 68d2ae2f..ad21d383 100644 --- a/PVE/Makefile +++ b/PVE/Makefile @@ -17,7 +17,7 @@ all: pvecfg.pm ${SUBDIRS} set -e && for i in ${SUBDIRS}; do ${MAKE} -C $$i; done pvecfg.pm: pvecfg.pm.in - sed -e s/@VERSION@/${VERSION}/ -e s/@PACKAGERELEASE@/${PACKAGERELEASE}/ -e s/@PACKAGE@/${PACKAGE}/ -e s/@REPOID@/${REPOID}/ $< >$@.tmp + sed -e s/@VERSION@/${VERSION}/ -e s/@PVERELEASE@/${PVERELEASE}/ -e s/@PACKAGE@/${PACKAGE}/ -e s/@REPOID@/${REPOID}/ $< >$@.tmp mv $@.tmp $@ %: diff --git a/PVE/Report.pm b/PVE/Report.pm index 1199a6d5..529acb37 100644 --- a/PVE/Report.pm +++ b/PVE/Report.pm @@ -2,7 +2,7 @@ package PVE::Report; use strict; use warnings; -use PVE::pvecfg; + use PVE::Tools; $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin'; diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm index 467748b1..4a515707 100755 --- a/PVE/Service/pveproxy.pm +++ b/PVE/Service/pveproxy.pm @@ -212,8 +212,7 @@ sub get_index { $langfile = 1; } - my $ver = PVE::pvecfg::version(); - my $release = PVE::pvecfg::release(); + my $version = PVE::pvecfg::version(); my $wtversionraw = PVE::Tools::file_read_firstline("$basedirs->{widgettoolkit}/proxmoxlib.js"); my $wtversion; @@ -229,7 +228,7 @@ sub get_index { console => $args->{console}, nodename => $nodename, debug => $server->{debug}, - version => "$ver-$release", + version => "$version", wtversion => $wtversion, }; diff --git a/PVE/pvecfg.pm.in b/PVE/pvecfg.pm.in index 376ed5d1..6307ed9b 100644 --- a/PVE/pvecfg.pm.in +++ b/PVE/pvecfg.pm.in @@ -1,35 +1,33 @@ package PVE::pvecfg; use strict; -use vars qw(@ISA); -use Carp; +use warnings; sub package { - return '@PACKAGE@'; + return '@PACKAGE@'; } sub version { - return '@VERSION@'; + return '@VERSION@'; } sub release { - return '@PACKAGERELEASE@'; + return '@PVERELEASE@'; } sub repoid { - return '@REPOID@'; + return '@REPOID@'; } -# this is diplayed on the GUI sub version_text { - return '@VERSION@-@PACKAGERELEASE@/@REPOID@'; + return '@VERSION@/@REPOID@'; } # this is returned by the API sub version_info { return { 'version' => '@VERSION@', - 'release' => '@PACKAGERELEASE@', + 'release' => '@PVERELEASE@', 'repoid' => '@REPOID@', } } diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js index 6d706384..7c771445 100644 --- a/www/manager6/Workspace.js +++ b/www/manager6/Workspace.js @@ -171,7 +171,7 @@ Ext.define('PVE.StdWorkspace', { var ui = me.query('#versioninfo')[0]; if (PVE.VersionInfo) { - var version = PVE.VersionInfo.version + '-' + PVE.VersionInfo.release; + var version = PVE.VersionInfo.version; ui.update('Virtual Environment ' + version); } else { ui.update('Virtual Environment'); -- 2.39.2