Set of scripts to facilitate project synchronization and mirroring
The scripts require Python 3 and they rely on a binary/symlink python3
to be
present that points to the latest Python 3.x version present on the system.
Currently it is assumed that Python 3.6 and greater is used.
See https://github.com/oracle/opengrok/wiki/Repository-synchronization for more details.
This is a list of the binaries in this package.
opengrok-config-merge
opengrok-deploy
opengrok-groups
opengrok
opengrok-indexer
opengrok-java
opengrok-mirror
opengrok-projadm
opengrok-reindex-project
opengrok-sync
Prepare a virtual environment
python3 -m venv env
. env/bin/activate
When you start developing, install the package in a development mode.
python setup.py develop
This installs the package however keeping the links directly to your source, so you can edit the files and see the immediate results.
Start developing, making changes in files. Test your changes with calling the entry points.
export PYTHONPATH=`pwd`/src/main/python:$PYTHONPATH
opengrok-groups
opengrok-sync
It is necessary to set the python path as the python interpreter is not able to find the packages in our provided structure on its own.
Also you call the opengrok tools scripts by the entry points then (opengrok-groups
, ...).
Calling directly the python script groups.py
would lead to error related to relative imports.
Note that on macOS, you will need to install libgit2 library for the tests to pass.
Test installing your package into the local environment
python setup.py install
# now you can try console scripts
opengrok-groups
opengrok-sync
or make a distribution tarball.
python setup.py sdist
ls -l dist/
Use the distribution tarball and run pip
.
python3 -m pip install opengrok-tools.tar.gz
This will download all dependencies and install the package to your local python3 modules. You can use console scripts to run the package binaries.
You can also install the tools to a specified directory, we suggest you to use the python virtual environment for it.
cd /opt/opengrok
python3 -m venv opengrok-tools
opengrok-tools/bin/python -m pip install opengrok-tools.tar.gz
This will install the package and all the dependencies under the /opt/opengrok/opengrok-tools
directory.
You can then call the scripts with
/opt/opengrok/opengrok-tools/bin/opengrok-indexer
/opt/opengrok/opengrok-tools/bin/opengrok-groups
...
python3 -m pip uninstall opengrok_tools
python setup.py install test
./mvnw test
Deactivate the virtual environment
deactivate
# optionally
# rm -r env