Skip to content

Commit d1fb379

Browse files
authored
Merge pull request #1112 from asklymenko/current
T8219: Start building Salt from source
2 parents 2c2e8a3 + 944e914 commit d1fb379

7 files changed

Lines changed: 109 additions & 10 deletions

File tree

.github/workflows/trigger_rebuild_packages.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ jobs:
8080
- 'scripts/package-build/pyhumps/**'
8181
radvd:
8282
- 'scripts/package-build/radvd/**'
83+
salt:
84+
- 'scripts/package-build/salt/**'
8385
strongswan:
8486
- 'scripts/package-build/strongswan/**'
8587
tacacs:
@@ -229,6 +231,10 @@ jobs:
229231
trigger_build "radvd"
230232
fi
231233
234+
if [ "${{ steps.changes.outputs.salt }}" == "true" ]; then
235+
trigger_build "salt"
236+
fi
237+
232238
if [ "${{ steps.changes.outputs.strongswan }}" == "true" ]; then
233239
trigger_build "strongswan"
234240
fi

data/architectures/amd64.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,3 @@ packages = [
1111
"intel-microcode",
1212
"amd64-microcode"
1313
]
14-
15-
[additional_repositories.salt]
16-
architecture = "amd64"
17-
url = "https://packages.vyos.net/saltproject/debian/11/amd64/3005"
18-
distribution = "bullseye"

data/architectures/arm64.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,3 @@ packages = [
44
]
55
bootloaders = "grub-efi"
66
squashfs_compression_type = "xz -b 256k -always-use-fragments -no-recovery"
7-
8-
[additional_repositories.salt]
9-
architecture = "arm64"
10-
url = "https://packages.vyos.net/saltproject/debian/11/arm64/3005"
11-
distribution = "bullseye"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/salt/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../build.py
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/sh
2+
3+
# ==============================================================================
4+
# Script to build Salt (Onedir) for VyOS
5+
# ==============================================================================
6+
7+
# Exit immediately on error
8+
set -e
9+
10+
# Configuration
11+
ARCH=$(dpkg --print-architecture)
12+
13+
# Uncomment SALT_REPO and ALT_VERSION variable to build Salt manually
14+
#SALT_REPO="https://github.com/saltstack/salt.git"
15+
#SALT_VERSION="v3006.19"
16+
TOOLS_REPO="https://github.com/saltstack/python-tools-scripts"
17+
18+
# Check this page to find a correct relenv/python combination.
19+
# https://github.com/saltstack/relenv/releases
20+
RELENV_VERSION="0.22.2"
21+
RELENV_PYTHON_VERSION="3.11.14"
22+
23+
# Specify the platform parameter, use x86_64 for amd64, arm64 for arm64
24+
if [ "${ARCH}" = "arm64" ]; then
25+
BUILD_ARCH=${ARCH}
26+
else
27+
BUILD_ARCH="x86_64"
28+
fi
29+
30+
# Specify the Python version currently used by VyOS. This version will be used to specify the correct requirements list,
31+
# for example: requirements/static/pkg/py3.11/tools.tx
32+
PYTHON_VERSION="3.11"
33+
34+
BUILD_DIR="salt"
35+
OUTPUT_DIR="$BUILD_DIR/artifacts"
36+
37+
# Prepare Build Directory
38+
mkdir -p "$BUILD_DIR"
39+
cd "$BUILD_DIR"
40+
41+
if [ ! -d "python-tools-scripts" ]; then
42+
git clone ${TOOLS_REPO}
43+
fi
44+
45+
# Setup Python Build Environment
46+
echo "Setting up build virtual environment..."
47+
if [ ! -d "venv-build" ]; then
48+
python3 -m venv venv-build
49+
fi
50+
51+
# Install Python build requirements
52+
echo "Installing Python build requirements..."
53+
venv-build/bin/python3 -m pip install --upgrade pip
54+
55+
# Install all required build tools
56+
venv-build/bin/python3 -m pip install relenv build packaging jinja2 pyyaml msgpack-python python-tools-scripts ppbt setuptools tornado
57+
58+
# Install repo-specific tools if found
59+
if [ -f "requirements/static/pkg/py${PYTHON_VERSION}/tools.txt" ]; then
60+
venv-build/bin/python3 -m pip install -r requirements/static/pkg/py${PYTHON_VERSION}/tools.txt
61+
fi
62+
63+
# Build the package
64+
echo "Starting Build..."
65+
export PYTHONPATH=$PYTHONPATH:$(pwd)
66+
67+
# The build script below handles fetching the correct runtime version.
68+
venv-build/bin/python3 -m tools.pkg.build deb
69+
70+
# Example: tools pkg build deb --relenv-version=0.22.2 --python-version=3.10.19 --arch=x86_64
71+
venv-build/bin/tools pkg build deb --relenv-version=${RELENV_VERSION} --python-version=${RELENV_PYTHON_VERSION} --arch=${BUILD_ARCH}
72+
73+
echo "List artifacts..."
74+
find ../ -name "*.deb"
75+
76+
echo "Build finished successfully"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[[packages]]
2+
name = "salt"
3+
commit_id = "v3006.19"
4+
scm_url = "https://github.com/saltstack/salt.git"
5+
build_cmd = "cd ..; ./build.sh"
6+
7+
[dependencies]
8+
packages = [
9+
"libssl-dev",
10+
"libffi-dev",
11+
"python3-dev",
12+
"python3-pip",
13+
"python3-venv",
14+
"patchelf",
15+
"fakeroot",
16+
"dpkg-dev",
17+
"cargo",
18+
"dh-make",
19+
"libgdbm-dev",
20+
"liblzma-dev",
21+
"libzmq3-dev",
22+
"patchelf",
23+
"pkg-config",
24+
"python3-venv"
25+
]

0 commit comments

Comments
 (0)