File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -1927,6 +1927,23 @@ def has_directory_content_fingerprint(self):
1927
1927
and ~ Q (extra_data__directory_content__in = IGNORED_DIRECTORY_FINGERPRINTS )
1928
1928
)
1929
1929
1930
+ def elfs (self ):
1931
+ """
1932
+ Resources that are ``files`` and their filetype startswith `elf` and contains any of thes
1933
+ `executable`, `relocatable`, `shared object`.
1934
+ """
1935
+ return (
1936
+ self .files ()
1937
+ .filter (
1938
+ file_type__istartswith = "elf" ,
1939
+ )
1940
+ .filter (
1941
+ Q (file_type__icontains = "executable" )
1942
+ | Q (file_type__icontains = "relocatable" )
1943
+ | Q (file_type__icontains = "shared object" )
1944
+ )
1945
+ )
1946
+
1930
1947
1931
1948
class ScanFieldsModelMixin (models .Model ):
1932
1949
"""Fields returned by the ScanCode-toolkit scans."""
Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+
3
+ from elf_inspector .dwarf import get_dwarf_paths
4
+
5
+ from scanpipe .models import CodebaseResource
6
+ from scanpipe .pipelines import Pipeline
7
+ from scanpipe .pipes import purldb
8
+ from scanpipe .pipes import scancode
9
+
10
+
11
+ class GetDwarfsFromElfs (Pipeline ):
12
+ """Get dwarfs from elfs."""
13
+
14
+ download_inputs = False
15
+ is_addon = True
16
+
17
+ @classmethod
18
+ def steps (cls ):
19
+ return (cls .get_dwarfs_from_elfs ,)
20
+
21
+ def get_dwarfs_from_elfs (self ):
22
+ """
23
+ Update ``extra_data`` of project with
24
+ dwarf data extracted from elf files.
25
+ """
26
+ for elf in self .project .codebaseresources .elfs ():
27
+ data = get_dwarf_paths (Path (self .project .codebase_path / elf .path ))
28
+ self .project .update_extra_data ({elf .path : data })
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ install_requires =
77
77
fetchcode-container ==1.2.3.210512; sys_platform == "linux"
78
78
# Inspectors
79
79
python-inspector ==0.10.0
80
+ elf-inspector ==0.0.1
80
81
aboutcode-toolkit ==10.1.0
81
82
# Utilities
82
83
XlsxWriter ==3.1.9
@@ -126,6 +127,7 @@ scancodeio_pipelines =
126
127
analyze_root_filesystem_or_vm_image = scanpipe.pipelines.root_filesystem:RootFS
127
128
analyze_windows_docker_image = scanpipe.pipelines.docker_windows:DockerWindows
128
129
find_vulnerabilities = scanpipe.pipelines.find_vulnerabilities:FindVulnerabilities
130
+ get_dwarfs_from_elfs = scanpipe.pipelines.get_dwarfs_from_elfs:GetDwarfsFromElfs
129
131
inspect_packages = scanpipe.pipelines.inspect_packages:InspectPackages
130
132
load_inventory = scanpipe.pipelines.load_inventory:LoadInventory
131
133
map_deploy_to_develop = scanpipe.pipelines.deploy_to_develop:DeployToDevelop
You can’t perform that action at this time.
0 commit comments