Skip to content

Commit

Permalink
fix: allow fedora based packages (#3479)
Browse files Browse the repository at this point in the history
fix: allow fedora distrobutions to work and add tests

Signed-off-by: Philip Cali <[email protected]>
  • Loading branch information
philcali authored Oct 12, 2023
1 parent 26ace52 commit 1088337
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,7 @@ geckodriver.log
var
.metaflow
selenium
/dist/
/dist/

# Ignore extra rpmdb sqlite stuff
rpmdb.sqlite-*
5 changes: 2 additions & 3 deletions src/packagedcode/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,9 @@ class RpmInstalledNdbDatabaseHandler(BaseRpmInstalledDatabaseHandler):

# TODO: add dependencies!!!
class RpmInstalledSqliteDatabaseHandler(BaseRpmInstalledDatabaseHandler):
# used by newer RHEL/CentOS/Fedora
# used by newer RHEL/CentOS/Fedora/CoreOS
datasource_id = 'rpm_installed_database_sqlite'
path_patterns = ('*var/lib/rpm/rpmdb.sqlite',)
filetypes = ('berkeley',)
path_patterns = ('*rpm/rpmdb.sqlite',)
default_package_type = 'rpm'
default_package_namespace = 'TBD'
description = 'RPM installed package SQLite database'
Expand Down
2 changes: 1 addition & 1 deletion tests/packagedcode/data/plugin/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ Package type: rpm
documentation URL: https://fedoraproject.org/wiki/Changes/Sqlite_Rpmdb
primary language: None
description: RPM installed package SQLite database
path_patterns: '*var/lib/rpm/rpmdb.sqlite'
path_patterns: '*rpm/rpmdb.sqlite'
--------------------------------------------
Package type: rpm
datasource_id: rpm_spefile
Expand Down
Binary file added tests/packagedcode/data/rpm/rpmdb.sqlite
Binary file not shown.
6 changes: 6 additions & 0 deletions tests/packagedcode/test_recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,9 @@ def test_recognize_go_sum(self):
packages = recognize_package_data(test_file)
assert packages
assert isinstance(packages[0], models.PackageData)

def test_recognize_rpmdb_sqlite(self):
test_file = self.get_test_loc('rpm/rpmdb.sqlite')
packages = recognize_package_data(test_file, system=True)
assert packages
assert isinstance(packages[0], models.PackageData)

0 comments on commit 1088337

Please sign in to comment.