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):
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):