Skip to content

Commit

Permalink
Improved service version publication
Browse files Browse the repository at this point in the history
  • Loading branch information
brevilo authored and lfield committed Dec 3, 2018
1 parent 19a6483 commit c4357e4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ py/Boinc/version.py
py/setup.py
stamp-h1
test/version.inc
html/inc/release.inc

## files created by make:
*.o
Expand Down
16 changes: 15 additions & 1 deletion generate_svn_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ elif [ -d .git ]; then
fi
URL=`git config --get remote.$remote.url`
DATE=`git log -n1 --pretty="format:%ct"`
SERVER_VERSION=`git describe --abbrev=0 --match server_release/*`
elif [ -d .svn ]; then
CMD="svn info"
else
CMD=""
fi

if [ "x$GIT_LOG" != "x" ]; then
echo "#define SVN_VERSION \"$GIT_LOG [$URL] ($HOST:$PWD [$BRANCH])\"" >> $TMPFILE
echo "#define SVN_VERSION \"$GIT_LOG [$URL] ($HOST:$PWD [$BRANCH]) [Server-Release: $SERVER_VERSION]\"" >> $TMPFILE
echo "$GIT_LOG" | sed 's/^\(........\).*/#define GIT_REVISION 0x\1/' >> $TMPFILE
echo "#define GIT_DATE $DATE" >> $TMPFILE
test "x$URL" = "x" ||
Expand Down Expand Up @@ -61,3 +62,16 @@ if cmp "$HEADER" "$TMPFILE" >/dev/null 2>&1; then
else
mv "$TMPFILE" "$HEADER"
fi

if [ ! -z ${SERVER_VERSION} ]; then
SERVER_VERSION=`echo ${SERVER_VERSION} | sed 's#.*/##'`
cat << EOF > html/inc/release.inc
<?php
global \$server_version ;
\$server_version = "${SERVER_VERSION}";
?>
EOF

fi
8 changes: 2 additions & 6 deletions html/user/get_project_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
require_once("../inc/consent.inc");
require_once("../inc/util.inc");
require_once("../inc/xml.inc");
if(file_exists('../../release.inc'))
include '../../release.inc';
if(file_exists('../inc/release.inc'))
include '../inc/release.inc';

BoincDb::get(true);
xml_header();
Expand Down Expand Up @@ -66,10 +66,6 @@ function show_platforms() {
<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";
}
Expand Down
11 changes: 6 additions & 5 deletions html/user/server_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
require_once("../inc/util.inc");
require_once("../inc/xml.inc");
require_once("../inc/boinc_db.inc");
if(file_exists('../../release.inc'))
include '../../release.inc';
if(file_exists('../inc/release.inc'))
include '../inc/release.inc';

if (!defined('STATUS_PAGE_TTL')) {
define('STATUS_PAGE_TTL', 3600);
Expand Down Expand Up @@ -187,9 +187,10 @@ function show_status_html($x) {
end_table();

global $server_version;
global $git_commit;
if ( isset($server_version) && isset($git_commit) ) {
echo "Server version: $server_version (<a href=https://github.com/BOINC/boinc/commit/$git_commit>$git_commit)</a>)<br>";
if ( isset($server_version) ) {
$url = "https://github.com/BOINC/boinc/tree/server_release/";
$url .= explode(".", $server_version)[0] . "." . explode(".", $server_version)[1] . "/" . "$server_version";
echo "Upstream server release: <a href=\"" . $url . "\">$server_version</a> <br>";
}

if ($j->db_revision) {
Expand Down
26 changes: 0 additions & 26 deletions py/Boinc/setup_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
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
Expand Down Expand Up @@ -340,31 +339,6 @@ def dir(*dirs):
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/'))
try:
os.remove(os.path.join(dest_dir, 'release.inc'))
except OSError:
pass
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", "describe", "--match", "server_release/*", "--tags", "--exact", "HEAD"],
stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
version = s.stdout.read().split("/")[-1].strip()
content = '''<?php
global $git_commit;
global $server_version;
$git_commit = "{commit}";
$server_version = "{version}";
?>
'''.format(commit=commit, version=version)
f = open(os.path.join(dest_dir, 'release.inc'), 'w')
f.write(content)
f.close()
os.chmod(os.path.join(dest_dir, 'release.inc'), 0o644)
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)),
Expand Down

0 comments on commit c4357e4

Please sign in to comment.