Home Wiki > openSUSE:Build Service adding build targets
Sign up | Login

openSUSE:Build Service adding build targets

tagline: From openSUSE

Adding build target repositories (distributions) to OBS

The easiest way to setup base distros as build targets in your Open Build Service instance is to "re-use" the distros publicly accessible on build.opensuse.org. See Configuration of OBS Appliance for more information.

If build.opensuse.org does not offer the distro build target you require or your build system is not connected to the Internet, you can manually add the required distro as a build repository.

The following is a simple step-by-step process to manually add local build target repositories to an instance of the Open Build Service. It requires setting up a project for the new build target, and adding some files to the filesystem of the server that is hosting the OBS instance. Admin access to the server hosting the OBS instance is required.

In this example the build target "project" is named "my-distro" and the architectures setup are i586 and x86_64. File paths shown assumes a standard setup with the server backend installed under /srv/obs and frontend installed under /srv/www/obs.


1) Create the build target project.

Command line:

# osc meta -e prj my-distro

Web UI:

  • Create a new project with the name "my-distro".
  • Edit the project meta data:
    • [MENU] -> Advanced -> Raw Config1

In the project meta data add a repository:

 <repository name="standard">
   <arch>x86_64</arch>
   <arch>i586</arch>
 </repository>

<build> and <publish> can be set to "disable".

After the project setup, you should now have a file called my-distro.xml under the /srv/obs/projects directory of the build service server. You should also have the following directory structure under /srv/obs/build

my-distro/standard/x86_64/
my-distro/standard/i586/


1(OBS v2.3 or later: Advanced -> Meta)


2) Copy distro packages to the build repo.

On the build service server filesystem make ":full" subdirectories.

# mkdir /srv/obs/build/my-distro/standard/{i586,x86_64}/:full

Under these :full sub-directories, copy all the packages from the distro for the given arch required for building packages. Make sure all new files/directories have proper ownership/permissions for access by the obs server software (standard setup requires: user=obsrun, group=obsrun).

# cp <path-to-my-distro-i586-packages>/*.rpm /srv/obs/build/my-distro/standard/i586/:full/
# cp <path-to-my-distro-x86_64-packages>/*.rpm /srv/obs/build/my-distro/standard/x86_64/:full/
# chown -R obsrun.obsrun /srv/obs/build/my-distro

3) Add build config file

The build target project requires a project config file that is used by the build service backend to properly setup build environments. Example configs come with the build.rpm package. Check in /usr/lib/build/configs of the latest build.rpm package for a config that best matches your distro. Copy this file to the projects directory renaming it to my-distro.conf.

# osc -A https://api.opensuse.org meta prjconf MY_PROJECT -F /usr/lib/build/configs/debian.conf

If there is not a config file available for your target distro, pick the closest match and you might have to edit it to get things building properly.

Or take the project config of a matching build target on build.opensuse.org:

Example: Project Config for SUSE Linux Enterprise 11:

Command Line:

# osc -A https://api.opensuse.org meta prjconf SUSE:SLE-11 > my-distro.conf

Web UI: On build.opensuse.org browse to Projects > SUSE:SLE-11 > [MENU] -> Advanced -> Project Config


4) Restart obs scheduler

The scheduler will scan and setup the new build repository on restart.

# obs_admin --rescan-repository MY_PROJECT MY_REPO ARCHITECTURE

5) Add a button to the "Add Repository" web ui to

For convienence you can add a repo button to the Add Repository page of your OBS frontend.

  • Pre-OBS 2.0: edit /srv/www/obs/webui/config/repositories.rb
  • OBS 2.0: edit /srv/www/obs/api/files/distributions.xml
  • OBS 2.6 and later: Edit the project meta data:
 [MENU] -> Advanced -> Meta

Insert:

 <repository name="SLE_11_SP4">
   <path project="SUSE:SLE-11:SP4" repository="standard"/>
   <arch>x86_64</arch>
   <arch>s390x</arch>
   <arch>i586</arch>
 </repository>

6) Build

You can now add the "my-distro" target as a repository in your projects.