Skip to content

Add bump() implementation for GentooVersion - #216

Open
Adnan9-63 wants to merge 1 commit into
aboutcode-org:mainfrom
Adnan9-63:fix/gentoo-version-bump
Open

Adnan9-63 wants to merge 1 commit into
aboutcode-org:mainfrom
Adnan9-63:fix/gentoo-version-bump

Conversation

@Adnan9-63

Copy link
Copy Markdown

What this PR does / why we need it:

Implements GentooVersion.bump() to compute the branch-bump upper bound for Gentoo ebuild versions.

In Gentoo Linux Security Advisories (GLSA), unaffected package ranges are frequently expressed with revision-greater-than-equals (<unaffected range="rge">2.23.3</unaffected>). As discussed in VulnerableCode PR aboutcode-org/vulnerablecode#2090, rge denotes a revision lower bound within a release branch whose upper bound is the subsequent minor release branch (vers:ebuild/>=2.23.3|<2.24).

With this change:

  • Added gentoo.bump(ver) and GentooVersion.bump():
    • Multi-segment versions: GentooVersion("2.23.3").bump() == GentooVersion("2.24"), GentooVersion("1.0.5").bump() == GentooVersion("1.1").
    • Single-segment versions: GentooVersion("2").bump() == GentooVersion("3").
    • Revisions & suffixes: GentooVersion("2.23.3-r1").bump() == GentooVersion("2.24"), GentooVersion("1.3.8b").bump() == GentooVersion("1.4").
    • Defensive stripping for slots and wildcards.
  • Added comprehensive unit tests in tests/test_gentoo.py.

Fixes #180

Checklist:

  • Unit tests added/updated
  • Tests pass (pytest tests/test_gentoo.py)
  • Commit is signed off (git commit -s)

Implements GentooVersion.bump() to compute the branch-bump upper bound
for Gentoo ebuild versions. This is required for translating GLSA advisory
unaffected revision ranges (rge/rgt) into fixed version ranges in
VulnerableCode GentooImporter.

Closes aboutcode-org#180

Assisted-by: Antigravity
Signed-off-by: Adnan9-63 <muhammad1414114@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 09:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical active finding remains because the new implementation fails the repository’s Black style check due to two consecutive blank lines inside a function.

1 open issue

Review effort: Lite

Comment thread src/univers/gentoo.py
base = version.split("_")[0]
segments = base.split(".")


This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a bump implementation for GentooVersion

2 participants