HowTo improve Debian packages using OBS   October 23rd, 2013

This is a quick tutorial how to branch packages on OBS (hosted by Kolab Systems), for improving the Debian packages.

Please see also the step by step instructions in the Kolab documentation.

My steps show how to fix the bug 2404:

  1. Register a user https://obs.kolabsys.com/user/register_user
  2. Create a home project by clicking “Home Project” in the upper right corner.
  3. Go to project “Kolab Winterfell”: https://obs.kolabsys.com/project/show?project=Kolab%3AWinterfell
  4. Since the problem is a missing file (auth_cache.py) in package pykolab, go to package https://obs.kolabsys.com/package/show?package=pykolab&project=Kolab%3AWinterfell
  5. Branch the package by clicking “Branch package”. Confirm with “OK”
  6. Now you are redirected to your branched version of the package, in my example: https://obs.kolabsys.com/package/show?package=pykolab&project=home%3Atimotheus%3Abranches%3AKolab%3AWinterfell
  7. Go back to your project, https://obs.kolabsys.com/project/show?project=home%3Atimotheus%3Abranches%3AKolab%3AWinterfell; click on Repositories, and remove all distributions that are of no interest to you. That way there are no unnecessary builds on the server. I keep only Debian 7.0. If the 64 bit version is what you want, you can also disable the 32 bit build, by hovering over the green icon, and selecting “Explicitly disable”.
    Also make sure that the “publish” flag is set for the distribution that you want to use.
  8. Now go back to “Overview”, and click on package “pykolab”. You could actually edit files directly in the web interface, and that would trigger a new build. But for the issue regarding the missing file, we need to edit a file inside the debian.tar.gz, and it is easier to use the osc command line tool for that.
  9. Install osc on your own local machine. It is a bit like a git client. It is availabe for many distributions.
  10. Checkout your project to your local machine:
    osc -A https://obs.kolabsys.com:444/ checkout home:timotheus:branches:Kolab:Winterfell
    cd home:timotheus:branches:Kolab:Winterfell/pykolab
  11. Now you untar the file debian.tar.gz, and edit the file
    tar xzf debian.tar.g
    cd debian
    vi pykolab.install
  12. check https://cgit.kolab.org/pykolab/tree/pykolab/auth/ldap for the missing files, and add new lines, and save:
    usr/lib*/python*/*-packages/pykolab/auth/ldap/auth_cache.py
    usr/lib*/python*/*-packages/pykolab/auth/ldap/syncrepl.py
  13. tar the file again, and delete the debian directory:
    tar czf debian.tar.gz debian
    rm -Rf debian
  14. In order for the package to be actually installed when you want to test it, and because it is good practise anyway, you have to update the files debian.changelog and pykolab.dsc as well:
    pykolab.dsc: modify the line with Version, eg. Version: 0.6.8-0~kolab1 to Version: 0.6.8-0~kolab1.1
    debian.changelog: copy the top lines, change the version number the same way as in pykolab.dsc, modify the description, and your author name
  15. Before you can commit, make sure you add the following lines to your file ~/.oscrc:
    [https://obs.kolabsys.com:444]
    user=timotheus
    pass=***
  16. Now commit your changes with the osc tool:
    osc commit -m “adding missing files auth_cache.py and syncrepl.py, fixing bug 2404”
  17. This will upload your changes to the OBS server, and immediately trigger a rebuild of the package pykolab.
  18. You can now install your packages, similar to installing the nightly packages, just replace the username in /etc/apt/sources.list.d/kolab.list
    Edit: you should add the development packages too, since currently 3.1 is not stable for Debian yet:

    username=timotheus
    cat > /etc/apt/sources.list.d/kolab.list <<FINISH
    deb http://obs.kolabsys.com:82/Kolab:/3.1/Debian_7.0/ ./
    deb http://obs.kolabsys.com:82/Kolab:/3.1:/Updates/Debian_7.0/ ./
    deb http://obs.kolabsys.com:82/Kolab:/Winterfell/Debian_7.0/ ./
    deb http://obs.kolabsys.com:82/home:/$username:/branches:/Kolab:/Winterfell/Debian_7.0/ ./
    FINISH
    
    wget http://obs.kolabsys.com:82/Kolab:/3.1/Debian_7.0/Release.key
    apt-key add Release.key; rm -rf Release.key
    wget http://obs.kolabsys.com:82/Kolab:/3.1:/Updates/Debian_7.0/Release.key
    apt-key add Release.key; rm -rf Release.key
    wget http://obs.kolabsys.com:82/Kolab:/Winterfell/Debian_7.0/Release.key
    apt-key add Release.key; rm -rf Release.key
    wget http://obs.kolabsys.com:82/home:/$username:/branches:/Kolab:/Winterfell/Debian_7.0/Release.key
    apt-key add Release.key; rm -rf Release.key
    
    cat > /etc/apt/preferences.d/kolab <<FINISH
    Package: *
    Pin: origin obs.kolabsys.com
    Pin-Priority: 501
    FINISH
    
    apt-get update
    apt-get install kolab
    
  19. When you have tested your packages, you can click “Submit package” on your pykolab project page: https://obs.kolabsys.com/package/show?package=pykolab&project=home%3Atimotheus%3Abranches%3AKolab%3AWinterfell to allow your fixes to go upstream again!
    You can see the submit request here: https://obs.kolabsys.com/request/show/168

Update:

  • To reinstall the Debian server for testing, I am using this script: reinstallKolabDebian.sh
  • For compiling Debian locally with osc, first you need to install the osc and the build package:
    wget http://download.opensuse.org/repositories/openSUSE:Tools/Debian_7.0/Release.key
    apt-key add - &lt; Release.key echo 'deb http://download.opensuse.org/repositories/openSUSE:Tools/Debian_7.0/ /' &gt;&gt; /etc/apt/sources.list.d/osc.list 
    apt-get update
    apt-get install osc build

    Otherwise you would get this error:

    Error: you need build.rpm with version 2007.3.12 or newer.
    See http://download.opensuse.org/repositories/openSUSE:/Tools/
    

    The command for the local build looks like this:

    osc build Debian_7.0 x86_64 roundcubemail-plugins-kolab.dsc
Tags: , ,
This entry was posted on Wednesday, October 23rd, 2013 at 2:15 pm and is filed under Software Development. You can follow any responses to this entry through the RSS 2.0 feed.Both comments and pings are currently closed.

No Responses