From 72bab749e5b21164c2e9c2e792bab754ab2a80f7 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 3 Aug 2022 12:36:01 +0200 Subject: obs: fix_source_format: ignore missing \n Apparently a \n at the end of debian/source/format is not required, so don't fix it if it is missing. This avoids printing this confusing line: osmo-trx: fixing debian/source/format (3.0 (native) => 3.0 (native)) Change-Id: I7f9bb22a389a2109109f7fecd3b7ae0413fe6f5b --- scripts/obs/lib/debian.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/obs/lib/debian.py b/scripts/obs/lib/debian.py index af152da..89153fb 100644 --- a/scripts/obs/lib/debian.py +++ b/scripts/obs/lib/debian.py @@ -59,15 +59,14 @@ def fix_source_format(project): if not os.path.exists(format_path): return - expected = "3.0 (native)\n" - current = open(format_path, "r").read() + expected = "3.0 (native)" + current = open(format_path, "r").read().rstrip() if current == expected: return - print(f"{project}: fixing debian/source/format ({current.rstrip()} =>" - f" {expected.rstrip()})") - open(format_path, "w").write(expected) + print(f"{project}: fixing debian/source/format ({current} => {expected})") + open(format_path, "w").write(f"{expected}\n") def get_last_version_from_changelog(project): -- cgit v1.2.3