summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Philippsen <nils@tiptoe.de>2016-08-13 14:38:28 +0200
committerPaul Davis <paul@linuxaudiosystems.com>2018-09-19 19:14:02 -0400
commit12544795e864e0210a97bbaaaaebfa3892e0b005 (patch)
tree5a9d6b9b0390f298c39a89652671ba3896d9728b
parentfb01698450e5cb88c7e58fb3a5ebe6294731fdfe (diff)
AppData release tags need a date to be valid
Or a timestamp, but that's deprecated. Create it from the last commit, store it in/retrieve it from revision.cc and substitute it in the template. https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-releases
-rw-r--r--gtk2_ardour/ardour.appdata.xml.in.in2
-rw-r--r--gtk2_ardour/wscript1
-rw-r--r--wscript44
3 files changed, 32 insertions, 15 deletions
diff --git a/gtk2_ardour/ardour.appdata.xml.in.in b/gtk2_ardour/ardour.appdata.xml.in.in
index 1b2b940fb7..9b8421a298 100644
--- a/gtk2_ardour/ardour.appdata.xml.in.in
+++ b/gtk2_ardour/ardour.appdata.xml.in.in
@@ -5,7 +5,7 @@
<project_license>GPL-2.0+</project_license>
<name>Ardour</name>
<releases>
- <release version="@VERSION@" />
+ <release version="@VERSION@" date="@DATE@" />
</releases>
<summary>Digital Audio Workstation</summary>
<description>
diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript
index aadf185b2a..2e9cb73b38 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -850,6 +850,7 @@ def build(bld):
'ARDOUR_EXEC' : str (bld.env['lwrcase_dirname']),
'ARDOUR_ICON' : str (bld.env['lwrcase_dirname']),
'VERSION': str (bld.env['VERSION']),
+ 'DATE': str (bld.env['DATE']),
}
if bld.env['FREEDESKTOP']:
diff --git a/wscript b/wscript
index 4901794fb7..4cec780268 100644
--- a/wscript
+++ b/wscript
@@ -147,25 +147,35 @@ clang_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded
clang_darwin_dict['full-optimization'] = [ '-O3', '-ffast-math']
compiler_flags_dictionaries['clang-darwin'] = clang_darwin_dict;
-def fetch_git_revision ():
- cmd = "git describe HEAD | sed 's/^[A-Za-z0-9]*+//'"
- output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
- rev = output[0].decode ('utf-8')
- return rev
+def fetch_git_revision_date ():
+ cmd = ["git", "describe", "HEAD"]
+ output = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
+ rev = re.sub(r"^[A-Za-z0-9]*\+", "", output[0].decode('utf-8'))
+
+ cmd = ["git", "log", "-1", "--pretty=format:%ci", "HEAD"]
+ output = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
+ date = output[0].decode('utf-8').split(None, 2)[0]
+
+ return rev, date
-def fetch_tarball_revision ():
+def fetch_tarball_revision_date():
if not os.path.exists ('libs/ardour/revision.cc'):
print ('This tarball was not created correctly - it is missing libs/ardour/revision.cc')
sys.exit (1)
with open('libs/ardour/revision.cc', 'rb') as f:
content = f.readlines()
remove_punctuation_map = dict((ord(char), None) for char in '";')
- return content[1].decode('utf-8').strip().split(' ')[7].translate (remove_punctuation_map)
+ raw_line_tokens = content[1].decode('utf-8').strip().split(' ')
+
+ rev = raw_line_tokens[7].translate(remove_punctuation_map)
+ date = raw_line_tokens[12].translate(remove_punctuation_map)
+
+ return rev, date
if os.path.isdir (os.path.join(os.getcwd(), '.git')):
- rev = fetch_git_revision ()
+ rev, rev_date = fetch_git_revision_date()
else:
- rev = fetch_tarball_revision ()
+ rev, rev_date = fetch_tarball_revision_date()
#
# rev is now of the form MAJOR.MINOR[-rcX]-rev-commit
@@ -282,7 +292,7 @@ def fetch_gcc_version (CC):
def create_stored_revision():
rev = ""
if os.path.exists('.git'):
- rev = fetch_git_revision();
+ rev, rev_date = fetch_git_revision_date();
print("Git version: " + rev + "\n")
elif os.path.exists('libs/ardour/revision.cc'):
print("Using packaged revision")
@@ -293,12 +303,16 @@ def create_stored_revision():
try:
#
- # if you change the format of this, be sure to fix fetch_tarball_revision() above
- # so that it still works.
+ # if you change the format of this, be sure to fix fetch_tarball_revision_date()
+ # above so that it still works.
#
text = '#include "ardour/revision.h"\n'
- text += 'namespace ARDOUR { const char* revision = \"%s\"; }\n' % rev
- print('Writing revision info to libs/ardour/revision.cc using ' + rev)
+ text += (
+ 'namespace ARDOUR { '
+ 'const char* revision = \"%s\"; '
+ 'const char* date = \"%s\"; }\n'
+ ) % (rev, rev_date)
+ print('Writing revision info to libs/ardour/revision.cc using ' + rev + ', ' + rev_date)
o = open('libs/ardour/revision.cc', 'w')
o.write(text)
o.close()
@@ -1332,6 +1346,8 @@ const char* const ardour_config_info = "\\n\\
def build(bld):
create_stored_revision()
+ bld.env['DATE'] = rev_date
+
# add directories that contain only headers, to workaround an issue with waf
if not bld.is_defined('USE_EXTERNAL_LIBS'):