-
-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dependencies to rpm #4084
base: develop
Are you sure you want to change the base?
Add dependencies to rpm #4084
Conversation
f9c5a17
to
7b69733
Compare
@pombredanne please review this PR, also all test cases have been successfully executed and passed. |
1c0e2b1
to
9bb48db
Compare
Added dependencies to rpm. Reference: aboutcode-org#649 Signed-off-by: Alok Kumar <[email protected]> Signed-off-by: Alok Kumar <[email protected]>
9bb48db
to
e16372a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this effort. Please see comments for feedback:
- This code cannot and does not work as it is: .rpm archives and installed RPM dbs are not the same.
- There is a lot of code duplication
- A package cannot be its own dependency
- Please start by crafting proper tests first so you can set expectations with carefully reviewed cases.
@@ -135,13 +134,45 @@ def parse(cls, location, package_only=False): | |||
loc_path = Path(location) | |||
rpmdb_loc = str(loc_path.parent) | |||
|
|||
rpm_tags = get_rpm_tags(location, include_desc=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot work. By constructions, an installed RPM database is one a binary database in of these formats: ndb, bdb or sqlite. In all cases the payloads are further encoded as binaries, but the DB is NOT accessible by the rpm headers parsing code from get_rpm_tags. This code above may work, but not when parsing an installed database.
) | ||
|
||
# Prepare the dependent package model | ||
dependencies.append( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks not right at all: you are adding the package as a dependency to itself ?
@@ -253,8 +323,48 @@ class RpmInstalledSqliteDatabaseHandler(BaseRpmInstalledDatabaseHandler): | |||
description = 'RPM installed package SQLite database' | |||
documentation_url = 'https://fedoraproject.org/wiki/Changes/Sqlite_Rpmdb' | |||
|
|||
@classmethod | |||
def parse(cls, location, package_only=False): | |||
rpm_tags = get_rpm_tags(location, include_desc=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This cannot work
- If this were to work, this would be duplicated code
@@ -267,6 +377,47 @@ class RpmInstalledBdbDatabaseHandler(BaseRpmInstalledDatabaseHandler): | |||
description = 'RPM installed package BDB database' | |||
documentation_url = 'https://man7.org/linux/man-pages/man8/rpmdb.8.html' | |||
|
|||
@classmethod | |||
def parse(cls, location, package_only=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This cannot work
- If this were to work, this would be duplicated code
) | ||
|
||
# Prepare the dependent package model | ||
dependencies.append( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since when there is a single dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pombredanne Can you suggest how I proceed to find multiple dependencies, I tried by Adding RPMTAG_REQUIRES and RPMTAG_REQUIREVERSION in RPMtags in pyrpm.py but in RPMTAG_REQUIRES I got this like eg: ['/bin/sh', '/bin/sh', '/bin/sh', '/bin/sh', '/bin/sh', 'rpmlib(PayloadFilesHavePrefix)', 'rpmlib(CompressedFileNames)', 'rpmlib(PayloadIsBzip2)']
corresponding I got require_version=[None, None, None, None, None, '4.0-1', '3.0.4-1', '3.0.5-1']
source: http://ftp.rpm.org/max-rpm/ch-queryformat-tags.html (For rpm tages)
can you tell how I proceed to find out their package name and their version, in rmp_requires, these represent capabilities or libraries, not actual packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since when there is a single dependency?
I do for single dependency only.
Added dependencies to rpm.
Reference: #649
Fixes #649
Tasks
Run tests locally to check for errors.
Signed-off-by: Alok Kumar [email protected]