52bd496006
Drop dependency on pystache since it nolong present in Fedora 32. To implement it, simplified debian package build process. It will be generate debian/ directory when building relocatable package, we just need to run debuild using the package. To generate debian/ directory this commit added debian_files_gen.py, it construct whole directory including control and changelog files from template files. Since we need to stop pystache, these template files swiched to string.Template class which is included python3 standard library. see: https://github.com/scylladb/scylla/pull/6313
69 lines
2.1 KiB
Python
Executable File
69 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/SCYLLA-VERSION-FILE') as f:
|
|
version = f.read().strip()
|
|
|
|
with open('build/SCYLLA-RELEASE-FILE') as f:
|
|
release = f.read().strip()
|
|
|
|
shutil.rmtree('build/debian/debian', ignore_errors=True)
|
|
shutil.copytree('dist/debian/debian', 'build/debian/debian')
|
|
|
|
if product != 'scylla':
|
|
for p in glob.glob('build/debian/debian/scylla-*'):
|
|
shutil.move(p, p.replace('scylla-', '{}-'.format(product)))
|
|
|
|
shutil.copy('dist/common/systemd/scylla-jmx.service', 'build/debian/debian/scylla-jmx.service')
|
|
|
|
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/debian/changelog', 'w') as f:
|
|
f.write(changelog_applied)
|
|
|
|
with open('build/debian/debian/control', 'w') as f:
|
|
f.write(control_applied)
|