Meego Wiki
Views

Getting started with OBS

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(Harmattan)
(OBS local build)
Line 126: Line 126:
<pre>
<pre>
osc build MeeGo_1.2_Harmattan_Maemo.org_MeeGo_1.2_Harmattan_standard  armv7el
osc build MeeGo_1.2_Harmattan_Maemo.org_MeeGo_1.2_Harmattan_standard  armv7el
 +
</pre>
 +
 +
====Possible pitfalls====
 +
'''Problem:'''
 +
<pre>
 +
failed to run command `/sbin/ldconfig': No such file or directory
 +
</pre>
 +
and
 +
<pre>
 +
chroot: failed to run command `dpkg': No such file or directory
 +
</pre>
 +
'''Solution:'''
 +
Install more Qemu related packages. :) Eq. on Ubuntu 11.04 this helps:
 +
<pre>
 +
sudo apt-get install qemu*
</pre>
</pre>

Revision as of 13:32, 10 August 2011

The MeeGo Open Build System (OBS) seems rather complicated, this page will attempt to make it nice and easy to get started. See also the Mer project's documentation on application building with OBS.

It's a work in progress, feel free to add and modify!


Contents

Prerequisites

  • You need a meego.com login to be able to access the OBS
  • Install osc (for example, apt-get install osc may work out-of-the-box on recent versions of Ubuntu & Debian, other repositories are available on openSUSE tools)
  • As an alternative to osc you may use the web interface to upload your files

Preparations

OBS is based around projects, packages and repositories. Packages have a set of files (source code, packaging meta-data, etc.) which are compiled by build servers against particular distributions. Each distribution results in your code being available in a repository.

Setting up your home project

Your home project is like a home directory in which you can create sub-projects, repositories, etc.

Creating a project

A project is required before anything can be built.

  • Go to the "Projects" tab for the project in which you wish to create it
  • Select "Add a new package"
  • Enter a UNIX-style (all lower case) "Name"
  • Enter a title-case, with appropriate spacing, "Title"
  • Enter a brief "Description"
  • Click "Save Changes"

Setting up a sub-project (optional)

A sub-project allows you to group related activities together.

  • In the "Overview" tab for your home project, select "Actions > Create subproject".

Adding repositories

  • Go to the "Repositories" tab for the project in question
  • Click "Add Repository"

As Harmattan OBS support is still in development, you can add it through the advanced interface.

Adding files to a package and building them

Needed files

MeeGo

For MeeGo you need a .spec file and a tarball containing your source code, etc.

Harmattan

For Harmattan you need a .dsc file, source tarball and .debian.tar.gz (this allows one to keep the debian directory out of the source). The source is extracted using dpkg-source -x ....dsc, so restrictions on file formats apply (e.g. mypkg_1.0.0.tar.gz, mypkg_1.0.0.dsc, mypkg_1.0.0.debian.tar.gz)

Alternatively, you may just use the .dsc together with a .tar.gz file containing both, the sources and the debian directory.

Use an additional tool

The steps below are encapsulated in a follow-up to mud-builder, called mud2. The tool only has a dependency on Perl and performs all the steps below, hoping to streamline the process of taking Qt Creator projects and producing MeeGo, Harmattan and Fremantle OBS-compatible files.

Set up QtCreator to produce files

First, you need to modify the rules file (qtc_packaging/debian_harmattan/rules, which is then copied to debian/rules):

  • Uncomment the lines marked with # Uncomment this line for use without Qt Creator.
  • In the clean section, comment the line $(MAKE) clean

Second, to get the files needed for building you may add a custom build step:

  • Projects -> Harmattan -> Build -> Build Steps -> Add Build Step
  • Enter Command: C:\QtSDK\Madde\wbin\mad.cmd
  • Leave Working directory unchanged: %{buildDir}
  • Enter Command arguments: -t harmattan-platform-api dpkg-buildpackage -sa -S -uc -us -Imoc -Iobj -Ircc -Iui -I.svn -I*.deb -I*.changes -Iqtc_packaging -IMakefile -I*.pro.user -I<packagename>

Notice that most of the command arguments remove unneccessary files from the tar package. They are not mandatory but reduce file size.

  • Build it

You will get the resulting <packagename>-<version>.tar.gz and <packagename>-<version>.dsc (together with a non-needed <packagename>-<version>.source.changes) in the directory above the source directory.

Take care: QtCreator uses the debian directory for packaging. However, it only copies the content of qtc_packaging/debian_harmattan into debian when you deploy the package (thus press run or debug). If you change something in qtc_packaging/debian_harmattan and only run a build without run/debug, you must manually copy the changes to debian before.

Security framework relevant applications: The rules file must include a step to add the <package name>.aegis manifest into the built debian archive. For this, add aegis-deb-add -control debian/<package name>/DEBIAN/control .. debian/<package name>.aegis=_aegis at the end (after dh_builddeb). Needed build dependencies in the control file are aegis-builder (>= 1.6), aegis-manifest-dev.

Start building

From the terminal

  • Checkout (like SVN) your home project, which will contain all your sub-projects and packages
 osc -A https://api.pub.meego.com co home:[username]
  • Add files to your local copy
 osc add [filename]
  • Commit the files
 osc commit

At this point the OBS will try to build your project remotely. You can also build locally by doing osc build

If you add new packages later on or commit changes from another computer you can update your local copy by doing

osc update

Using the webinterface

  • Add the correct files as listed above and they will be automatically built for you

Debugging

What to do if packages don't build in OBS.

Harmattan

It is advised to first try if a package builds in the Scratchbox based SDK before submitting it to OBS. The Scratchbox environment should be reasonably similar to OBS and lower rebuild time enables faster debugging of packaging issues.

OBS local build

It is possible to build packages locally, using the osc tool. Also unlike during the online build, it is possible to enter the build chroot and inspect its state.

  • install osc
  • install OBS build tools
  • install quemu
  • check out a project with some packages
osc co home:name:project
  • enter a package folder folder
cd /home:name:project/package
  • initiate local build
osc build

COBS+Harmattan

  • to do a local build with the Harmattan target from COBS:
osc build MeeGo_1.2_Harmattan_Maemo.org_MeeGo_1.2_Harmattan_standard  armv7el

Possible pitfalls

Problem:

failed to run command `/sbin/ldconfig': No such file or directory

and

chroot: failed to run command `dpkg': No such file or directory

Solution: Install more Qemu related packages. :) Eq. on Ubuntu 11.04 this helps:

sudo apt-get install qemu*

Installing packages

Into your MeeGo system

Main article: Zypper#Adding_a_repository

  • Once packages are built, you can include them in your MeeGo installation.
  • The general method is:
  zypper ar -f http://repo.pub.meego.com/home:/username/repository/ title
  zypper in <package>
    • Where:
    • username is your user
    • repository is the repository branch name
    • title is the name zypper will use for the repository

Into Harmattan

  1. Find the repository address:
    1. Go to the appropriate project's Overview page (e.g. your home project, or sub-project)
    2. Click on the MeeGo 1.2 Harmattan repository on the Build Status
    3. Copy the link for the Download Repository
  • Create /etc/apt/sources.list.d/project.list (where project is a memorable name, e.g. your username for your home project), containing the download link, prefixed with deb and suffixed by ./. For example:
 deb http://repo.pub.meego.com/home:/jaffa/Harmattan/ ./
  • Run:
 apt-get update
 apt-get install package
...where package is, of course, your package name.

Updates to the installed applications will appear at Settings > Applications > Manage Applications > Updates

Into Maemo 5

Enable Extras-devel.

Personal tools