openSUSE:Zypper development

Jump to: navigation, search
First steps to build your own ZYpp.

Source code

Zypper's source code is maintained in a GIT repository at github. You can get the most recent copy of zypper with the following command:

git clone https://github.com/openSUSE/zypper.git

This will create a local copy of the repository in a directory named zypper in your current working directory.


Contacting developers


Documentation

Zypper has a detailed manual page, doc/zypper.8. Please keep it up to date whenever you make any changes, either in command-line interface or behavior.

If you are discouraged by the groff markup language, just write in plain text and we will beautify it afterwards.


Development branches

Zypper's development branches should generally match those of libzypp, but there may be exceptions. In general, main development is done in trunk. The branches are mostly needed internally by SUSE developers for maintenance or development of zypper versions shipped with specific products.


Building Zypper

In order to build zypper, you will need the following packages installed:

libzypp-devel augeas-devel cmake gcc-c++ pkg-config boost-devel gettext-devel rubygem(asciidoctor) readline-devel

To build zypper, create a build directory (either _build direcotry inside zypper's source tree or any directory outside) and execute cmake and make in it like this:

mkdir <build_dir>
cd <build_dir>
cmake <zypper_src_dir>
make

Eventually, you can use make install to install zypper under /usr directory. If you wish to use a different install prefix when developing zypper, tell that to the cmake command like this:

cmake -DCMAKE_INSTALL_PREFIX=/my/devel/usr <zypper_src_dir>

and continue building with make as usual.

After successfull build, your zypper executable will be in <build_dir>/src. You can execute this binary directly or you can use make install to install it into bin dir under specified install prefix (see above).

To build source tarball, use

make srcpackage

or

make srcpackage_local

The former checks for uncommitted changes in your source tree, the latter skips the check. Generated tarball will be placed in <build_dir>/package together with zypper.spec file.

Other cmake variables

  • ZYPP_PREFIX - use this to specify libzypp's install prefix in case you want to use libzypp installed in non-standard location
  • SYSCONFDIR - specify your own /etc dir for installation of logrotate.d/zypper.lr
  • MANDIR - specify your own manual page install directory

Style

Tabs vs. Spaces and Indentation

Two-character indentation is used in the source code. You can mix tabs and spaces to indent your code but make sure you have your editor set to display tab characters on 8 character wide columns. In vim editor, this can be achieved by:

set tabstop=8 shiftwidth=2 softtabstop=2

When configured like this, it does not matter wheter you tell your editor to insert spaces instead of tab characters when you hit the tab key. Not all editors support this though, but at least vim, emacs, cream, recently also Eclipse CDT do.