Zypper/Development

From openSUSE

Be sure to be subscribed to the zypp-devel mailing list when working on zypper.

Contents

Source Code

Zypper's source is maintained in a subversion repository together with libzypp at http://svn.opensuse.org/svn/zypp in a subdirectory named zypper. You can check out the most recent copy of zypper with the following command:

svn co http://svn.opensuse.org/svn/zypp/trunk/zypper

This will download the sources into zypper directory under your current working directory.

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, cmake, gcc-c++, pkg-config, boost-devel, gettext-devel, and 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.

Future Plans

Check this TODO file if you want to know what we plan to work on. You can either make sure our effort is not duplicated or conflicting or you can get an idea for your own work.