Skip to content

Commit

Permalink
Update datafile handlers for debian
Browse files Browse the repository at this point in the history
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
  • Loading branch information
AyanSinhaMahapatra committed Feb 27, 2024
1 parent 9d466d3 commit cf1bf06
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
10 changes: 2 additions & 8 deletions src/packagedcode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from packagedcode import godeps
from packagedcode import golang
from packagedcode import haxe
from packagedcode import jar_manifest
from packagedcode import maven
from packagedcode import misc
from packagedcode import npm
Expand Down Expand Up @@ -84,6 +83,7 @@
cran.CranDescriptionFileHandler,

debian_copyright.DebianCopyrightFileInPackageHandler,
debian_copyright.StandaloneDebianCopyrightFileHandler,
debian.DebianDscFileHandler,

debian.DebianControlFileInExtractedDebHandler,
Expand Down Expand Up @@ -216,13 +216,7 @@

debian.DebianInstalledFilelistHandler,
debian.DebianInstalledMd5sumFilelistHandler,
debian.DebianInstalledStatusDatabaseHandler,
debian.DebianControlFileInSourceHandler,
debian.DebianDscFileHandler,
debian.DebianSourcePackageTarballHandler,
debian.DebianSourcePackageMetadataTarballHandler,
debian.DebianDebPackageHandler,
debian_copyright.StandaloneDebianCopyrightFileHandler
debian.DebianInstalledStatusDatabaseHandler
]

if on_linux:
Expand Down
29 changes: 15 additions & 14 deletions tests/packagedcode/test_debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,6 @@ def test_can_get_installed_system_packages_with_license_from_debian_container_la
results = list(get_installed_packages(test_dir))
self.check_packages_data(results, expected_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES)

def test_parse_control_file_basic(self):
test_dir = self.get_test_loc('debian/control')
expected_file = self.get_test_loc('debian/control.expected.json')
result_file = self.get_temp_file('results.json')
run_scan_click(['--system-package', test_dir, '--json-pp', result_file])
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)

def test_parse_dsc_file_basic(self):
test_dir = self.get_test_loc('debian/dsc_files/adduser_3.118+deb11u1.dsc')
expected_file = self.get_test_loc('debian/dsc_files/adduser_3.118+deb11u1.dsc.expected.json')
result_file = self.get_temp_file('results.json')
run_scan_click(['--system-package', test_dir, '--json-pp', result_file])
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)


class TestDebian(PackageTester):
test_data_dir = os.path.join(os.path.dirname(__file__), 'data')
Expand Down Expand Up @@ -111,6 +97,21 @@ def test_scan_system_package_end_to_end_installed_ubuntu_with_missing_md5sums(se
run_scan_click(['--system-package', test_dir, '--json-pp', result_file])
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)

def test_parse_control_file_basic(self):
test_dir = self.get_test_loc('debian/control')
expected_file = self.get_test_loc('debian/control.expected.json')
result_file = self.get_temp_file('results.json')
run_scan_click(['--package', test_dir, '--json-pp', result_file])
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)

def test_parse_dsc_file_basic(self):
test_dir = self.get_test_loc('debian/dsc_files/adduser_3.118+deb11u1.dsc')
expected_file = self.get_test_loc('debian/dsc_files/adduser_3.118+deb11u1.dsc.expected.json')
result_file = self.get_temp_file('results.json')
run_scan_click(['--package', test_dir, '--json-pp', result_file])
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)



class TestDebianGetListOfInstalledFiles(PackageTester):
test_data_dir = os.path.join(os.path.dirname(__file__), 'data')
Expand Down

0 comments on commit cf1bf06

Please sign in to comment.