Basic workflows for working with packages on Open Build Service.

Install requirements

Add repositories for specific openSuSE version

openSUSE 43.2

zypper ar http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_42.3/ Tools
zypper ar http://download.opensuse.org/repositories/devel:/tools/openSUSE_Leap_42.3/ devel:tools

openSuSE 15.0

zypper ar http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_15.0/ Tools
zypper ar http://download.opensuse.org/repositories/devel:/tools/openSUSE_Leap_15.0/ devel:tools

openSUSE Tumbleweed

zypper ar http://download.opensuse.org/repositories/devel:/tools/openSUSE_Tumbleweed/ devel:tools

Install osc client and obs services

zypper in osc obs-service-format_spec_file obs-service-set_version obs-service-obs_scm obs-service-source_validator

Setup

Creating a working dir and config osc client

$ mkdir OBS
$ cd OBS
/OBS $ osc

osc command write down a new oscrc configuration file in ~/.config/osc/. Usually I apply only this changes to the file:

-#su-wrapper = sudo
+su-wrapper = sudo

-#build-root = /var/tmp/build-root
+build-root = /var/tmp/build-root/%(repo)s
  1. enabling sudo wrapper
  2. creating building dir for every OS

Edit sudoers file to give your user the authority to use osc and build command without prompt for password.

$ su
# visudo

and add this line

gallochri ALL = NOPASSWD: /usr/bin/build, /usr/bin/osc

use your user instead of gallochri ;-).

Checkout a project

Now it’s time to download some projects and start making changes

$ osc co home:gallochri
A    home:gallochri
A    home:gallochri/EmulationStation
...

Working on existing packet with quilt

cd yourproject/yourpackage
quilt setup -v *spec
cd yourpackage-*/
quilt push -a                                   # apply old patches
quilt new yourpackage-version_fixbuild.patch
quilt edit src/foo.c
quilt refresh -p0

You can find a new .patch file in source dir.

Creating new packet

cd yourproject
osc mkpac yourpackage
cd yourpackage
rpmdev-newspec -t minimal yourpackage

When you have finished writing your spec file without any rpmlint errors, you can send the package to the Open Build Service.

osc vc                                          # write down changes file
osc ci                                          # commit package