Meego Wiki
Views

OBS source services

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
Line 5: Line 5:
-
== Create an archive from your repository ==
+
== Create an archive from your source code repository ==
A service called '''tar_scm''' is available to create a ''.tar'' archive from Subversion, Git, Mercurial and Bazaar source code management systems.  
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:
Here is a configuration example:
<code>
<code>
Line 28: Line 27:
-
== Extract build-control files ==
+
== Extract files from an archive ==
-
After having created the archive, you may want to extract some files, for example the spec file of your package.
+
After having created an archive with the '''tar_scm''' service, you may want to extract some files, for example the spec file of your package. The '''extract_file''' service is what you need.
Here is an example:
Here is an example:
<code>
<code>
Line 38: Line 37:
</code>
</code>
Tag significations:
Tag significations:
-
* '''archive''' (''required''): name of the archive to extract files from. Bash regular expressions authorized.  
+
* '''archive''' (''required''): name of the archive to extract files from. Bash regular expressions authorized.
* '''files''' (''required''): name(s) of file(s) to be extracted.
* '''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.
* '''outfilename''' (''optional''): name the extracted file will be renamed to. To be used only if you extract a single file.
== Change archive compression ==
== Change archive compression ==
 +
The '''recompress''' service allows you to compress or recompress an archive. Two reasons to use it: save space, and make an archive compatible with your spec file (which probably expects ''.tar.gz'' or ''.tar.bz2''). Here is an example:
<code>
<code>
  <service name="recompress">
  <service name="recompress">
-
  <param name="file">*git*.tar</param>
 
   <param name="compression">gz</param>
   <param name="compression">gz</param>
 +
  <param name="file">*git*.tar</param>
  </service>
  </service>
</code>
</code>
Tag significations:
Tag significations:
* '''compression''' (''required''): the compression format to be used. Allowed values are ''none, gz, bz2, xz''.
* '''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.
+
* '''file''' (''required''): the name of the file to be recompressed. Bash regular expressions authorized.
== Update build-control files ==
== Update build-control files ==
 +
You have just configured the '''tar_scm''' service, but the archive name is different from the one in your spec file, because the version part of the name has been incremented.
 +
The '''set_version''' service allows you to update your ''.spec'' and ''.dsc'' files with the new version of your archive.
 +
Here is a simple example:
<code>
<code>
  <service name="set_version"/>
  <service name="set_version"/>
</code>
</code>
 +
The version will be automatically guessed from ''*.tar.*'', ''*.tgz'', ''*.tbz2'' or ''*.zip'' files.
 +
 +
However there are optional parameters (syntax <code>''<param name="'''parameter_name'''">'''value'''</param>''</code>):
 +
* '''version''': specify the version, if you do not want auto-detection.
 +
* '''basename''': the prefix of files to use for version auto-detection.
 +
* '''file''': the name of the file to update. If not specified, all ''*.spec'' and ''*.dsc'' files will be updated.

Revision as of 13:50, 16 January 2012

Contents

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 source code 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.


Extract files from an archive

After having created an archive with the tar_scm service, you may want to extract some files, for example the spec file of your package. The extract_file service is what you need. 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

The recompress service allows you to compress or recompress an archive. Two reasons to use it: save space, and make an archive compatible with your spec file (which probably expects .tar.gz or .tar.bz2). Here is an example:

<service name="recompress">
  <param name="compression">gz</param>
  <param name="file">*git*.tar</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. Bash regular expressions authorized.

Update build-control files

You have just configured the tar_scm service, but the archive name is different from the one in your spec file, because the version part of the name has been incremented. The set_version service allows you to update your .spec and .dsc files with the new version of your archive. Here is a simple example:

<service name="set_version"/>

The version will be automatically guessed from *.tar.*, *.tgz, *.tbz2 or *.zip files.

However there are optional parameters (syntax <param name="parameter_name">value</param>):

  • version: specify the version, if you do not want auto-detection.
  • basename: the prefix of files to use for version auto-detection.
  • file: the name of the file to update. If not specified, all *.spec and *.dsc files will be updated.
Personal tools