Meego Wiki
Views

Build Infrastructure/Packagers Developers/CLI Part 1

From MeeGo wiki
Jump to: navigation, search

Contents

How to use the MeeGo / OBS Command Line Tools

The command line tool `osc' can be used to access OBS services. The following content will show you how to install and configure it. Once you've successfully setuped the OBS command line tool, the next part will show you how to check out packages from the MeeGo project/package for local modification and building.

OSC Installation

You will need to install some tools in order to access and build packages. This includes the command line client 'osc', and packages that it relies on.

The easiest method is to use your distribution's package manager to pull the osc package and its requirements. Package repositories for many distributions are available here.

For example, with Fedora 12:
 # cd /etc/yum.repos.d
 # wget http://repo.meego.com/MeeGo/tools/repos/fedora/12/meego-tools.repo
 # yum install osc

The upstream OBS Tutorial describes more generalities about using the tools.

Configuring OSC using $HOME/.oscrc

OSC should be customized using the file $HOME/.oscrc for OBS service apiurl and the account settings. When you run osc for the first time, the osc itself will create one for you with several questions. And the following is a stripped sample oscrc:

[general]
apiurl = https://api.meego.com

packagecachedir = /var/obs-tmp/osbuild-packagecache
build-root = /var/obs-tmp/build-root

debug = 0
http_debug = 0

extra-pkgs = gzip

[https://api.meego.com]
user=user1
pass = passwd-in-plain-text
aliases=mg

In the above sample, "apiurl", "user", and "pass" keys should be replaced with the valid ones.

Tips: su-wrapper setting

 To make it easier to run needed things as root, configure for sudo
  In $HOME/.oscrc set:
   su-wrapper = sudo
  And then run 'visudo' and add the line:
   <yourlogin> ALL=NOPASSWD: /usr/bin/build

Tips: build-boot setting

 If you tend to build for several different architectures/projects, it can be helpful to keep each build-root seperate, in $HOME/.oscrc, set:
  build-root = /var/tmp/build-root/%(project)s-%(arch)s-%(package)s

Tips: Multiple OBS configration

To use a different source of packages and build server access, you can easily create a wrapper script to do this for you:

 $ cat > ~/bin/losc
 #!/bin/bash
 exec osc -Ahttps://api.meego.com "$@"
 $ chmod +x ~/bin/losc 

When you're using pub meego osc you should use:

 exec osc -Ahttps://api.pub.meego.com "$@"

instead of

 exec osc -Ahttps://api.meego.com "$@"

Summary and next steps

This guide gave an introduction on how to set up and initialize the 'osc' tool. Next you will check out your project from the server and build it. Click here to open the 2nd part.

Personal tools