pvecfg: adapt version and release semantic

Wit commit bcef9bde68a920a4d204beb8ec1d5f334f7fbb78 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 <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-05-26 15:58:16 +02:00
parent 17dcedb801
commit b597d23d35
8 changed files with 29 additions and 22 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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);

View File

@ -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 $@
%:

View File

@ -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';

View File

@ -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,
};

View File

@ -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@',
}
}

View File

@ -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');