@@ -434,6 +434,7 @@ def _parse_bindgen_command(command: str) -> list[Path]:
434434 (re .compile (r"sh (.*/)?orc_hash\.sh\b" ), _parse_orc_hash_command ),
435435 (re .compile (r"sh (.*/)?xen-hypercalls\.sh\b" ), _parse_xen_hypercalls_command ),
436436 (re .compile (r"sh (.*/)?gen_initramfs\.sh\b" ), _parse_gen_initramfs_command ),
437+ (re .compile (r"sh (.*/)?checkundef\.sh\b" ), _parse_noop ),
437438 (re .compile (r"(.*/)?vdso2c\b" ), _parse_vdso2c_command ),
438439 (re .compile (r"^(.*/)?mkpiggy.*?>" ), _parse_mkpiggy_command ),
439440 (re .compile (r"^(.*/)?relocs\b" ), _parse_relocs_command ),
@@ -489,7 +490,9 @@ def _unwrap_outer_parentheses(s: str) -> str:
489490 return _unwrap_outer_parentheses (s [1 :- 1 ])
490491
491492
492- def _find_first_top_level_semicolon_position (commands : str ) -> int | None :
493+ def _find_first_top_level_command_separator (
494+ commands : str , separators : list [str ] = [";" , "&&" ]
495+ ) -> tuple [int | None , int | None ]:
493496 in_single_quote = False
494497 in_double_quote = False
495498 in_curly_braces = 0
@@ -516,11 +519,15 @@ def _find_first_top_level_semicolon_position(commands: str) -> int | None:
516519 if char == ")" :
517520 in_braces -= 1
518521
519- elif char == ";" and in_curly_braces == 0 and in_braces == 0 :
520- # Found top level semicolon
521- return i
522+ if in_curly_braces > 0 or in_braces > 0 :
523+ continue
524+
525+ # return found separator position and separator length
526+ for separator in separators :
527+ if commands [i : i + len (separator )] == separator :
528+ return i , len (separator )
522529
523- return None
530+ return None , None
524531
525532
526533def _split_commands (commands : str ) -> list [str | IfBlock ]:
@@ -538,11 +545,11 @@ def _split_commands(commands: str) -> list[str | IfBlock]:
538545 remaining_commands = remaining_commands .removeprefix (full_matched ).lstrip ("; \n " )
539546 continue
540547
541- # command until next semicolon
542- found_semicolon_pos = _find_first_top_level_semicolon_position (remaining_commands )
543- if found_semicolon_pos is not None :
544- single_commands .append (remaining_commands [:found_semicolon_pos ].strip ())
545- remaining_commands = remaining_commands [found_semicolon_pos + 1 :].strip ()
548+ # command until next separator
549+ separator_position , separator_length = _find_first_top_level_command_separator (remaining_commands )
550+ if separator_position is not None and separator_length is not None :
551+ single_commands .append (remaining_commands [:separator_position ].strip ())
552+ remaining_commands = remaining_commands [separator_position + separator_length :].strip ()
546553 continue
547554
548555 # single last command
@@ -554,7 +561,7 @@ def _split_commands(commands: str) -> list[str | IfBlock]:
554561
555562def parse_commands (commands : str ) -> list [Path ]:
556563 """
557- Parses a collection of command line commands separated by semicolon and returns the combined input files required for these commands.
564+ Parses a collection of command line commands and returns the combined input files required for these commands.
558565
559566 Returns:
560567 input_files (list[str]): Input files of the commands.
0 commit comments