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
This commit is contained in:
Oliver Smith 2022-08-03 12:36:01 +02:00
parent c1ea04938d
commit e0c3a1ab01
1 changed files with 4 additions and 5 deletions

View File

@ -59,15 +59,14 @@ def fix_source_format(project):
if not os.path.exists(format_path): if not os.path.exists(format_path):
return return
expected = "3.0 (native)\n" expected = "3.0 (native)"
current = open(format_path, "r").read() current = open(format_path, "r").read().rstrip()
if current == expected: if current == expected:
return return
print(f"{project}: fixing debian/source/format ({current.rstrip()} =>" print(f"{project}: fixing debian/source/format ({current} => {expected})")
f" {expected.rstrip()})") open(format_path, "w").write(f"{expected}\n")
open(format_path, "w").write(expected)
def get_last_version_from_changelog(project): def get_last_version_from_changelog(project):