build: rip out automated version history
Automatically checking all of the tags in order to construct our version history has always been a bit gross. It means that what lands in the release tarball is determined by more than just the current commit. On top of that, the script to do this nasty bit of work just produced an output which failed to validate, owing to the recent out-of-sequence release of 264.2. Version history really ought to be tracked downstream, so let's rip all of this out and replace it with a very simple approach to writing a single release line into the file. This is the minimum required for the file to validate. Any additional history can be handled downstream (manually, for the time being).
This commit is contained in:
parent
d30cfdcbcb
commit
a33062f002
|
@ -22,7 +22,7 @@ distdir: $(DISTFILES)
|
|||
git -C '$(srcdir)' ls-files -x test/reference .fmf plans test tools > .extra_dist.tmp && \
|
||||
mv .extra_dist.tmp '$(srcdir)/.extra_dist'; fi
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am EXTRA_FILES="$$(tr '\n' ' ' < $(srcdir)/.extra_dist) .extra_dist"
|
||||
test ! -x $(srcdir)/src/client/add-metainfo-releases || $(srcdir)/src/client/add-metainfo-releases --version '$(VERSION)' '$(distdir)'/src/client/*.metainfo.xml
|
||||
sed -i "s/[@]VERSION@/$(VERSION)/" "$(distdir)/src/client/org.cockpit_project.CockpitClient.metainfo.xml"
|
||||
sed -i "/^Version:/ s/0/$(VERSION)/" "$(distdir)/tools/cockpit.spec"
|
||||
sed -i "/^pkgver=/ s/0/$(VERSION)/" "$(distdir)/tools/arch/PKGBUILD"
|
||||
sed -i "1 s/0/$(VERSION)/" "$(distdir)/tools/debian/changelog"
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import time
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
BASE_DIR = os.path.realpath(f'{__file__}/../../..')
|
||||
|
||||
|
||||
# Pretend like this is a little bit functional
|
||||
def element(tag, text=None, children=(), **kwargs):
|
||||
tag = ET.Element(tag, kwargs)
|
||||
tag.text = text
|
||||
tag.extend(children)
|
||||
return tag
|
||||
|
||||
|
||||
def points_from_body(body):
|
||||
for text in re.split('^ *-', body, flags=re.MULTILINE):
|
||||
if point := ' '.join(text.split()).strip():
|
||||
yield element('li', point)
|
||||
|
||||
|
||||
def format_release(blob):
|
||||
version, date, body = blob.split('|', 2)
|
||||
|
||||
return element('release', version=version, date=date, children=[
|
||||
element('url', f'https://cockpit-project.org/blog/cockpit-{version}.html', type='details'),
|
||||
element('description', children=[
|
||||
element('p', f'Changes in Cockpit {version}:'),
|
||||
element('ul', children=points_from_body(body))
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
def get_releases():
|
||||
# %(if)%(taggerdate) ensures we get only annotated tags. 258 was the first release
|
||||
format = '%(if)%(taggerdate)%(then)%(refname:short)|%(taggerdate:short)|%(contents:body)%(end)'
|
||||
output = subprocess.check_output(['git', '-C', BASE_DIR, 'for-each-ref', '--shell', '--sort=-taggerdate',
|
||||
'--contains', '258', '--format', format, 'refs/tags'], text=True)
|
||||
return shlex.split(output)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--version', help='Current version number', default='')
|
||||
parser.add_argument('xml', help='Path to xml.in file in tree')
|
||||
args = parser.parse_args()
|
||||
|
||||
tree = ET.parse(args.xml)
|
||||
releases = tree.find('releases')
|
||||
|
||||
# Only update the file if it doesn't already contain releases.
|
||||
if not releases.find('release'):
|
||||
if 'g' in args.version:
|
||||
today = time.strftime('%Y-%m-%d')
|
||||
releases.append(element('release', version=args.version, date=today, type='development'))
|
||||
releases.extend(format_release(r) for r in get_releases() if r)
|
||||
if 'ELEMENT_TREE_NO_INDENT' not in os.environ:
|
||||
ET.indent(releases, space=" ", level=1)
|
||||
tree.write(args.xml, encoding='utf-8', xml_declaration=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -32,7 +32,9 @@
|
|||
</screenshot>
|
||||
</screenshots>
|
||||
|
||||
<releases/>
|
||||
<releases>
|
||||
<release version="@VERSION@" date="@DATE@"/>
|
||||
</releases>
|
||||
|
||||
<launchable type="desktop-id">org.cockpit_project.CockpitClient.desktop</launchable>
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@ timestamp() {
|
|||
stamp="$((stamp + 1))"
|
||||
}
|
||||
|
||||
# we add the date of the release to the Cockpit Client metainfo
|
||||
sed -i "s/@DATE@/$(date -d@${stamp} +'%Y-%m-%d')/" \
|
||||
"${distdir}/src/client/org.cockpit_project.CockpitClient.metainfo.xml"
|
||||
|
||||
# all files get the same timestamp as the commit date
|
||||
timestamp "${distdir}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue