Osc Setup

This page describes how to setup osc to build for Mer inside the Mer SDK and a some basic osc usage.

= Introduction =

osc is a tool to interact with OBS servers. It provides many functions including:


 * Creating, modifying and deleting the information about projects and packages and downloading/uploading their source code and packaging
 * Managing the repositories/targets that projects/packages build against
 * Preparing and running local builds of packages
 * Making and managing requests to modify packages in projects (so called SRs or Submit Requests)

= Preparation =

You'll need a merproject.org account and have the Mer Platform SDK setup.

Getting Access
Just use your Mer Project username (from the Mer bugzilla)

Setup osc credentials
Once your account is enabled, run osc the first time with osc -A https://api.merproject.org ls mer-tools:devel This will ask you to enter your merproject.org user account details and will simply return a list of packages in the devel level mer-tools project.

From now on, you can omit the API URL in the command. osc ls mer-tools:devel

Create a home project
Visit https://build.merproject.org and select the "create home" option.

= Setup a Mer build project =

For any commands below the ACC environment variable should be set to your OBS username. eg:

export ACC=lbt

Adding repos to your home
You can add repositories on the OBS or edit them locally with this command which will launch an editor for you:

osc meta prj home:${ACC} -e

Use the 'lbt' home project as a guide; it has a target (ie a repository of binaries used to make a build root) for Mer_Core_i486 and looks like this:

 lbt's Home Project      i586

If you need to build for ARM too then you can add a suitable target just before the :

  armv8el

See the OBS architecture naming page for more info.

Creating projects
You may create sub-projects using the web user interface (see the 'Subprojects' tab for your home project).

These are useful for building against different targets; eg a NemoApps project may point at various Nemo build targets.

Creating packages
To create a package you could do:

osc meta pkg home:${ACC}:tools powertop -F - << EOF  PowerTOP PowerTOP is a Linux tool to diagnose issues with power consumption and power management. In addition to being a diagnostic tool, PowerTOP also has an interactive mode where you can experiment with various power management settings for cases where the Linux distribution has not enabled those settings. https://01.org/powertop/ EOF

= Tips and Tricks =

Specifying local build targets and cache location
The ~/.oscrc comments describe how these work. Some useful values are:


 * build-root : if you can set this to use an SSD it will make a big difference to local builds
 * packagecachedir : a large cache can be very useful. It's not cleaned automatically.

Using Multiple API URLs
If you're using osc with other API URLs, you can edit ~/.oscrc and add each of them and assign them aliases  user = your-merproject.org-username pass = your-merproject.org-password aliases = cobs  user = username pass = password aliases = opensuse

Note the apiurl value in that file defines the default OBS instance.

And to use the alias: osc -A mobs ls osc -A opensuse ls

Copying packages between OBS instances
It is possible (and quite handy :)) to copy packages between different OBS instances: osc -A source_api copypac -t destination_api source_prj source_pkg destination_prj [destination_pkg]

Examples:

With the above mentioned aliases: osc -A opensuse copypac -t cobs Application:Geo monav home:MartinK:nemo Just with the API URL: osc -A https://api.opensuse.org copypac -t https://api.merproject.org Application:Geo monav home:martink:nemo

NOTE: You usually need a user account on both OBS instances.