Development

The following page describes the steps necessary to configure your local environment for Pulp development.


Source Code

The Pulp repositories are accessed through git at the following URLs based on the level of access required:

Anonymous

$ git clone git://git.fedorahosted.org/git/pulp.git/

Commit

$ git clone ssh://git.fedorahosted.org/git/pulp.git/

If you have been approved for git commit access to the Pulp git repository, the following steps are necessary:


Dependencies

The easiest way to download the dependencies is to install Pulp through yum, which will pull in the latest dependencies according to the spec file.

  1. Follow the instructions for your platform on the UGInstallation page, using the testing repositories for the most recent updates. Make sure to enable the Testing Build repository as described in those instructions; it is possible that the current code base uses newer versions of dependencies than the previous community release did.
  1. Remove the installed Pulp RPMs; these will be replaced with running directly from the checked out code.
    $ rpm -e pulp pulp-admin pulp-client-lib pulp-consumer pulp-common
    

The only caveat to this approach is that these dependencies will need to be maintained after this initial setup. Leaving the testing builds repository enabled will cause them to be automatically updated on subsequent yum update calls. Messages are sent to the Pulp mailing list when these dependencies are updated as well to serve as a reminder to update before the next code update.


Installation

Pulp can be installed to run directly from the checked out code base through the setup.py script. Running this script requires the python-setuptools package to be installed. Additionally, it is also recommended to install python-pip for access to additional setup-related features.

This method of installation links the git repositories as the locally deployed libraries and scripts. Any changes made in the working copy will be immediately deployed in the site-packages libraries and installed scripts.

$ cd $PULP_ROOT/src
$ sudo python ./setup.py develop

Additionally, Pulp specific files such as configuration and package directories must be linked to the checked out code base. These additions are not performed by setup.py but rather by the Pulp specific script pulp-dev.py.

$ cd $PULP_ROOT
$ sudo python ./pulp-dev.py --install --debug

Uninstallation

The setup.py script does not handle uninstallation. Rather, pip is used to undo the changes made by setup.py. The pulp-dev.py script can be run with the --uninstall flag to remove its changes.

$ cd $PULP_ROOT
$ sudo pip uninstall pulp
$ sudo ./pulp-dev.py --uninstall --debug

Permissions

The pulp-dev.py script links Pulp's WSGI application into the checked out code base. In many cases, Apache will not have the required permissions to serve the applications (for instance, if the code is checked out into a user's home directory.

For example:

$ ls -l /srv/pulp/
lrwxrwxrwx  1 root   root   50 Aug 11 20:05 webservices.wsgi -> /home/jdob/code/pulp/srv/pulp/webservices.wsgi

One solution, if your system supports it, is to use ACLs to grant Apache the required permissions.

For example, assuming the Pulp source was checked out to ~/code/pulp, the following series of commands would grant Apache the required access:

$ cd $HOME
$ setfacl -m user:apache:rwx .
$ cd code
$ setfacl -m user:apache:rwx .
$ cd pulp
$ setfacl -m user:apache:rwx .

SELinux


mod_python

Pulp is a mod_wsgi application. mod_wsgi and mod_python can not both be loaded into apache, as they don't function correctly when running alongside each other. Either uninstall mod_python before starting Pulp, or make sure the mod_python module is not loaded in the apache config.


Initialize and Start

At this point, the Server Installation guide can be followed to initialize and start Pulp.

Keep in mind that code changes will often require Apache to be restarted to load the changes.


Unit Tests

See: Unit Tests

Unit Test Coverage

  1. Install the coverage plugin for nosetests:
    easy_install coverage
    
  1. When you run the test suite with nosetests, pass in the following flags:
    nosetests --with-coverage --cover-html --cover-package pulp --cover-erase
    

A quick explanation:

That'll put them in a directory called "cover" which I think is in "unit" (it may be your cwd if you run with -w).