Files
scylladb/dist/debian/python3/debian_files_gen.py
Takuya ASADA d65b15f3b2 dist/debian/python3: apply version number fixup on scylla-python3
Sync version number fixup from main package, contains #6546 and #6752 fixes.

Note that scylla-python3 likely does not affect this versioning issue,
since it uses python3 version, which normally does not contain 'rcX'.
2020-07-05 14:21:18 +03:00

68 lines
2.1 KiB
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 ScyllaDB
#
#
# This file is part of Scylla.
#
# Scylla is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Scylla is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Scylla. If not, see <http://www.gnu.org/licenses/>.
#
import string
import os
import glob
import shutil
class DebianFilesTemplate(string.Template):
delimiter = '%'
scriptdir = os.path.dirname(__file__)
with open(os.path.join(scriptdir, 'changelog.template')) as f:
changelog_template = f.read()
with open(os.path.join(scriptdir, 'control.template')) as f:
control_template = f.read()
with open('build/SCYLLA-PRODUCT-FILE') as f:
product = f.read().strip()
with open('build/python3/SCYLLA-VERSION-FILE') as f:
version = f.read().strip().replace('.rc', '~rc').replace('_', '-')
with open('build/python3/SCYLLA-RELEASE-FILE') as f:
release = f.read().strip()
shutil.rmtree('build/debian/python3/debian', ignore_errors=True)
shutil.copytree('dist/debian/python3/debian', 'build/debian/python3/debian')
if product != 'scylla':
for p in glob.glob('build/debian/python3/debian/scylla-*'):
shutil.move(p, p.replace('scylla-', '{}-'.format(product)))
s = DebianFilesTemplate(changelog_template)
changelog_applied = s.substitute(product=product, version=version, release=release, revision='1', codename='stable')
s = DebianFilesTemplate(control_template)
control_applied = s.substitute(product=product)
with open('build/debian/python3/debian/changelog', 'w') as f:
f.write(changelog_applied)
with open('build/debian/python3/debian/control', 'w') as f:
f.write(control_applied)