@@ -1870,14 +1870,41 @@ def map_elfs(project, logger=None):
1870
1870
None
1871
1871
1872
1872
"""
1873
- map_paths (
1874
- project = project ,
1875
- file_type = "elfs" ,
1876
- collect_paths_func = get_elf_file_dwarf_paths ,
1877
- map_types = ["dwarf_compiled_paths" , "dwarf_included_paths" ],
1878
- logger = logger ,
1873
+ from_resources = project .codebaseresources .files ().from_codebase ()
1874
+ to_resources = (
1875
+ project .codebaseresources .files ().to_codebase ().has_no_relation ().elfs ()
1876
+ )
1877
+ for resource in to_resources :
1878
+ try :
1879
+ paths = get_elf_file_dwarf_paths (resource .location_path )
1880
+ resource .update_extra_data (paths )
1881
+ except Exception as e :
1882
+ logger (f"Can not parse { resource .location_path !r} { e !r} " )
1883
+
1884
+ if logger :
1885
+ logger (
1886
+ f"Mapping { to_resources .count ():,d} to/ resources using paths "
1887
+ f"with { from_resources .count ():,d} from/ resources."
1888
+ )
1889
+
1890
+ from_resources_index = pathmap .build_index (
1891
+ from_resources .values_list ("id" , "path" ), with_subpaths = True
1879
1892
)
1880
1893
1894
+ if logger :
1895
+ logger ("Done building from/ resources index." )
1896
+
1897
+ resource_iterator = to_resources .iterator (chunk_size = 2000 )
1898
+ progress = LoopProgress (to_resources .count (), logger )
1899
+ for to_resource in progress .iter (resource_iterator ):
1900
+ map_paths_resource (
1901
+ to_resource ,
1902
+ from_resources ,
1903
+ from_resources_index ,
1904
+ map_types = ["dwarf_compiled_paths" , "dwarf_included_paths" ],
1905
+ logger = logger ,
1906
+ )
1907
+
1881
1908
1882
1909
def get_elf_file_dwarf_paths (location ):
1883
1910
"""
@@ -1929,10 +1956,40 @@ def map_go_paths(project, logger=None):
1929
1956
None
1930
1957
1931
1958
"""
1932
- map_paths (
1933
- project = project ,
1934
- file_type = "executable_binaries" ,
1935
- collect_paths_func = get_go_file_paths ,
1936
- map_types = [ "go_file_paths" ],
1937
- logger = logger ,
1959
+ from_resources = project . codebaseresources . files (). from_codebase ()
1960
+ to_resources = (
1961
+ project . codebaseresources . files ()
1962
+ . to_codebase ()
1963
+ . has_no_relation ()
1964
+ . executable_binaries ()
1938
1965
)
1966
+ for resource in to_resources :
1967
+ try :
1968
+ paths = get_go_file_paths (resource .location_path )
1969
+ resource .update_extra_data (paths )
1970
+ except Exception as e :
1971
+ logger (f"Can not parse { resource .location_path !r} { e !r} " )
1972
+
1973
+ if logger :
1974
+ logger (
1975
+ f"Mapping { to_resources .count ():,d} to/ resources using paths "
1976
+ f"with { from_resources .count ():,d} from/ resources."
1977
+ )
1978
+
1979
+ from_resources_index = pathmap .build_index (
1980
+ from_resources .values_list ("id" , "path" ), with_subpaths = True
1981
+ )
1982
+
1983
+ if logger :
1984
+ logger ("Done building from/ resources index." )
1985
+
1986
+ resource_iterator = to_resources .iterator (chunk_size = 2000 )
1987
+ progress = LoopProgress (to_resources .count (), logger )
1988
+ for to_resource in progress .iter (resource_iterator ):
1989
+ map_paths_resource (
1990
+ to_resource ,
1991
+ from_resources ,
1992
+ from_resources_index ,
1993
+ map_types = ["go_file_paths" ],
1994
+ logger = logger ,
1995
+ )
0 commit comments