Skip to content

Support HTTP(S) .src.rpm and .rpm extract after wget#279

Merged
soimkim merged 3 commits into
mainfrom
rpm
May 14, 2026
Merged

Support HTTP(S) .src.rpm and .rpm extract after wget#279
soimkim merged 3 commits into
mainfrom
rpm

Conversation

@soimkim
Copy link
Copy Markdown
Contributor

@soimkim soimkim commented May 14, 2026

Description

Support HTTP(S) .src.rpm and .rpm extract after wget.
ex. https://mirror.de.leaseweb.net/fedora/updates/testing/44/Everything/source/tree/Packages/r/rust-gst-plugin-gif-0.15.0-1.fc44.src.rpm

Summary by CodeRabbit

  • New Features
    • Added support for extracting RPM and SRPM archive files with multiple extraction methods and automatic fallback options to ensure successful extraction when primary tools are unavailable.

Review Change Stack

@soimkim soimkim self-assigned this May 14, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Warning

Rate limit exceeded

@soimkim has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 54 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 63230d8c-6607-4c0a-bbe6-cbe2ec096a1e

📥 Commits

Reviewing files that changed from the base of the PR and between 18ba697 and 6b101b8.

📒 Files selected for processing (1)
  • src/fosslight_util/download.py
📝 Walkthrough

Walkthrough

This PR adds RPM/SRPM extraction support to the download utility. The compression extension collection is converted from a set to a dict, a new helper function handles RPM payload extraction with multiple fallback methods, and the main extraction flow is extended to recognize and process RPM files.

Changes

RPM/SRPM Extraction Support

Layer / File(s) Summary
Compression extension data structure
src/fosslight_util/download.py
compression_extension redefined from set to dict keyed by archive and RPM extensions, changing downstream iteration behavior.
RPM payload extraction helper
src/fosslight_util/download.py
extract_rpm_payload() unpacks RPM/SRPM cpio payloads via `rpm2cpio
RPM integration into main extraction
src/fosslight_util/download.py
extract_compressed_file() now detects .src.rpm and .rpm files (case-insensitive) and routes them through extract_rpm_payload(), updating success flags accordingly.

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main feature added: support for extracting .rpm and .src.rpm files downloaded via HTTP(S), which aligns with the core changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rpm

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@soimkim soimkim added the enhancement [PR/Issue] New feature or request label May 14, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/fosslight_util/download.py (1)

1008-1015: 💤 Low value

Collapse the two RPM branches into a single endswith tuple.

Both branches have identical bodies and only differ by the extension being matched. Consider merging them for readability.

♻️ Proposed refactor
-            elif fname.lower().endswith(".src.rpm"):
-                if not extract_rpm_payload(fname, extract_path):
-                    success = False
-                    is_compressed_file = False
-            elif fname.lower().endswith(".rpm"):
+            elif fname.lower().endswith((".src.rpm", ".rpm")):
                 if not extract_rpm_payload(fname, extract_path):
                     success = False
                     is_compressed_file = False
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_util/download.py` around lines 1008 - 1015, Both RPM branches
duplicate logic; replace the two separate elifs with a single conditional that
checks fname.lower().endswith((".src.rpm", ".rpm")) and keep the existing body
that calls extract_rpm_payload(fname, extract_path) and updates success and
is_compressed_file; ensure you reference the same variables (fname,
extract_path, success, is_compressed_file, extract_rpm_payload) so behavior
remains identical while removing the duplicated block.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fosslight_util/download.py`:
- Around line 907-942: The rpm2cpio child process (p1) can be leaked if
subprocess.run for cpio raises; wrap the subprocess.run([cpio, ...],
stdin=p1.stdout, ...) call in a try/except so that any exception (including
TimeoutExpired/OSError) will close p1.stdout (if present), kill p1 and call
p1.wait() to reap it, then log and return False; also in the existing
p1.communicate TimeoutExpired handler, after p1.kill() call p1.wait() before
returning, and ensure any code paths that inspect p1.returncode do so after
p1.wait() so the process has been reaped (references: p1, rpm2cpio,
subprocess.run call, p1.communicate, extract_compressed_file).

---

Nitpick comments:
In `@src/fosslight_util/download.py`:
- Around line 1008-1015: Both RPM branches duplicate logic; replace the two
separate elifs with a single conditional that checks
fname.lower().endswith((".src.rpm", ".rpm")) and keep the existing body that
calls extract_rpm_payload(fname, extract_path) and updates success and
is_compressed_file; ensure you reference the same variables (fname,
extract_path, success, is_compressed_file, extract_rpm_payload) so behavior
remains identical while removing the duplicated block.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4991ae1d-7468-4ac1-b4ab-22bd8b9307b3

📥 Commits

Reviewing files that changed from the base of the PR and between 9fdf1a3 and 18ba697.

📒 Files selected for processing (1)
  • src/fosslight_util/download.py

Comment thread src/fosslight_util/download.py
soimkim and others added 2 commits May 15, 2026 07:15
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@soimkim soimkim merged commit 80e9d37 into main May 14, 2026
7 of 8 checks passed
@soimkim soimkim deleted the rpm branch May 14, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement [PR/Issue] New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant