mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
build: sort.py: fix whitespace in entire profile (#6593)
Changes:
* Strip whitespace at the beginning
* Strip whitespace at the end
* Ensure exactly one newline at the end
* Strip extraneous newlines
Also, for clarity print the git diff in the sort.py ci job, since the
specific lines changed are not printed by the sort.py script in this
case (as whitespace is fixed in the entire profile at once).
Command used to search and replace:
./contrib/sort.py etc/inc/*.inc etc/profile*/*.profile
This is a follow-up to #6556.
Update contrib/sort.py
This commit is contained in:
parent
9bd077b39c
commit
c222b7f692
11 changed files with 13 additions and 11 deletions
4
.github/workflows/check-profiles.yml
vendored
4
.github/workflows/check-profiles.yml
vendored
|
|
@ -48,7 +48,9 @@ jobs:
|
|||
- name: sort.py
|
||||
run: >
|
||||
./ci/check/profiles/sort.py
|
||||
etc/inc/*.inc etc/{profile-a-l,profile-m-z}/*.profile
|
||||
etc/inc/*.inc etc/{profile-a-l,profile-m-z}/*.profile;
|
||||
echo;
|
||||
git diff --exit-code
|
||||
# Currently broken (see #5610)
|
||||
# - name: private-etc-always-required.sh
|
||||
# run: >
|
||||
|
|
|
|||
|
|
@ -99,11 +99,20 @@ def check_profile(filename, overwrite):
|
|||
)
|
||||
fixed_profile.append(line)
|
||||
|
||||
fixed_profile_str = "\n".join(fixed_profile)
|
||||
stripped_profile_str = fixed_profile_str.strip() + "\n"
|
||||
while "\n\n\n" in stripped_profile_str:
|
||||
stripped_profile_str = stripped_profile_str.replace("\n\n\n", "\n\n")
|
||||
|
||||
if stripped_profile_str != fixed_profile_str:
|
||||
was_fixed = True
|
||||
print(f"{filename}:(fixed whitespace)")
|
||||
|
||||
if was_fixed:
|
||||
if overwrite:
|
||||
profile.seek(0)
|
||||
profile.truncate()
|
||||
profile.write("\n".join(fixed_profile))
|
||||
profile.write(stripped_profile_str)
|
||||
profile.flush()
|
||||
print(f"[ Fixed ] {filename}")
|
||||
return 101
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ include devhelp.local
|
|||
# Persistent global definitions
|
||||
include globals.local
|
||||
|
||||
|
||||
include disable-common.inc
|
||||
include disable-devel.inc
|
||||
include disable-exec.inc
|
||||
|
|
|
|||
|
|
@ -5,6 +5,5 @@ include display-im6.q16.local
|
|||
# Persistent global definitions
|
||||
include globals.local
|
||||
|
||||
|
||||
# Redirect
|
||||
include display.profile
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ include empathy.local
|
|||
# Persistent global definitions
|
||||
include globals.local
|
||||
|
||||
|
||||
include disable-common.inc
|
||||
include disable-devel.inc
|
||||
include disable-interpreters.inc
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ include gnome-font-viewer.local
|
|||
# Persistent global definitions
|
||||
include globals.local
|
||||
|
||||
|
||||
include disable-common.inc
|
||||
include disable-devel.inc
|
||||
include disable-exec.inc
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ include gnome-recipes.local
|
|||
# Persistent global definitions
|
||||
include globals.local
|
||||
|
||||
|
||||
noblacklist ${HOME}/.cache/gnome-recipes
|
||||
noblacklist ${HOME}/.local/share/gnome-recipes
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ protocol unix,inet,inet6,netlink
|
|||
seccomp
|
||||
tracelog
|
||||
|
||||
|
||||
#private-bin godot
|
||||
private-cache
|
||||
private-dev
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ include quassel.local
|
|||
# Persistent global definitions
|
||||
include globals.local
|
||||
|
||||
|
||||
include disable-common.inc
|
||||
include disable-devel.inc
|
||||
include disable-interpreters.inc
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ include rtorrent.local
|
|||
# Persistent global definitions
|
||||
include globals.local
|
||||
|
||||
|
||||
include disable-common.inc
|
||||
include disable-devel.inc
|
||||
include disable-interpreters.inc
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ include silentarmy.local
|
|||
# Persistent global definitions
|
||||
include globals.local
|
||||
|
||||
|
||||
include disable-common.inc
|
||||
#include disable-devel.inc
|
||||
include disable-exec.inc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue