Skip to content

Commit 815411a

Browse files
authored
Create directory resources in rootfs pipeline #515 (#517)
* Update test expectations Signed-off-by: Jono Yang <jyang@nexb.com>
1 parent 94d7cee commit 815411a

4 files changed

Lines changed: 265 additions & 2 deletions

File tree

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ v31.1.0 (unreleased)
3535

3636
- The ``dependencies`` field has been removed from the DiscoveredPackage model.
3737

38+
- Create directory CodebaseResources in the rootfs pipeline.
39+
https://github.com/nexB/scancode.io/issues/515
40+
3841
v31.0.0 (2022-08-25)
3942
--------------------
4043

scanpipe/pipes/rootfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def create_codebase_resources(project, rootfs):
153153
"""
154154
Creates the CodebaseResource for a `rootfs` in `project`.
155155
"""
156-
for resource in rootfs.get_resources():
156+
for resource in rootfs.get_resources(with_dir=True):
157157
pipes.make_codebase_resource(
158158
project=project,
159159
location=resource.location,

scanpipe/tests/data/basic-rootfs_root_filesystems.json

Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,32 @@
129129
],
130130
"dependencies": [],
131131
"files": [
132+
{
133+
"for_packages": [],
134+
"path": "basic-rootfs.tar.gz-extract/etc",
135+
"sha1": "",
136+
"md5": "",
137+
"extra_data": {},
138+
"copyrights": [],
139+
"holders": [],
140+
"authors": [],
141+
"licenses": [],
142+
"license_expressions": [],
143+
"emails": [],
144+
"urls": [],
145+
"status": "scanned",
146+
"tag": "",
147+
"type": "directory",
148+
"name": "etc",
149+
"extension": "",
150+
"programming_language": "",
151+
"is_binary": false,
152+
"is_text": false,
153+
"is_archive": false,
154+
"is_key_file": false,
155+
"is_media": false,
156+
"package_data": []
157+
},
132158
{
133159
"for_packages": [],
134160
"path": "basic-rootfs.tar.gz-extract/etc/os-release",
@@ -155,6 +181,110 @@
155181
"is_media": false,
156182
"package_data": []
157183
},
184+
{
185+
"for_packages": [],
186+
"path": "basic-rootfs.tar.gz-extract/usr",
187+
"sha1": "",
188+
"md5": "",
189+
"extra_data": {},
190+
"copyrights": [],
191+
"holders": [],
192+
"authors": [],
193+
"licenses": [],
194+
"license_expressions": [],
195+
"emails": [],
196+
"urls": [],
197+
"status": "scanned",
198+
"tag": "",
199+
"type": "directory",
200+
"name": "usr",
201+
"extension": "",
202+
"programming_language": "",
203+
"is_binary": false,
204+
"is_text": false,
205+
"is_archive": false,
206+
"is_key_file": false,
207+
"is_media": false,
208+
"package_data": []
209+
},
210+
{
211+
"for_packages": [],
212+
"path": "basic-rootfs.tar.gz-extract/usr/share",
213+
"sha1": "",
214+
"md5": "",
215+
"extra_data": {},
216+
"copyrights": [],
217+
"holders": [],
218+
"authors": [],
219+
"licenses": [],
220+
"license_expressions": [],
221+
"emails": [],
222+
"urls": [],
223+
"status": "scanned",
224+
"tag": "",
225+
"type": "directory",
226+
"name": "share",
227+
"extension": "",
228+
"programming_language": "",
229+
"is_binary": false,
230+
"is_text": false,
231+
"is_archive": false,
232+
"is_key_file": false,
233+
"is_media": false,
234+
"package_data": []
235+
},
236+
{
237+
"for_packages": [],
238+
"path": "basic-rootfs.tar.gz-extract/usr/share/doc",
239+
"sha1": "",
240+
"md5": "",
241+
"extra_data": {},
242+
"copyrights": [],
243+
"holders": [],
244+
"authors": [],
245+
"licenses": [],
246+
"license_expressions": [],
247+
"emails": [],
248+
"urls": [],
249+
"status": "scanned",
250+
"tag": "",
251+
"type": "directory",
252+
"name": "doc",
253+
"extension": "",
254+
"programming_language": "",
255+
"is_binary": false,
256+
"is_text": false,
257+
"is_archive": false,
258+
"is_key_file": false,
259+
"is_media": false,
260+
"package_data": []
261+
},
262+
{
263+
"for_packages": [],
264+
"path": "basic-rootfs.tar.gz-extract/usr/share/doc/libncurses5",
265+
"sha1": "",
266+
"md5": "",
267+
"extra_data": {},
268+
"copyrights": [],
269+
"holders": [],
270+
"authors": [],
271+
"licenses": [],
272+
"license_expressions": [],
273+
"emails": [],
274+
"urls": [],
275+
"status": "scanned",
276+
"tag": "",
277+
"type": "directory",
278+
"name": "libncurses5",
279+
"extension": "",
280+
"programming_language": "",
281+
"is_binary": false,
282+
"is_text": false,
283+
"is_archive": false,
284+
"is_key_file": false,
285+
"is_media": false,
286+
"package_data": []
287+
},
158288
{
159289
"for_packages": [],
160290
"path": "basic-rootfs.tar.gz-extract/usr/share/doc/libncurses5/copyright",
@@ -217,6 +347,32 @@
217347
}
218348
]
219349
},
350+
{
351+
"for_packages": [],
352+
"path": "basic-rootfs.tar.gz-extract/usr/share/doc/libndp0",
353+
"sha1": "",
354+
"md5": "",
355+
"extra_data": {},
356+
"copyrights": [],
357+
"holders": [],
358+
"authors": [],
359+
"licenses": [],
360+
"license_expressions": [],
361+
"emails": [],
362+
"urls": [],
363+
"status": "scanned",
364+
"tag": "",
365+
"type": "directory",
366+
"name": "libndp0",
367+
"extension": "",
368+
"programming_language": "",
369+
"is_binary": false,
370+
"is_text": false,
371+
"is_archive": false,
372+
"is_key_file": false,
373+
"is_media": false,
374+
"package_data": []
375+
},
220376
{
221377
"for_packages": [],
222378
"path": "basic-rootfs.tar.gz-extract/usr/share/doc/libndp0/copyright",
@@ -283,6 +439,110 @@
283439
}
284440
]
285441
},
442+
{
443+
"for_packages": [],
444+
"path": "basic-rootfs.tar.gz-extract/var",
445+
"sha1": "",
446+
"md5": "",
447+
"extra_data": {},
448+
"copyrights": [],
449+
"holders": [],
450+
"authors": [],
451+
"licenses": [],
452+
"license_expressions": [],
453+
"emails": [],
454+
"urls": [],
455+
"status": "scanned",
456+
"tag": "",
457+
"type": "directory",
458+
"name": "var",
459+
"extension": "",
460+
"programming_language": "",
461+
"is_binary": false,
462+
"is_text": false,
463+
"is_archive": false,
464+
"is_key_file": false,
465+
"is_media": false,
466+
"package_data": []
467+
},
468+
{
469+
"for_packages": [],
470+
"path": "basic-rootfs.tar.gz-extract/var/lib",
471+
"sha1": "",
472+
"md5": "",
473+
"extra_data": {},
474+
"copyrights": [],
475+
"holders": [],
476+
"authors": [],
477+
"licenses": [],
478+
"license_expressions": [],
479+
"emails": [],
480+
"urls": [],
481+
"status": "scanned",
482+
"tag": "",
483+
"type": "directory",
484+
"name": "lib",
485+
"extension": "",
486+
"programming_language": "",
487+
"is_binary": false,
488+
"is_text": false,
489+
"is_archive": false,
490+
"is_key_file": false,
491+
"is_media": false,
492+
"package_data": []
493+
},
494+
{
495+
"for_packages": [],
496+
"path": "basic-rootfs.tar.gz-extract/var/lib/dpkg",
497+
"sha1": "",
498+
"md5": "",
499+
"extra_data": {},
500+
"copyrights": [],
501+
"holders": [],
502+
"authors": [],
503+
"licenses": [],
504+
"license_expressions": [],
505+
"emails": [],
506+
"urls": [],
507+
"status": "scanned",
508+
"tag": "",
509+
"type": "directory",
510+
"name": "dpkg",
511+
"extension": "",
512+
"programming_language": "",
513+
"is_binary": false,
514+
"is_text": false,
515+
"is_archive": false,
516+
"is_key_file": false,
517+
"is_media": false,
518+
"package_data": []
519+
},
520+
{
521+
"for_packages": [],
522+
"path": "basic-rootfs.tar.gz-extract/var/lib/dpkg/info",
523+
"sha1": "",
524+
"md5": "",
525+
"extra_data": {},
526+
"copyrights": [],
527+
"holders": [],
528+
"authors": [],
529+
"licenses": [],
530+
"license_expressions": [],
531+
"emails": [],
532+
"urls": [],
533+
"status": "scanned",
534+
"tag": "",
535+
"type": "directory",
536+
"name": "info",
537+
"extension": "",
538+
"programming_language": "",
539+
"is_binary": false,
540+
"is_text": false,
541+
"is_archive": false,
542+
"is_key_file": false,
543+
"is_media": false,
544+
"package_data": []
545+
},
286546
{
287547
"for_packages": [],
288548
"path": "basic-rootfs.tar.gz-extract/var/lib/dpkg/info/libncurses5_amd64.md5sums",

scanpipe/tests/test_pipelines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def test_scanpipe_rootfs_pipeline_integration_test(self):
543543
exitcode, out = pipeline.execute()
544544
self.assertEqual(0, exitcode, msg=out)
545545

546-
self.assertEqual(6, project1.codebaseresources.count())
546+
self.assertEqual(16, project1.codebaseresources.count())
547547
self.assertEqual(2, project1.discoveredpackages.count())
548548
self.assertEqual(0, project1.discovereddependencies.count())
549549

0 commit comments

Comments
 (0)