Remove salt execution and state modules only when building the windows package

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-07-28 18:27:25 +01:00 committed by Megan Wilhite
parent e646735f91
commit bff4741252
4 changed files with 480 additions and 268 deletions

View file

@ -49,6 +49,44 @@ ci:
# Help files
- "**/*.chm"
- "**/Scripts/wmitest*"
pkg:
darwin:
dir_patterns:
- *ci_darwin_dir_patterns
- "**/pkgconfig"
- "**/share"
- "**/artifacts/salt/opt"
- "**/artifacts/salt/etc"
- "**/artifacts/salt/Lib"
file_patterns:
- *ci_darwin_file_patterns
linux:
dir_patterns:
- *ci_linux_dir_patterns
file_patterns:
- *ci_linux_file_patterns
windows:
dir_patterns:
- *ci_windows_dir_patterns
- "**/salt/share"
- "**/site-packages/pywin32_system32"
file_patterns:
- *ci_windows_file_patterns
- "**/Scripts/py.exe"
- "**/Scripts/pyw.exe"
- "**/Scripts/venvlauncher.exe"
- "**/Scripts/venvwlauncher.exe"
- "**/Scripts/wheel*"
- "**/doc"
- "**/readme"
- "**/salt/salt-api*"
- "**/salt/salt-key*"
- "**/salt/salt-run*"
- "**/salt/salt-syndic*"
- "**/salt/salt-unity*"
- "**/salt/spm*"
- "**/salt/wheel*"
# Non Windows execution modules
- "**/site-packages/salt/modules/aacme.py*"
- "**/site-packages/salt/modules/aix.py*"
@ -231,41 +269,3 @@ ci:
- "**/site-packages/salt/states/virt.py.py*"
- "**/site-packages/salt/states/zfs.py*"
- "**/site-packages/salt/states/zpool.py*"
pkg:
darwin:
dir_patterns:
- *ci_darwin_dir_patterns
- "**/pkgconfig"
- "**/share"
- "**/artifacts/salt/opt"
- "**/artifacts/salt/etc"
- "**/artifacts/salt/Lib"
file_patterns:
- *ci_darwin_file_patterns
linux:
dir_patterns:
- *ci_linux_dir_patterns
file_patterns:
- *ci_linux_file_patterns
windows:
dir_patterns:
- *ci_windows_dir_patterns
- "**/salt/share"
- "**/site-packages/pywin32_system32"
file_patterns:
- *ci_windows_file_patterns
- "**/Scripts/py.exe"
- "**/Scripts/pyw.exe"
- "**/Scripts/venvlauncher.exe"
- "**/Scripts/venvwlauncher.exe"
- "**/Scripts/wheel*"
- "**/doc"
- "**/readme"
- "**/salt/salt-api*"
- "**/salt/salt-key*"
- "**/salt/salt-run*"
- "**/salt/salt-syndic*"
- "**/salt/salt-unity*"
- "**/salt/spm*"
- "**/salt/wheel*"

View file

@ -73,17 +73,19 @@ function VerifyOrDownload ($local_file, $URL, $SHA256) {
# Script Variables
#-------------------------------------------------------------------------------
$WEBCACHE_DIR = "$env:TEMP\msi_build_cache_dir"
$DEPS_URL = "https://repo.saltproject.io/windows/dependencies"
$PROJECT_DIR = $(git rev-parse --show-toplevel)
$BUILD_DIR = "$PROJECT_DIR\pkg\windows\build"
$BUILDENV_DIR = "$PROJECT_DIR\pkg\windows\buildenv"
$SCRIPTS_DIR = "$BUILDENV_DIR\Scripts"
$PYTHON_BIN = "$SCRIPTS_DIR\python.exe"
$BUILD_ARCH = $(. $PYTHON_BIN -c "import platform; print(platform.architecture()[0])")
$SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").DirectoryName
$RUNTIME_DIR = [System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
$CSC_BIN = "$RUNTIME_DIR\csc.exe"
$WEBCACHE_DIR = "$env:TEMP\msi_build_cache_dir"
$DEPS_URL = "https://repo.saltproject.io/windows/dependencies"
$PROJECT_DIR = $(git rev-parse --show-toplevel)
$BUILD_DIR = "$PROJECT_DIR\pkg\windows\build"
$BUILDENV_DIR = "$PROJECT_DIR\pkg\windows\buildenv"
$SCRIPTS_DIR = "$BUILDENV_DIR\Scripts"
$SITE_PKGS_DIR = "$BUILDENV_DIR\Lib\site-packages"
$BUILD_SALT_DIR = "$SITE_PKGS_DIR\salt"
$PYTHON_BIN = "$SCRIPTS_DIR\python.exe"
$BUILD_ARCH = $(. $PYTHON_BIN -c "import platform; print(platform.architecture()[0])")
$SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").DirectoryName
$RUNTIME_DIR = [System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
$CSC_BIN = "$RUNTIME_DIR\csc.exe"
if ( $BUILD_ARCH -eq "64bit" ) {
$BUILD_ARCH = "AMD64"
@ -263,6 +265,214 @@ Write-Host "Packaging *.dll's to *.CA.dll: " -NoNewline
"$SCRIPT_DIR\CustomAction01\CustomAction.config" > build.tmp
CheckExitCode
#-------------------------------------------------------------------------------
# Remove Non-Windows Execution Modules
#-------------------------------------------------------------------------------
Write-Host "Removing Non-Windows Execution Modules: " -NoNewline
$modules = "acme",
"aix",
"alternatives",
"apcups",
"apf",
"apt",
"arista",
"at",
"bcache",
"blockdev",
"bluez",
"bridge",
"bsd",
"btrfs",
"ceph",
"container_resource",
"cron",
"csf",
"daemontools",
"deb*",
"devmap",
"dpkg",
"ebuild",
"eix",
"eselect",
"ethtool",
"extfs",
"firewalld",
"freebsd",
"genesis",
"gentoo",
"glusterfs",
"gnomedesktop",
"groupadd",
"grub_legacy",
"guestfs",
"htpasswd",
"ilo",
"img",
"incron",
"inspector",
"ipset",
"iptables",
"iwtools",
"k8s",
"kapacitor",
"keyboard",
"keystone",
"kmod",
"layman",
"linux",
"localemod",
"locate",
"logadm",
"logrotate",
"lvs",
"lxc",
"mac",
"makeconf",
"mdadm",
"mdata",
"monit",
"moosefs",
"mount",
"napalm",
"netbsd",
"netscaler",
"neutron",
"nfs3",
"nftables",
"nova",
"nspawn",
"openbsd",
"openstack",
"openvswitch",
"opkg",
"pacman",
"parallels",
"parted",
"pcs",
"pkgin",
"pkgng",
"pkgutil",
"portage_config",
"postfix",
"poudriere",
"powerpath",
"pw_",
"qemu_",
"quota",
"redismod",
"restartcheck",
"rh_",
"riak",
"rpm",
"runit",
"s6",
"scsi",
"sensors",
"service",
"shadow",
"smartos",
"smf",
"snapper",
"solaris",
"solr",
"ssh_",
"supervisord",
"sysbench",
"sysfs",
"sysrc",
"system",
"test_virtual",
"timezone",
"trafficserver",
"tuned",
"udev",
"upstart",
"useradd",
"uswgi",
"varnish",
"vbox",
"virt",
"xapi",
"xbpspkg",
"xfs",
"yum*",
"zfs",
"znc",
"zpool",
"zypper"
$modules | ForEach-Object {
Remove-Item -Path "$BUILD_SALT_DIR\modules\$_*" -Recurse
if ( Test-Path -Path "$BUILD_SALT_DIR\modules\$_*" ) {
Write-Result "Failed" -ForegroundColor Red
Write-Host "Failed to remove: $BUILD_SALT_DIR\modules\$_"
exit 1
}
}
Write-Result "Success" -ForegroundColor Green
#-------------------------------------------------------------------------------
# Remove Non-Windows State Modules
#-------------------------------------------------------------------------------
Write-Host "Removing Non-Windows State Modules: " -NoNewline
$states = "acme",
"alternatives",
"apt",
"at",
"blockdev",
"ceph",
"cron",
"csf",
"deb",
"eselect",
"ethtool",
"firewalld",
"glusterfs",
"gnome",
"htpasswd",
"incron",
"ipset",
"iptables",
"k8s",
"kapacitor",
"keyboard",
"keystone",
"kmod",
"layman",
"linux",
"lxc",
"mac",
"makeconf",
"mdadm",
"monit",
"mount",
"nftables",
"pcs",
"pkgng",
"portage",
"powerpath",
"quota",
"redismod",
"smartos",
"snapper",
"ssh",
"supervisord",
"sysrc",
"trafficserver",
"tuned",
"vbox",
"virt.py",
"zfs",
"zpool"
$states | ForEach-Object {
Remove-Item -Path "$BUILD_SALT_DIR\states\$_*" -Recurse
if ( Test-Path -Path "$BUILD_SALT_DIR\states\$_*" ) {
Write-Result "Failed" -ForegroundColor Red
Write-Host "Failed to remove: $BUILD_SALT_DIR\states\$_"
exit 1
}
}
Write-Result "Success" -ForegroundColor Green
# move conf folder up one dir because it must not be discovered twice and xslt is difficult
Write-Host "Remove configs from discovery: " -NoNewline
Move-Item -Path "$DISCOVER_CONFDIR" `

View file

@ -51,17 +51,19 @@ function Write-Result($result, $ForegroundColor="Green") {
# Script Variables
#-------------------------------------------------------------------------------
$PROJECT_DIR = $(git rev-parse --show-toplevel)
$SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").DirectoryName
$BUILD_DIR = "$PROJECT_DIR\pkg\windows\build"
$BUILDENV_DIR = "$PROJECT_DIR\pkg\windows\buildenv"
$INSTALLER_DIR = "$SCRIPT_DIR\installer"
$SCRIPTS_DIR = "$BUILDENV_DIR\Scripts"
$PYTHON_BIN = "$SCRIPTS_DIR\python.exe"
$PY_VERSION = [Version]((Get-Command $PYTHON_BIN).FileVersionInfo.ProductVersion)
$PY_VERSION = "$($PY_VERSION.Major).$($PY_VERSION.Minor)"
$NSIS_BIN = "$( ${env:ProgramFiles(x86)} )\NSIS\makensis.exe"
$ARCH = $(. $PYTHON_BIN -c "import platform; print(platform.architecture()[0])")
$PROJECT_DIR = $(git rev-parse --show-toplevel)
$SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").DirectoryName
$BUILD_DIR = "$PROJECT_DIR\pkg\windows\build"
$BUILDENV_DIR = "$PROJECT_DIR\pkg\windows\buildenv"
$INSTALLER_DIR = "$SCRIPT_DIR\installer"
$SCRIPTS_DIR = "$BUILDENV_DIR\Scripts"
$SITE_PKGS_DIR = "$BUILDENV_DIR\Lib\site-packages"
$BUILD_SALT_DIR = "$SITE_PKGS_DIR\salt"
$PYTHON_BIN = "$SCRIPTS_DIR\python.exe"
$PY_VERSION = [Version]((Get-Command $PYTHON_BIN).FileVersionInfo.ProductVersion)
$PY_VERSION = "$($PY_VERSION.Major).$($PY_VERSION.Minor)"
$NSIS_BIN = "$( ${env:ProgramFiles(x86)} )\NSIS\makensis.exe"
$ARCH = $(. $PYTHON_BIN -c "import platform; print(platform.architecture()[0])")
if ( $ARCH -eq "64bit" ) {
$ARCH = "AMD64"
@ -133,6 +135,214 @@ if ( Test-Path -Path "$INSTALLER_DIR\salt.ico" ) {
exit 1
}
#-------------------------------------------------------------------------------
# Remove Non-Windows Execution Modules
#-------------------------------------------------------------------------------
Write-Host "Removing Non-Windows Execution Modules: " -NoNewline
$modules = "acme",
"aix",
"alternatives",
"apcups",
"apf",
"apt",
"arista",
"at",
"bcache",
"blockdev",
"bluez",
"bridge",
"bsd",
"btrfs",
"ceph",
"container_resource",
"cron",
"csf",
"daemontools",
"deb*",
"devmap",
"dpkg",
"ebuild",
"eix",
"eselect",
"ethtool",
"extfs",
"firewalld",
"freebsd",
"genesis",
"gentoo",
"glusterfs",
"gnomedesktop",
"groupadd",
"grub_legacy",
"guestfs",
"htpasswd",
"ilo",
"img",
"incron",
"inspector",
"ipset",
"iptables",
"iwtools",
"k8s",
"kapacitor",
"keyboard",
"keystone",
"kmod",
"layman",
"linux",
"localemod",
"locate",
"logadm",
"logrotate",
"lvs",
"lxc",
"mac",
"makeconf",
"mdadm",
"mdata",
"monit",
"moosefs",
"mount",
"napalm",
"netbsd",
"netscaler",
"neutron",
"nfs3",
"nftables",
"nova",
"nspawn",
"openbsd",
"openstack",
"openvswitch",
"opkg",
"pacman",
"parallels",
"parted",
"pcs",
"pkgin",
"pkgng",
"pkgutil",
"portage_config",
"postfix",
"poudriere",
"powerpath",
"pw_",
"qemu_",
"quota",
"redismod",
"restartcheck",
"rh_",
"riak",
"rpm",
"runit",
"s6",
"scsi",
"sensors",
"service",
"shadow",
"smartos",
"smf",
"snapper",
"solaris",
"solr",
"ssh_",
"supervisord",
"sysbench",
"sysfs",
"sysrc",
"system",
"test_virtual",
"timezone",
"trafficserver",
"tuned",
"udev",
"upstart",
"useradd",
"uswgi",
"varnish",
"vbox",
"virt",
"xapi",
"xbpspkg",
"xfs",
"yum*",
"zfs",
"znc",
"zpool",
"zypper"
$modules | ForEach-Object {
Remove-Item -Path "$BUILD_SALT_DIR\modules\$_*" -Recurse
if ( Test-Path -Path "$BUILD_SALT_DIR\modules\$_*" ) {
Write-Result "Failed" -ForegroundColor Red
Write-Host "Failed to remove: $BUILD_SALT_DIR\modules\$_"
exit 1
}
}
Write-Result "Success" -ForegroundColor Green
#-------------------------------------------------------------------------------
# Remove Non-Windows State Modules
#-------------------------------------------------------------------------------
Write-Host "Removing Non-Windows State Modules: " -NoNewline
$states = "acme",
"alternatives",
"apt",
"at",
"blockdev",
"ceph",
"cron",
"csf",
"deb",
"eselect",
"ethtool",
"firewalld",
"glusterfs",
"gnome",
"htpasswd",
"incron",
"ipset",
"iptables",
"k8s",
"kapacitor",
"keyboard",
"keystone",
"kmod",
"layman",
"linux",
"lxc",
"mac",
"makeconf",
"mdadm",
"monit",
"mount",
"nftables",
"pcs",
"pkgng",
"portage",
"powerpath",
"quota",
"redismod",
"smartos",
"snapper",
"ssh",
"supervisord",
"sysrc",
"trafficserver",
"tuned",
"vbox",
"virt.py",
"zfs",
"zpool"
$states | ForEach-Object {
Remove-Item -Path "$BUILD_SALT_DIR\states\$_*" -Recurse
if ( Test-Path -Path "$BUILD_SALT_DIR\states\$_*" ) {
Write-Result "Failed" -ForegroundColor Red
Write-Host "Failed to remove: $BUILD_SALT_DIR\states\$_"
exit 1
}
}
Write-Result "Success" -ForegroundColor Green
#-------------------------------------------------------------------------------
# Remove compiled files
#-------------------------------------------------------------------------------

View file

@ -278,214 +278,6 @@ $directories | ForEach-Object {
}
}
#-------------------------------------------------------------------------------
# Remove Non-Windows Execution Modules
#-------------------------------------------------------------------------------
Write-Host "Removing Non-Windows Execution Modules: " -NoNewline
$modules = "acme",
"aix",
"alternatives",
"apcups",
"apf",
"apt",
"arista",
"at",
"bcache",
"blockdev",
"bluez",
"bridge",
"bsd",
"btrfs",
"ceph",
"container_resource",
"cron",
"csf",
"daemontools",
"deb*",
"devmap",
"dpkg",
"ebuild",
"eix",
"eselect",
"ethtool",
"extfs",
"firewalld",
"freebsd",
"genesis",
"gentoo",
"glusterfs",
"gnomedesktop",
"groupadd",
"grub_legacy",
"guestfs",
"htpasswd",
"ilo",
"img",
"incron",
"inspector",
"ipset",
"iptables",
"iwtools",
"k8s",
"kapacitor",
"keyboard",
"keystone",
"kmod",
"layman",
"linux",
"localemod",
"locate",
"logadm",
"logrotate",
"lvs",
"lxc",
"mac",
"makeconf",
"mdadm",
"mdata",
"monit",
"moosefs",
"mount",
"napalm",
"netbsd",
"netscaler",
"neutron",
"nfs3",
"nftables",
"nova",
"nspawn",
"openbsd",
"openstack",
"openvswitch",
"opkg",
"pacman",
"parallels",
"parted",
"pcs",
"pkgin",
"pkgng",
"pkgutil",
"portage_config",
"postfix",
"poudriere",
"powerpath",
"pw_",
"qemu_",
"quota",
"redismod",
"restartcheck",
"rh_",
"riak",
"rpm",
"runit",
"s6",
"scsi",
"sensors",
"service",
"shadow",
"smartos",
"smf",
"snapper",
"solaris",
"solr",
"ssh_",
"supervisord",
"sysbench",
"sysfs",
"sysrc",
"system",
"test_virtual",
"timezone",
"trafficserver",
"tuned",
"udev",
"upstart",
"useradd",
"uswgi",
"varnish",
"vbox",
"virt",
"xapi",
"xbpspkg",
"xfs",
"yum*",
"zfs",
"znc",
"zpool",
"zypper"
$modules | ForEach-Object {
Remove-Item -Path "$BUILD_SALT_DIR\modules\$_*" -Recurse
if ( Test-Path -Path "$BUILD_SALT_DIR\modules\$_*" ) {
Write-Result "Failed" -ForegroundColor Red
Write-Host "Failed to remove: $BUILD_SALT_DIR\modules\$_"
exit 1
}
}
Write-Result "Success" -ForegroundColor Green
#-------------------------------------------------------------------------------
# Remove Non-Windows State Modules
#-------------------------------------------------------------------------------
Write-Host "Removing Non-Windows State Modules: " -NoNewline
$states = "acme",
"alternatives",
"apt",
"at",
"blockdev",
"ceph",
"cron",
"csf",
"deb",
"eselect",
"ethtool",
"firewalld",
"glusterfs",
"gnome",
"htpasswd",
"incron",
"ipset",
"iptables",
"k8s",
"kapacitor",
"keyboard",
"keystone",
"kmod",
"layman",
"linux",
"lxc",
"mac",
"makeconf",
"mdadm",
"monit",
"mount",
"nftables",
"pcs",
"pkgng",
"portage",
"powerpath",
"quota",
"redismod",
"smartos",
"snapper",
"ssh",
"supervisord",
"sysrc",
"trafficserver",
"tuned",
"vbox",
"virt.py",
"zfs",
"zpool"
$states | ForEach-Object {
Remove-Item -Path "$BUILD_SALT_DIR\states\$_*" -Recurse
if ( Test-Path -Path "$BUILD_SALT_DIR\states\$_*" ) {
Write-Result "Failed" -ForegroundColor Red
Write-Host "Failed to remove: $BUILD_SALT_DIR\states\$_"
exit 1
}
}
Write-Result "Success" -ForegroundColor Green
Write-Host "Removing unneeded files (.pyc, .chm): " -NoNewline
$remove = "__pycache__",
"*.pyc",