Mer/Build/Application Building

(First draft)
Line 28: Line 28:
This means that build dependencies will be looked for in:
This means that build dependencies will be looked for in:
-
1. Maemo:Mer:Extras:Stable
+
# Maemo:Mer:Extras:Stable
-
1. Maemo:Mer:Stable
+
# Maemo:Mer:Stable
-
1. Ubuntu_9.04
+
# Ubuntu_9.04
 +
 
 +
Once this is done, any packages uploaded to this project will build.
===Setting up Build Repositories : WWW===
===Setting up Build Repositories : WWW===
Line 63: Line 65:
Here is a full set of [[/XML_Build_Targets|XML Build targets]] for Ubuntu; they aren't needed unless you're doing something clever.
Here is a full set of [[/XML_Build_Targets|XML Build targets]] for Ubuntu; they aren't needed unless you're doing something clever.
 +
 +
==Creating Package==
 +
Each package has its own directory in the project and, by default, is built against any build targets for the project.
===Creating Package : WWW===
===Creating Package : WWW===
* Click on "Home project" in the left navigation bar in the OBS website
* Click on "Home project" in the left navigation bar in the OBS website
-
* Click on "[Create Subproject]"
+
* Click on "Add Package"
-
Fill in the values in the boxes and Create Project.
+
Fill in the values in the boxes and save changes.
===Creating Package : CLI===
===Creating Package : CLI===
Line 104: Line 109:
</pre>
</pre>
-
 
+
==Uploading Source==
-
==Uploading Source : WWW==
+
===Uploading Source : WWW===
From your Home Project, you should see a "merpad" entry under Packages.
From your Home Project, you should see a "merpad" entry under Packages.
Select merpad to go to the Package page (you may already be there if you just created it).
Select merpad to go to the Package page (you may already be there if you just created it).
-
Now  
+
Now click [Add File] and upload the tar.gz and then do it again for the dsc files.
-
 
+
===Uploading Source : CLI===
-
==Uploading Source : CLI==
+
To get a local (empty) copy make sure you're at your obs root (eg <code>~/maemo/Mer/obs</code>)
To get a local (empty) copy make sure you're at your obs root (eg <code>~/maemo/Mer/obs</code>)
Line 137: Line 141:
This will send the source and dsc to the builder and trigger a build.
This will send the source and dsc to the builder and trigger a build.
-
To watch what is going on:
+
==Monitoring the Build==
-
osc buildlog <target>
+
-
so
+
-
osc buildlog Debian_5.0 i586
+
-
 
+
-
This does something like a "tail -f" of the Xen builder.
+
-
 
+
-
=== Standalone Project ===
+
-
 
+
-
On the web, create the (sub)project maemopad.
+
-
 
+
-
In the repository section add a repository and from advanced select the Mer project: Maemo:Mer:Devel
+
-
 
+
-
Now we need to pick build targets:
+
-
  <nowiki>https://build.opensuse.org/project/add_target_simple?project=home:<username></nowiki>
+
-
 
+
-
And pick one or two ( I picked Debian Lenny and Ubuntu 8.10)
+
-
This creates a standalone project and builds against another project
+
-
 
+
-
Goto your obs base (eg /scratch3/maemo/Mer/obs) and checkout the project:
+
-
  osc co home:<username>:maemopad
+
-
 
+
-
Now create the package metadata:
+
-
  osc meta pkg -e home:<username>:maemopad maemopad
+
-
 
+
-
and get a local copy (empty still):
+
-
  cd home:<username>:maemopad/
+
-
  osc up
+
-
the 'osc up' created a directory so go into it and get the source:
+
The OBS builder will now schedule and build the application
-
  cd maemopad/
+
-
  wget <nowiki>http://repository.maemo.org/pool/maemo4.1.2/free/m/maemopad/maemopad_2.4.dsc</nowiki>
+
-
  wget <nowiki>http://repository.maemo.org/pool/maemo4.1.2/free/m/maemopad/maemopad_2.4.tar.gz</nowiki>
+
-
Use the cheap'n'cheerful 'register all file adds and removes with vc'-command:
+
===Following the build log : WWW ===
-
  osc addremove
+
In the package page under the build target is a [Build Log] entry.
 +
This takes you to a page showing the build log. There are tickboxes to refresh automatically and to autoscroll.
-
and then commit the source which uploads it to the OBS
+
===Following the build log : CLI ===
-
  osc commit -m "added source"
+
To watch what is going on on the cli:
 +
osc buildlog MerExtrasStable_MerStable_Ubuntu_9.04 armv5el
-
This will trigger a rebuild and you can access the logs.
+
This does something like a "tail -f" of the builder.
== Co-existing with Scratchbox ==
== Co-existing with Scratchbox ==

Revision as of 15:41, 4 June 2009

This page assumes you have installed OBS and setup an account.

The objective is to walk through creating a package on OBS that you can download to your Mer device using the package manager.

We will use MerPad as an example

You can follow either the CLI or www commands; if you mix them up you need to ensure you execute the commands in the right place.

Contents

To create a new package

These osc commands are done in your own area - use your username after "home:" or make sure you are at your "Home Project" on OBS.

Before you can create projects in your home project, you have to create it.

We will use

  • a name of "merpad" (lowercase); this is the package name
  • a title of "MerPad Example"; this is the human title
  • a description of: "A Mer version of Maemopad. Built on OBS by <yourname>"; this is seen upon installation

If you use the CLI interface you can also enter a url.

Configure your Home Project to Build against Mer

When you upload some source the build-dependencies need to be resolved. OBS does this by looking at a build target repository; if the dependency isn't there and that repository has its own build target repository then it looks there... and so on.

So Maemo:Mer:Stable has a build target of Ubuntu_9.04.

However, if you built against :Stable then you'd miss any community libraries in :Extras. So we will setup your home to build against :Extras:Stable

This means that build dependencies will be looked for in:

  1. Maemo:Mer:Extras:Stable
  2. Maemo:Mer:Stable
  3. Ubuntu_9.04

Once this is done, any packages uploaded to this project will build.

Setting up Build Repositories : WWW

  • Click on "Home project" in the left navigation bar in the OBS website
  • On the right click on "Add Repository"
  • At the bottom, click on "Advanced"
  • Use the name "MerExtrasStable_MerStable_Ubuntu_9.04" (this is important)
  • In the (huge!) "Build Target Selection" scrollbox, select "Maemo:Mer:Extras:Stable/MerStable_Ubuntu_9.04"
  • In the tickboxes, pick "i586" and "armv5el"
  • Click "Save Changes"

If you want to build against Mer:Testing and Mer:Devel aswell then use the XML interface to ensure you get it right.

Setting up Build Repositories : CLI

To change the build target repositories (part of the project metadata):

 osc meta prj home:lbt -e

The XML should look like this (make sure you use your own "name=" value) paying special attention to the <repository> tags:

<project name="home:yourname">
  <title>yourname's Home Project</title>
  <description>Mer is cool</description>
  <person userid="yourname" role="maintainer"/>
  <person userid="yourname" role="bugowner"/>
  <repository name="MerExtrasStable_MerStable_Ubuntu_9.04">
    <path project="Maemo:Mer:Extras:Stable" repository="MerStable_Ubuntu_9.04"/>
    <arch>armv5el</arch>
    <arch>i586</arch>
  </repository>
</project>

Here is a full set of XML Build targets for Ubuntu; they aren't needed unless you're doing something clever.

Creating Package

Each package has its own directory in the project and, by default, is built against any build targets for the project.

Creating Package : WWW

  • Click on "Home project" in the left navigation bar in the OBS website
  • Click on "Add Package"

Fill in the values in the boxes and save changes.

Creating Package : CLI

Run

osc meta pkg -e home:<username> <package>

This will tell the OBS server about the package. It pops up an editor where you can edit the name/description in XML format and then save. The XML appears like this:

<package name="merpad">
  <title>Title of New Package</title>
  <description>
LONG DESCRIPTION 
GOES 
HERE
  </description>
  <person role="maintainer" userid="lbt"/>
  <person role="bugowner" userid="lbt"/>
  <url>PUT_UPSTREAM_URL_HERE</url>
</package>

and fill it in:

<package name="merpad">

  <title>MerPad Example</title>

  <description>
A Mer version of Maemopad.
Built on OBS by David.
  </description>

  <person role="maintainer" userid="lbt"/>
  <person role="bugowner" userid="lbt"/>
  <url>PUT_UPSTREAM_URL_HERE</url>
</package>

Uploading Source

Uploading Source : WWW

From your Home Project, you should see a "merpad" entry under Packages. Select merpad to go to the Package page (you may already be there if you just created it).

Now click [Add File] and upload the tar.gz and then do it again for the dsc files.

Uploading Source : CLI

To get a local (empty) copy make sure you're at your obs root (eg ~/maemo/Mer/obs)

Then run

osc co home:<username>/merpad

(If you were already in ~/maemo/Mer/obs then co merpad would work.. beware, nothing stops you checking out a project inside a project!)

This makes a package directory so now you can:

cd home:<username>/<package>

Once there you can copy in the tarball and dsc file from your application... or in this tutorial we'll get them from the web.

wget 

Then add them to version control

osc addremove

The addremove command is a shortcut... it removes any files from OBS that are no longer in the directory and then adds any that are there. Typically you just delete old tarballs and dsc files and run osc addremove. If you prefer osc has an explicit add command.

Now they are ready to be uploaded or comitted:

osc commit

This will send the source and dsc to the builder and trigger a build.

Monitoring the Build

The OBS builder will now schedule and build the application

Following the build log : WWW

In the package page under the build target is a [Build Log] entry. This takes you to a page showing the build log. There are tickboxes to refresh automatically and to autoscroll.

Following the build log : CLI

To watch what is going on on the cli:

osc buildlog MerExtrasStable_MerStable_Ubuntu_9.04 armv5el

This does something like a "tail -f" of the builder.

Co-existing with Scratchbox

If you use the OBS local build facility and the scratchbox-1 local builder then you need to know how to teach the two emulators how to co-exist.

Both OBS and Scratchbox use binfmt_misc to cause the kernel to invoke (in our case) qemu when it comes across an armel binary.

To disable qemu and enable sbox

 echo 0 > /proc/sys/fs/binfmt_misc/arm
 echo 0 > /proc/sys/fs/binfmt_misc/armeb
 echo 1 > /proc/sys/fs/binfmt_misc/sbox-arm
 echo 1 > /proc/sys/fs/binfmt_misc/sbox-armeb

To disable sbox and enable arm

 echo 1 > /proc/sys/fs/binfmt_misc/arm
 echo 1 > /proc/sys/fs/binfmt_misc/armeb
 echo 0 > /proc/sys/fs/binfmt_misc/sbox-arm
 echo 0 > /proc/sys/fs/binfmt_misc/sbox-armeb

Don't do this whilst a build is in progress!

Note that you may need to run :

 qemu-binfmt-conf.sh

to register qemu to handle arm binaries