File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -1946,6 +1946,23 @@ def has_directory_content_fingerprint(self):
1946
1946
and ~ Q (extra_data__directory_content__in = IGNORED_DIRECTORY_FINGERPRINTS )
1947
1947
)
1948
1948
1949
+ def elfs (self ):
1950
+ """
1951
+ Resources that are ``files`` and their filetype startswith `elf` and contains any of thes
1952
+ `executable`, `relocatable`, `shared object`.
1953
+ """
1954
+ return (
1955
+ self .files ()
1956
+ .filter (
1957
+ file_type__istartswith = "elf" ,
1958
+ )
1959
+ .filter (
1960
+ Q (file_type__icontains = "executable" )
1961
+ | Q (file_type__icontains = "relocatable" )
1962
+ | Q (file_type__icontains = "shared object" )
1963
+ )
1964
+ )
1965
+
1949
1966
1950
1967
class ScanFieldsModelMixin (models .Model ):
1951
1968
"""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 @@ -76,7 +76,8 @@ install_requires =
76
76
# FetchCode
77
77
fetchcode-container ==1.2.3.210512; sys_platform == "linux"
78
78
# Inspectors
79
- python-inspector ==0.11.0
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
load_sbom = scanpipe.pipelines.load_sbom:LoadSBOM
You can’t perform that action at this time.
0 commit comments