mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-28 20:27:03 +00:00
Instead of lengthy blurbs, switch to single-line, machine-readable standardized (https://spdx.dev) license identifiers. The Linux kernel switched long ago, so there is strong precedent. Three cases are handled: AGPL-only, Apache-only, and dual licensed. For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0), reasoning that our changes are extensive enough to apply our license. The changes we applied mechanically with a script, except to licenses/README.md. Closes #9937
72 lines
2.2 KiB
Python
Executable File
72 lines
2.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright (C) 2020-present ScyllaDB
|
|
#
|
|
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
#
|
|
|
|
import string
|
|
import os
|
|
import shutil
|
|
import re
|
|
from pathlib import Path
|
|
|
|
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().replace('.rc', '~rc').replace('_', '-')
|
|
|
|
with open('build/SCYLLA-RELEASE-FILE') as f:
|
|
release = f.read().strip()
|
|
|
|
if os.path.exists('build/debian/debian'):
|
|
shutil.rmtree('build/debian/debian')
|
|
shutil.copytree('dist/debian/debian', 'build/debian/debian')
|
|
|
|
if product != 'scylla':
|
|
for p in Path('build/debian/debian').glob('scylla-*'):
|
|
# pat1: scylla-server.service
|
|
# -> scylla-enterprise-server.scylla-server.service
|
|
# or
|
|
# scylla-server.default
|
|
# -> scylla-enterprise-server.scylla-server.default
|
|
# pat2: scylla-server.scylla-fstrim.service
|
|
# -> scylla-enterprise-server.scylla-fstrim.service
|
|
# pat3: scylla-conf.install
|
|
# -> scylla-enterprise-conf.install
|
|
|
|
if m := re.match(r'^scylla(-[^.]+)\.(service|default)$', p.name):
|
|
p.rename(p.parent / f'{product}{m.group(1)}.{p.name}')
|
|
elif m := re.match(r'^scylla(-[^.]+\.scylla-[^.]+\.[^.]+)$', p.name):
|
|
p.rename(p.parent / f'{product}{m.group(1)}')
|
|
else:
|
|
p.rename(p.parent / p.name.replace('scylla', product, 1))
|
|
|
|
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)
|
|
|