Added version detection and publishing

This commit is contained in:
lfield 2018-10-05 15:03:54 +02:00
parent 4a433336b2
commit ad1d27fa94
3 changed files with 40 additions and 0 deletions

View File

@ -18,6 +18,8 @@
require_once("../inc/util.inc");
require_once("../inc/xml.inc");
if(file_exists('../inc/release.inc'))
include '../inc/release.inc';
BoincDb::get(true);
xml_header();
@ -63,6 +65,14 @@ echo "<project_config>
<web_rpc_url_base>".secure_url_base()."</web_rpc_url_base>
";
if ( isset($git_commit) ) {
echo "<git_commit>$git_commit</git_commit>\n";
}
if ( isset($server_version) ) {
echo "<server_version>$server_version</server_version>\n";
}
if (parse_config($config, "<account_manager>")) {
echo " <account_manager/>\n";
}

View File

@ -30,6 +30,8 @@ require_once("../inc/cache.inc");
require_once("../inc/util.inc");
require_once("../inc/xml.inc");
require_once("../inc/boinc_db.inc");
if(file_exists('../inc/release.inc'))
include '../inc/release.inc';
if (!defined('STATUS_PAGE_TTL')) {
define('STATUS_PAGE_TTL', 3600);
@ -183,6 +185,11 @@ function show_status_html($x) {
";
}
end_table();
if ( isset($server_version) && isset($git_commit) ) {
echo "Server version: $server_version ($git_commit)\n";
}
if ($j->db_revision) {
echo tra("Database schema version: "), $j->db_revision;
}

View File

@ -9,6 +9,7 @@ import boinc_path_config
from Boinc import database, db_mid, configxml, tools
from Boinc.boinc_db import *
import os, sys, glob, time, shutil, re, random
import subprocess
class Options:
pass
@ -339,6 +340,28 @@ def install_boinc_files(dest_dir, install_web_files, install_server_files):
shutil.copy(srcdir('html/user/sample_motd.php'), dir('html/user/motd.php'))
os.system("rm -f "+dir('html/languages/translations/*'))
install_glob(srcdir('html/languages/translations/*.po'), dir('html/languages/translations/'))
os.remove(srcdir('html/inc/release.inc'))
try:
s = subprocess.Popen(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
commit = s.stdout.read()[:7]
s = subprocess.Popen(["git", "branch"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
branch = s.stdout.read().split('*')[1].split('\n')[0].strip()
s = subprocess.Popen(["git", "tag", "-l", "--points-at", "HEAD"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
version = s.stdout.read().split("/")[-1].strip()
content = '''<?php
$git_commit = {commit}
$git_branch = {branch}
$server_version = {version}
\?>
'''.format(commit=commit, branch=branch, version=version)
f = open(srcdir('html/inc/release.inc'), 'w')
f.write(content)
f.close()
except Exception, e:
print 'Not running from git source, no version or commit detected.'
# copy Python stuff
map(lambda (s): install(srcdir('sched',s), dir('bin',s)),