Search code examples
rpmrpmbuildrpm-spec

rpm spec: is possible to automatize the creation of tar.gz archive before prep?


I want to build a rpm from git project. In this case the command

git archive

Cannot work and so I use the old method

git clone repo
tar -cvf file.tar.gz repo

If I try to build the rpm without tar.gz cannot start. So I have "split" the process in two parts One is the shell script.sh which create the archive

#!/bin/sh
GIT=https://gitproject..
NAME=gitproject
VERSION=$(date +%mY)

git clone $GIT $NAME-$VERSION
tar -cvf $NAME-$VERSION.tar.gz $NAME-$VERSION

The second is the spec

My question is..is possible to put the shell script commands in the spec(maybe I will change the syntax of variables) to obtain a total automatic .spec?


Solution

  • There are several projects which are doing this. Choose yourself:

    1. Tito (blog post) - I prefer this one.
    2. dgroc (blog post)
    3. mock-scm
    4. rpkg-util