Do you have some Fedora related project? Is your output an RPM package? Yes? And do you provide user information how they can create RPM package from your git repository? Can they do that within five seconds? No? Then continue reading.
Very often I stumble upon some open source project. It is good to see open source projects. But half of the work is deployment. If user have to spend too much time on deployment or he deploy it in way you did not predict, he may give up and go away.
And I'm very sad when such deployment information is not present even for projects, which target just rpm distribution. Or even just Fedora distribution.
But there is tool, which can easy creating and releasing rpm packages. It is called TITO. Lets do quick demo:
I will assume you are already in directory with your git checkout of your project. Lets do:
sudo yum install tito
tito init
This created some files in ./rel-eng/. We will inspect it later. If your git checkout have multiple projects/packages go to that directory from which you are creating tar.gz. Otherwise stay in your git root. Make sure that there is spec file for your package. And do:
tito tag
This will bump up version in spec file; suggest you changelog from lasts commits; create commit and git tag. So it is very clear for everybody, from which commit you are building package. Read output of this command. It tells you to do something like:
git push && git push origin some-tag-1.0
If you do not want to push it to remote repository, you must add
to following commands option --offline
. Otherwise tito
checks if tags from which you are building exist in remote
repository. This is useful if you forgot to git-push and you see
those tags, but everybody else do not see it.
tito build --tgz [--offline]
This command create tar.gz file from last git tag. And do some magic on it. So it have always the same checksum. Which is not true, if you call plain git-archive.
tito build --srpm [--offline]
This command create tar.gz as in previous step and automatically create SRPM file as well. And finish this examples with:
tito build --rpm [--offline]
This command execute all previous steps in one and call rpmbuild
on that SRPM file. Which will produce binary rpm package. Tito can
even install that resulting package in one step. See man
tito
for more information.
This was set up for you upstream projects. But now assume you
are maintainer some package in Fedora. Tito can help you here as
well. Assume you have git repository where is directory
./name-of-your-package/
and it contains tag.gz file
and spec file (and optionally patches or other sources). Now again
execute:
tito init
and modify rel-eng/tito.props
so it contains:
[globalconfig]
default_builder = tito.builder.NoTgzBuilder
default_tagger = tito.tagger.ReleaseTagger
These are name of classes which modify Tito behavior to bump
release instead of Version and to not create tar.gz files. More
information can be found in man tito.props
.
Now create file rel-eng/releasers.conf
with
content:
[fedora-git-unreleased]
releaser = tito.release.FedoraGitReleaser
branches = master f20
Now you can even call:
cd ./name-of-your-package/
tito release fedora-git-unreleased
which will create tar.gz, import it in dist-git look-aside
cache. Show diff of your spec file and ask if this is ok and then
commit and push it into dist-git and call fedpkg
build
. It will do this for each specified branch. Which
lower risk that you forget on some branch. Here I gently assume
that you want to have same version of package in all
branches. Which may or may not be true. This is just to illustrate
the capability of Tito. More about releasers can be found in
man releasers.conf
.
You can combine taggers, builders and releasers as you like to satisfy your needs. And you can even write your own classes if you want to.