Onedir Packaging

Relenv onedir packaging

Starting in 3006, only onedir packaging will be available. The 3006 onedir packages are built with the relenv tool.

Docker Containers

The Salt Project uses docker containers to build our packages. If you are building your own packages you can use the same containers we build with in the Github piplines. These containers are documented here.

How to build onedir only

  1. Install relenv:

    pip install relenv
    
  2. Fetch toolchain (Only required for linux OSs)

    relenv toolchain fetch
    
  3. Fetch Native Python Build:

    relenv fetch --python=<pythonversion>
    
  4. Create relenv environment:

    relenv create --python=3.10.10 <relenv name>
    
  5. Add Salt into onedir.

    path/to/<relenv-name>/bin/pip install /path/to/salt
    

How to build rpm packages

  1. Install the dependencies:

    yum -y install python3 python3-pip openssl git rpmdevtools rpmlint systemd-units libxcrypt-compat git
    
  2. (Optional) To build a specific Salt version, you will need to install tools and changelog dependencies:

    pip install -r requirements/static/ci/py{python_version}/tools.txt
    
    pip install -r requirements/static/ci/py{python_version}/changelog.txt
    
  3. Ensure you are in the current Salt cloned git repo:

    cd salt
    
  4. (Optional) To build a specific Salt version, run tools and set Salt version:

    tools changelog update-rpm <salt version>
    
  5. Run rpmbuild in the Salt repo:

    rpmbuild -bb --define="_salt_src $(pwd)" $(pwd)/pkg/rpm/salt.spec
    

How to build deb packages

  1. Install the dependencies:

    apt install -y python3 python3-venv python3-pip build-essential devscripts debhelper bash-completion git
    
  2. (Optional) To build a specific Salt version, you will need to install tools and changelog dependencies:

    pip install -r requirements/static/ci/py{python_version}/tools.txt
    
    pip install -r requirements/static/ci/py{python_version}/changelog.txt
    
  3. Ensure you are in the current Salt cloned git repo.:

    cd salt
    
  4. (Optional) To build a specific Salt version, run tools and set Salt version:

    tools changelog update-deb <salt version>
    
  5. Add a symlink and run debuild in the Salt repo:

    ln -sf pkg/debian/ .
    debuild -uc -us
    

How to access python binary

The python library is available in the install directory of the onedir package. For example on linux the default location would be /opt/saltstack/salt/bin/python3.