From e48aefdf2a0b49d7d57512e2e5c8147b4461b82d Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Wed, 4 Oct 2023 00:45:23 +0200 Subject: [PATCH] fix debian packaging and version bumping script --- debian_packaging/f.e.i.s-control | 5 ++--- debian_packaging/postinst | 11 +++++------ debian_packaging/postrm | 2 +- utils/bump_version.py | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/debian_packaging/f.e.i.s-control b/debian_packaging/f.e.i.s-control index 6c143d3..57cf747 100644 --- a/debian_packaging/f.e.i.s-control +++ b/debian_packaging/f.e.i.s-control @@ -9,9 +9,8 @@ Depends: libsfml-system2.5 (>= 2.5.1), libsfml-window2.5 (>= 2.5.1), libsfml-gra Architecture: amd64 Description: jubeat chart editor 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 /opt/f.e.i.s/bin - assets.tar.gz /opt/f.e.i.s/bin +Files: f.e.i.s /usr/bin + assets.tar.gz /tmp/f.e.i.s f.e.i.s.desktop /usr/share/applications f.e.i.s.svg /usr/share/icons/hicolor/scalable/apps Postinst: postinst diff --git a/debian_packaging/postinst b/debian_packaging/postinst index 32bbdd5..5d988dd 100644 --- a/debian_packaging/postinst +++ b/debian_packaging/postinst @@ -5,12 +5,11 @@ /usr/bin/gtk-update-icon-cache /usr/share/icons/* &>/dev/null || true # extract assets +mkdir -p /usr/share/f.e.i.s tar \ --extract \ --gzip \ - --directory /opt/f.e.i.s/bin \ - --file /opt/f.e.i.s/bin/assets.tar.gz -rm -f /opt/f.e.i.s/bin/assets.tar.gz - -mkdir -p /opt/f.e.i.s/bin/settings -chmod 777 /opt/f.e.i.s/bin/settings \ No newline at end of file + --directory /usr/share/f.e.i.s \ + --strip-components=1 \ + --file /tmp/f.e.i.s/assets.tar.gz +rm -f /tmp/f.e.i.s/assets.tar.gz \ No newline at end of file diff --git a/debian_packaging/postrm b/debian_packaging/postrm index 0f30e7c..8ba933a 100644 --- a/debian_packaging/postrm +++ b/debian_packaging/postrm @@ -5,4 +5,4 @@ /usr/bin/gtk-update-icon-cache /usr/share/icons/* &>/dev/null || true # remove extracted assets not tracked by the .deb package -rm -rf /opt/f.e.i.s/bin/assets \ No newline at end of file +rm -rf /usr/share/f.e.i.s \ No newline at end of file diff --git a/utils/bump_version.py b/utils/bump_version.py index c120453..1a697a1 100644 --- a/utils/bump_version.py +++ b/utils/bump_version.py @@ -2,6 +2,7 @@ import argparse import re import subprocess from dataclasses import dataclass +from pathlib import Path @dataclass class Version: @@ -24,11 +25,25 @@ def parse_version(text: str) -> Version: else: 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.add_argument("version", type=parse_version) args = parser.parse_args() +rewrite_debian_control_file() subprocess.check_call(["meson", "rewrite", "kwargs", "set", "project", "/", "version", str(args.version)]) subprocess.check_call(["git", "add", "meson.build"]) subprocess.check_call(["git", "commit", "-m", f"bump to v{args.version}"])