Skip to content

feat(targets): add pkg-dnf target (dnf repo / Fedora COPR)#476

Open
Alexander-Sorrell-IT wants to merge 2 commits into
profullstack:masterfrom
Alexander-Sorrell-IT:feat/target-pkg-dnf
Open

feat(targets): add pkg-dnf target (dnf repo / Fedora COPR)#476
Alexander-Sorrell-IT wants to merge 2 commits into
profullstack:masterfrom
Alexander-Sorrell-IT:feat/target-pkg-dnf

Conversation

@Alexander-Sorrell-IT
Copy link
Copy Markdown

Add pkg-dnf target — dnf / RPM (Fedora COPR or self-hosted)

Implements the pkg-dnf distribution target for Fedora/RHEL-like systems, filling the README "Package managers → dnf" entry. Mirrors the pkg-apt adapter convention.

What's included

  • packages/targets/pkg-dnf/ — adapter, tests, package.json, tsconfig, README.
  • build() generates a real RPM .spec (with valid version normalization — strips v, replaces -) and a dnf .repo file (self-hosted baseurl or Fedora COPR results URL).
  • ship() is dry-run-safe and surfaces the exact rpmbuild + (copr-cli build | createrepo_c + GPG-sign) commands. Live publish throws not implemented rather than returning a false success.
  • Registered pkg-dnf in packages/cli/src/adapter-registry.ts; TARGETS.md row added (✅).
  • manualSetup covers both COPR (hosted, copr-cli) and self-hosted GPG-signed repo paths.

Tests

  • smokeTest + spec/repo generation (self-hosted + COPR variants), version normalization, and dry-run command surfacing.
  • typecheck clean; package tests pass; pnpm install --frozen-lockfile green.

No external CLI or secrets needed for build/test (dry-run only).

Adds the dnf/RPM distribution target for Fedora/RHEL-like systems.
- build() generates a real RPM .spec (valid version normalization) + a dnf .repo
  file (self-hosted or Fedora COPR baseurl).
- ship() is dry-run-safe and surfaces the exact rpmbuild + (copr-cli build |
  createrepo_c + GPG-sign) commands; live publish throws not-implemented rather
  than returning a false success.
- Register pkg-dnf in cli adapter-registry; TARGETS.md row added.
- manualSetup covers both COPR (hosted) and self-hosted GPG-signed repo paths.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

Greptile Summary

Adds the pkg-dnf distribution target adapter for Fedora/RHEL RPM packaging via either Fedora COPR or a self-hosted dnf repo, mirroring the pkg-apt adapter convention. All three issues flagged in previous review rounds (invalid %changelog format, wrong COPR gpgkey URL, and misleading secret validation before the "not implemented" throw) are resolved in this version.

  • build() generates a valid RPM .spec file with locale-independent changelog date formatting and a .repo file with correct COPR or self-hosted gpgkey URLs; the spec is explicitly a stub with # TODO sections for users to fill in %build, %install, and %files.
  • ship() is dry-run-safe and throws immediately with a clear "not implemented" error on live publish, surfacing the exact rpmbuild + copr-cli/createrepo_c commands for manual execution.
  • pkg-dnf is registered alphabetically in the adapter registry and marked ✅ in TARGETS.md.

Confidence Score: 5/5

Safe to merge; this is an additive, opt-in adapter with no live publish path yet — all operations are either file generation or dry-run only.

All three blocking issues from previous review rounds are addressed: the %changelog header now uses locale-independent date formatting, the COPR gpgkey URL correctly points to the COPR project pubkey, and secret validation is removed so ship() throws immediately. The remaining observations are minor and do not affect any currently shipped code paths.

packages/targets/pkg-dnf/src/index.ts — minor arch-field handling and status URL issues, but nothing blocking

Important Files Changed

Filename Overview
packages/targets/pkg-dnf/src/index.ts Core adapter implementing RPM spec and .repo file generation; all three previously flagged issues addressed; arch field is silently ignored for non-noarch values and status() always returns a hardcoded self-hosted URL regardless of COPR use
packages/targets/pkg-dnf/src/index.test.ts Smoke test + spec/repo generation tests for both COPR and self-hosted paths, version normalization, and dry-run; changelog format regex correctly validates the fixed header form
packages/cli/src/adapter-registry.ts Adds pkg-dnf to the alphabetically sorted adapter list correctly
packages/targets/pkg-dnf/package.json Standard package manifest following monorepo conventions; no test script (consistent with peers)

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[adapter.build] --> B[renderSpec\nrpmVersion + changelog date]
    A --> C[renderRepoFile]
    B --> D[Write myapp.spec]
    C --> E{coprProject set?}
    E -- yes --> F[baseurl: download.copr.fedorainfracloud.org\ngpgkey: COPR pubkey.gpg]
    E -- no --> G[baseurl: repoBaseUrl or dnf.sh1pt.com\ngpgkey: RPM-GPG-KEY-name]
    F --> H[Write myapp.repo]
    G --> H
    D --> I[return artifact + commands]
    H --> I
    J[adapter.ship] --> K{dryRun?}
    K -- yes --> L[return dry-run + publishCommands]
    K -- no --> M[throw not implemented]
Loading

Reviews (2): Last reviewed commit: "fix(pkg-dnf): valid RPM %changelog date,..." | Re-trigger Greptile

Comment thread packages/targets/pkg-dnf/src/index.ts
Comment thread packages/targets/pkg-dnf/src/index.ts
Comment thread packages/targets/pkg-dnf/src/index.ts Outdated
…live ship

Addresses Greptile + adversarial review:
- %changelog now emits a valid RPM header '* Wed May 29 2026 sh1pt <…> - ver-rel'
  (rpmbuild rejected the prior freeform line).
- COPR .repo gpgkey now points at the COPR project's pubkey.gpg, not the
  self-hosted fallback (GPG verify would have failed).
- ship() throws 'not implemented' immediately (no misleading secret-check first).
- Tests assert the changelog format, COPR gpgkey, and the live-throw.
@Alexander-Sorrell-IT
Copy link
Copy Markdown
Author

Thanks — addressed in the latest commit:

  • %changelog (P1): now emits a valid RPM header — * Wed May 29 2026 sh1pt <release@sh1pt.com> - <ver>-<rel> (the prior freeform line would have been rejected by rpmbuild).
  • COPR gpgkey: the .repo gpgkey now resolves to https://download.copr.fedorainfracloud.org/results/<project>/pubkey.gpg when coprProject is set, instead of the self-hosted fallback (end-user GPG verification would have failed).
  • ship(): throws not implemented immediately after the dry-run guard (dropped the misleading secret-check-first ordering).
  • Added tests for the changelog format, the COPR gpgkey, and the live-throw.

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