Skip to content

[DOCS] Instructions to build deb onedir packages #65437

Closed as not planned
Closed as not planned

Description

@MartinEmrich

Description
I try to build own Deb packages on Debian 12 for the Salt Minion with some local modifications. The documentation link I found via Google (https://docs.saltproject.io/en/latest/topics/packaging/index.html#how-to-build-deb-packages) seems incomplete, and/or parts do not work.

Suggested Fix
A perfect 10 would be a step-by-step guide from git clone to a directory full of working Salt onedir .deb (or .rpm, .exe, .msi) packages, expecting only knowledge about the OS to build for (for me Debian 12) and the packaging format (deb).

Some details/suggestions:

Step 2 does not work as-is on Debian 12: Installing os-wide pip dependencies on Debian 12 is (IMHO rightfully) deactivated, thus the pip install command fails with a big warning. Debian recommends using the packaged python modules instead.
Analyzing the text file from step 2, I came up with this:

apt-get install python3-attr python3-boto3 python3-botocore python3-certifi python3-charset-normalizer python3-commonmark python3-idna python3-jinja2 python3-jmespath python3-markupsafe python3-packaging python3-pygments python3-dateutil python3-yaml python3-requests python3-rich python3-s3transfer python3-six python3-urllib3

(This will most certainly not provide the exact versions from the tools.txt file, and the virustotal3 module is not available in Debian 12)

There's also pipx available in Debian, which will install modules locally below the user's home directory (though I do not know if this will work transparently with the actuall build/packaging process)

Step 4 and 5 look like having a formatting error, there is no "tools" command.

Possibly, the python scripts tools/changelog.py and tools/pkg/build.py are meant.
Both fail with a missing ptscripts module that even Google does not know, so I guess my assumption is false:

$ python3 tools/pkg/build.py deb
Traceback (most recent call last):
  File "/home/emric05/tmp/salt/tools/pkg/build.py", line 17, in <module>
    from ptscripts import Context, command_group
ModuleNotFoundError: No module named 'ptscripts' 

Yet that mysterious tools command is mentioned here explicitly: https://docs.saltproject.io/en/latest/topics/packaging/testing.html#using-tools

But again no explaination on where to get that tools tool. (Tbh, giving any tool that generic name "tools" and placing it in $PATH feels a bit strange, too.)

So I have no clue what to do there and I am stuck now.

Apart from that, I tried the "generic" Debian package build approach: find the debian/../ directory and run dpkg-buildpackage, but that did not work either.

Type of documentation
Salt documentation (Onedir Packaging guide)

Location or format of documentation
https://docs.saltproject.io/en/latest/topics/packaging/index.html#how-to-build-deb-packages

Activity

  1. added
    documentation
    on Oct 20, 2023
  2. OrangeDog commented on Oct 20, 2023

    @OrangeDog
    Contributor

    There's also pipx

    pip --user should do the same thing

  3. added
    severity-medium
    and removed on Nov 13, 2023
  4. Darkentik commented on May 26, 2025

    @Darkentik

    Hi @MartinEmrich,

    i want to let you know that we now were able to build the Debian packages on our own after hardly reverse engineer the Salt's Github code.
    We are not finished now to set this up in our internal Gitlab env but we are working on it.
    For now here are the infos that i can share with you:

    Forword

    For now we are able to build the DEB packages inside a clean Dockercontainter but not in a local dev env using python venv.
    That tools is a python package.
    Here is the pypi page: https://pypi.org/project/python-tools-scripts/

    Pre-requisites

    relenv-version: "0.18.1"
    python-version: "3.10.16"
    

    System wide packages:

    First we tried to install the packages on our own and after we got it running we used AI 'Grok' to check for redundant package dependencies and it came up with this list that works:

        build-essential \
        bash-completion \
        cargo \
        devscripts \
        dh-make \
        libgdbm-dev \
        liblzma-dev \
        libzmq3-dev \
        patchelf \
        pkg-config \
        python3-dev \
        python3-venv
    

    Python virtual environment packages

    RUN pip install python-tools-scripts
    RUN pip install setuptools -U
    RUN pip install relenv=="0.18.1"
    COPY requirements/static/ci/py3.10/tools.txt /tmp/tools.txt
    RUN pip install -r /tmp/tools.txt
    

    Build magic using python-tools-scripts

    # Copy everything
    ADD . /usr/src/salt
    WORKDIR /usr/src/salt
    RUN tools pkg configure-git
    RUN tools pkg source-tarball
    RUN relenv fetch
    RUN relenv toolchain fetch
    RUN tools pkg build onedir-dependencies --arch x86_64 --python-version 3.10.16 --package-name artifacts/salt-3006.10-onedir-linux-x86_64 --platform linux
    RUN tools pkg build deb --relenv-version=0.18.1 --python-version=3.10.16 --arch=x86_64
    

    Final words

    Dockerfile complete

    FROM python:3.10.16
    
    # Suggested by GROK
    RUN apt update && apt install -y \
        build-essential \
        bash-completion \
        cargo \
        devscripts \
        dh-make \
        libgdbm-dev \
        liblzma-dev \
        libzmq3-dev \
        patchelf \
        pkg-config \
        python3-dev \
        python3-venv
    
    RUN pip install python-tools-scripts
    RUN pip install setuptools -U
    RUN pip install relenv=="0.18.1"
    COPY requirements/static/ci/py3.10/tools.txt /tmp/tools.txt
    RUN pip install -r /tmp/tools.txt
    # Copy everything
    ADD . /usr/src/salt
    WORKDIR /usr/src/salt
    RUN tools pkg configure-git
    RUN tools pkg source-tarball
    RUN relenv fetch
    RUN relenv toolchain fetch
    RUN tools pkg build onedir-dependencies --arch x86_64 --python-version 3.10.16 --package-name artifacts/salt-3006.10-onedir-linux-x86_64 --platform linux
    RUN tools pkg build deb --relenv-version=0.18.1 --python-version=3.10.16 --arch=x86_64
    

    For us it was quite a lot of pain to find out the correct versions of the packages and to reverse engineer the Github actions and workflows.
    I hope that our experience will help you to get forward.
    After we finished our internal DEB build pipeline i try to remember this here and share our experience.
    Now we have to face the challenge how we can implement patchmanagement to the build chain.
    Have a nice time.

  5. MartinEmrich commented on Jun 2, 2025

    @MartinEmrich
    Author

    Nice, great work!

    But sorry, TBH after that long time, we seem to have just worked around the original issue, and I forgot what that was in the first place. (It could have been that at that time, there were no native Debian 12 packages, but now they are. It could also be the unusual installation directory under /opt, but we managed that now, too).

  6. dwoz commented on Oct 28, 2026

    @dwoz
    Contributor

    Closing — consolidated into #70585. The checkbox for this item is in the appropriate theme section of that tracker. Please pick up the sub-item there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationseverity-mediumtime-estimate-long-term

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions