mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	scripts/get_abi.pl: Add filtering capabilities to rest output
This way, Sphinx ABI extension can parse symbols only once, while keep displaying results in separate files. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/41e108e816e46434aa596e5c0d25d227cb9f0fe5.1739182025.git.mchehab+huawei@kernel.org
This commit is contained in:
		
							parent
							
								
									cc93e4829a
								
							
						
					
					
						commit
						2a21d80dfb
					
				
					 1 changed files with 15 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -160,6 +160,7 @@ class AbiParser:
 | 
			
		|||
                        self.data[fdata.key] = {
 | 
			
		||||
                            "what": [content],
 | 
			
		||||
                            "file": [fdata.file_ref],
 | 
			
		||||
                            "path": fdata.ftype,
 | 
			
		||||
                            "line_no": fdata.ln,
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -182,8 +183,6 @@ class AbiParser:
 | 
			
		|||
                if new_what:
 | 
			
		||||
                    fdata.label = ""
 | 
			
		||||
 | 
			
		||||
                    self.data[fdata.key]["type"] = fdata.ftype
 | 
			
		||||
 | 
			
		||||
                    if "description" in self.data[fdata.key]:
 | 
			
		||||
                        self.data[fdata.key]["description"] += "\n\n"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -299,6 +298,7 @@ class AbiParser:
 | 
			
		|||
        fdata.nametag = {}
 | 
			
		||||
        fdata.nametag["what"] = [f"File {path}/{basename}"]
 | 
			
		||||
        fdata.nametag["type"] = "File"
 | 
			
		||||
        fdata.nametag["path"] = fdata.ftype
 | 
			
		||||
        fdata.nametag["file"] = [fdata.file_ref]
 | 
			
		||||
        fdata.nametag["line_no"] = 1
 | 
			
		||||
        fdata.nametag["description"] = ""
 | 
			
		||||
| 
						 | 
				
			
			@ -427,7 +427,8 @@ class AbiParser:
 | 
			
		|||
 | 
			
		||||
        return new_desc + "\n\n"
 | 
			
		||||
 | 
			
		||||
    def doc(self, output_in_txt=False, show_file=True):
 | 
			
		||||
    def doc(self, output_in_txt=False, show_symbols=True, show_file=True,
 | 
			
		||||
            filter_path=None):
 | 
			
		||||
        """Print ABI at stdout"""
 | 
			
		||||
 | 
			
		||||
        part = None
 | 
			
		||||
| 
						 | 
				
			
			@ -435,12 +436,20 @@ class AbiParser:
 | 
			
		|||
                             key=lambda x: (x[1].get("type", ""),
 | 
			
		||||
                                            x[1].get("what"))):
 | 
			
		||||
 | 
			
		||||
            wtype = v.get("type", "Var")
 | 
			
		||||
            wtype = v.get("type", "Symbol")
 | 
			
		||||
            file_ref = v.get("file")
 | 
			
		||||
            names = v.get("what", [""])
 | 
			
		||||
 | 
			
		||||
            if not show_file and wtype == "File":
 | 
			
		||||
                continue
 | 
			
		||||
            if wtype == "File":
 | 
			
		||||
                if not show_file:
 | 
			
		||||
                    continue
 | 
			
		||||
            else:
 | 
			
		||||
                if not show_symbols:
 | 
			
		||||
                    continue
 | 
			
		||||
 | 
			
		||||
            if filter_path:
 | 
			
		||||
                if v.get("path") != filter_path:
 | 
			
		||||
                    continue
 | 
			
		||||
 | 
			
		||||
            msg = ""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue