Skip to content

Commit

Permalink
Update salt-minion to 3004 and python310 (#5017)
Browse files Browse the repository at this point in the history
* salt-minion: Initial import from PR #4845

* salt-minion: Move log+cache+pki in var

* salt-minion: Use patch.py to fis path for libcrypto.so

* Update spk/salt-minion/Makefile

Co-authored-by: hgy59 <hpgy59@gmail.com>

* Update spk/salt-minion/Makefile

Co-authored-by: hgy59 <hpgy59@gmail.com>

* salt-minion: Fix pid & socket directories

* salt-minion: Use default start-stop-status PID_FILE variable

* salt-minion: Change log level back to info

* salt-minion: Move configurations to @appconf

Co-authored-by: Bjarne Saltbaek <arnebjarne72@hotmail.com>

* salt-master: Migrate to python310

Co-Author:Bjarne Saltbaek <arnebjarne72@hotmail.com>

* salt-master: Fix service install

* salt-*: Fix typo

* salt-*: Enable using root_dir: configuration option

Co-authored-by: hgy59 <hpgy59@gmail.com>
Co-authored-by: Bjarne Saltbaek <arnebjarne72@hotmail.com>
  • Loading branch information
3 people authored Mar 6, 2022
1 parent c0bb214 commit a5c601e
Show file tree
Hide file tree
Showing 18 changed files with 903 additions and 310 deletions.
57 changes: 37 additions & 20 deletions spk/salt-master/Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,55 @@
SPK_NAME = salt-master
SPK_VERS = 2015.5.11
SPK_REV = 9
SPK_VERS = 3004
SPK_REV = 10
SPK_ICON = src/salt-master.png

DEPENDS =
WHEELS = src/requirements.txt
SPK_DEPENDS = "python>2.7.8-10"
BUILD_DEPENDS = cross/python310
SPK_DEPENDS = "python310"

MAINTAINER = SynoCommunity
DESCRIPTION = Salt, a new approach to infrastructure management, is easy enough to get running in minutes, scalable enough to manage tens of thousands of servers, and fast enough to communicate with those servers in seconds.
UNSUPPORTED_ARCHS = $(PPC_ARCHS) $(ARMv5_ARCHS)

# Requirements file generation
# /usr/local/python3/bin/python3 -mvirtualenv --python=python3 salt-env
# virtualenv --python=python3 salt-env
# source salt-env/bin/activate
# pip install salt
# pip freeze > requirements.txt
WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt

MAINTAINER = SynoCommunity
DESCRIPTION = Salt, a new approach to infrastructure management, is easy enough to get running in minutes, scalable enough to manage tens of thousands of servers, and fast enough to communicate with those servers in seconds.
RELOAD_UI = yes
DISPLAY_NAME = Salt Master
CHANGELOG = "1. Update to 2015.5.11<br/>2. Fix salt-api<br/>3. Update dependencies"
CHANGELOG = "1. Update to 3004<br/>2. Migrate to Python 3.10"

HOMEPAGE = https://www.saltstack.com/
LICENSE = Apache v2

INSTALLER_SCRIPT = src/installer.sh
SSS_SCRIPT = src/dsm-control.sh
FWPORTS = src/${SPK_NAME}.sc
HOMEPAGE = https://repo.saltproject.io/
LICENSE = Apache v2
#LICENSE_FILE = $(WORK_DIR)/salt-$(SPK_VERS)/LICENSE

POST_STRIP_TARGET = salt-master_extra_install

# Pure Python package, make sure ARCH is not defined
override ARCH=
# Service configuration
SERVICE_USER = auto
SERVICE_SETUP = src/service-setup.sh
SERVICE_PORT = 4505,4506,8282
SERVICE_PORT_TITLE = $(DISPLAY_NAME)
STARTABLE = yes

SPK_USR_LOCAL_LINKS = bin:env/bin/salt
SPK_USR_LOCAL_LINKS += bin:env/bin/salt-cp
SPK_USR_LOCAL_LINKS += bin:env/bin/salt-key
SPK_USR_LOCAL_LINKS += bin:env/bin/salt-master
SPK_USR_LOCAL_LINKS += bin:env/bin/salt-run
SPK_USR_LOCAL_LINKS += bin:env/bin/salt-unity
SPK_USR_LOCAL_LINKS += bin:env/bin/spm
SPK_USR_LOCAL_LINKS += bin:env/bin/salt-ssh

include ../../mk/spksrc.spk.mk

.PHONY: salt-master_extra_install
salt-master_extra_install:
install -m 755 -d $(STAGING_DIR)/var
install -m 755 -d $(STAGING_DIR)/etc
install -m 644 src/master $(STAGING_DIR)/etc/master
install -m 644 src/rsax931.py.patch $(STAGING_DIR)/share
install -m 644 src/master $(STAGING_DIR)/share
install -m 755 -d $(STAGING_DIR)/share/extensions
install -m 755 -d $(STAGING_DIR)/share/extensions/auth
install -m 644 src/synology.py $(STAGING_DIR)/share/extensions/auth/synology.py

100 changes: 0 additions & 100 deletions spk/salt-master/src/dsm-control.sh

This file was deleted.

91 changes: 0 additions & 91 deletions spk/salt-master/src/installer.sh

This file was deleted.

12 changes: 12 additions & 0 deletions spk/salt-master/src/requirements-crossenv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://github.com/saltstack/salt/blob/master/requirements/static/pkg/py3.10/linux.txt
cffi==1.14.6
cryptography==3.3.2
immutables==0.15
MarkupSafe==1.1.1
msgpack==1.0.2
psutil==5.8.0
pycryptodomex==3.9.8
PyYAML==5.4.1
pyzmq==20.0.0
setproctitle==1.2.2
timelib==0.2.5
32 changes: 32 additions & 0 deletions spk/salt-master/src/requirements-pure.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# https://github.com/saltstack/salt/blob/master/requirements/static/pkg/py3.10/linux.txt
#certifi==2020.6.20 ==> python310
chardet==3.0.4
cheroot==8.5.2
CherryPy==18.6.1
contextvars==2.4
distro==1.5.0
idna==2.10
importlib-metadata==4.8.3
jaraco.classes==3.2.1
jaraco.collections==3.4.0
jaraco.functools==2.0
jaraco.text==3.5.1
Jinja2==2.11.3
more-itertools==5.0.0
portend==2.4
pycparser==2.17
pyOpenSSL==19.1.0
python-dateutil==2.8.1
python-gnupg==0.4.4
pytz==2021.1
requests==2.25.1
rpm-vercmp==0.1.2
salt==3004
six==1.16.0
tempora==4.1.1
urllib3==1.26.6
zc.lockfile==1.4
zipp==3.5.0

# To allow patching rsax931.py during service setup
patch==1.16
13 changes: 0 additions & 13 deletions spk/salt-master/src/requirements.txt

This file was deleted.

12 changes: 12 additions & 0 deletions spk/salt-master/src/rsax931.py.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- rsax931.py.orig 2020-08-14 19:28:44.642281454 +0100
+++ rsax931.py 2020-08-14 19:32:33.948276534 +0100
@@ -76,6 +76,9 @@
else:
lib = glob.glob("/opt/freeware/lib/libcrypto.so*")
lib = lib[0] if lib else None
+ else:
+ lib = glob.glob("/var/packages/python310/target/lib/libcrypto.so*")
+ lib = lib[0] if lib else None
if not lib:
raise OSError("Cannot locate OpenSSL libcrypto")
return lib
Binary file modified spk/salt-master/src/salt-master.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions spk/salt-master/src/service-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Define python310 binary path
PYTHON_DIR="/var/packages/python310/target/bin"
# Add local bin, virtualenv along with python310 to the default PATH
PATH="${SYNOPKG_PKGDEST}/env/bin:${SYNOPKG_PKGDEST}/bin:${PYTHON_DIR}:${PATH}"
LANGUAGE="env LANG=en_US.UTF-8"
SYNOPKG_PKGETC=/var/packages/${SYNOPKG_PKGNAME}/etc

SERVICE_COMMAND="salt-master --pid-file ${PID_FILE} -c ${SYNOPKG_PKGETC} -d"

service_postinst ()
{
# Create a Python virtualenv
install_python_virtualenv

# Install wheels
install_python_wheels

# patch rsax931.py file to find libcrypto lib provided by python310
# (rely on patch==1.16 included in requirements-pure.txt)
python ${SYNOPKG_PKGDEST}/env/lib/python3.10/site-packages/patch.py \
--directory=${SYNOPKG_PKGDEST}/env/lib/python3.10/site-packages/salt/utils \
${SYNOPKG_PKGDEST}/share/rsax931.py.patch

# Prepare salt-master config in /var/packages/salt-master/target/etc
test -d ${SYNOPKG_PKGETC}/master.d || install -m 755 -d ${SYNOPKG_PKGETC}/master.d
test -f ${SYNOPKG_PKGETC}/master || install -m 644 ${SYNOPKG_PKGDEST}/share/master ${SYNOPKG_PKGETC}/master
test -f ${SYNOPKG_PKGETC}/master.d/01_pidfile.conf || echo "pidfile: run" > ${SYNOPKG_PKGETC}/master.d/01_pidfile.conf
test -f ${SYNOPKG_PKGETC}/master.d/02_sockdir.conf || echo "sock_dir: run/master" > ${SYNOPKG_PKGETC}/master.d/02_sockdir.conf
test -f ${SYNOPKG_PKGETC}/master.d/03_cachedir.conf || echo "cachedir: cache" > ${SYNOPKG_PKGETC}/master.d/03_cachedir.conf
test -f ${SYNOPKG_PKGETC}/master.d/04_logging.conf || echo "log_file: ${SYNOPKG_PKGNAME}.log" > ${SYNOPKG_PKGETC}/master.d/04_logging.conf
test -f ${SYNOPKG_PKGETC}/master.d/05_loglevel.conf || echo "log_level_logfile: info" >> ${SYNOPKG_PKGETC}/master.d/05_loglevel.conf
test -f ${SYNOPKG_PKGETC}/master.d/06_pkidir.conf || echo "pki_dir: pki/master" > ${SYNOPKG_PKGETC}/master.d/06_pkidir.conf
test -f ${SYNOPKG_PKGETC}/master.d/07_rootdir.conf || echo "root_dir: ${SYNOPKG_PKGVAR}" > ${SYNOPKG_PKGETC}/master.d/07_rootdir.conf
}
Loading

0 comments on commit a5c601e

Please sign in to comment.