[RFC] RPM VCS tag. Building from VCS tag/branch/commit

Igor Gnatenko ignatenkobrain at fedoraproject.org
Mon Aug 3 13:50:12 UTC 2015


Hi folks,

Since 2010 we have defined VCS tag in RPM, but we're not using it
actually. No guidelines for it, nothing other. Just tag.

============
Introduction
============
Currently we are using "Source0" for "%setup" and related macroes. All
mesa builds in Fedora are done from git (master and other stable
branches) + some patches. Kernel also built on top of upstream git
tree (tags or master) + patches (from ML, backported or fedora
specific). Many of packages comes from github built from git tags.

=======
Problem
=======
Now we need to have fork of upstream repo, commit our patches, rebase
on top of needed branch/tag, do git format-patch, add those patches to
fedora repo and to spec file. If we're building from git -- git should
have webUI for downloading snapshot or we should make tarballs via
script. Apply patches if needed and etc. It all takes time and
knowledge.

In case if we want to build package from git we should follow naming
guidelines[0], and the same. Do archive, patches, etc.

========
Proposal
========
With having something like below we can simplify maintaining RPMs.
VCS: git://github.com/foo/bar.git#commit_or_tag
which will add all do we need in naming and archiving instead of
Source0: https://github.com/foo/bar/archive/commit_or_tag/%{name}-%{shortcommit}.tar.gz
and some RPM macro playing around commits and in case of
non-github/bitbucket/etc. to have shell scripts like my[1].

Probably we'd want to add some logic for picking up patches from that
repo. For example, I had to backport 10+ patches from upstream in
beignet[2]. Here I don't have ideas - allow commit sha in PatchX tags
if VCS defined? Have new tags?

Sure, usage of VCS tag is optional. You still can use Source0 instead of VCS.

rpm-side: if VCS specified -- clone, checkout, make git archive and
use generated archive as source to use/unpack

dist-git-side: we wil upload rpm-generated source

======
Syntax
======
As we don't have any guidelines/syntax for VCS tag I'd propose:
NOTE: Don't allow builds without optional mark in fedora
- scm:git:git://github.com/foo/bar.git#commit
#commit is optional for RPM itself, if it doesn't exist -- we will get
package with version 0.0.1-1.DATEgitCOMMIT%{?dist}. Or something like
this.

I've inspired by syntax from Peter's erlang package in Fedora[3].

=====
Notes
=====
When I'm talking about git -- the same could be done for hg/cvs/svn/etc.

=======
Outline
=======

Appstream-GLib
--------------
appstream-glib has reporting it in metadata[4], I've planned to use it
as filter to know is project is dead in upstream or no longer
developed.

createrepo_c
------------
createrepo_c has issue[5] about vcs tag reporting in metadata, but
nothing done due to lacks of use-cases.


[0] https://fedoraproject.org/wiki/Packaging:SourceURL#Git_Hosting_Services
[1] http://pkgs.fedoraproject.org/cgit/mesa.git/tree/Makefile
[2] http://pkgs.fedoraproject.org/cgit/beignet.git/commit/?id=49c7a3c15b9985ab3f685363aad899fa414b7215
[3] http://pkgs.fedoraproject.org/cgit/erlang.git/tree/erlang.spec#n20
[4] https://github.com/hughsie/appstream-glib/issues/27
[5] https://github.com/Tojaj/createrepo_c/pull/1
--
-Igor Gnatenko


More information about the devel mailing list