In OBS, you can build packages both in the OBS server (build.meego.com), or do a local build.
When you do an OBS local build for a package, OBS creates a local chroot under /var/tmp/build-root. OBS first prepares the chroot by installing dependant packages from the OBS server inside the chroot (that is, IF they are found in the OBS repository you're building against). After that, it takes your tarball, spec (and possible patches), builds things inside chroot and gives you a new RPM package.
First get a new package to your home project by using one of these:
1. Copying/linking a package which exists in the OBS server
- osc copypac/linkpac <repository>/<package> home:myusername - osc co home:myusername/<package>
2. Creating a new package
- create new package in OBS web UI OR 'osc meta pkg -e home:myusername <mypackage>' - osc co home:myusername/<mypackage> - Add the spec file, tarball, patches to the project and you're ready to build.
If you have a source RPM that you want to rebuild, extract it with rpm2cpio <the.src.rpm> | cpio -idmv and you get the spec file, tarball and possible patches.
Local build command: osc build <options> <repository> <target architecture> (see 'osc help build' for details)
This assumes that the package dependencies have been solved and the package has been succesfully built using the local build. Let's say you have built a package called mypackage.rpm. This means that the chroot now contains all the dependencies and tools needed to develop that package. (The instructions below assume your distro is using sudo, adjust the commands accordingly if you're not using e.g. Ubuntu)
Rebuilding the sources inside OBS chroot
- Make a directory for the package: sudo mkdir /var/tmp/build-root/home/abuild/mypackage - Copy/untar the sources under the directory above - Move to the chroot: sudo chroot /var/tmp/build-root - cd /home/abuild/mypackage - Develop the code normally - call configure & make and whatever is needed to build your package - 'exit' when you're done working inside the chroot
Repackaging the code that was developed inside the chroot
- sudo tar -czf mypackage.tar /var/tmp/build-root/home/abuild/mypackage - copy the tarball into your OBS project which contains the previously packaged version - adjust mypackage.spec to use the tarball and possible dependency/file changes etc - osc build <options> <repository> <target architecture>