mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Add support for Py3
This commit is contained in:
parent
aa4eed93c8
commit
7b8d6cbbd2
@ -19,14 +19,16 @@
|
||||
# $1 : <version> : the version of salt to build
|
||||
# (a git tag, not a branch)
|
||||
# (defaults to git-repo state)
|
||||
# $2 : <package dir> : the staging area for the package
|
||||
# $2 : <pythin ver> : The version of Python to use in the
|
||||
# build. Default is 2
|
||||
# $3 : <package dir> : the staging area for the package
|
||||
# defaults to /tmp/salt_pkg
|
||||
#
|
||||
# Example:
|
||||
# The following will build Salt v2015.8.3 and stage all files
|
||||
# in /tmp/custom_pkg:
|
||||
# The following will build Salt v2015.8.3 with Python 2 and
|
||||
# stage all files in /tmp/custom_pkg:
|
||||
#
|
||||
# ./build.sh v2015.8.3 /tmp/custom_pkg
|
||||
# ./build.sh v2015.8.3 2 /tmp/custom_pkg
|
||||
#
|
||||
############################################################################
|
||||
echo -n -e "\033]0;Build: Variables\007"
|
||||
@ -41,9 +43,15 @@ else
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
PYVER=2
|
||||
else
|
||||
PYVER=$2
|
||||
fi
|
||||
|
||||
if [ "$3" == "" ]; then
|
||||
PKGDIR=/tmp/salt_pkg
|
||||
else
|
||||
PKGDIR=$2
|
||||
PKGDIR=$3
|
||||
fi
|
||||
|
||||
############################################################################
|
||||
@ -51,6 +59,11 @@ fi
|
||||
############################################################################
|
||||
SRCDIR=`git rev-parse --show-toplevel`
|
||||
PKGRESOURCES=$SRCDIR/pkg/osx
|
||||
if [ "$PYVER" == "2" ]; then
|
||||
PYTHON=/opt/salt/bin/python
|
||||
else
|
||||
PYTHON=/opt/salt/bin/python3
|
||||
fi
|
||||
|
||||
############################################################################
|
||||
# Make sure this is the Salt Repository
|
||||
@ -66,16 +79,16 @@ fi
|
||||
# Create the Build Environment
|
||||
############################################################################
|
||||
echo -n -e "\033]0;Build: Build Environment\007"
|
||||
sudo $PKGRESOURCES/build_env_2.sh
|
||||
sudo $PKGRESOURCES/build_env.sh $PYVER
|
||||
|
||||
############################################################################
|
||||
# Install Salt
|
||||
############################################################################
|
||||
echo -n -e "\033]0;Build: Install Salt\007"
|
||||
sudo /opt/salt/bin/python $SRCDIR/setup.py install
|
||||
sudo $PYTHON $SRCDIR/setup.py install
|
||||
|
||||
############################################################################
|
||||
# Build Package
|
||||
############################################################################
|
||||
echo -n -e "\033]0;Build: Package Salt\007"
|
||||
sudo $PKGRESOURCES/build_pkg.sh $VERSION $PKGDIR
|
||||
sudo $PKGRESOURCES/build_pkg.sh $VERSION $PYVER $PKGDIR
|
||||
|
@ -6,18 +6,21 @@
|
||||
# Authors: CR Oldham, Shane Lee
|
||||
# Date: December 2015
|
||||
#
|
||||
# Description: This script sets up a build environment for salt on macOS.
|
||||
# Description: This script sets up a build environment for Salt on macOS.
|
||||
#
|
||||
# Requirements:
|
||||
# - XCode Command Line Tools (xcode-select --install)
|
||||
#
|
||||
# Usage:
|
||||
# This script is not passed any parameters
|
||||
# This script can be passed 1 parameter
|
||||
# $1 : <python version> : the version of Python to use for the
|
||||
# build environment. Default is 2
|
||||
#
|
||||
# Example:
|
||||
# The following will set up a build environment for salt on macOS
|
||||
# The following will set up a Python 3 build environment for Salt
|
||||
# on macOS
|
||||
#
|
||||
# ./dev_env.sh
|
||||
# ./dev_env.sh 3
|
||||
#
|
||||
############################################################################
|
||||
|
||||
@ -31,6 +34,15 @@ quit_on_error() {
|
||||
exit -1
|
||||
}
|
||||
|
||||
############################################################################
|
||||
# Check passed parameters, set defaults
|
||||
############################################################################
|
||||
if [ "$1" == "" ]; then
|
||||
PYVER=2
|
||||
else
|
||||
PYVER=$1
|
||||
fi
|
||||
|
||||
############################################################################
|
||||
# Parameters Required for the script to function properly
|
||||
############################################################################
|
||||
@ -45,6 +57,15 @@ SHADIR=$SCRIPTDIR/shasums
|
||||
PKG_CONFIG_PATH=/opt/salt/lib/pkgconfig
|
||||
CFLAGS="-I/opt/salt/include"
|
||||
LDFLAGS="-L/opt/salt/lib"
|
||||
if [ "$PYVER" == "2" ]; then
|
||||
PYDIR=/opt/salt/lib/python2.7
|
||||
PYTHON=/opt/salt/bin/python
|
||||
PIP=/opt/salt/bin/pip
|
||||
else
|
||||
PYDIR=/opt/salt/lib/python3.5
|
||||
PYTHON=/opt/salt/bin/python3
|
||||
PIP=/opt/salt/bin/pip3
|
||||
fi
|
||||
|
||||
############################################################################
|
||||
# Determine Which XCode is being used (XCode or XCode Command Line Tools)
|
||||
@ -197,8 +218,13 @@ sudo -H $MAKE install
|
||||
############################################################################
|
||||
echo -n -e "\033]0;Build_Env: Python\007"
|
||||
|
||||
PKGURL="https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz"
|
||||
PKGDIR="Python-2.7.13"
|
||||
if [ "$PYVER" == "2" ]; then
|
||||
PKGURL="https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz"
|
||||
PKGDIR="Python-2.7.13"
|
||||
else
|
||||
PKGURL="https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tar.xz"
|
||||
PKGDIR="Python-3.5.3"
|
||||
fi
|
||||
|
||||
download $PKGURL
|
||||
|
||||
@ -227,23 +253,23 @@ cd $BUILDDIR
|
||||
echo "################################################################################"
|
||||
echo "Installing Salt Dependencies with pip (normal)"
|
||||
echo "################################################################################"
|
||||
sudo -H /opt/salt/bin/pip install \
|
||||
-r $SRCDIR/pkg/osx/req.txt \
|
||||
--no-cache-dir
|
||||
sudo -H $PIP install \
|
||||
-r $SRCDIR/pkg/osx/req.txt \
|
||||
--no-cache-dir
|
||||
|
||||
echo "################################################################################"
|
||||
echo "Installing Salt Dependencies with pip (build_ext)"
|
||||
echo "################################################################################"
|
||||
sudo -H /opt/salt/bin/pip install \
|
||||
-r $SRCDIR/pkg/osx/req_ext.txt \
|
||||
--global-option=build_ext \
|
||||
--global-option="-I/opt/salt/include" \
|
||||
--no-cache-dir
|
||||
sudo -H $PIP install \
|
||||
-r $SRCDIR/pkg/osx/req_ext.txt \
|
||||
--global-option=build_ext \
|
||||
--global-option="-I/opt/salt/include" \
|
||||
--no-cache-dir
|
||||
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
echo "Create Symlink to certifi for openssl"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
sudo ln -s /opt/salt/lib/python2.7/site-packages/certifi/cacert.pem /opt/salt/openssl/cert.pem
|
||||
sudo ln -s $PYDIR/site-packages/certifi/cacert.pem /opt/salt/openssl/cert.pem
|
||||
|
||||
echo -n -e "\033]0;Build_Env: Finished\007"
|
||||
|
@ -15,13 +15,16 @@
|
||||
# This script can be passed 2 parameters
|
||||
# $1 : <version> : the version name to give the package (overrides
|
||||
# version of the git repo) (Defaults to the git repo version)
|
||||
# $2 : <package dir> : the staging area for the package defaults to
|
||||
# $2 : <python ver> : the version of python that was built (defaults
|
||||
# to 2)
|
||||
# $3 : <package dir> : the staging area for the package defaults to
|
||||
# /tmp/salt_pkg
|
||||
#
|
||||
# Example:
|
||||
# The following will build Salt and stage all files in /tmp/salt_pkg:
|
||||
# The following will build Salt version 2017.7.0 with Python 3 and
|
||||
# stage all files in /tmp/salt_pkg:
|
||||
#
|
||||
# ./build.sh
|
||||
# ./build.sh 2017.7.0 3
|
||||
#
|
||||
############################################################################
|
||||
|
||||
@ -45,11 +48,18 @@ else
|
||||
VERSION=$1
|
||||
fi
|
||||
|
||||
# Get/Set temp directory
|
||||
# Get/Set Python Version
|
||||
if [ "$2" == "" ]; then
|
||||
PYVER=2
|
||||
else
|
||||
PYVER=$2
|
||||
fi
|
||||
|
||||
# Get/Set temp directory
|
||||
if [ "$3" == "" ]; then
|
||||
PKGDIR=/tmp/salt_pkg
|
||||
else
|
||||
PKGDIR=$2
|
||||
PKGDIR=$3
|
||||
fi
|
||||
|
||||
CPUARCH=`uname -m`
|
||||
@ -114,7 +124,11 @@ sudo rm -rdf $PKGDIR/opt/salt/lib/engines
|
||||
sudo rm -rdf $PKGDIR/opt/salt/share/aclocal
|
||||
sudo rm -rdf $PKGDIR/opt/salt/share/doc
|
||||
sudo rm -rdf $PKGDIR/opt/salt/share/man/man1/pkg-config.1
|
||||
sudo rm -rdf $PKGDIR/opt/salt/lib/python2.7/test
|
||||
if [ "$PYVER" == "2" ]; then
|
||||
sudo rm -rdf $PKGDIR/opt/salt/lib/python2.7/test
|
||||
else
|
||||
sudo rm -rdf $PKGDIR/opt/salt/lib/python3.5/test
|
||||
fi
|
||||
|
||||
echo -n -e "\033]0;Build_Pkg: Remove compiled python files\007"
|
||||
sudo find $PKGDIR/opt/salt -name '*.pyc' -type f -delete
|
||||
@ -133,15 +147,30 @@ cp $SRCDIR/conf/master $PKGDIR/etc/salt/master.dist
|
||||
############################################################################
|
||||
echo -n -e "\033]0;Build_Pkg: Add Version to .xml\007"
|
||||
|
||||
if [ "$PYVER" == "2" ]; then
|
||||
TITLE="Salt $VERSION"
|
||||
DESC="Salt $VERSION with Python 2"
|
||||
else
|
||||
TITLE="Salt $VERSION (Python 3)"
|
||||
DESC="Salt $VERSION with Python 3"
|
||||
fi
|
||||
|
||||
cd $PKGRESOURCES
|
||||
cp distribution.xml.dist distribution.xml
|
||||
SEDSTR="s/@VERSION@/$VERSION/"
|
||||
echo $SEDSTR
|
||||
sed -i '' $SEDSTR distribution.xml
|
||||
SEDSTR="s/@TITLE@/$TITLE/g"
|
||||
sed -E -i '' "$SEDSTR" distribution.xml
|
||||
|
||||
SEDSTR="s/@CPUARCH@/$CPUARCH/"
|
||||
echo $SEDSTR
|
||||
sed -i '' $SEDSTR distribution.xml
|
||||
SEDSTR="s/@DESC@/$DESC/g"
|
||||
sed -E -i '' "$SEDSTR" distribution.xml
|
||||
|
||||
SEDSTR="s/@VERSION@/$VERSION/g"
|
||||
sed -E -i '' "$SEDSTR" distribution.xml
|
||||
|
||||
SEDSTR="s/@PYVER@/$PYVER/g"
|
||||
sed -E -i '' "$SEDSTR" distribution.xml
|
||||
|
||||
SEDSTR="s/@CPUARCH@/$CPUARCH/g"
|
||||
sed -i '' "$SEDSTR" distribution.xml
|
||||
|
||||
############################################################################
|
||||
# Build the Package
|
||||
@ -152,10 +181,10 @@ pkgbuild --root=$PKGDIR \
|
||||
--scripts=pkg-scripts \
|
||||
--identifier=com.saltstack.salt \
|
||||
--version=$VERSION \
|
||||
--ownership=recommended salt-src-$VERSION-$CPUARCH.pkg
|
||||
--ownership=recommended salt-src-$VERSION-py$PYVER-$CPUARCH.pkg
|
||||
|
||||
productbuild --resources=pkg-resources \
|
||||
--distribution=distribution.xml \
|
||||
--package-path=salt-src-$VERSION-$CPUARCH.pkg \
|
||||
--version=$VERSION salt-$VERSION-$CPUARCH.pkg
|
||||
--package-path=salt-src-$VERSION-py$PYVER-$CPUARCH.pkg \
|
||||
--version=$VERSION salt-$VERSION-py$PYVER-$CPUARCH.pkg
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<installer-gui-script minSpecVersion="2">
|
||||
<title>Salt @VERSION@</title>
|
||||
<title>@TITLE@</title>
|
||||
<organization>com.saltstack.salt</organization>
|
||||
<!-- Define minimum system requirements -->
|
||||
<volume-check>
|
||||
@ -25,7 +25,7 @@
|
||||
<!-- List all component packages -->
|
||||
<pkg-ref id="com.saltstack.salt"
|
||||
version="@VERSION@"
|
||||
auth="root">salt-src-@VERSION@-@CPUARCH@.pkg</pkg-ref>
|
||||
auth="root">salt-src-@VERSION@-py@PYVER@-@CPUARCH@.pkg</pkg-ref>
|
||||
<!-- List them again here. They can now be organized
|
||||
as a hierarchy if you want. -->
|
||||
<choices-outline>
|
||||
@ -34,8 +34,8 @@
|
||||
<!-- Define each choice above -->
|
||||
<choice id="com.saltstack.salt"
|
||||
visible="false"
|
||||
title="Salt @VERSION@"
|
||||
description="Salt @VERSION@"
|
||||
title="@TITLE@"
|
||||
description="@DESC@"
|
||||
start_selected="true">
|
||||
<pkg-ref id="com.saltstack.salt" />
|
||||
</choice>
|
||||
|
1
pkg/osx/shasums/Python-3.5.3.tar.xz.sha512
Normal file
1
pkg/osx/shasums/Python-3.5.3.tar.xz.sha512
Normal file
@ -0,0 +1 @@
|
||||
bbcc20e315c63dbc8901d7e7bfa29d4dbdad9335720757d8d679730319fd1d9fcfdb55cf62d620c9b052134170f162c28d653a8af60923185b8932524d827864 ./Python-3.5.3.tar.xz
|
Loading…
Reference in New Issue
Block a user