How to build latest source from Git using OBS and source services
OBS provides source services which can download/compress/extract/verify files before actually building a package. There is only small documentation here.
You can find two interesting blog posts here and there.
Create an archive from your repository
A service called tar_scm is available to create a .tar archive from Subversion, Git, Mercurial and Bazaar source code management systems.
Here is a configuration example:
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">git://gitorious.org/meego-developer-tools/obs-light.git</param>
<param name="subdir">src</param>
<param name="filename">obslight</param>
<param name="versionprefix">0.4.git</param>
</service>
Tag significations:
- scm (required): the type of source code management system you want to get source from. Available values are svn, git, hg, bzr.
- url (required): the checkout URL of your repository.
- subdir (optional): the name of the sub-directory of your repository you want to checkout.
- filename (optional): the name of the tar file which will be created. If not specified, the last part of the URL will be used (without .git for Git repositories).
- versionprefix (optional): the base version string that will be appended to the file name.
- version (optional): the version string that will be appended to the file name. If not specified, the timestamp of the last commit is used (number of seconds since the epoch) for Git or the revision number for Subversion.
- exclude (optional): name of a file to exclude when creating the archive. Can be used multiple times.
After having created the archive, you may want to extract some files, for example the spec file of your package.
Here is an example:
<service name="extract_file">
<param name="archive">*.tar</param>
<param name="files">*/deb/* */rpm/obslight.changes */rpm/obslight.spec */rpm/obslight.yaml</param>
</service>
Tag significations:
- archive (required): name of the archive to extract files from. Bash regular expressions authorized.
- files (required): name(s) of file(s) to be extracted.
- outfilename (optional): name the extracted file will be renamed to. To be used only if you extract a single file.
Change archive compression
<service name="recompress">
<param name="file">*git*.tar</param>
<param name="compression">gz</param>
</service>
Tag significations:
- compression (required): the compression format to be used. Allowed values are none, gz, bz2, xz.
- file (required): the name of the file to be recompressed.
Update build-control files
<service name="set_version"/>