Skip to content
Snippets Groups Projects
Commit 5a783df0 authored by Jan Mach's avatar Jan Mach
Browse files

Propagating build number to Grunt and documentation.

Build number from Buildbot system now gets propagated to Grunt and autogenerated documentation. This feature is intended to be used for development (unstable) builds to somehow autoincrement the package version number. For production distributions this will be skipped and developer still has to set the desired version number manually. (Redmine issues: #3361 and #3387)
parent 57db1217
No related branches found
No related tags found
No related merge requests found
module.exports = function(grunt) { module.exports = function(grunt) {
// ---------------------------------------------------------------------
// Command line options.
var distribution = grunt.option('distribution') || 'development';
var buildnumber = grunt.option('buildnumber') || '';
function cbk_dir_size(err, stdout, stderr, cb) { function cbk_dir_size(err, stdout, stderr, cb) {
grunt.config.set('template.deb-control.options.data.package_size', stdout.trim()); grunt.config.set('template.deb-control.options.data.package_size', stdout.trim());
cb(); cb();
} }
function version() { function version() {
return '<%= meta.version %>'; if (distribution == 'development') {
return '<%= meta.version %>.' + buildnumber;
}
else {
return '<%= meta.version %>'
}
} }
function deb_package_filename() { function deb_package_filename() {
...@@ -246,6 +256,11 @@ module.exports = function(grunt) { ...@@ -246,6 +256,11 @@ module.exports = function(grunt) {
grunt.config.set('template.deb-control.options.data.package_version', grunt.template.process(version())); grunt.config.set('template.deb-control.options.data.package_version', grunt.template.process(version()));
}); });
// Subtask for displaying current version number.
grunt.registerTask('check-version', function() {
console.log("Current package version: " + grunt.template.process(version()));
});
// Save current state of metadata. // Save current state of metadata.
grunt.registerTask('save-meta', function() { grunt.registerTask('save-meta', function() {
try { try {
......
...@@ -27,6 +27,9 @@ sys.path.insert(0, os.path.abspath('../../lib')) ...@@ -27,6 +27,9 @@ sys.path.insert(0, os.path.abspath('../../lib'))
with open('metadata.json') as json_metadata_file: with open('metadata.json') as json_metadata_file:
custom_metadata = json.load(json_metadata_file) custom_metadata = json.load(json_metadata_file)
def setup(app):
app.add_config_value('build_suite', custom_metadata['suite'], 'env')
# -- General configuration ----------------------------------------------------- # -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here. # If your documentation needs a minimal Sphinx version, state it here.
...@@ -121,6 +124,7 @@ rst_epilog = """ ...@@ -121,6 +124,7 @@ rst_epilog = """
.. |suite| replace:: *{suite}* .. |suite| replace:: *{suite}*
.. |bversion| replace:: *{bversion}* .. |bversion| replace:: *{bversion}*
.. |revision| replace:: ``{revision}`` .. |revision| replace:: ``{revision}``
.. |bnumber| replace:: *- {bnumber}*
""".format(**custom_metadata) """.format(**custom_metadata)
# -- Options for HTML output ---------------------------------------------- # -- Options for HTML output ----------------------------------------------
......
...@@ -14,6 +14,11 @@ Welcome to Mentat's documentation! ...@@ -14,6 +14,11 @@ Welcome to Mentat's documentation!
* distribution: |codename| (|suite|) * distribution: |codename| (|suite|)
* Git revision: |revision| * Git revision: |revision|
.. ifconfig:: build_suite in ('unstable')
.. warning::
This documentation was generated from unstable codebase: |bversion| |bnumber|
Contents: Contents:
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
...@@ -30,4 +35,3 @@ Indices and tables ...@@ -30,4 +35,3 @@ Indices and tables
* :ref:`genindex` * :ref:`genindex`
* :ref:`modindex` * :ref:`modindex`
* :ref:`search` * :ref:`search`
{"codename":"local","suite": "unstable","bversion":"unknown","revision":"latest"} {"codename":"local","suite": "unstable","bversion":"unknown","revision":"latest","bnumber":"unknown"}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment