From 08a9d197423061ad820a0657779ce90263d293d4 Mon Sep 17 00:00:00 2001 From: Philip Guyton Date: Wed, 24 Jul 2019 17:01:43 +0100 Subject: [PATCH] changelog fails on version lines #2054 - Improve Web-UI changelog parsing to account for both empty and release version line entries, the latter begin with "*". - Remove version lines filter mechanism in low level changelog parser. --- .../static/storageadmin/js/views/version.js | 48 ++++++++++++------- src/rockstor/system/pkg_mgmt.py | 1 + 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/version.js b/src/rockstor/storageadmin/static/storageadmin/js/views/version.js index b3ba94e7f..2fc492173 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/version.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/version.js @@ -239,28 +239,40 @@ VersionView = RockstorLayoutView.extend({ var contributors = []; for (var i = 0; i < logArray.length; i++) { - var hashIndex = logArray[i].indexOf('#'); - var atRateIndex = logArray[i].indexOf('@'); - issues[i] = logArray[i].substring(hashIndex + 1, atRateIndex - 1); - var namesNum = logArray[i].indexOf('@') + 1; - changeDescription[i] = logArray[i].substring(0, hashIndex - 1); - nextString[i] = logArray[i].substring(namesNum, logArray[i].length); - contributors[i] = nextString[i].split(' @'); + if (logArray[i] == '' || logArray[i].substring(0, 1) == '*') { + // Preserve empty lines and package version entries 'as is' + // and Bold for section emphasis. + changeDescription[i] = logArray[i] + } else { + var hashIndex = logArray[i].indexOf('#'); + var atRateIndex = logArray[i].indexOf('@'); + issues[i] = logArray[i].substring(hashIndex + 1, atRateIndex - 1); + var namesNum = logArray[i].indexOf('@') + 1; + changeDescription[i] = logArray[i].substring(0, hashIndex - 1); + nextString[i] = logArray[i].substring(namesNum, logArray[i].length); + contributors[i] = nextString[i].split(' @'); + } } for (var k = 0; k < changeDescription.length; k++) { var cl = changeDescription[k]; - cl += ' #'; - cl += issues[k]; - cl += ''; - - for (var j = 0; j < contributors[k].length; j++) { - cl += ' @'; - cl += contributors[k][j]; + // Don't process package version lines for issue and contributor + if (cl == '' || cl.substring(0, 1) == '*') { + cl = '' + cl + '' + } else { + cl += ' #'; + cl += issues[k]; cl += ''; + if (typeof contributors[k] !== 'undefined') { + for (var j = 0; j < contributors[k].length; j++) { + cl += ' @'; + cl += contributors[k][j]; + cl += ''; + } + } } changeLogArray.push(new Handlebars.SafeString(cl)); } diff --git a/src/rockstor/system/pkg_mgmt.py b/src/rockstor/system/pkg_mgmt.py index 3d8fd2a4d..310ccfcae 100644 --- a/src/rockstor/system/pkg_mgmt.py +++ b/src/rockstor/system/pkg_mgmt.py @@ -225,6 +225,7 @@ def update_check(subscription=None): if (len(l.strip()) == 0): log = False if (re.match('\* ', l) is not None): + updates.append(l) log = True if (new_version is None): new_version = version