88import fnmatch
99import functools
1010import getpass
11+ import glob
1112import graphlib
1213import io
1314import itertools
@@ -1204,6 +1205,7 @@ def config_make_list_parser(
12041205 unescape : bool = False ,
12051206 reset : bool = True ,
12061207 key : Optional [Callable [[T ], Any ]] = None ,
1208+ expand_globs : bool = False ,
12071209) -> ConfigParseCallback [list [T ]]:
12081210 def config_parse_list (value : Optional [str ], old : Optional [list [T ]]) -> Optional [list [T ]]:
12091211 new = old .copy () if old else []
@@ -1228,6 +1230,9 @@ def config_parse_list(value: Optional[str], old: Optional[list[T]]) -> Optional[
12281230 if reset and len (values ) == 1 and values [0 ] == "" :
12291231 return None
12301232
1233+ if expand_globs :
1234+ values = flatten (sorted (glob .glob (v )) for v in values )
1235+
12311236 new += [parse (v ) for v in values if v ]
12321237
12331238 if key :
@@ -2694,7 +2699,7 @@ def parse_kernel_module_filter_regexp(p: str) -> str:
26942699 long = "--configure-script" ,
26952700 metavar = "PATH" ,
26962701 section = "Config" ,
2697- parse = config_make_list_parser (delimiter = "," , parse = make_path_parser ()),
2702+ parse = config_make_list_parser (delimiter = "," , parse = make_path_parser (), expand_globs = True ),
26982703 path_suffixes = ("configure" ,),
26992704 help = "Configure script to run before doing anything" ,
27002705 ),
@@ -2968,7 +2973,7 @@ def parse_kernel_module_filter_regexp(p: str) -> str:
29682973 long = "--clean-script" ,
29692974 metavar = "PATH" ,
29702975 section = "Output" ,
2971- parse = config_make_list_parser (delimiter = "," , parse = make_path_parser ()),
2976+ parse = config_make_list_parser (delimiter = "," , parse = make_path_parser (), expand_globs = True ),
29722977 path_suffixes = ("clean" ,),
29732978 recursive_path_suffixes = ("clean.d/*" ,),
29742979 help = "Clean script to run after cleanup" ,
@@ -3098,7 +3103,7 @@ def parse_kernel_module_filter_regexp(p: str) -> str:
30983103 long = "--sync-script" ,
30993104 metavar = "PATH" ,
31003105 section = "Content" ,
3101- parse = config_make_list_parser (delimiter = "," , parse = make_path_parser ()),
3106+ parse = config_make_list_parser (delimiter = "," , parse = make_path_parser (), expand_globs = True ),
31023107 path_suffixes = ("sync" ,),
31033108 recursive_path_suffixes = ("sync.d/*" ,),
31043109 help = "Sync script to run before starting the build" ,
@@ -3109,7 +3114,7 @@ def parse_kernel_module_filter_regexp(p: str) -> str:
31093114 long = "--prepare-script" ,
31103115 metavar = "PATH" ,
31113116 section = "Content" ,
3112- parse = config_make_list_parser (delimiter = "," , parse = make_path_parser ()),
3117+ parse = config_make_list_parser (delimiter = "," , parse = make_path_parser (), expand_globs = True ),
31133118 path_suffixes = ("prepare" , "prepare.chroot" ),
31143119 recursive_path_suffixes = ("prepare.d/*" ,),
31153120 help = "Prepare script to run inside the image before it is cached" ,
@@ -3121,7 +3126,7 @@ def parse_kernel_module_filter_regexp(p: str) -> str:
31213126 long = "--build-script" ,
31223127 metavar = "PATH" ,
31233128 section = "Content" ,
3124- parse = config_make_list_parser (delimiter = "," , parse = make_path_parser ()),
3129+ parse = config_make_list_parser (delimiter = "," , parse = make_path_parser (), expand_globs = True ),
31253130 path_suffixes = ("build" , "build.chroot" ),
31263131 recursive_path_suffixes = ("build.d/*" ,),
31273132 help = "Build script to run inside image" ,
@@ -3133,7 +3138,7 @@ def parse_kernel_module_filter_regexp(p: str) -> str:
31333138 metavar = "PATH" ,
31343139 name = "PostInstallationScripts" ,
31353140 section = "Content" ,
3136- parse = config_make_list_parser (delimiter = "," , parse = make_path_parser ()),
3141+ parse = config_make_list_parser (delimiter = "," , parse = make_path_parser (), expand_globs = True ),
31373142 path_suffixes = ("postinst" , "postinst.chroot" ),
31383143 recursive_path_suffixes = ("postinst.d/*" ,),
31393144 help = "Postinstall script to run inside image" ,
@@ -3144,7 +3149,7 @@ def parse_kernel_module_filter_regexp(p: str) -> str:
31443149 long = "--finalize-script" ,
31453150 metavar = "PATH" ,
31463151 section = "Content" ,
3147- parse = config_make_list_parser (delimiter = "," , parse = make_path_parser ()),
3152+ parse = config_make_list_parser (delimiter = "," , parse = make_path_parser (), expand_globs = True ),
31483153 path_suffixes = ("finalize" , "finalize.chroot" ),
31493154 recursive_path_suffixes = ("finalize.d/*" ,),
31503155 help = "Postinstall script to run outside image" ,
@@ -3156,7 +3161,7 @@ def parse_kernel_module_filter_regexp(p: str) -> str:
31563161 metavar = "PATH" ,
31573162 name = "PostOutputScripts" ,
31583163 section = "Content" ,
3159- parse = config_make_list_parser (delimiter = "," , parse = make_path_parser ()),
3164+ parse = config_make_list_parser (delimiter = "," , parse = make_path_parser (), expand_globs = True ),
31603165 path_suffixes = ("postoutput" ,),
31613166 recursive_path_suffixes = ("postoutput.d/*" ,),
31623167 help = "Output postprocessing script to run outside image" ,
0 commit comments