Build Service/CLI

From openSUSE

< Build Service(Redirected from Osc)


The openSUSE build service command line tool is called osc

Contents

osc, the Python command line client

osc is written in Python, and in addition to the commandline interface it also provides a Python module, for use by other Python programs.

Packages can be found at http://download.opensuse.org/repositories/openSUSE:/Tools/ for various distributions (openSUSE, SLES, Fedora, Mandriva, Debian, etc.). The code lives here: https://forgesvn1.novell.com/svn/opensuse/trunk/buildservice/src/clientlib/python/osc


osc is a subversion-like client. It serves as client for the source code repository part of the build service, and it is used to edit metadata or query about build results.

Introductory usage examples are shown below. Note the Build_Service_Tutorial, which gives a more systematic introduction.

osc is extensible. You can modify the behavior or write your own commands.


osc will ask you for your credentials when you use it for the first time, and store them in ~/.oscrc. The password is stored in plain text. Protect your ~/.oscrc file and your filesystem appropriately.


Show usage info on a command

osc help
osc help <cmd>

List existing content on the server

osc ls                          # list projects
osc ls Apache                   # list packages in a project
osc ls Apache subversion        # list files of package of a project

Check out content

osc co Apache                   # entire project
osc co Apache subversion        # a package
osc co Apache subversion foo    # single file

Update a working directory

osc up
osc up <directory>
osc up *                        # from within a project dir, update all packages
osc up                          # from within a project dir, update all packages
                                  AND check out all newly added packages

Upload changed content

osc ci                          # current dir
osc ci <file1> <file2>          # only specific files
osc ci <dir1> <dir2> ...        # multiple packages
osc ci -m "updated foobar"      # specify a commit message

See the commit log

osc log 

Show the status (which files have been changed locally)

osc st
osc st <directory>

If an update cannot be merged automatically, a file is in 'C' (conflict) state, and conflicts are marked with special <<<<<<< and >>>>>>> lines. After manually resolving the problem, use

osc resolved <file>

Mark files to be added or removed on the next 'checkin'

osc add foo
osc rm foo

Add all new files in local copy and removes all disappeared files.

osc addremove

Generate a diff to view the changes

osc diff [file]

Show the build results of the package

osc results
osc results <platform>

Show the log file of a package (you need to be inside a package directory)

osc buildlog <platform> <arch>

Show the URLs of .repo files which are packages sources for Yum/YaST/smart

osc repourls [dir]

Trigger a package rebuild for all repositories/architectures of a package

osc rebuildpac [dir]

Build a package on your local plattform

osc build <platform> <arch> <specfile> [--clean|--noinit|...]

Show the configured platforms/build targets.

osc platforms [project]

Show the possible build targets for your project.

osc repos

Show meta information

osc meta prj <project>
osc meta pkg <project> <package>
osc meta user <username>
osc meta prjconf <project>

Edit meta information. Creates new package/project if it doesn't exist. It will open an Editor with the raw XML metadata. If unsure about XML, you can use the web client instead.

osc meta prj -e <project>
osc meta pkg -e <project> <package>
osc meta prjconf -e <project>

(The project configuration (prjconf) may well be empty. It is needed in special cases only.)

Update package meta data with metadata taken from spec file

osc updatepacmetafromspec <dir>

package tracking

With osc it is also possible to manage packages in a svn like way. This feature is called package tracking and has to be enabled in ~/.oscrc's [general] section

# manage your packages in a svn like way
do_package_tracking = 1

Add a new package to a project

osc mkpac <package>

Add an already existing directory and its files to a project

osc add <directory>

Remove a package and its files from a project

osc deletepac <package>

All the commands above only change your local working copy. To submit your changes to the buildservice you have to commit them (osc ci -m <message>).

The status command also displays the state of the packages

osc st

Configuration migration

Version 0.114 got some cleanups for the configfile handling and therefore some options are now deprecated, namely:

  • apisrv
  • scheme

One new option was added:

  • apiurl = <protocol>://<somehost> # use this as the default apiurl. If this option isn't specified the default (https://api.opensuse.org) is used.

So far osc still has some backward compatibility for these options but it might get removed in the future that's why it issues a deprecation warning in case one of those options is still in use. The new configuration scheme looks like the following:

# entry for an apiurl
[<protocol>://<apiurl>]
user = <username>
password = <password>
...

Before starting the migration please save your ~/.oscrc file!

If the migration doesn't work for whatever reason feel free to send me an email or ask on the opensuse-buildservice mailinglist or in the #opensuse-buildservice irc channel.

Migration case I (apisrv only)

The apisrv option is used to specify the default apihost. If apisrv isn't specified at all the default ("api.opensuse.org") is used. The current [general] section looks like this:

[general]
...
apisrv = <somehost>
# or
apisrv = <protocol>://<somehost>

apisrv got superseded by the new apiurl option which looks like this:

[general]
...
apiurl = <protocol>://<somehost>

If apisrv has no "<protocol>" https is used. Make sure all apiurl sections have the new format which is described above. Afterwards apisrv can be removed.

Migration case II (scheme only)

The current [general] section looks like this:

[general]
...
scheme = <protocol>

This means every apiurl section which don't have the new format which is described above for instance

[<somehost>]
user = <username>
password = <password>
...

has to be converted to

[<protocol>://<somehost>]
user = <username>
password = <password>
...

Afterwards the scheme option can be removed from the [general] section (it might be the case that some sections already have the correct format).

Migration case III (apisrv and scheme)

The current [general] section looks like this:

[general]
...
apisrv = <somehost>
scheme = <protocol>

Both options can be removed if all apiurl sections have the new format which is described above. So basically just adjust all apiurl sections (it might be the case that some sections already have the correct format).

osc build with xen

You'll need to have xen packages and xen kernel installed and booted to proceed. To activate local builds with xen, you'll have to add these lines to section [general] of your ~/.oscrc:

build-type=xen
build-device=/tmp/FILE.root
build-swap=/tmp/FILE.swap
build-memory=512

Then create the 2 files:

dd if=/dev/zero of=/tmp/FILE.root bs=1M count=4096  # 4GB partition for / . On big projects 8GB should be used.
mkfs.ext3 /tmp/FILE.root                            # Hit (y) if it complains about the file not being a device node.
dd if=/dev/zero of=/tmp/FILE.swap bs=1M count=512   # use other sizes as needed
mkswap /tmp/FILE.swap

If you want to use the cross-compilation feature, you'll have to add to your /etc/sysconfig/kernel:

  • binfmt_misc to INITRD_MODULES
  • binfmt_misc to DOMU_INITRD_MODULES
  • binfmt_misc to MODULES_LOADED_ON_BOOT

Recreate the initrd's with mkinitrd.

Run osc build.

The Perl client 'opensuse-commandline'

In the early beginnings, there was a Perl client (named 'opensuse-commandline') but it is no longer maintained. Some code lives in the opensuse svn. Please use 'osc', unless you intend to hack on it.

Graphical user interface (GUI) and Framework

MonoOSC project logo from Robert Lihm <rlihm@suse.de>


openSUSE Build Service Developer Graphical User Interface

MonoOSC is a project composed of two parts. A CSharp, C#, library used to access the openSUSE Build Service, OBS. The second part is a nice GUI which uses this library. MonoOSC requires the Mono 2.1 version of the distribution. more info can be find here (developpement in progress) : http://sourceforge.net/projects/monoosc/ OpenSuse Build Service Repository : http://download.opensuse.org/repositories/home:/surfzoid/

  • Another article is open to provide help