Using the SuSE OBS to package your python module
This is a crash course (or tutorial) in how to get started using OpenSUSE Build Server OBS and packaging your first python module so you can target a python interpreter.
In the OBS server each user can have:
- Many "Projects" each one using several "Repositories" (linux distributions)
- Each "Projects" contains several "Packages" sharing their "Projects" settings
Requirements
To be follow this tutorial you need:
- an account on OBS
- the Osc command line client
Configuration
Filling the following information will update the tutorial in order to provide a cut'n copy step by step instructions.
| The OBS account the one you just acquired on the OBS server |
|
| The new project name a project name for your modules |
home:: |
| The new package name The module name possibly with a version |
home::: |
| The desired opt-python interpreter the python tag to build against the module |
Workflow
Although the following steps can be done using the web base interface, we focus in using the cli interface here.
First time
- Create a new project
osc meta prj -e home::
You need the relevant fileds in the xml configuration file and the build targets against which the build will be performed (see build targes).
- Select the desired python intepreters to use (as many as you need):
osc linkpac home:cavallo71:opt-python-interpreters \ opt-python home::You could use any of the current python builds from the main page.
For each package
- Create the package within the project:
osc meta pkg -e home:: \Again you need to set the xml fields to match your requirements.
Creating a local working copy
The Osc command line client has a syntax similar to subversion: developer
used to it shouldn't have problems in using it. The workflow follows the usual scheme: check out the working copy of a project, go to the package directory, add/edit/delete the
files then commit the changes: the OBS server will perform the build on the committed files.
What follows is using a simple test module that builds on almost all the rpm based platforms: this is a possible good starting point in packaging your module.
- Check out a local copy for your project:
osc co home::
- Enter the local working copy for you module:
cd "home::/"
-
Add the files to the Package either:
- grabbing a ready made example module tar file + .spec file:
curl -LO "http://cclimited.webfactional.com/data/pyquality/pyquality.spec" curl -LO "http://cclimited.webfactional.com/data/pyquality/pyquality.tar.bz2" curl -LO "http://cclimited.webfactional.com/data/pyquality/ident2.sh"
- if you have a tar file and you just need a spec file for it you can make use of: Pyquality spec file creator).
Either way you should have a .spec file + one or more source files in your working dir.
- grabbing a ready made example module tar file + .spec file:
- Fix the opt-python line in the .spec file
perl -p -i -e \ 's/opt-python-svn12345/opt-python/g' pyquality.spec
- Add the files (if you've used the ready made example)
osc add pyquality.spec pyquality.tar.bz2 ident2.sh
- Commit the changes
osc commit
Enter a commit message
- Et voila! If the build goes well the results should be under:
http://download.opensuse.org/repositories/home:/:/