fix debian packaging and version bumping script

This commit is contained in:
Stepland 2023-10-04 00:45:23 +02:00
parent 1302543400
commit e48aefdf2a
4 changed files with 23 additions and 10 deletions

View File

@ -9,9 +9,8 @@ Depends: libsfml-system2.5 (>= 2.5.1), libsfml-window2.5 (>= 2.5.1), libsfml-gra
Architecture: amd64 Architecture: amd64
Description: jubeat chart editor Description: jubeat chart editor
F.E.I.S is a GUI chart editor for jubeat and its simulators, inspired by ArrowVortex F.E.I.S is a GUI chart editor for jubeat and its simulators, inspired by ArrowVortex
Links: /opt/f.e.i.s/bin/f.e.i.s /usr/bin/f.e.i.s Files: f.e.i.s /usr/bin
Files: f.e.i.s /opt/f.e.i.s/bin assets.tar.gz /tmp/f.e.i.s
assets.tar.gz /opt/f.e.i.s/bin
f.e.i.s.desktop /usr/share/applications f.e.i.s.desktop /usr/share/applications
f.e.i.s.svg /usr/share/icons/hicolor/scalable/apps f.e.i.s.svg /usr/share/icons/hicolor/scalable/apps
Postinst: postinst Postinst: postinst

View File

@ -5,12 +5,11 @@
/usr/bin/gtk-update-icon-cache /usr/share/icons/* &>/dev/null || true /usr/bin/gtk-update-icon-cache /usr/share/icons/* &>/dev/null || true
# extract assets # extract assets
mkdir -p /usr/share/f.e.i.s
tar \ tar \
--extract \ --extract \
--gzip \ --gzip \
--directory /opt/f.e.i.s/bin \ --directory /usr/share/f.e.i.s \
--file /opt/f.e.i.s/bin/assets.tar.gz --strip-components=1 \
rm -f /opt/f.e.i.s/bin/assets.tar.gz --file /tmp/f.e.i.s/assets.tar.gz
rm -f /tmp/f.e.i.s/assets.tar.gz
mkdir -p /opt/f.e.i.s/bin/settings
chmod 777 /opt/f.e.i.s/bin/settings

View File

@ -5,4 +5,4 @@
/usr/bin/gtk-update-icon-cache /usr/share/icons/* &>/dev/null || true /usr/bin/gtk-update-icon-cache /usr/share/icons/* &>/dev/null || true
# remove extracted assets not tracked by the .deb package # remove extracted assets not tracked by the .deb package
rm -rf /opt/f.e.i.s/bin/assets rm -rf /usr/share/f.e.i.s

View File

@ -2,6 +2,7 @@ import argparse
import re import re
import subprocess import subprocess
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path
@dataclass @dataclass
class Version: class Version:
@ -24,11 +25,25 @@ def parse_version(text: str) -> Version:
else: else:
raise ValueError(f"Couldn't parse {text} as a version number") raise ValueError(f"Couldn't parse {text} as a version number")
def rewrite_debian_control_file():
path = Path(__file__).parents[1] / "debian_packaging/f.e.i.s-control"
with path.open(mode="r+") as f:
debian_control_lines = f.readlines()
for i in range(len(debian_control_lines)):
line = debian_control_lines[i]
if line.startswith("Version:"):
debian_control_lines[i] = f"Version: {args.version}\n"
f.truncate(0)
f.seek(0)
f.writelines(debian_control_lines)
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("version", type=parse_version) parser.add_argument("version", type=parse_version)
args = parser.parse_args() args = parser.parse_args()
rewrite_debian_control_file()
subprocess.check_call(["meson", "rewrite", "kwargs", "set", "project", "/", "version", str(args.version)]) subprocess.check_call(["meson", "rewrite", "kwargs", "set", "project", "/", "version", str(args.version)])
subprocess.check_call(["git", "add", "meson.build"]) subprocess.check_call(["git", "add", "meson.build"])
subprocess.check_call(["git", "commit", "-m", f"bump to v{args.version}"]) subprocess.check_call(["git", "commit", "-m", f"bump to v{args.version}"])