diff options
author | rusty-snake <41237666+rusty-snake@users.noreply.github.com> | 2021-02-13 20:52:37 +0100 |
---|---|---|
committer | rusty-snake <41237666+rusty-snake@users.noreply.github.com> | 2021-02-14 09:04:35 +0100 |
commit | 455f75a7f45bf431b3f99493b4cb460f21407f74 (patch) | |
tree | 24b1df5d3df165ad52646ab7975d79e2900e7ccf | |
parent | sort.py: Better error message (diff) | |
download | firejail-455f75a7f45bf431b3f99493b4cb460f21407f74.tar.gz firejail-455f75a7f45bf431b3f99493b4cb460f21407f74.tar.zst firejail-455f75a7f45bf431b3f99493b4cb460f21407f74.zip |
sort.py: Print the fixed line when running in a CI
-rwxr-xr-x | contrib/sort.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/sort.py b/contrib/sort.py index 921343162..ad5e063ac 100755 --- a/contrib/sort.py +++ b/contrib/sort.py | |||
@@ -24,6 +24,7 @@ Exit-Codes: | |||
24 | 24 | ||
25 | # Requirements: | 25 | # Requirements: |
26 | # python >= 3.6 | 26 | # python >= 3.6 |
27 | from os import getenv | ||
27 | from sys import argv | 28 | from sys import argv |
28 | 29 | ||
29 | 30 | ||
@@ -80,7 +81,7 @@ def fix_profile(filename): | |||
80 | lines = profile.read().split("\n") | 81 | lines = profile.read().split("\n") |
81 | was_fixed = False | 82 | was_fixed = False |
82 | fixed_profile = [] | 83 | fixed_profile = [] |
83 | for line in lines: | 84 | for lineno, line in enumerate(lines): |
84 | if line[:12] in ("private-bin ", "private-etc ", "private-lib "): | 85 | if line[:12] in ("private-bin ", "private-etc ", "private-lib "): |
85 | fixed_line = f"{line[:12]}{sort_alphabetical(line[12:])}" | 86 | fixed_line = f"{line[:12]}{sort_alphabetical(line[12:])}" |
86 | elif line[:13] in ("seccomp.drop ", "seccomp.keep "): | 87 | elif line[:13] in ("seccomp.drop ", "seccomp.keep "): |
@@ -95,6 +96,8 @@ def fix_profile(filename): | |||
95 | fixed_line = line | 96 | fixed_line = line |
96 | if fixed_line != line: | 97 | if fixed_line != line: |
97 | was_fixed = True | 98 | was_fixed = True |
99 | if getenv("CI"): | ||
100 | print(f"{filename}:{lineno + 1}:{fixed_line}") | ||
98 | fixed_profile.append(fixed_line) | 101 | fixed_profile.append(fixed_line) |
99 | if was_fixed: | 102 | if was_fixed: |
100 | profile.seek(0) | 103 | profile.seek(0) |