Thursday, August 15, 2013

openSUSE: packaging workflow

I use the Open Build Service to work on openSUSE packages. There is a useful tutorial HERE.

Important resources:

  1. post-build-checks source code
  2. Spec file guidelines

And here is a summary of 'osc' commands I use the most:

alias oosc='osc -A'

Assuming you will be using the openSUSE Build Service, you will need to include the -A option on all the commands shown below. If you set up this alias, you can save a lot of typing.

osc search PKG

Search for a package. You can also use and zypper search PKG is also helpful.

osc search --binary PKG

Search for a binary package. If you know the name of a binary package (subpackage) and want to find the corresponding OBS project/package, this magic incantation is what you're looking for!

osc meta pkg PRJ PKG -e

If you are project maintainer of PRJ, you can create a package directly using this command, which will throw you into an editor and expect you to set up the package's META file. (Hint, it's easier to create new packages via the OBS web UI.)

osc meta prj PRJ -e

This throws up an editor with the meta data of project PRJ.

osc bco PRJ PKG

osc branch -c PRJ PKG

If you are not a project maintainer of PRJ, you can still work on PKG by branching it to your home project. Since you typically will want to checkout immediately after branching, 'bco' is a handy abbreviation.

osc ar

Add new files, remove disappeared files -- forces the "repository" version into line with the working directory.


Build the package locally -- typically I do this to make sure the package builds before committing it to the server, where it will build again. The REPOSITORY and ARCH can be chosen from the list produced by osc repos


Builds take place in a chroot environment, and sometimes they fail mysteriously. This command gives you access to that chroot environment so you can debug. In more recent openSUSEs the directory to go to is ~/rpmbuild/BUILD/

osc vc

After making your changes, edit the changes file. For each release you need to have an entry. Do not edit the changes file yourself: instead, use this command to maintain the changes file "automagically".

osc ci

Commit your changes to the server. Other SVN-like subcommands (like update, status, diff) also work as expected.

osc results

Check what the server is doing. Typically a build will be triggered by your commit. This command lets you see the status.

osc sr

'sr' is short for submitrequest -- this submits your changes to the PROJECT for review and, hopefully, acceptance by the project maintainers. If you're curious who those are, you can run osc maintainer (or osc bugowner)

osc rq list

'rq' is short for request -- and request list $PRJ $PKG lists all open requests ("SRs") for the given project and package. For example, if the package python-execnet was submitted to openSUSE:Factory from the devel:languages:python project, the following command would find the request:

$ oosc rq list devel:languages:python python-execnet
356494  State:review     By:factory-auto When:2016-01-28T12:01:16
        submit:          devel:languages:python/python-execnet@3 ->         openSUSE:Factory
        Review by Group      is accepted:  legal-auto(licensedigger)                         
        Review by Group      is accepted:  factory-auto(factory-auto)                        
        Review by Group      is new:       factory-staging                                   
        Review by Group      is new:       legal-team                                        
        Review by Group      is new:       opensuse-review-team                              
        Review by User       is new:       factory-repo-checker                              
        Comment: Please review build success

osc rebuildpac

Sometimes it's desirable to trigger a rebuild on the OBS server.

osc results

This command shows the current build status. Adding -v gives more information.


JFYI: lists all well known licenses and their original source. This becomes extremely handy if you start packaging.

No comments:

Post a Comment