Skip to content

Commit 387eadc

Browse files
authored
Run the extract_archives step in ScanSinglePackage #1081 (#1083)
Signed-off-by: tdruez <tdruez@nexb.com>
1 parent 0b0fc4a commit 387eadc

File tree

5 files changed

+22
-23
lines changed

5 files changed

+22
-23
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ v33.2.0 (unreleased)
3838
unit paths when available from elfs.
3939
https://github.com/nexB/purldb/issues/260
4040

41+
- Extract all archives recursively in the `scan_single_package` pipeline.
42+
https://github.com/nexB/scancode.io/issues/1081
43+
4144
v33.1.0 (2024-02-02)
4245
--------------------
4346

scanpipe/pipelines/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,18 @@ def flag_ignored_resources(self):
248248
if ignored_patterns := self.env.get("ignored_patterns"):
249249
flag.flag_ignored_patterns(self.project, patterns=ignored_patterns)
250250

251+
def extract_archives(self):
252+
"""Extract archives located in the codebase/ directory with extractcode."""
253+
from scanpipe.pipes import scancode
254+
255+
extract_errors = scancode.extract_archives(
256+
location=self.project.codebase_path,
257+
recurse=self.env.get("extract_recursively", True),
258+
)
259+
260+
if extract_errors:
261+
self.add_error("\n".join(extract_errors))
262+
251263

252264
def is_pipeline(obj):
253265
"""

scanpipe/pipelines/deploy_to_develop.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def steps(cls):
5757
return (
5858
cls.get_inputs,
5959
cls.extract_inputs_to_codebase_directory,
60-
cls.extract_archives_in_place,
60+
cls.extract_archives,
6161
cls.collect_and_create_codebase_resources,
6262
cls.fingerprint_codebase_directories,
6363
cls.flag_empty_files,
@@ -133,16 +133,6 @@ def extract_inputs_to_codebase_directory(self):
133133
if errors:
134134
self.add_error("\n".join(errors))
135135

136-
def extract_archives_in_place(self):
137-
"""Extract recursively from* and to* archives in place with extractcode."""
138-
extract_errors = scancode.extract_archives(
139-
self.project.codebase_path,
140-
recurse=self.env.get("extract_recursively", True),
141-
)
142-
143-
if extract_errors:
144-
self.add_error("\n".join(extract_errors))
145-
146136
def collect_and_create_codebase_resources(self):
147137
"""Collect and create codebase resources."""
148138
pipes.collect_and_create_codebase_resources(self.project)

scanpipe/pipelines/scan_codebase.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,6 @@ def copy_inputs_to_codebase_directory(self):
5454
"""
5555
copy_inputs(self.project.inputs(), self.project.codebase_path)
5656

57-
def extract_archives(self):
58-
"""Extract archives with extractcode."""
59-
extract_errors = scancode.extract_archives(
60-
location=self.project.codebase_path,
61-
recurse=self.env.get("extract_recursively", True),
62-
)
63-
64-
if extract_errors:
65-
self.add_error("\n".join(extract_errors))
66-
6757
def collect_and_create_codebase_resources(self):
6858
"""Collect and create codebase resources."""
6959
pipes.collect_and_create_codebase_resources(self.project)

scanpipe/pipelines/scan_single_package.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from scanpipe.pipes import scancode
3232
from scanpipe.pipes.input import copy_input
3333
from scanpipe.pipes.input import is_archive
34-
from scanpipe.pipes.scancode import extract_archive
3534

3635

3736
class ScanSinglePackage(Pipeline):
@@ -50,6 +49,7 @@ def steps(cls):
5049
cls.get_package_input,
5150
cls.collect_input_information,
5251
cls.extract_input_to_codebase_directory,
52+
cls.extract_archives,
5353
cls.run_scan,
5454
cls.load_inventory_from_toolkit_scan,
5555
cls.make_summary_from_scan_results,
@@ -93,7 +93,11 @@ def extract_input_to_codebase_directory(self):
9393
copy_input(self.input_path, self.project.codebase_path)
9494
return
9595

96-
extract_errors = extract_archive(self.input_path, self.project.codebase_path)
96+
extract_errors = scancode.extract_archive(
97+
location=self.input_path,
98+
target=self.project.codebase_path,
99+
)
100+
97101
if extract_errors:
98102
self.add_error("\n".join(extract_errors))
99103

0 commit comments

Comments
 (0)