File venv-salt-minion.spec of Package venv-salt-minion

#
# spec file for package venv-salt-minion
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

# OBS directives (do not remove)
# needsbinariesforbuild

%global salt_venv /usr/lib/
%global venv venv-salt-minion
%global python_ver 3.9

Name:           venv-salt-minion
Version:        3002.2
Release:        0
Summary:        The venvjailed client component for Salt
License:        Apache-2.0
Group:          System/Management
Url:            http://saltstack.org/
Source:         v%{version}.tar.gz
%if "%_vendor" == "debbuild"
Source10:       exclude-deb
Source11:       include-deb
%else
Source10:       exclude-rpm
Source11:       include-rpm
%endif
Source12:       remove-file
Source13:       venv.py.src
Source100:      venv-salt-minion-rpmlintrc
Source101:      filter-requires.sh
Patch1:         run-salt-master-as-dedicated-salt-user.patch
Patch2:         run-salt-api-as-user-salt-bsc-1064520.patch
Patch3:         activate-all-beacons-sources-config-pillar-grains.patch
Patch4:         avoid-excessive-syslogging-by-watchdog-cronjob-58.patch
Patch5:         fix-bsc-1065792.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/46684
Patch6:         add-saltssh-multi-version-support-across-python-inte.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/46890
Patch7:         fall-back-to-pymysql.patch
# PATCH-FIX_OPENSUSE bsc#1091371
Patch8:         enable-passing-a-unix_socket-for-mysql-returners-bsc.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/47638
Patch9:         add-all_versions-parameter-to-include-all-installed-.patch
# PATCH-FIX_OPENSUSE bsc#1057635
Patch10:        add-environment-variable-to-know-if-yum-is-invoked-f.patch
# PATCH-FIX_OPENSUSE
Patch11:        add-custom-suse-capabilities-as-grains.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/48294
Patch12:        fix-zypper.list_pkgs-to-be-aligned-with-pkg-state.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49063
Patch13:        integration-of-msi-authentication-with-azurearm-clou.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49538
Patch14:        fix-for-suse-expanded-support-detection.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/48812
Patch15:        use-adler32-algorithm-to-compute-string-checksums.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49497
Patch16:        x509-fixes-111.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49696
Patch17:        loosen-azure-sdk-dependencies-in-azurearm-cloud-driv.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49737
Patch18:        do-not-load-pip-state-if-there-is-no-3rd-party-depen.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49815
Patch19:        fix-ipv6-scope-bsc-1108557.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49480
Patch20:        early-feature-support-config.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49936
Patch21:        make-profiles-a-package.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49946
Patch22:        add-cpe_name-for-osversion-grain-parsing-u-49946.patch
# PATCH-FIX_OPENSUSE: Fix unit test for grains core
Patch23:        fix-unit-test-for-grains-core.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50095
Patch24:        support-config-non-root-permission-issues-fixes-u-50.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50018
Patch25:        add-multi-file-support-and-globbing-to-the-filetree-.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/49761
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50201
Patch26:        fixes-cve-2018-15750-cve-2018-15751.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50417
Patch27:        fix-git_pillar-merging-across-multiple-__env__-repos.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50523
Patch28:        get-os_arch-also-without-rpm-package-installed.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50392
Patch29:        make-aptpkg.list_repos-compatible-on-enabled-disable.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50453
Patch30:        debian-info_installed-compatibility-50453.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50773
Patch31:        add-hold-unhold-functions.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50401
# NOTE: This is a techpreview as well as in Fluorine! Release only in Neon.
Patch32:        add-supportconfig-module-for-remote-calls-and-saltss.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/116
Patch33:        return-the-expected-powerpc-os-arch-bsc-1117995.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/51108
Patch34:        remove-arch-from-name-when-pkg.list_pkgs-is-called-w.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/51119
Patch35:        fix-issue-2068-test.patch
# PATCH_FIX_OPENSUSE: Temporary fix allowing "id_" and "force" params while upstrem figures it out
Patch36:        temporary-fix-extend-the-whitelist-of-allowed-comman.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/51382
Patch37:        don-t-call-zypper-with-more-than-one-no-refresh.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50109
# PATCH_FIX_OPENSUSE https://github.com/openSUSE/salt/pull/121
Patch38:        add-virt.all_capabilities.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/51384
Patch39:        include-aliases-in-the-fqdns-grains.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/50546
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/51863
Patch40:        async-batch-implementation.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/52527
Patch41:        calculate-fqdns-in-parallel-to-avoid-blockings-bsc-1.patch
#PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/139
Patch42:        fix-async-batch-race-conditions.patch
#PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/141
Patch43:        add-batch_presence_ping_timeout-and-batch_presence_p.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/52527
Patch44:        use-threadpool-from-multiprocessing.pool-to-avoid-le.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/52888
Patch45:        do-not-crash-when-there-are-ipv6-established-connect.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/144
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/52855
Patch46:        fix-async-batch-multiple-done-events.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/52743
Patch47:        switch-firewalld-state-to-use-change_interface.patch
# PATCH-FIX_OPENSUSE
Patch48:        add-standalone-configuration-file-for-enabling-packa.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53293
Patch49:        do-not-break-repo-files-with-multiple-line-values-on.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53159
Patch50:        batch.py-avoid-exception-when-minion-does-not-respon.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53471
Patch51:        fix-zypper-pkg.list_pkgs-expectation-and-dpkg-mockin.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/161
Patch52:        provide-the-missing-features-required-for-yomi-yet-o.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53661
Patch53:        do-not-make-ansiblegate-to-crash-on-python3-minions.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53693
Patch54:        allow-passing-kwargs-to-pkg.list_downloaded-bsc-1140.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53661
Patch55:        prevent-ansiblegate-unit-tests-to-fail-on-ubuntu.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/54048
Patch56:        avoid-traceback-when-http.query-request-cannot-be-pe.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53992
#                     https://github.com/saltstack/salt/pull/53996
#                     https://github.com/saltstack/salt/pull/54022
#                     https://github.com/saltstack/salt/pull/54024
Patch57:        accumulated-changes-required-for-yomi-165.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/159
Patch58:        move-server_id-deprecation-warning-to-reduce-log-spa.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/54077
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/166
Patch59:        fix-aptpkg-systemd-call-bsc-1143301.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/170
Patch60:        strip-trailing-from-repo.uri-when-comparing-repos-in.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/177
Patch61:        restore-default-behaviour-of-pkg-list-return.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/172
Patch62:        implement-network.fqdns-module-function-bsc-1134860-.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/6af07030a502c427781991fc9a2b994fa04ef32e
Patch63:        fix-memory-leak-produced-by-batch-async-find_jobs-me.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/002543df392f65d95dbc127dc058ac897f2035ed
Patch64:        improve-batch_async-to-release-consumed-memory-bsc-1.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/54077
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/44a91c2ce6df78d93ce0ef659dedb0e41b1c2e04
Patch65:        prevent-systemd-run-description-issue-when-running-a.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/55d8a777d6a9b19c959e14a4060e5579e92cd106
Patch66:        use-current-ioloop-for-the-localclient-instance-of-b.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/8378bb24a5a53973e8dba7658b8b3465d967329f
Patch67:        fix-failing-unit-tests-for-batch-async.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53326
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/54954
Patch68:        accumulated-changes-from-yomi-167.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/180
Patch69:        fix-a-wrong-rebase-in-test_core.py-180.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/182
Patch70:        remove-unnecessary-yield-causing-badyielderror-bsc-1.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/186
Patch71:        read-repo-info-without-using-interpolation-bsc-11356.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53293
Patch72:        prevent-test_mod_del_repo_multiline_values-to-fail.patch
Patch73:        fix-for-log-checking-in-x509-test.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/190
Patch74:        fixing-streamclosed-issue.patch
Patch75:        fix-batch_async-obsolete-test.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/191
Patch76:        let-salt-ssh-use-platform-python-binary-in-rhel8-191.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/193
Patch77:        xfs-do-not-fails-if-type-is-not-present.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/55245
Patch78:        virt-adding-kernel-boot-parameters-to-libvirt-xml-55.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/200
Patch79:        support-for-btrfs-and-xfs-in-parted-and-mkfs.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/56125
Patch80:        add-astra-linux-common-edition-to-the-os-family-list.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/211
Patch81:        apply-patch-from-upstream-to-support-python-3.8.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/217
Patch82:        batch_async-avoid-using-fnmatch-to-match-event-217.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/8a23030d347b7487328c0395f5e30ef29daf1455
Patch83:        batch-async-catch-exceptions-and-safety-unregister-a.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/a38adfa2efe40c2b1508b685af0b5d28a6bbcfc8
Patch84:        fix-unit-tests-for-batch-async-after-refactor.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/b4c401cfe6031b61e27f7795bfa1aca6e8341e52
Patch85:        changed-imports-to-vendored-tornado.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/25b4e3ea983b2606b2fb3d3c0e42f9840208bf84
Patch86:        remove-deprecated-usage-of-no_mock-and-no_mock_reaso.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/a8f0a15e4067ec278c8a2d690e3bf815523286ca
Patch87:        fix-wrong-test_mod_del_repo_multiline_values-test-af.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/55814
Patch88:        opensuse-3000-virt-defined-states-222.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/223
Patch89:        fix-for-temp-folder-definition-in-loader-unit-test.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/56392
Patch90:        virt._get_domain-don-t-raise-an-exception-if-there-i.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/226
Patch91:        re-adding-function-to-test-for-root.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/227
Patch92:        loop-fix-variable-names-for-until_no_eval.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/226
Patch93:        make-setup.py-script-to-not-require-setuptools-9.1.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/50453
#                     https://github.com/saltstack/salt/commit/e20362f6f053eaa4144583604e6aac3d62838419
# Can be dropped one pull/50453 is in released version.
Patch94:        reintroducing-reverted-changes.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/b713d0b3031faadc17cd9cf09977ccc19e50bef7
Patch95:        add-new-custom-suse-capability-for-saltutil-state-mo.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/56491
Patch96:        sanitize-grains-loaded-from-roster_grains.json.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/228
Patch97:        adds-explicit-type-cast-for-port.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53882
Patch98:        fixed-bug-lvm-has-no-parttion-type.-the-scipt-later-.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/4f80e969e31247a4755d98d25f29b5d8b1b916c3
Patch99:        remove-vendored-backports-abc-from-requirements.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57123
Patch100:       prevent-logging-deadlock-on-salt-api-subprocesses-bs.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/235
Patch101:       python3.8-compatibility-pr-s-235.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/56419
Patch102:       option-to-en-disable-force-refresh-in-zypper-215.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/229
Patch103:       fix-a-test-and-some-variable-names-229.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/56439
Patch104:       add-docker-logout-237.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57392
Patch105:       zypperpkg-filter-patterns-that-start-with-dot-244.patch
# PATCH-FIX_OPENSUSE: hhttps://github.com/openSUSE/salt/commit/da936daeebd701e147707ad814c07bfc259d4be
Patch106:       add-publish_batch-to-clearfuncs-exposed-methods.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57779
Patch107:       info_installed-works-without-status-attr-now.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57491
Patch108:       opensuse-3000.3-spacewalk-runner-parse-command-250.patch
# PATCH-FIX_UPSTREAM: https://github.com/openSUSE/salt/pull/251
Patch109:       opensuse-3000-libvirt-engine-fixes-251.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58013
Patch110:       fix-__mount_device-wrapper-254.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58214
Patch111:       ansiblegate-take-care-of-failed-skipped-and-unreacha.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58301
Patch112:       do-not-raise-streamclosederror-traceback-but-only-lo.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/257
Patch113:       opensuse-3000.2-virt-backports-236-257.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/256
Patch114:       backport-virt-patches-from-3001-256.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/262
Patch115:       fix-the-removed-six.itermitems-and-six.-_type-262.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/263
Patch116:       fix-virt.update-with-cpu-defined-263.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/261
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57571
Patch117:       remove-msgpack-1.0.0-requirement-in-the-installed-me.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/bc20f38d0fa492af70321fef7fe2530937dfc86a
Patch118:       prevent-import-errors-when-running-test_btrfs-unit-t.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58529
Patch119:       invalidate-file-list-cache-when-cache-file-modified-.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58400
Patch120:       xen-disk-fixes-264.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58552
Patch121:       zypperpkg-ignore-retcode-104-for-search-bsc-1176697-.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58520
Patch122:       support-transactional-systems-microos-271.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/272
Patch123:       backport-a-few-virt-prs-272.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/275
Patch124:       bsc-1176024-fix-file-directory-user-and-group-owners.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/277
Patch125:       fix-grains.test_core-unit-test-277.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/e2c3b1cb72b796fe12f94af64baa2e64cbe5db0b
Patch126:       drop-wrong-mock-from-chroot-unit-test.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/280
Patch127:       ensure-virt.update-stop_on_reboot-is-updated-with-it.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/281
Patch128:       path-replace-functools.wraps-with-six.wraps-bsc-1177.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58560
Patch129:       fix-novendorchange-option-284.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58871
Patch130:       fix-cve-2020-25592-and-add-tests-bsc-1178319.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58520
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/286
Patch131:       grains-master-can-read-grains.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58784
Patch132:       add-migrated-state-and-gpg-key-management-functions-.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/292
Patch133:       transactional_update-unify-with-chroot.call.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/295
Patch134:       pkgrepo-support-python-2.7-function-call-295.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/79ae019ac7515614c6fbc620e66575f015bc447
Patch135:       drop-wrong-virt-capabilities-code-after-rebasing-pat.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/5ea2f10b15684dd417bad858642faafc92cd382
#                     (revert https://github.com/saltstack/salt/pull/58655)
Patch136:       revert-fixing-a-use-case-when-multiple-inotify-beaco.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59269
Patch137:       fix-aptpkg.normalize_name-when-package-arch-is-all.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/310
Patch138:       open-suse-3002.2-bigvm-310.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59146
Patch139:       open-suse-3002.2-virt-network-311.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/298
Patch140:       fix-salt.utils.stringutils.to_str-calls-to-make-it-w.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58262
Patch141:       add-pkg.services_need_restart-302.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/301
Patch142:       add-patch-support-for-allow-vendor-change-option-wit.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/304
Patch143:       force-zyppnotify-to-prefer-packages.db-than-packages.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/4028fd6e84d882b6dcee695d409c7e1ed6c83bdc
Patch144:       revert-add-patch-support-for-allow-vendor-change-opt.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/73e357d7eee19a73cade22becb30d9689cae27ba
Patch145:       remove-deprecated-warning-that-breaks-miniion-execut.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59345
Patch146:       fix-onlyif-unless-when-multiple-conditions-bsc-11808.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59354
Patch147:       do-not-crash-when-unexpected-cmd-output-at-listing-p.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59189
Patch148:       virt-uefi-fix-backport-312.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59355
#                     https://github.com/saltstack/salt/pull/59417
Patch149:       3002.2-xen-spicevmc-dns-srv-records-backports-314.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59485
Patch150:       open-suse-3002.2-xen-grub-316.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/320
Patch151:       async-batch-implementation-fix-320.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/56173
Patch152:       fixes-56144-to-enable-hotadd-profile-support.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/307
Patch153:       add-sleep-on-exception-handling-on-minion-connection.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/323
Patch154:       implementation-of-suse_ip-execution-module-bsc-10999.patch
# PATCH-FIX_UPSTREAM: no PR to link to yet
Patch155:       fix-for-some-cves-bsc1181550.patch
# PATCH-FIX_UPSTREAM: no PR to link to yet
Patch156:       allow-extra_filerefs-as-sanitized-kwargs-for-ssh-cli.patch
# PATCH-FIX_UPSTREAM: no PR to link to yet
Patch157:       fix-regression-on-cmd.run-when-passing-tuples-as-cmd.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59524
Patch158:       prevent-race-condition-on-sigterm-for-the-minion-bsc.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59746
Patch159:       do-not-monkey-patch-yaml-bsc-1177474.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59536
Patch160:       3002-set-distro-requirement-to-oldest-supported-vers.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59693
Patch161:       virt.network_update-handle-missing-ipv4-netmask-attr.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/313
Patch162:       allow-vendor-change-option-with-zypper-313.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59404
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/341
Patch163:       add-almalinux-and-alibaba-cloud-linux-to-the-os-fami.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/347
Patch164:       notify-beacon-for-debian-ubuntu-systems-347.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/336
Patch165:       update-target-fix-for-salt-ssh-to-process-targets-li.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59687
Patch166:       add-alibaba-cloud-linux-2-by-backporting-upstream-s-.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/353
Patch167:       regression-fix-of-salt-ssh-on-processing-targets-353.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60056
Patch168:       improvements-on-ansiblegate-module-354.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58520
Patch169:       transactional_update-detect-recursion-in-the-executo.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59648
Patch170:       prevent-command-injection-in-the-snapper-module-bsc-.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60056
Patch171:       fix-issue-parsing-errors-in-ansiblegate-state-module.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/376
Patch172:       check-if-dpkgnotify-is-executable-bsc-1186674-376.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57881
Patch173:       parsing-epoch-out-of-version-provided-during-pkg-rem.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58503
Patch174:       fix-missing-minion-returns-in-batch-mode-360.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58520
Patch175:       grains.extra-support-old-non-intel-kernels-bsc-11806.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60133
Patch176:       handle-volumes-on-stopped-pools-in-virt.vm_info-373.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60229
Patch177:       figure-out-python-interpreter-to-use-inside-containe.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60402
Patch178:       enhance-logging-when-inotify-beacon-is-missing-pyino.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60421
Patch179:       move-vendor-change-logic-to-zypper-class-355.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60420
Patch180:       virt-use-dev-kvm-to-detect-kvm-383.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60358
Patch181:       fix-save-for-iptables-state-module-bsc-1185131-372.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60356
Patch182:       fix-exception-in-yumpkg.remove-for-not-installed-pac.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59535
Patch183:       backport-thread.is_alive-fix-390.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/56935
#                     https://github.com/saltstack/salt/pull/60432
Patch184:       implementation-of-held-unheld-functions-for-state-pk.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59682
Patch185:       adding-preliminary-support-for-rocky.-59682-391.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60492
Patch186:       virt-pass-emulator-when-getting-domain-capabilities-.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59756
Patch187:       enhance-openscap-module-add-xccdf_eval-call-386.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58520
Patch188:       handle-master-tops-data-when-states-are-applied-by-t.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58520
Patch189:       do-noop-for-services-states-when-running-systemd-in-.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60662
#                     https://github.com/saltstack/salt/pull/60688
Patch190:       better-handling-of-bad-public-keys-from-minions-bsc-.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59756
Patch191:       fix-error-handling-in-openscap-module-bsc-1188647-40.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/58520
Patch192:       fix-failing-unit-tests-for-systemd.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59492
Patch193:       backport-of-upstream-pr59492-to-3002.2-404.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60650
Patch194:       add-missing-aarch64-to-rpm-package-architectures-405.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/413
Patch195:       don-t-use-shell-sbin-nologin-in-requisites.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60811
Patch196:       templates-move-the-globals-up-to-the-environment-jin.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/commit/0b75ba190fda9c04cc026ad1aa4a6d572f40349b
Patch197:       exclude-the-full-path-of-a-download-url-to-prevent-i.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/59777
Patch198:       3002.2-postgresql-json-support-in-pillar-424.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60342
Patch199:       fix-traceback.-_exc-calls-429.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60983
Patch200:       3002.2-do-not-consider-skipped-targets-as-failed-for.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/61061
Patch201:       fix-ip6_interface-grain-to-not-leak-secondary-ipv4-a.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60324
Patch202:       mock-ip_addrs-in-utils-minions.py-unit-test-444.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/415
Patch203:       prevent-pkg-plugins-errors-on-missing-cookie-path-bs.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/60815
Patch204:       add-rpm_vercmp-python-library-for-version-comparison.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/61179
Patch205:       dnfnotify-pkgset-plugin-implementation-3002.2-450.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/452
Patch206:       remove-wrong-_parse_cpe_name-from-grains.core-452.patch
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/456
Patch207:       fix-the-regression-for-yumnotify-plugin-456.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  logrotate
BuildRequires:  fdupes
BuildRequires:  binutils
BuildRequires:  saltbundlepy-rpm-macros
BuildRequires:  saltbundlepy-setuptools
BuildRequires:  saltbundlepy-venvjail
# --- [venvjail - BuildRequires] START ---
BuildRequires:  saltbundle-libsodium
BuildRequires:  saltbundle-libzmq

BuildRequires:  saltbundlepy-base
BuildRequires:  saltbundlepy-distro
BuildRequires:  saltbundlepy-jinja2
BuildRequires:  saltbundlepy-markupsafe
BuildRequires:  saltbundlepy-msgpack > 0.3
BuildRequires:  saltbundlepy-m2crypto
BuildRequires:  saltbundlepy-pyzmq >= 2.2.0

BuildRequires:  saltbundlepy-pyyaml
BuildRequires:  saltbundlepy-psutil
BuildRequires:  saltbundlepy-requests >= 1.0.0

BuildRequires:  saltbundlepy-pyinotify
BuildRequires:  saltbundlepy-netaddr

%if 0%{?suse_version} || 0%{?fedora} || 0%{?rhel}
BuildRequires:  saltbundlepy-rpm-vercmp
%endif
%if 0%{?fedora} || 0%{?rhel}
%if 0%{?fedora} >= 22 || 0%{?rhel} >= 8
%if 0%{?fedora} != 33 && 0%{?fedora} != 34
BuildRequires:  python3
%endif
%else
BuildRequires:  python
%endif
%endif
%if 0%{?debian} || 0%{?raspbian} || 0%{?ubuntu}
BuildRequires:  saltbundlepy-apt
%endif

# --- [venvjail - BuildRequires] END ---
# --- [venvjail - Requires] START ---
# --- [venvjail - Requires] END ---

%if 0%{?suse_version}
# required for zypper.py
Requires(pre):  libzypp(plugin:system) >= 0
BuildRequires:  saltbundlepy-zypp-plugin
%endif

Requires:       logrotate
Requires:       systemd

%if "%_vendor" == "debbuild"
AutoReqProv:    0
%else
AutoProv:       0

Provides:       config(%{name}) = %{version}-%{release}

# Use custom filter to prevent wrong requires
%define _use_internal_dependency_generator 0
%define __find_requires sh %{SOURCE101}
%endif

%description
Virtual environment jail for Salt minion.
Salt minion is queried and controlled from the master.
Listens to the salt master and execute the commands.

%prep
%autosetup -n salt-%{version}-suse -p1

%build
%if 0%{?fedora} || 0%{?rhel}
export PATH=/usr/bin:$PATH
%endif
%{__saltbundlepy} setup.py --with-salt-version=%{version} --salt-transport=both build
cp ./build/lib/salt/_version.py ./salt

%install
cp %{S:10} .
cp %{S:11} .
cp %{S:12} .
venvjail create %{venv} \
%if "%_vendor" == "debbuild"
  -i include-deb \
  -e exclude-deb \
%endif
  --python-version %{python_ver} \
  --relocate %{salt_venv} \
  --version %{version} \
  --track ../../OTHER/%{name}-%{_arch}-%{version}-%{release}.noarch.rpm.packages

mkdir -p %{buildroot}%{salt_venv}
mv %{venv} %{buildroot}%{salt_venv}

# Install salt right into virtual environment
%{__saltbundlepy} setup.py --salt-transport=both \
    --salt-config-dir=%{_sysconfdir}/%{venv} \
    --salt-cache-dir=%{_localstatedir}/cache/%{venv} \
    --salt-logs-dir=%{_localstatedir}/log \
    install --prefix=%{_prefix} --root=%{buildroot}%{salt_venv}%{venv} --no-compile

# Renive not used activate scripts
rm -f %{buildroot}%{salt_venv}%{venv}/bin/Activate.ps1 \
      %{buildroot}%{salt_venv}%{venv}/bin/activate.csh \
      %{buildroot}%{salt_venv}%{venv}/bin/activate.fish

# Fix links for python interpreter files
sed -i '7 i export SALT_CONFIG_DIR="%{_sysconfdir}/%{venv}"' "%{buildroot}%{salt_venv}%{venv}/bin/python"
rm -f %{buildroot}%{salt_venv}%{venv}/bin/python3 \
      %{buildroot}%{salt_venv}%{venv}/bin/python%{python_ver} \
      %{buildroot}%{salt_venv}%{venv}/bin/python3.original \
      %{buildroot}%{salt_venv}%{venv}/bin/python%{python_ver}.original
ln -s python %{buildroot}%{salt_venv}%{venv}/bin/python3
ln -s python %{buildroot}%{salt_venv}%{venv}/bin/python%{python_ver}
ln -s python.original %{buildroot}%{salt_venv}%{venv}/bin/python3.original
ln -s python.original %{buildroot}%{salt_venv}%{venv}/bin/python%{python_ver}.original

# Fix salt scripts
find %{buildroot}%{salt_venv}%{venv}/bin/ -type f -name 'salt*' -delete
for script in build/scripts-*/salt-minion build/scripts-*/salt-call \
              build/scripts-*/salt-unity build/scripts-*/salt-support \
              build/scripts-*/spm; do
  SCRIPT_NAME=$(basename $script)
  install -m 0755 $script %{buildroot}%{salt_venv}%{venv}/bin
  sed -i '1s=^#!/usr/bin/\(python\|env python\)[0-9.]*=#!%{salt_venv}%{venv}/bin/python=' %{buildroot}%{salt_venv}%{venv}/bin/$SCRIPT_NAME
done

# Fix salt scripts to bindir with venv- prefix
install -Dd -m 0755 %{buildroot}%{_bindir}
find "%{buildroot}%{salt_venv}%{venv}/bin/" -type f -name 'salt-*' | while read _FILE; do
  FILE_NAME=$(basename "${_FILE}")
  ln -s "%{salt_venv}%{venv}/bin/${FILE_NAME}" "%{buildroot}%{_bindir}/venv-${FILE_NAME}"
done

# Remove some of the files
rm -rf %{buildroot}%{salt_venv}%{venv}/usr/share/man
find %{buildroot}%{salt_venv}%{venv}%{saltbundlepy_sitelib}/salt/cloud/deploy/ -name '*.sh' -delete

# Copy venv executor in place
cp %{S:13} %{buildroot}%{salt_venv}%{venv}/lib/python%{python_ver}/site-packages/salt/executors/venv.py

%if 0%{?suse_version}
install -Dpm 0644 pkg/suse/salt-minion.service %{buildroot}%{_unitdir}/venv-salt-minion.service
%else
install -Dpm 0644 pkg/suse/salt-minion.service.rhel7 %{buildroot}%{_unitdir}/venv-salt-minion.service
%endif
sed -i 's/^After=.*/After=network.target/; s/^Description=.*/Description=The venvjailed Salt Minion/; s#^ExecStart=.*#ExecStart=%{salt_venv}%{venv}/bin/salt-minion#' \
    %{buildroot}%{_unitdir}/venv-salt-minion.service

install -Dd -m 0755 %{buildroot}%{_sbindir}
ln -s service %{buildroot}%{_sbindir}/rcvenv-salt-minion

install -Dd -m 0750 %{buildroot}%{_sysconfdir}/%{venv}/minion.d
install -Dd -m 0750 %{buildroot}%{_sysconfdir}/%{venv}/pki/minion

install -Dpm 0640 conf/minion %{buildroot}%{_sysconfdir}/%{venv}/minion
install -Dpm 0640 /dev/null   %{buildroot}%{_sysconfdir}/%{venv}/minion_id

cat <<EOF > "%{buildroot}/etc/%{venv}/minion.d/00-venv.conf"
pki_dir: /etc/%{venv}/pki/minion
pidfile: /run/%{venv}.pid
log_file: /var/log/%{venv}.log
cachedir: /var/cache/%{venv}
sock_dir: /run/%{venv}
module_executors: [venv]

server_id_use_crc: adler32
enable_legacy_startup_events: False
enable_fqdns_grains: False
start_event_grains: [machine_id, saltboot_initrd, susemanager]
EOF

mkdir -p "%{buildroot}/etc/logrotate.d"
cat <<EOF > "%{buildroot}/etc/logrotate.d/venv-salt-minion"
/var/log/%{venv}.log {
    weekly
    missingok
    rotate 7
    compress
    notifempty
}
EOF

mkdir -p "%{buildroot}/usr/lib/tmpfiles.d"
cat <<EOF > "%{buildroot}/usr/lib/tmpfiles.d/venv-salt-minion.conf"
# Type Path                         Mode UID  GID     Age Argument
d      /run/venv-salt-minion        0750 root root

EOF

mkdir -p "%{buildroot}/var/cache/%{venv}"

rm -rf "%{buildroot}%{salt_venv}%{venv}/etc" "%{buildroot}%{salt_venv}%{venv}/var" \
       "%{buildroot}%{salt_venv}%{venv}/srv" "%{buildroot}%{salt_venv}%{venv}/usr/share"

find "%{buildroot}%{salt_venv}%{venv}/lib/" -type d -name 'test*' | while read _DIR; do
  rm -rf "${_DIR}"
done

find %{buildroot}%{salt_venv}%{venv} -name '*.pyc' -delete
%{__saltbundlepy} -m compileall -d %{salt_venv}%{venv} %{buildroot}%{salt_venv}%{venv}
%{__saltbundlepy} -O -m compileall -d %{salt_venv}%{venv} %{buildroot}%{salt_venv}%{venv}

## Install Zypper plugins only on SUSE machines
%if 0%{?suse_version}
install -Dd -m 0750 %{buildroot}%{_prefix}/lib/zypp/plugins/commit
%{__install} scripts/suse/zypper/plugins/commit/zyppnotify %{buildroot}%{_prefix}/lib/zypp/plugins/commit/venv-zyppnotify
sed -i '1s=^#!/usr/bin/\(python\|env python\)[0-9.]*=#!%{salt_venv}%{venv}/bin/python=' %{buildroot}%{_prefix}/lib/zypp/plugins/commit/venv-zyppnotify
sed -i -E 's#self.ck_path = ".*#self.ck_path = "/var/cache/%{venv}/rpmdb.cookie"#' \
    %{buildroot}%{_prefix}/lib/zypp/plugins/commit/venv-zyppnotify
%endif

# Install Yum plugins only on RH machines
%if 0%{?fedora} || 0%{?rhel}
%if 0%{?fedora} >= 22 || 0%{?rhel} >= 8
%define python3_sitelib %(python3 -c "import sysconfig as s; print(s.get_paths().get('purelib'))")
%if 0%{?fedora} == 33 && 0%{?fedora} == 34
%define __platform_python python3
%else
%define __platform_python %{__saltbundlepy}
%define python3_sitelib %{saltbundlepy_sitelib}
%endif
install -Dd %{buildroot}%{python3_sitelib}/dnf-plugins
install -Dd %{buildroot}%{_sysconfdir}/dnf/plugins
%{__install} scripts/suse/dnf/plugins/dnfnotify.py %{buildroot}%{python3_sitelib}/dnf-plugins/venv-dnfnotify.py
sed -i -E 's#self\.cookie_file = ".*#self.cookie_file = "/var/cache/%{venv}/rpmdb.cookie"#' \
          %{buildroot}%{python3_sitelib}/dnf-plugins/venv-dnfnotify.py
%{__platform_python} -m compileall -d %{python3_sitelib}/dnf-plugins %{buildroot}%{python3_sitelib}/dnf-plugins
%{__platform_python} -O -m compileall -d %{python3_sitelib}/dnf-plugins %{buildroot}%{python3_sitelib}/dnf-plugins
%fdupes %{buildroot}%{python3_sitelib}/dnf-plugins
%{__install} scripts/suse/dnf/plugins/dnfnotify.conf %{buildroot}%{_sysconfdir}/dnf/plugins/venv-dnfnotify.conf
%else
install -Dd %{buildroot}%{_prefix}/share/yum-plugins
install -Dd %{buildroot}/etc/yum/pluginconf.d
%{__install} -m 0644 scripts/suse/yum/plugins/yumnotify.py %{buildroot}%{_prefix}/share/yum-plugins/venv-yumnotify.py
sed -i -E 's#CK_PATH = ".*#CK_PATH = "/var/cache/%{venv}/rpmdb.cookie"#' \
          %{buildroot}%{_prefix}/share/yum-plugins/venv-yumnotify.py
python -m compileall -d %{_prefix}/share/yum-plugins %{buildroot}%{_prefix}/share/yum-plugins
python -O -m compileall -d %{_prefix}/share/yum-plugins %{buildroot}%{_prefix}/share/yum-plugins
%fdupes %{buildroot}%{_prefix}/share/yum-plugins
%{__install} -m 0644 scripts/suse/yum/plugins/yumnotify.conf %{buildroot}/etc/yum/pluginconf.d/venv-yumnotify.conf
%endif
%endif

# Install DPkg plugins only on Debian machines
%if "%_vendor" == "debbuild"
install -Dd %{buildroot}/etc/apt/apt.conf.d
%{__install} scripts/suse/dpkg/99dpkgnotify %{buildroot}/etc/apt/apt.conf.d/99dpkgnotify-venv
%{__install} scripts/suse/dpkg/dpkgnotify %{buildroot}%{_bindir}/venv-dpkgnotify
sed -i -E 's#/usr/bin/dpkgnotify#%{_bindir}/venv-dpkgnotify#g' \
          %{buildroot}/etc/apt/apt.conf.d/99dpkgnotify-venv
sed -i -E 's#CK_PATH = ".*#CK_PATH = "%{_localstatedir}/cache/%{venv}/dpkg.cookie"#' \
          %{buildroot}%{_bindir}/venv-dpkgnotify
%endif

%fdupes %{buildroot}%{salt_venv}%{venv}

# Strip debuginfo
strip -g %{buildroot}%{salt_venv}%{venv}/bin/python.original
find "%{buildroot}%{salt_venv}%{venv}" -type f -name '*.so*' | while read _FILE; do
  strip -g $_FILE
done

%pre
%if 0%{?suse_version}
%service_add_pre venv-salt-minion.service
%endif

%post
if which semanage > /dev/null 2>&1 ; then
    if ! semanage fcontext -a -t bin_t '%{salt_venv}%{venv}/bin' > /dev/null 2>&1 ; then
        semanage fcontext -d '%{salt_venv}%{venv}/bin' > /dev/null 2>&1
        semanage fcontext -a -t bin_t '%{salt_venv}%{venv}/bin' > /dev/null 2>&1
    fi
    if ! semanage fcontext -a -t bin_t '%{salt_venv}%{venv}/bin(/.*)?' > /dev/null 2>&1 ; then
        semanage fcontext -d '%{salt_venv}%{venv}/bin(/.*)?' > /dev/null 2>&1
        semanage fcontext -a -t bin_t '%{salt_venv}%{venv}/bin(/.*)?' > /dev/null 2>&1
    fi
    restorecon %{salt_venv}%{venv}/bin || :
    restorecon %{salt_venv}%{venv}/bin/* || :
fi

%if 0%{?suse_version}
%service_add_post venv-salt-minion.service
%else
%systemd_post venv-salt-minion.service
%endif

%preun
%if 0%{?suse_version}
%service_del_preun venv-salt-minion.service
%else
%systemd_preun venv-salt-minion.service
%endif

%postun
%if 0%{?suse_version}
%service_del_postun venv-salt-minion.service
%else
%systemd_postun_with_restart venv-salt-minion.service
%endif

%files
%defattr(-,root,root)
%{salt_venv}%{venv}
%{_bindir}/venv-salt-*
%{_sbindir}/rcvenv-salt-minion
%dir               %attr(0750, root, root) %{_sysconfdir}/%{venv}
%dir               %attr(0750, root, root) %{_sysconfdir}/%{venv}/pki
%config(noreplace) %attr(0640, root, root) %{_sysconfdir}/%{venv}/minion
%config(noreplace) %attr(0640, root, root) %ghost %{_sysconfdir}/%{venv}/minion_id
%dir               %attr(0750, root, root) %{_sysconfdir}/%{venv}/minion.d/
%config            %attr(0640, root, root) %{_sysconfdir}/%{venv}/minion.d/00-venv.conf
%dir               %attr(0750, root, root) %{_sysconfdir}/%{venv}/pki/minion/
%dir               %attr(0750, root, root) %{_localstatedir}/cache/%{venv}/

# Install plugin only on SUSE machines
%if 0%{?suse_version}
%{_prefix}/lib/zypp/plugins/commit/venv-zyppnotify
%endif

# Install Yum plugins only on RH machines
%if 0%{?fedora} || 0%{?rhel}
%if 0%{?fedora} >= 22 || 0%{?rhel} >= 8
%{python3_sitelib}/dnf-plugins/venv-dnfnotify.py
%{python3_sitelib}/dnf-plugins/__pycache__/venv-dnfnotify.*
%{_sysconfdir}/dnf/plugins/venv-dnfnotify.conf
%else
%{_prefix}/share/yum-plugins/venv-yumnotify.*
/etc/yum/pluginconf.d/venv-yumnotify.conf
%endif
%endif

# Install DPkg plugins only on Debian machines
%if "%_vendor" == "debbuild"
/etc/apt/apt.conf.d/99dpkgnotify-venv
/usr/bin/venv-dpkgnotify
%endif

%{_unitdir}/venv-salt-minion.service

%config(noreplace) %{_sysconfdir}/logrotate.d/venv-salt-minion
%{_prefix}/lib/tmpfiles.d/venv-salt-minion.conf

%changelog
openSUSE Build Service is sponsored by