Skip to content

Publish dfetch to Fedora COPR (dnf install dfetch) #1320

Description

@spoorcc

Goal

Make dfetch installable via dnf on Fedora (and compatible distros such as RHEL, CentOS Stream, openSUSE) by publishing to a COPR project.

Background

dfetch already builds a self-contained binary via Nuitka and produces an .rpm in CI (build.yml via fpm). COPR is the standard community hosting for RPM packages outside the official Fedora repos. Users would install with:

dnf copr enable dfetch-org/dfetch
dnf install dfetch

Suggested plan

1. Write packaging/dfetch.spec

COPR builds from a source RPM (srpm), which requires a .spec file. Since dfetch is a pre-built binary (Nuitka), the spec wraps the binary rather than compiling from source:

Name:           dfetch
Version:        0.14.2
Release:        1%{?dist}
Summary:        Vendor tool for fetching external dependencies
License:        MIT
URL:            https://github.com/dfetch-org/dfetch
Source0:        https://github.com/dfetch-org/dfetch/releases/download/%{version}/dfetch-%{version}-nix.tar.gz

ExclusiveArch:  x86_64

%description
dfetch fetches external dependencies and copies them directly into
your project as plain filesno submodules, no externals.

%prep
%setup -q -c

%install
install -Dm755 dfetch %{buildroot}%{_bindir}/dfetch

%files
%{_bindir}/dfetch

%changelog
* Fri Jun 27 2025 dfetch-org <bot@dfetch.dev> - 0.14.2-1
- Initial COPR packaging

2. Create a COPR project

  • Go to https://copr.fedorainfracloud.org/ and create project dfetch-org/dfetch.
  • Select the chroots to build for: fedora-rawhide-x86_64, fedora-41-x86_64, fedora-42-x86_64, epel-9-x86_64.
  • Enable "follow Fedora branching" so new Fedora versions are auto-enabled.

3. Generate an API token

  • COPR → Account → API → generate token.
  • Store it as COPR_API_TOKEN in a GitHub copr environment secret.

4. Add copr-publish.yml workflow

name: Publish to COPR

on:
  release:
    types: [published]
  workflow_dispatch:
    inputs:
      release-tag:
        description: 'Release tag (e.g. 0.14.2)'
        required: true

jobs:
  publish:
    if: >-
      github.event_name != 'release' ||
      github.event.release.tag_name != 'latest'
    runs-on: ubuntu-latest
    environment:
      name: copr
      url: https://copr.fedorainfracloud.org/coprs/dfetch-org/dfetch

    steps:
      - uses: actions/checkout@...

      - name: Install build tools
        run: sudo apt-get install -y rpm rpmbuild copr-cli

      - name: Build source RPM
        env:
          TAG: ${{ github.event.release.tag_name || inputs.release-tag }}
        run: |
          sed -i "s/^Version:.*/Version: ${TAG}/" packaging/dfetch.spec
          spectool -g -R packaging/dfetch.spec
          rpmbuild -bs packaging/dfetch.spec \
            --define "_sourcedir $HOME/rpmbuild/SOURCES" \
            --define "_srcrpmdir dist/"

      - name: Submit to COPR
        env:
          COPR_TOKEN: ${{ secrets.COPR_API_TOKEN }}
        run: |
          copr-cli --config <(echo -e "[copr-cli]\nlogin=...\nusername=dfetch-org\ntoken=${COPR_TOKEN}\ncopr_url=https://copr.fedorainfracloud.org") \
            build dfetch-org/dfetch dist/*.src.rpm

Alternatively use the copr-build GitHub Action to avoid shelling out copr-cli directly.

5. Verify the build

Once the first COPR build succeeds, test on a Fedora container:

docker run --rm -it fedora:latest bash
dnf copr enable dfetch-org/dfetch
dnf install -y dfetch
dfetch --version

Acceptance criteria

  • dnf copr enable dfetch-org/dfetch && dnf install dfetch works on Fedora 41+
  • COPR package version is updated automatically on each GitHub Release
  • Builds are triggered for at least fedora-41-x86_64 and fedora-42-x86_64 chroots
  • The workflow is skipped for the rolling latest tag

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions