How to get .spec files from COPR?

I want to learn .spec files and 2 things:

  1. After a short look the documentation on them seems to be really basic and not complete at all. I would like to improve those docs.

  2. For COPR you need .spec files and I heard users can get them from other peoples repos, but I found no way to do that.

2 Likes

The RPM spec file can be downloaded here:

User Documentation — COPR documentation

3 Likes

There are two parts to the RPM spec, one is the format provided by RPM.
See rpm.org - Spec file format
The other is the macros that a distribution, like fedora, uses on top of the RPM base.
I’m not sure where you how the fedora macros are documented and examples are a good guide.

You can get the .spec files from the Fedora source RPM by installing the source RPM via dnf.
You can also find the git repo behind the package as well.
The same for copr builds. There is a dist-git repo that contains the spec file and patches.
For example this is for one of my copr packages: barryascott/tools/rust-sfind.git - [no description]

3 Likes

You can also download spec files from, https://src.fedoraproject.org/

2 Likes

Hello, all spec files are available here, if you want it complete :slight_smile: (edit: I fixed the link)

For copr, there’s copr download-build --help (the --spec option might help).

If you want to simply rebuild package from Fedora, no need to have spec file in hand - you may do copr build-distgit <your-project --name <pkgname> --distgit fedora.

1 Like

Is this part of the dnf copr command? I am on Kinoite where that is missing, I found a replacement for the copr enable part and could include the download of spec files in there.

The replacement link doesn’t work for me. So, I’m not sure. The copr command is part of the copr-cli rpm.

discourse also needs links with https://