Skip to content

Commit

Permalink
sort.py: Print the fixed line when running in a CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty-snake committed Feb 13, 2021
1 parent 0f76e53 commit 19c92f2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

# Requirements:
# python >= 3.6
from os import getenv
from sys import argv


Expand Down Expand Up @@ -80,7 +81,7 @@ def fix_profile(filename):
lines = profile.read().split("\n")
was_fixed = False
fixed_profile = []
for line in lines:
for lineno, line in enumerate(lines):
if line[:12] in ("private-bin ", "private-etc ", "private-lib "):
fixed_line = f"{line[:12]}{sort_alphabetical(line[12:])}"
elif line[:13] in ("seccomp.drop ", "seccomp.keep "):
Expand All @@ -95,6 +96,8 @@ def fix_profile(filename):
fixed_line = line
if fixed_line != line:
was_fixed = True
if getenv("CI"):
print(f"{filename}:{lineno + 1}:{fixed_line}")
fixed_profile.append(fixed_line)
if was_fixed:
profile.seek(0)
Expand Down

0 comments on commit 19c92f2

Please sign in to comment.