globs = [normalize_module_glob(p) for p in include if not p.startswith("re:")]
for m in modules:
- rel = os.fspath(Path(*m.parts[5:]))
+ rel = os.fspath(m.relative_to(modulesd))
if (patterns and regex.search(rel)) or globs_match_module(normalize_module_name(rel), globs):
keep.add(rel)
remove = set()
for m in modules:
- rel = os.fspath(Path(*m.parts[5:]))
+ rel = os.fspath(m.relative_to(modulesd))
if rel not in keep and regex.search(rel):
remove.add(m)
if exclude:
logging.debug(f"Firmware exclude: {' '.join(exclude)}")
+ firmwared = Path("usr/lib/firmware")
+
# globs can be also used to exclude firmware, so we we need to apply them
# to the inherited list of firmware files too.
globs = [p for p in include if not p.startswith("re:")]
regex = re.compile("|".join(patterns))
for f in firmware:
- rel = os.fspath(Path(*f.parts[3:]))
+ rel = os.fspath(f.relative_to(firmwared))
if (patterns and regex.search(rel)) or not globs_match_firmware(rel, globs, match_default=True):
remove.add(f)
firmware -= remove
if include:
- firmwared = Path("usr/lib/firmware")
with chdir(root):
all_firmware = {p for p in firmwared.rglob("*") if p.is_file() or p.is_symlink()}
regex = re.compile("|".join(patterns))
for f in all_firmware:
- rel = os.fspath(Path(*f.parts[3:]))
+ rel = os.fspath(f.relative_to(firmwared))
if (patterns and regex.search(rel)) or globs_match_firmware(rel, globs):
firmware.add(f)