Skip to content

Commit

Permalink
extract_utils: Make --section accept a pattern
Browse files Browse the repository at this point in the history
This lets one do --section "Power-off alarm*".

Change-Id: I76e19667d2e111742ff3026c84c2bdc125aed14a
  • Loading branch information
luk1337 committed Oct 20, 2024
1 parent 41780c0 commit 5298aaa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extract_utils/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
'-s',
'--section',
action='store',
help='only apply to section',
help='only apply to section name matching pattern',
)
parser.add_argument(
'-m',
Expand Down
3 changes: 2 additions & 1 deletion extract_utils/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from __future__ import annotations

import fnmatch
import re
from enum import Enum
from os import path
Expand Down Expand Up @@ -499,7 +500,7 @@ def __add_file(self, file: File, section: str | None):
if FileArgs.SYMLINK in file.args:
self.package_symlinks.add(file)

if self.__section is None or section == self.__section:
if self.__section is None or fnmatch.fnmatch(section, self.__section):
self.files.add(file)
self.partitions.add(file.partition)
if file.has_dst:
Expand Down

0 comments on commit 5298aaa

Please sign in to comment.