Meego Wiki
Views

Build Infrastructure/Packagers Developers/Using OBS chroot for development

From MeeGo wiki
< Build Infrastructure | Packagers Developers(Difference between revisions)
Jump to: navigation, search
(Using the OBS chroot for development)
(categorise)
 
(One intermediate revision not shown)
Line 1: Line 1:
-
In OBS, you can build packages both in the OBS servers (build.meego.com or the community OBS),
+
In OBS, you can build packages both in the OBS server (build.meego.com),
or do a local build.
or do a local build.
Line 25: Line 25:
Local build command: '''osc build <options> <repository> <target architecture>''' (see 'osc help build' for details)
Local build command: '''osc build <options> <repository> <target architecture>''' (see 'osc help build' for details)
-
'''NOTE: Especially the community OBS might not have all the dependencies for the package you are trying to build. The dependencies have to be built first inside the OBS you're using e.g. by getting them from repo.meego.com and building them under your home project.'''
 
== Using the OBS chroot for development ==
== Using the OBS chroot for development ==
Line 44: Line 43:
  - adjust mypackage.spec to use the tarball and possible dependency/file changes etc
  - adjust mypackage.spec to use the tarball and possible dependency/file changes etc
  - osc build <options> <repository> <target architecture>
  - osc build <options> <repository> <target architecture>
 +
 +
[[Category:Build Infrastructure]]

Latest revision as of 12:04, 26 April 2011

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.

Doing a local build with OBS

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)


Using the OBS chroot for development

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>
Personal tools