Skip to content
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

✨ Include version in origin field for debian packages #3426

Merged
merged 4 commits into from
Feb 28, 2024

Conversation

czunker
Copy link
Contributor

@czunker czunker commented Feb 26, 2024

Some packages contain the version information for the source package. Where we can find it, we add it.

@czunker
Copy link
Contributor Author

czunker commented Feb 26, 2024

An exmaple:

cnquery run container image samba:bookworm -c "packages.where(origin == /samba/){ name version origin originVersion }" 
→ loaded configuration from /etc/opt/mondoo/mondoo.yml using source default
packages.where.list: [
  0: {
    name: "libldb2"
    version: "2:2.6.2+samba4.17.12+dfsg-0+deb12u1"
    originVersion: "2:4.17.12+dfsg-0+deb12u1"
    origin: "samba"
  }
  1: {
    name: "python3-ldb"
    version: "2:2.6.2+samba4.17.12+dfsg-0+deb12u1"
    originVersion: "2:4.17.12+dfsg-0+deb12u1"
    origin: "samba"
  }
]

Copy link
Contributor

github-actions bot commented Feb 26, 2024

Test Results

2 806 tests  ±0   2 805 ✅ ±0   47s ⏱️ -2s
  187 suites ±0       1 💤 ±0 
    5 files   ±0       0 ❌ ±0 

Results for commit 1843f11. ± Comparison against base commit 39df8dc.

♻️ This comment has been updated with latest results.

@czunker czunker force-pushed the christian/add_source_version_dpkg branch from 1c73764 to d75c312 Compare February 26, 2024 14:30
Some packages contain the version information for the source package.
Where we can find it, we add it.

Signed-off-by: Christian Zunker <[email protected]>
@czunker czunker force-pushed the christian/add_source_version_dpkg branch from d75c312 to 357468d Compare February 26, 2024 17:47
Copy link
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comment about the MQL resource. Do we also need to adjust other operating systems that have origin support or is that just debian?

@@ -616,6 +616,9 @@ package @defaults("name version") {

// Package origin (optional)
origin() string
// Package origin version (optional)
originVersion() string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not be origin package that references another full package? We have the following options:

// dict returns name and version field
originPackage() dict

// return full package resource
originPackage() package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discuessed, I now include the version in the origin field as it is shown in dpkg output:

samba (2:4.17.12+dfsg-0+deb12u1)

@czunker
Copy link
Contributor Author

czunker commented Feb 27, 2024

I added some comment about the MQL resource. Do we also need to adjust other operating systems that have origin support or is that just debian?

I checked Alpine. That does not provide a version, only the origin name.

@czunker czunker force-pushed the christian/add_source_version_dpkg branch from 3fdeba2 to 1843f11 Compare February 28, 2024 05:07
@czunker czunker changed the title ✨ Add origin version to debian packages ✨ Include version in origin field for debian packages Feb 28, 2024
Copy link
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @czunker

providers/os/resources/packages.go Outdated Show resolved Hide resolved
providers/os/resources/os.lr Outdated Show resolved Hide resolved
providers/os/resources/packages/dpkg_packages.go Outdated Show resolved Hide resolved
czunker and others added 2 commits February 28, 2024 13:57
Signed-off-by: Christian Zunker <[email protected]>
Co-authored-by: Christoph Hartmann <[email protected]>
@czunker czunker merged commit e13883f into main Feb 28, 2024
7 checks passed
@czunker czunker deleted the christian/add_source_version_dpkg branch February 28, 2024 13:04
@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants