Verified Commit 11b60e83 authored by Antoine Fontaine's avatar Antoine Fontaine Committed by Bart Ribbers
Browse files

ci: check for executable files (MR 1257)

fix #593.
parent b4b94bdb
Pipeline #148942128 passed with stages
in 1 minute and 7 seconds
......@@ -2,6 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import glob
import os
import stat
expected_directories = [
"console",
......@@ -28,6 +29,23 @@ def test_directories():
"Consider adding it to test_directory_structure.py!"
# Ensure no file in pmaports are executable.
# see https://gitlab.com/postmarketOS/pmaports/-/issues/593.
def test_executable_files():
for file in glob.iglob("**/*", recursive=True):
if os.path.isdir(file) or os.path.islink(file):
continue
# still check other less common inode types
permissions = os.stat(file).st_mode
executable_bits = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
if permissions & executable_bits != 0:
raise RuntimeError(f"\"{file}\" is executable. Files in pmaports" +
" should not be executables. post-* files" +
" don't need to be executable and executables" +
" should be installed using `install -D" +
"m0755` or a variation thereof.")
# Make sure files are either:
# - in root directory (README.md)
# - hidden (.gitlab-ci/, device/.shared-patches/)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment