Text of docs.fedoraproject.org › bg › packaging-guidelines › SourceURL as Styx crawled it on Oct 10, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Referencing Source :: Fedora Docs

en-US ar ast az be bg bn ca cs de el es es_419 fa fi fil fr fur ga gl he hi hr hu hy id it ja jp ka kab km ko lo lt mr ms my nb_NO ne nl nn or pl pt pt_BR pt_PT ro ru si sk sq sv sw szl te tr tzm uk ur ur_PK uz vi zh_CN zh_Hans zh_Hant zh_TW Referencing Source One of the design goals of rpm is to cleanly separate upstream source from vendor modifications. For the Fedora packager, this means that sources used to build a package should be the vanilla sources available from upstream.

To help reviewers and QA scripts verify this, the packager needs to indicate where a reviewer can find the source that was used to make the rpm. The most common case is where upstream distributes source as a tar.gz , tar.bz2 or zip archive that we can download from an upstream website. In these cases you must use a full URL to the package in the Source: line. For example: Source: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz Source: https://ftp.gnome.org/pub/GNOME/sources/gnome-common/2.12/gnome-common-2.12.0.tar.bz2 Smallest Compressed Archive If the upstream source archive is available in multiple compressed formats that our tools can decompress, it’s best to use the one that is smallest in size.

This ensures the smallest source rpm to save space on the mirrors and downloads of source RPM packages. Using Forges (Hosted Revision Control) Any software publishing website, permitting the download of source archives via normalized URLs, that can be deduced from a project root URL and version, commit, tag, scm, extension… values is a “forge” that can be supported by the redhat-rpm-config %{forgemeta} macro. Common Forge examples are GitLab and GitHub . %{forgemeta} centralizes and abstracts our knowledge about those forges, so packagers do not have to handle download quirks manually. %{forgemeta} makes it easy to switch from release to tag to commit source archives.

Using %{forgemeta} , forge download URLs or guideline changes are propagated to spec files without manual refactoring. When those changes result in a different naming or structure of the source archive, the source file needs to be uploaded to the build system before rebuilding existing spec files. That is the main drawback of using %{forgemeta} . The following examples show how to use the Forge macros in various situations.

Release Example spectemplate-forge-release.spec # This template shows how to package a commit state using the forgemeta macro. # That should be the default target use case. # Other less common use cases are documented in separate templates. # # The project url on the forge, for example # https://gitlab.gnome.org/GNOME/gtk/ %global forgeurl # # Packaging a release requires setting Version before calling forgemeta. # Because most forges follow the git model, and git made no provision for # release objects, forgemeta will try to guess the customary way to write # release tags on the selected forge. # If it guesses wrong use the forge-tag template instead of this one.

Version: # # forgemeta converts the supplied rpm variables to variables that can be used # in the spec file. Most of those can be overriden before or after the # forgemeta call. # – use the “-i” flag to display the variables forgemeta reads and sets # – use the “-v” flag if you want verbose processing # – remove “-i” and “-v” before commit %forgemeta # The following lines use variables computed by forgemeta as default values. # You can replace them with manual definitions.

For example, replace forgeurl # with the project homepage if it exists separately from the repository URL. # Only replace the variables when it adds value to the spec file and you # understand the consequences. Release ordering is controlled by the packager # with x%{?dist}/0.x%{?dist} number chains. Name: Release: 1%{?dist} Summary: URL: %{forgeurl} Source: %{forgesource} %description %prep # forgesetup calls setup with the correct flags for archives downloaded from # the selected forge.

A forgeautosetup autosetup wrapper is also provided. If # you disagree with the computed setup/autosetup flags, just call # setup/autosetup directly. # – use the “-v” flag if you want verbose processing %forgesetup # # After this point the archive extraction is done. forgemeta is no longer used. %build %install %check %files %license %doc %changelog Tag Example spectemplate-forge-tag.spec # This template shows how to package a tag state using the forgemeta macro. # For more explanations on forgemeta, read the forgemeta-release template. # # The project url on the forge %global forgeurl # # The tag being packaged %global tag # # – use the “-i” flag to display the variables forgemeta reads and sets # – use the “-v” flag if you want verbose processing # – remove “-i” and “-v” before commit %forgemeta # The following lines use variables computed by forgemeta as default values. # You can replace them with manual definitions. # forgemeta will prepend tag information to dist.

Release ordering is # controlled by the packager with x%{?dist}/0.x%{?dist} numbers chains. Name: Version: Release: 1%{?dist} Summary: URL: %{forgeurl} Source: %{forgesource} %description %prep # – an autosetup wrapper, forgeautosetup, is also provided # – use the “-v” flag if you want verbose processing; remove it before commit # – call forgesetup/autosetup directly if you do not like the result %forgesetup # # After this point the archive extraction is done. forgemeta is no longer used. %build %install %check %files %license %doc %changelog Commit Example spectemplate-forge-commit.spec # This template shows how to package a commit state using the forgemeta macro. # For more explanations on forgemeta, read the forgemeta-release template. # # The project url on the forge %global forgeurl # # The commit being packaged (when using git, a full hash) %global commit # # – use the “-i” flag to display the variables forgemeta reads and sets # – use the “-v” flag if you want verbose processing # – remove “-i” and “-v” before commit %forgemeta # The following lines use variables computed by forgemeta as default values. # You can replace them with manual definitions. # forgemeta will prepend commit information to dist.

Release ordering is # controlled by the packager with x%{?dist}/0.x%{?dist} numbers chains. Name: Version: Release: 1%{?dist} Summary: URL: %{forgeurl} Source: %{forgesource} %description %prep # – an autosetup wrapper, forgeautosetup, is also provided # – use the “-v” flag if you want verbose processing; remove it before commit # – call forgesetup/autosetup directly if you do not like the result %forgesetup # # After this point the archive extraction is done. forgemeta is no longer used. %build %install %check %files %license %doc %changelog Branch Example spectemplate-forge-branch.spec # This template shows how to package a branch state using the forgemeta macro. # # BRANCH STATES ARE NOT REPRODUCIBLE AND SHOULD NEVER BE SHARED WITH OTHERS. # # For more explanations on forgemeta, read the forgemeta-release template. # # The project url on the forge %global forgeurl # # The branch being packaged %global branch # # – use the “-i” flag to display the variables forgemeta reads and sets # – use the “-v” flag if you want verbose processing # – remove “-i” and “-v” before commit %forgemeta # The following lines use variables computed by forgemeta as default values. # You can replace them with manual definitions. # forgemeta will prepend branch information to dist.

Release ordering is # controlled by the packager with x%{?dist}/0.x%{?dist} number chains. Name: Version: Release: 1%{?dist} Summary: URL: %{forgeurl} Source: %{forgesource} %description %prep # – an autosetup wrapper, forgeautosetup, is also provided # – use the “-v” flag if you want verbose processing; remove it before commit # – call forgesetup/autosetup directly if you do not like the result %forgesetu

The rest of this page is on the live site.