Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a mechanism to automatically exclude Windows executables #814

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion autospec/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ def __init__(self, download_path):
"nodebug": "do not generate debuginfo for this package",
"openmpi": "configure build also for openmpi",
"server": "Package is only used by servers",
"no_glob": "Do not use the replacement pattern for file matching"
"no_glob": "Do not use the replacement pattern for file matching",
"allow_exe": "Allow Windows executables (*.exe, *.dll) to be packaged",
}
# simple_pattern_pkgconfig patterns
# contains patterns for parsing build.log for missing dependencies
Expand Down
10 changes: 10 additions & 0 deletions autospec/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@ def push_file(self, filename, pkg_name):
if self.want_dev_split and self.file_pat_match(filename, r"^/usr/.*/include/.*\.h$", "dev"):
return

# Exclude Windows executables and DLLs unless otherwise configured
# Can't just skip them because they could be swept up in a python lib wildcard, for example
if re.search(r"[^/]+\.(exe|dll)$", filename):
if self.config.config_opts.get('allow_exe'):
util.print_warning("Allowing {} because allow_exe is true".format(filename))
else:
util.print_warning("Blocking {} because allow_exe is false".format(filename))
self.excludes.append(filename)
return

# if configured to do so, add .so files to the lib package instead of
# the dev package. THis is useful for packages with a plugin
# architecture like elfutils and mesa.
Expand Down