Suse Packages

From WorldForgeWiki
Jump to: navigation, search

About

While not really related to the WorldForge project, I'm trying to document how to build packages for OpenSUSE using y2pmbuild. There is a tutorial by the OpenSUSE project, but in my opinion, a step-by-step guide would be more useful. So here it is. I'm assuming you're using SUSE Linux 10.0 OSS, which is what I used for this example. You must have access to the root password on your machine to perform some of the steps, including building the packages.

Initial setup

First, you need to have y2pmbuild installed, bzip2 and gpg are a good idea, too. y2pmbuild comes in the package y2pmsh.

After installation, you should have a directory called /etc/y2pmbuild/. In there, open the file dists_common with the editor of your choice.

My version of the file looks like:

# where to store built rpms
repository="/home/builds/$BUILD_DIST"

# type of installation source to generate in repository
# either plain or yum or both
regen_repository="yum"

# additional sources, specify with url_...
add_sources="suse"

# suse here is the one from $add_sources
# I'm using a local copy of the SL-10.0-OSS repository, but you could use an http or ftp address here, too.
url_suse="file:///home/suse/inst-source/"

# add this url as top priority source
url_repository="file:$repository"

# extra directories that will be copied to the buildroot after
# packages have been installed. $y2pmbuildconfdir/files/$BUILD_DIST/
# is always copied. Note that rsync is used so you may want to
# think about when to append slashes to directory names.
extra_copy=""

# basename for build root directories. The final name will be
# $buildrootbase.$USER.$BUILD_DIST
buildrootbase="/var/tmp/build-root"

# gpg signature to use for signing. Leave empty to not sign packages
rpm_sign_name="Kai Blin <kais@email.example.com>"
rpm_sign_key="$y2pmbuildconfdir/signkey.asc"

As I said in the comment to the url_suse line, I'm using a local copy of the suse repository, as I have more diskspace than bandwidth. If you have cheap, fast bandwidth available, you might prefer to not pull a copy of the whole repository for just using a couple of packages.

The key to sign the packages is optional, but created easily. Assuming you already have a gpg key you want to use to sign packages, it's a simple

gpg -a --export kais@email.example.com > ~/signkey.asc
gpg -a --export-secret-key kais@email.example.com >> ~/signkey.asc
chmod 0600 ~/signkey.asc

After that, copy signkey.asc into </etc/y2pmbuild/</code> as root. You will of course want to replace kais@email.example.com with the email address connected to your key.

Now it's time to create the repository root and make the user you want to kick off the builds as the owner of the directory.

In my case I do the following as root:
mkdir /home/builds
chown kai /home/builds

That's it for the setup.