Skip to content

fix: restore '~' in pre-release deb filenames before apt push#445

Open
maqeel75 wants to merge 2 commits into
mainfrom
fix/apt-prerelease-tilde-filename
Open

fix: restore '~' in pre-release deb filenames before apt push#445
maqeel75 wants to merge 2 commits into
mainfrom
fix/apt-prerelease-tilde-filename

Conversation

@maqeel75

Copy link
Copy Markdown
Member

GitHub Releases sanitizes ~. in asset filenames on upload, so a
pre-release deb goreleaser builds as ...~rc1-1... is served from the
release as ...\.rc1-1.... reprepro pools debs under their canonical
<Package>_<Version>_<Arch>.deb name (which keeps the ~), so the
sanitized download name no longer matches the pooled name.

On a re-push of an already-published pre-release, the apt-repo-builder
moves the pooled ~ copy into its staging dir and copies the .
download alongside it. Because the names differ, the copy doesn't
replace the pooled copy, so reprepro receives two files for the same
version with different bytes and fails:

ERROR: '...~rc1-1.bookworm_amd64.deb' cannot be included ...
Already existing files can only be included again, if they are the same

Fix

After gh release download, rebuild each deb's canonical filename from
its own control metadata (Package/Version/Architecture — the same
fields reprepro uses), restoring the ~. This only reads metadata and
renames; package bytes are untouched, and it's a no-op for GA releases
(no ~).

Testing

Verified end-to-end in a debian:bookworm container:

  • Sanitized .rc1 download restored to canonical ~rc1 name
  • Package bytes unchanged (md5 identical before/after)
  • GA name already canonical → no rename
  • Full re-push simulation (pooled ~ copy + renamed download) collapses
    to one file → reprepro includedeb succeeds, no collision

Note: only affects pre-releases (rc/beta/etc.); GA releases were never impacted. No repo cleanup needed — the fix makes the next push's names match the existing pooled ~ names.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cd956482-37f8-444b-83ff-a4cf7d058471

📥 Commits

Reviewing files that changed from the base of the PR and between d6dbeb1 and f249135.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/publish.yml

📝 Walkthrough

Walkthrough

The push-apt workflow reads downloaded Debian package metadata, removes version epochs, reconstructs canonical filenames, checks for collisions, and renames assets affected by GitHub Release filename sanitization.

Changes

APT filename repair

Layer / File(s) Summary
Canonicalize downloaded Debian packages
.github/workflows/publish.yml
After downloading .deb assets, the workflow derives canonical names from package metadata, prevents conflicting renames, and updates mismatched filenames before APT organization.

Poem

I’m a rabbit hopping through the build,
Where .deb names are neatly filled.
Tildes fade and epochs flee,
Canonical names bloom free.
Reprepro smiles with glee!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, Conventional Commit style, and matches the main change of restoring canonical pre-release Debian filenames.
Description check ✅ Passed The PR includes a clear summary and testing, but it omits the template's Changes, Checklist, and Notes for Reviewers sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/apt-prerelease-tilde-filename

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

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 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 @.github/workflows/publish.yml:
- Around line 237-239: Update the renaming logic around the canonical variable
and mv command to detect when the destination canonical .deb already exists
before moving. Fail the workflow with a clear error instead of overwriting the
existing file, while preserving the no-op behavior when f already matches
canonical.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a2cdcef1-f2b2-465d-a4fb-8f5e8a2efb64

📥 Commits

Reviewing files that changed from the base of the PR and between c0ce2e8 and d6dbeb1.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml

Comment thread .github/workflows/publish.yml
@maqeel75
maqeel75 requested a review from tsivaprasad July 24, 2026 19:28
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.

1 participant