Skip to content

Commit

Permalink
Add etc_files log
Browse files Browse the repository at this point in the history
When a package has content in /etc, it is removed silently, this
change adds an etc_files log file in git that shows what files were in
/etc that weren't packaged.

Signed-off-by: William Douglas <[email protected]>
  • Loading branch information
bryteise committed Mar 22, 2024
1 parent 312e171 commit c02b2fe
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions autospec/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def commit_to_git(config, name, success):
call("git add profile_payload", check=False, stderr=subprocess.DEVNULL, cwd=path)
call("git add options.conf", check=False, stderr=subprocess.DEVNULL, cwd=path)
call("git add configure_misses", check=False, stderr=subprocess.DEVNULL, cwd=path)
call("git add etc_files", check=False, stderr=subprocess.DEVNULL, cwd=path)
call("git add whatrequires", check=False, stderr=subprocess.DEVNULL, cwd=path)
call("git add description", check=False, stderr=subprocess.DEVNULL, cwd=path)
call("git add attrs", check=False, stderr=subprocess.DEVNULL, cwd=path)
Expand Down
34 changes: 27 additions & 7 deletions autospec/logcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,25 @@

import os
import re
import sys

from util import print_fatal, write_out


def log_etc(lines):
"""Return the content of the START/etc ... END/etc section."""
etc = []
while True:
line = next(lines)
line = line.strip()
if line == 'END/etc':
break
if line.startswith('+'):
continue
etc.append(line)
return etc


def logcheck(pkg_loc):
"""Try to discover configuration options that were automatically switched off."""
log = os.path.join(pkg_loc, 'results', 'build.log')
Expand Down Expand Up @@ -52,7 +67,12 @@ def logcheck(pkg_loc):

pat = re.compile(r"^checking (?:for )?(.*?)\.\.\. no")
misses = []
for line in lines:
iter_lines = iter(lines)
for line in iter_lines:
if line.strip() == "START/etc":
etc = log_etc(iter_lines)
if etc:
write_log(pkg_loc, "etc_files", etc)
match = None
m = pat.search(line)
if m:
Expand All @@ -70,18 +90,18 @@ def logcheck(pkg_loc):
if match in blacklist:
print_fatal("Blacklisted configure-miss is forbidden: " + match)
misses.append("Blacklisted configure-miss is forbidden: " + match)
write_misses(pkg_loc, misses)
exit(1)
write_log(pkg_loc, 'configure_misses', misses)
sys.exit(1)

print("Configure miss: " + match)
misses.append("Configure miss: " + match)

if not misses:
return

write_misses(pkg_loc, misses)
write_log(pkg_loc, 'configure_misses', misses)


def write_misses(pkg_loc, misses):
"""Create configure_misses file with automatically disabled configuration options."""
write_out(os.path.join(pkg_loc, 'configure_misses'), '\n'.join(sorted(misses)))
def write_log(pkg_loc, fname, content):
"""Create log file with content."""
write_out(os.path.join(pkg_loc, fname), '\n'.join(sorted(content)))

0 comments on commit c02b2fe

Please sign in to comment.