summaryrefslogtreecommitdiff
path: root/spec/unit/plugins/rpm_spec.rb
blob: e225cd49a68e34d4989d1a96ba51c5365f06d620 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
# Author:: Davide Cavalca <dcavalca@fb.com>
# Copyright:: Copyright (c) 2021 Facebook
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require "spec_helper"

describe Ohai::System, "rpm plugin" do
  let(:plugin) { get_plugin("rpm") }

  before do
    allow(plugin).to receive(:collect_os).and_return(:linux)
  end

  it "populates rpm if rpm is found" do
    rpm_version_out = "RPM version 4.17.0\n"
    rpm_showrc_out = File.read(File.join(SPEC_PLUGIN_PATH, "rpm-showrc.output"))

    allow(plugin).to receive(:which).with("rpm").and_return("/bin/rpm")
    allow(plugin).to receive(:shell_out).with("/bin/rpm --version").and_return(mock_shell_out(0, rpm_version_out, ""))
    allow(plugin).to receive(:shell_out).with("/bin/rpm --showrc").and_return(mock_shell_out(0, rpm_showrc_out, ""))
    plugin.run
    expect(plugin[:rpm].to_hash).to eq({
      "arch_os" => { "build_arch" => "x86_64", "build_os" => "Linux", "compatible_archs" => %w{x86_64 amd64 em64t athlon noarch i686 i586 i486 i386 fat}, "compatible_build_archs" => %w{x86_64 noarch}, "compatible_build_oses" => ["Linux"], "compatible_oses" => ["Linux"], "install_arch" => "x86_64", "install_os" => "Linux" },
      "features" => { "rpmlib(BuiltinLuaScripts)" => "4.2.2-1", "rpmlib(CaretInVersions)" => "4.15.0-1", "rpmlib(CompressedFileNames)" => "3.0.4-1", "rpmlib(ConcurrentAccess)" => "4.1-1", "rpmlib(DynamicBuildRequires)" => "4.15.0-1", "rpmlib(ExplicitPackageProvide)" => "4.0-1", "rpmlib(FileCaps)" => "4.6.1-1", "rpmlib(FileDigests)" => "4.6.0-1", "rpmlib(HeaderLoadSortsTags)" => "4.0.1-1", "rpmlib(LargeFiles)" => "4.12.0-1", "rpmlib(PartialHardlinkSets)" => "4.0.4-1", "rpmlib(PayloadFilesHavePrefix)" => "4.0-1", "rpmlib(PayloadIsBzip2)" => "3.0.5-1", "rpmlib(PayloadIsLzma)" => "4.4.2-1", "rpmlib(PayloadIsXz)" => "5.2-1", "rpmlib(PayloadIsZstd)" => "5.4.18-1", "rpmlib(RichDependencies)" => "4.12.0-1", "rpmlib(ScriptletExpansion)" => "4.9.0-1", "rpmlib(ScriptletInterpreterArgs)" => "4.0.3-1", "rpmlib(TildeInVersions)" => "4.10.0-1", "rpmlib(VersionedDependencies)" => "3.0.3-1" },
      "macros" => { "GNAT_arches" => "%{GPRbuild_arches} ia64 ppc alpha", "Main" => "loop\nif processall then\n  for _,s in pairs(fedora.getsuffixes(\"goipath\")) do\n    process(s)\n  end\nelse\n  process(rpm.expand(\"%{-z*}\"))\nend\n}", "P" => "<builtin>", "__7zip" => "/usr/bin/7za", "___build_cmd" => "%{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}", "___build_pre" => "\n  RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\n  RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\n  RPM_OPT_FLAGS=\"%{optflags}\"\n  RPM_LD_FLAGS=\"%{?build_ldflags}\"\n  RPM_ARCH=\"%{_arch}\"\n  RPM_OS=\"%{_os}\"\n  RPM_BUILD_NCPUS=\"%{_smp_build_ncpus}\"\n  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS RPM_BUILD_NCPUS RPM_LD_FLAGS\n  RPM_DOC_DIR=\"%{_docdir}\"\n  export RPM_DOC_DIR\n  RPM_PACKAGE_NAME=\"%{NAME}\"\n  RPM_PACKAGE_VERSION=\"%{VERSION}\"\n  RPM_PACKAGE_RELEASE=\"%{RELEASE}\"\n  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\n  LANG=C\n  export LANG\n  unset CDPATH DISPLAY ||:\n  %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\n  export RPM_BUILD_ROOT}\n  %{?_javaclasspath:CLASSPATH=\"%{_javaclasspath}\"\n  export CLASSPATH}\n  PKG_CONFIG_PATH=\"${PKG_CONFIG_PATH}:%{_libdir}/pkgconfig:%{_datadir}/pkgconfig\"\n  export PKG_CONFIG_PATH\n  CONFIG_SITE=${CONFIG_SITE:-NONE}\n  export CONFIG_SITE\n  \n  %[%{verbose}?\"set -x\":\"\"]\n  umask 022\n  cd \"%{u2p:%{_builddir}}\"", "___build_template" => "#!%{___build_shell}\n%{___build_pre}\n%{nil}", "__ar" => "ar", "__as" => "as", "__bootstrap" => "~bootstrap", "__brp_check_rpaths" => "/usr/lib/rpm/check-rpaths", "__brp_elfperms" => "%{_rpmconfigdir}/brp-elfperms", "__brp_ldconfig" => "/usr/lib/rpm/redhat/brp-ldconfig", "__brp_mangle_shebangs" => "/usr/lib/rpm/redhat/brp-mangle-shebangs %{?__brp_mangle_shebangs_exclude:--shebangs \"%{?__brp_mangle_shebangs_exclude}\"} %{?__brp_mangle_shebangs_exclude_file:--shebangs-from \"%{__brp_mangle_shebangs_exclude_file}\"} %{?__brp_mangle_shebangs_exclude_from:--files \"%{?__brp_mangle_shebangs_exclude_from}\"} %{?__brp_mangle_shebangs_exclude_from_file:--files-from \"%{__brp_mangle_shebangs_exclude_from_file}\"}", "__brp_python_hardlink" => "%{_rpmconfigdir}/redhat/brp-python-hardlink", "__brp_strip" => "/usr/lib/rpm/brp-strip %{__strip}", "__brp_strip_lto" => "/usr/lib/rpm/redhat/brp-strip-lto %{__strip}", "__bzip2" => "/usr/bin/bzip2", "__cargo_skip_build" => "%{lua:\nlocal crate = rpm.expand('%{crate}')\nlocal build_crate = false\nfor w in rpm.expand('%{?_build_crates}'):gmatch('%S+') do\n  if w == crate then\n    build_crate = true\n    break\n  end\nend\nif (rpm.expand('%{defined _module_build}') ~= '0' and not build_crate) then\n  print(1)\nelse\n  print(0)\nend}", "__cc" => "%{expand:%%{__cc_%{toolchain}}}", "__cc_gcc" => "gcc", "__cflags_arch_x86_64" => "%[0%{?rhel} >= 9 ? \"-march=x86-64-v2\" : \"\"]", "__chmod" => "/usr/bin/chmod", "__cmake" => "/usr/bin/cmake", "__cmake_path" => "^(%{_libdir}|%{_datadir})/cmake/.*/.*(Config.cmake|-config.cmake)$", "__cmake_requires" => "%{_rpmconfigdir}/cmake.req", "__cpp" => "%{expand:%%{__cpp_%{toolchain}}}", "__cpp_gcc" => "gcc -E", "__ctest" => "/usr/bin/ctest", "__cxx_clang" => "clang++", "__debug_install_post" => "\n    %{__find_debuginfo} \\\n    %{?_smp_build_ncpus:-j%{_smp_build_ncpus}} \\\n    %{?_missing_build_ids_terminate_build:--strict-build-id} \\\n    %{?_no_recompute_build_ids:-n} \\\n    %{?_include_minidebuginfo:-m} \\\n    %{?_include_gdb_index:-i} \\\n    %{?_unique_build_ids:--build-id-seed \"%{VERSION}-%{RELEASE}\"} \\\n    %{?_unique_debug_names:--unique-debug-suffix \"-%{VERSION}-%{RELEASE}.%{_arch}\"} \\\n    %{?_unique_debug_srcs:--unique-debug-src-base \"%{name}-%{VERSION}-%{RELEASE}.%{_arch}\"} \\\n    %{?_find_debuginfo_dwz_opts} \\\n    %{?_find_debuginfo_opts} \\\n    %{?_debugsource_packages:-S debugsourcefiles.list} \\\n    \"%{_builddir}/%{?buildsubdir}\"\n%{nil}", "__debuginfo_provides" => "%{lua:\n  local file = rpm.expand(\"%1\")\n  local b1, b2 = file:match(\"/([0-9a-f]+)/([0-9a-f]+).debug$\")\n  print(string.format(\"debuginfo(build-id) = %s%s\\n\", b1, b2))\n}", "__default_python3_version" => "3.10", "__desktop_provides" => "%{lua:\n  local executable = false\n  local mimetypes = nil\n  for line in io.lines(rpm.expand(\"%1\")) do\n    if line:match(\"^Type%s*=%s*Application$\") or line:match(\"^Exec%s*=\") then\n      executable = true\n    elseif line:match(\"^MimeType%s*=\") then\n      mimetypes = line:match(\"=%s*(.+)\")\n    end\n  end\n  if executable then\n    print(\"application()\\n\")\n    print(string.format(\"application(%s)\\n\", rpm.expand(\"%{basename:%1}\")))\n    if mimetypes then\n      for mimetype in mimetypes:gmatch(\"([^;]+)\") do\n        print(string.format(\"mimehandler(%s)\\n\", mimetype))\n      end\n    end\n  end\n}", "__elf_magic" => "^(setuid,? )?(setgid,? )?(sticky )?ELF (32|64)-bit.*$", "__elf_requires" => "%{_rpmconfigdir}/elfdeps --requires", "__file" => "/usr/bin/file", "__find_provides" => "%{_rpmconfigdir}/find-provides", "__font_magic" => "[Ff]ont?( (program|collection))?( (text|data))", "__font_requires" => "%{nil}", "__git" => "/usr/bin/git", "__global_compiler_flags" => "%{_general_options} %{_warning_options} %{_preprocessor_defines} %{_hardened_cflags} %{_annotation_cflags} %{_legacy_options}", "__global_fcflags" => "%{build_fflags}", "__global_ldflags" => "%{build_ldflags}", "__global_requires_exclude_from" => "%{?_docdir:%{_docdir}}", "__go_path" => "^%{gopath}/src/.+/.goipath$", "__go_requires" => "go-rpm-integration requires --prefix \"%{buildroot}\" --go-path \"%{gopath}\" %{?goreqflags}", "__gobundled_flags" => "magic_and_path", "__gobundled_path" => "^%{gopath}/src/.+/vendor/.+/.*$", "__godevelinstall(-i:v)" => "%{expand:\n(\n%define __godevelinstall_ipath %{-i*}\ncd \"%{gobuilddir}/src/%{__godevelinstall_ipath}\"\n%define listfiles_include %{?currentgosupfiles}\n%define listfiles_exclude  %{?currentgosupfilesex}\nIFS= gosupfiles=$(%listfiles\n)\nmapfile -t gosupfilesA <<< \"${gosupfiles}\"\ngo-rpm-integration install -i \"%{__godevelinstall_ipath}\"            \\\n                           -b \"%{gobuilddir}/bin\"                    \\\n                           -s \"%{gobuilddir}\"                        \\\n                           -o \"%{currentgodevelfilelist}\"            \\\n                           -O \"%{goworkdir}\"                         \\\n                           -V \"%{version}-%{release}\"                \\\n                           %{?currenttag:    -T \"%{?currenttag}\"}    \\\n                           %{?currentcommit: -C \"%{?currentcommit}\"} \\\n                           %{?currentbranch: -B \"%{?currentbranch}\"} \\\n                           -p \"%{buildroot}\"                         \\\n                           -g \"%{gopath}\"                            \\\n                           %{?currentgoipathsex}                     \\\n                           %{?currentgoextensions}                   \\\n                           %{?goinstallflags}                        \\\n                           %{-v} ${gosupfilesA[@]:+\"${gosupfilesA[@]}\"}\n)\n}", "__gosymlink_flags" => "magic_and_path", "__gosymlink_path" => "^%{gopath}/src/.*$", "__gosymlink_requires" => "%{_rpmconfigdir}/gosymlink.deps requires --prefix \"%{buildroot}\" --go-path \"%{gopath}\"", "__gpg_reserved_space" => "4096", "__grep" => "/usr/bin/grep", "__gstreamer1_provides" => "%{_rpmconfigdir}/gstreamer1.prov", "__hg" => "/usr/bin/hg", "__id_u" => "%{__id} -u", "__isa" => "%{__isa_name}-%{__isa_bits}", "__isa_name" => "x86", "__kmod_provides" => "%{lua:\n  function basename(fn)\n      return string.gsub(fn, \"(.*/)(.*)\", \"%2\")\n  end\n  function printdep(mod)\n      print(\"kmod(\"..mod..\")\")\n  end\n  local fn = rpm.expand(\"%{1}\")\n  local bn = basename(fn)\n  if bn == \"modules.builtin\" then\n      for l in io.lines(fn) do\n          printdep(basename(l))\n      end\n  else\n      local mod = string.match(bn, \"%g+.ko\")\n      if mod then\n         printdep(mod)\n      end\n  end\n}", "__libsymlink_flags" => "magic_and_path", "__libsymlink_path" => "^.*.so$", "__ln_s" => "ln -s", "__lzip" => "/usr/bin/lzip", "__meson" => "/usr/bin/meson", "__meson_wrap_mode" => "nodownload", "__metainfo_provides" => "%{lua:\n  print(\"metainfo()\\n\")\n  print(string.format(\"metainfo(%s)\\n\", rpm.expand(\"%{basename:%1}\")))\n}", "__mkdir_p" => "/usr/bin/mkdir -p", "__ninja" => "/usr/bin/ninja", "__nodejs" => "%{_bindir}/node", "__nodejs_native_requires" => "%{_rpmconfigdir}/nodejs_native.req", "__nodejs_provides" => "%{_rpmconfigdir}/nodejs.prov", "__nodejs_suggests" => "%{_rpmconfigdir}/nodejs.req --optional", "__ocaml_flags" => "magic_and_path", "__ocaml_path" => ".(cma|cmi|cmo|cmx|cmxa|cmxs)$", "__ocaml_requires" => "%{_rpmconfigdir}/ocamldeps.sh --requires", "__os_install_post_python" => "\n    %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \n    %{?py_reproducible_pyc_path:%{?__brp_fix_pyc_reproducibility} \"%{py_reproducible_pyc_path}\"} \n    %{?__brp_python_hardlink} \n%{nil}", "__perl" => "%{_bindir}/perl", "__pkgconfig_provides" => "%{_rpmconfigdir}/pkgconfigdeps.sh --provides", "__plugindir" => "%{_libdir}/rpm-plugins", "__psdriver_path" => "^(/usr/lib/cups/driver/.*|%{_datadir}/cups/drv/.*.drv)$", "__pypi_default_extension" => "tar.gz", "__pytest" => "/usr/bin/pytest%(test %{python3_pkgversion} == 3 || echo -%{python3_version})", "__python2" => "/usr/bin/python2", "__python_path" => "^((%{_prefix}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$", "__python_requires" => "%{lua:\n    -- Match buildroot paths of the form\n    --    /PATH/OF/BUILDROOT/usr/lib/pythonMAJOR.MINOR/  and\n    --    /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/\n    -- generating a line of the form:\n    --    python(abi) = MAJOR.MINOR\n    local path = rpm.expand('%1')\n    if path:match('/usr/lib%d*/python%d+%.%d+/.*') then\n        local requires = path:gsub('.*/usr/lib%d*/python(%d+%.%d+)/.*', 'python(abi) = %1')\n        print(requires)\n    end\n}", "__pythondist_provides" => "%{_rpmconfigdir}/pythondistdeps.py --provides --normalized-names-format pep503 --package-name %{name} --normalized-names-provide-both --majorver-provides-versions %{__default_python3_version}", "__pythonname_path" => "^/", "__quilt" => "/usr/bin/quilt", "__scm" => "patch", "__scm_apply_gendiff(qp:m:)" => "\n%{__patch} %{-p:-p%{-p*}} %{-q:-s} --fuzz=%{_default_patch_fuzz} %{_default_patch_flags} -b --suffix \".%{2}\"", "__scm_apply_git_am(qp:m:)" => "\n%{__git} am --reject %{-q} %{-p:-p%{-p*}}", "__scm_apply_patch(qp:m:)" => "\n%{__patch} %{-p:-p%{-p*}} %{-q:-s} --fuzz=%{_default_patch_fuzz} %{_default_patch_flags}", "__scm_author" => "%{__scm_username} %{__scm_usermail}", "__scm_setup_gendiff(q)" => "%{nil}", "__scm_setup_git_am(q)" => "\n%{expand:%__scm_setup_git %{-q}}", "__scm_setup_patch(q)" => "%{nil}", "__scm_usermail" => "<rpm-build>", "__script_flags" => "exeonly", "__script_requires" => "%{_rpmconfigdir}/script.req", "__spec_build_args" => "%{___build_args}", "__spec_build_cmd" => "%{___build_cmd}", "__spec_build_pre" => "%{___build_pre}", "__spec_build_template" => "#!%{__spec_build_shell}\n%{__spec_build_pre}\n%{nil}", "__spec_buildrequires_body" => "%{___build_body}", "__spec_buildrequires_post" => "%{___build_post}", "__spec_buildrequires_shell" => "%{___build_shell}", "__spec_check_args" => "%{___build_args}", "__spec_check_cmd" => "%{___build_cmd}", "__spec_check_pre" => "%{___build_pre}", "__spec_check_template" => "#!%{__spec_check_shell}\n%{__spec_check_pre}\n%{nil}", "__spec_clean_body" => "%{___build_body}", "__spec_clean_post" => "%{___build_post}", "__spec_clean_shell" => "%{___build_shell}", "__spec_install_args" => "%{___build_args}", "__spec_install_cmd" => "%{___build_cmd}", "__spec_install_pre" => "%{___build_pre}\n    [ \"$RPM_BUILD_ROOT\" != \"/\" ] && rm -rf \"${RPM_BUILD_ROOT}\"\n    mkdir -p \"`dirname \"$RPM_BUILD_ROOT\"`\"\n    mkdir \"$RPM_BUILD_ROOT\"\n%{nil}", "__spec_install_template" => "#!%{__spec_install_shell}\n%{__spec_install_pre}\n%{nil}", "__spec_prep_body" => "%{___build_body}", "__spec_prep_post" => "%{___build_post}", "__spec_prep_shell" => "%{___build_shell}", "__spec_rmbuild_args" => "%{___build_args}", "__spec_rmbuild_cmd" => "%{___build_cmd}", "__spec_rmbuild_pre" => "%{___build_pre}", "__spec_rmbuild_template" => "#!%{__spec_rmbuild_shell}\n%{__spec_rmbuild_pre}\n%{nil}", "__systemd_someargs_0(:)" => "%{error:The %%%1 macro requires some arguments}", "__sysusers_path" => "^%{_sysusersdir}/.*\\.conf$", "__tar" => "/usr/bin/tar", "__transaction_dbus_announce" => "%{__plugindir}/dbus_announce.so", "__transaction_fsverity" => "%{__plugindir}/fsverity.so", "__transaction_prioreset" => "%{__plugindir}/prioreset.so", "__transaction_syslog" => "%{__plugindir}/syslog.so", "__unzip" => "/usr/bin/unzip", "__urlhelpercmd" => "/usr/bin/curl", "__vsflags" => "0xf0000", "__zstd" => "/usr/bin/zstd", "_annobin_gcc_plugin" => "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1", "_annotation_cflags" => "%[ \"%{_target_cpu}\" == \"armv7hl\" ? \"\" : \"%{_annotation_plugin}\" ]", "_annotation_plugin" => "%{?_annotated_build:%{expand:%%{_annobin_%{toolchain}_plugin}}}", "_binaries_in_noarch_packages_terminate_build" => "1", "_binary_payload" => "w19.zstdio", "_binfmtdir" => "/usr/lib/binfmt.d", "_build_alias" => "%{_host_alias}", "_build_cpu" => "%{_host_cpu}", "_build_name_fmt" => "%%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm", "_build_vendor" => "%{_host_vendor}", "_buildrootdir" => "%{_topdir}/BUILDROOT", "_changelog_trimage" => "%{expr:2*365*24*60*60}", "_clang_lto_cflags" => "-flto", "_cmake_shared_libs" => "-DBUILD_SHARED_LIBS:BOOL=ON", "_cmake_version" => "3.21.3", "_color_output" => "never", "_configure" => "./configure", "_configure_libtool_hardening_hack" => "1", "_datarootdir" => "%{_prefix}/share", "_dbpath" => "%{_var}/lib/rpm", "_debuginfo_subpackages" => "1", "_debugsource_packages" => "1", "_default_patch_flags" => "--no-backup-if-mismatch -f", "_defaultdocdir" => "%{_datadir}/doc", "_disable_source_fetch" => "1", "_duplicate_files_terminate_build" => "0", "_dwz_low_mem_die_limit" => "10000000", "_dwz_low_mem_die_limit_armv7hl" => "4000000", "_dwz_max_die_limit_armv5tel" => "10000000", "_dwz_max_die_limit_x86_64" => "110000000", "_empty_manifest_terminate_build" => "1", "_environmentdir" => "/usr/lib/environment.d", "_exec_prefix" => "%{_prefix}", "_file_context_file_pre" => "%{_localstatedir}/lib/rpm-state/file_contexts.pre", "_file_custom_defined_booleans_tmp" => "%{_selinux_store_policy_path}/rpmbooleans.custom.tmp", "_find_debuginfo_dwz_opts" => "--run-dwz\\\n   --dwz-low-mem-die-limit %{_dwz_limit _dwz_low_mem_die_limit}\\\n   --dwz-max-die-limit %{_dwz_limit _dwz_max_die_limit}", "_fixperms" => "%{__chmod} -Rf a+rX,u+w,g-w,o-w", "_fontbasedir" => "/usr/share/fonts", "_fontconfig_masterdir" => "/etc/fonts", "_gcc_lto_cflags" => "-flto=auto -ffat-lto-objects", "_gnu" => "-gnu", "_hardened_cflags" => "%{?_hardened_build:%{_hardening_cflags}}", "_hardening_cflags" => "%{expand:%%{_hardening_%{toolchain}_cflags}} -fstack-protector-strong", "_hardening_gcc_cflags" => "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1", "_hkp_keyserver" => "http://pgp.mit.edu", "_host" => "x86_64-redhat-linux-gnu", "_host_cpu" => "x86_64", "_host_vendor" => "redhat", "_include_gdb_index" => "1", "_includedir" => "%{_prefix}/include", "_initddir" => "%{_sysconfdir}/rc.d/init.d", "_install_langs" => "all", "_invalid_encoding_terminates_build" => "1", "_ivyxmldir" => "%{_datadir}/ivy-xmls", "_javadir" => "%{_datadir}/java", "_jnidir" => "%{_prefix}/lib/java", "_jvmcommondatadir" => "%{_datadir}/jvm-common", "_jvmcommonsysconfdir" => "%{_sysconfdir}/jvm-common", "_jvmdir" => "%{_prefix}/lib/jvm", "_jvmprivdir" => "%{_prefix}/lib/jvm-private", "_keyring" => "rpmdb", "_keyringsdir" => "%_datadir/keyrings", "_ld_as_needed_flags" => "%{?_ld_as_needed:-Wl,--as-needed}", "_legacy_options" => "%{?_legacy_common_support: -fcommon}", "_libdir" => "%{_prefix}/lib64", "_localstatedir" => "/var", "_make_output_sync" => "%(! %{__make} --version -O >/dev/null 2>&1 || echo -O)", "_mandir" => "%{_datarootdir}/man", "_metainfodir" => "%{_datadir}/metainfo", "_missing_doc_files_terminate_build" => "1", "_modulesloaddir" => "/usr/lib/modules-load.d", "_monogacdir" => "%{_monodir}/gac", "_os" => "linux", "_pam_libdir" => "%{_libdir}", "_pam_secconfdir" => "%{_sysconfdir}/security", "_pkgdocdir" => "%{_docdir}/%{name}", "_pkgverify_level" => "digest", "_preprocessor_defines" => "-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS", "_pyproject_builddir" => "%{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir", "_pyproject_modules" => "%{_builddir}/pyproject-modules", "_pyproject_wheeldir" => "%{_builddir}%{?buildsubdir:/%{buildsubdir}}/pyproject-wheeldir", "_python_bytecompile_extra" => "0", "_qt5_epoch" => "0", "_qt5_version" => "5.15.2", "_query_selector_match" => "default", "_rpmdir" => "%{_topdir}/RPMS", "_rpmlock_path" => "%{_dbpath}/.rpm.lock", "_rpmmacrodir" => "%{_rpmconfigdir}/macros.d", "_sbindir" => "%{_exec_prefix}/sbin", "_selinux_store_path" => "/var/lib/selinux", "_set_pytest_addopts" => "%global __pytest_addopts --ignore=%{_pyproject_builddir}", "_sharedstatedir" => "/var/lib", "_smp_build_nthreads" => "%{_smp_build_ncpus}", "_source_filedigest_algorithm" => "8", "_specdir" => "%{_topdir}/SPECS", "_swidtagdir" => "%{_prefix}/lib/swidtag/fedoraproject.org", "_sysconfdir" => "/etc", "_systemd_system_env_generator_dir" => "/usr/lib/systemd/system-environment-generators", "_systemd_util_dir" => "/usr/lib/systemd", "_systemdusergeneratordir" => "/usr/lib/systemd/user-generators", "_target" => "x86_64-linux", "_target_cpu" => "x86_64", "_target_platform" => "%{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}", "_texmf" => "/usr/share/texlive/texmf-local", "_texmf_main" => "/usr/share/texlive/texmf-dist", "_texmf_vendor" => "/usr/share/texlive/texmf-dist", "_tmppath" => "%{_var}/tmp", "_transaction_color" => "3", "_udevrulesdir" => "/usr/lib/udev/rules.d", "_unique_debug_names" => "1", "_unitdir" => "/usr/lib/systemd/system", "_urlhelper" => "%{__urlhelpercmd} %{?__urlhelper_localopts} %{?__urlhelper_proxyopts} %{__urlhelperopts}", "_userpresetdir" => "/usr/lib/systemd/user-preset", "_usr" => "/usr", "_var" => "/var", "_vpath_builddir" => "%{_vendor}-%{_target_os}-build", "_vsflags_build" => "%{__vsflags}", "_vsflags_install" => "%{__vsflags}", "_vsflags_rebuilddb" => "0xc0c00", "_warning_options" => "-Wall -Werror=format-security", "alpha" => "alpha alphaev56 alphaev6 alphaev67", "arm" => "%{arm32}", "arm64" => "aarch64", "autopatch(vp:m:M:)" => "%{lua:\nif #arg == 0 then\n    local lo = tonumber(rpm.expand(\"%{-m:%{-m*}}\"))\n    local hi = tonumber(rpm.expand(\"%{-M:%{-M*}}\"))\n    for i, n in ipairs(patch_nums) do\n        if ((not lo or n >= lo) and (not hi or n <= hi)) then\n            table.insert(arg, n)\n        end\n    end\nend\nlocal options = rpm.expand(\"%{!-v:-q} %{-p:-p%{-p*}} \")\nlocal bynum = {}\nfor i, p in ipairs(patches) do\n    bynum[patch_nums[i]] = p\nend\nfor i, a in ipairs(arg) do\n    local p = bynum[a]\n    if p then\n        print(rpm.expand(\"%__apply_patch -m %{basename:\"..p..\"}  \"..options..p..\" \"..i..\"\\n\"))\n    else\n        macros.error({\"no such patch \"..a})\n    end\nend\n}", "autosetup(a:b:cDn:TvNS:p:)" => "\n%setup %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{!-v:-q}\n%{-S:%global __scm %{-S*}}\n%{expand:%__scm_setup_%{__scm} %{!-v:-q}}\n%{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}", "bcond_with" => "%{expand:%%{?_with_%{1}:%%global with_%{1} 1}}", "binfmt_apply" => "\n%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# binfmt_apply}} \n[ -x /usr/lib/systemd/systemd-binfmt ] && /usr/lib/systemd/systemd-binfmt %{?*} || : \n%{nil}", "build_cflags" => "%{optflags}", "build_cxx" => "%{__cxx}", "build_fflags" => "%{optflags} -I%{_fmoddir}", "buildroot" => "%{_buildrootdir}/%{NAME}-%{VERSION}-%{RELEASE}.%{_arch}", "cmake" => "\n%if 0%{?set_build_flags:1} \n  %set_build_flags \n%else \n  CFLAGS=\"${CFLAGS:-%optflags}\" ; export CFLAGS ; \n  CXXFLAGS=\"${CXXFLAGS:-%optflags}\" ; export CXXFLAGS ; \n  FFLAGS=\"${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}\" ; export FFLAGS ; \n  FCFLAGS=\"${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}\" ; export FCFLAGS ; \n  %{?__global_ldflags:LDFLAGS=\"${LDFLAGS:-%__global_ldflags}\" ; export LDFLAGS ;} \n%endif \n  %__cmake \\\n        %{!?__cmake_in_source_build:-S \"%{_vpath_srcdir}\"} \\\n        %{!?__cmake_in_source_build:-B \"%{__cmake_builddir}\"} \\\n        -DCMAKE_C_FLAGS_RELEASE:STRING=\"-DNDEBUG\" \\\n        -DCMAKE_CXX_FLAGS_RELEASE:STRING=\"-DNDEBUG\" \\\n        -DCMAKE_Fortran_FLAGS_RELEASE:STRING=\"-DNDEBUG\" \\\n        -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\n        -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF \\\n        -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\n        -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\n        -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\n        -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\n        -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\n%if \"%{?_lib}\" == \"lib64\" \n        %{?_cmake_lib_suffix64} \\\n%endif \n        %{?_cmake_shared_libs}", "cmake3_build" => "%cmake_build", "cmake_build" => "\n  %__cmake --build \"%{__cmake_builddir}\" %{?_smp_mflags} --verbose", "configure" => "\n  %{set_build_flags}; \n  [ \"%{_lto_cflags}\"x != x ] && %{_fix_broken_configure_for_lto}; \n  [ \"%_configure_gnuconfig_hack\" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \n      [ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \n  done ; \n  [ \"%_configure_libtool_hardening_hack\" = 1 ] && [ x != \"x%{_hardened_ldflags}\" ] && \n      for i in $(find . -name ltmain.sh) ; do \n        %{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags=\"%{_hardened_ldflags}\"~' $i \n      done ; \n  %{_configure} --build=%{_build} --host=%{_host} \\\n\t--program-prefix=%{?_program_prefix} \\\n\t--disable-dependency-tracking \\\n\t%{?_configure_disable_silent_rules:--disable-silent-rules} \\\n\t--prefix=%{_prefix} \\\n\t--exec-prefix=%{_exec_prefix} \\\n\t--bindir=%{_bindir} \\\n\t--sbindir=%{_sbindir} \\\n\t--sysconfdir=%{_sysconfdir} \\\n\t--datadir=%{_datadir} \\\n\t--includedir=%{_includedir} \\\n\t--libdir=%{_libdir} \\\n\t--libexecdir=%{_libexecdir} \\\n\t--localstatedir=%{_localstatedir} \\\n\t--sharedstatedir=%{_sharedstatedir} \\\n\t--mandir=%{_mandir} \\\n\t--infodir=%{_infodir}", "ctest(:-:)" => "\n  cd \"%{__cmake_builddir}\" \n  %__ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} %{**} \n  cd -", "debug_package" => "\n%ifnarch noarch\n%global __debug_package 1\n%_debuginfo_template\n%{?_debugsource_packages:%_debugsource_template}\n%endif\n%{nil}", "define" => "<builtin>", "dirname" => "<builtin>", "dnl" => "<builtin>", "echo" => "<builtin>", "efi_alt_arch" => "%{expand:%{_efi_srpm_macros_setup}}%{?_efi_alt_arch}%{nil}", "efi_arch" => "%{expand:%{_efi_srpm_macros_setup}}%{_efi_arch}", "efi_build_requires" => "bash coreutils", "efi_esp_dir" => "%{expand:%{_efi_srpm_macros_setup}}%{efi_esp_efi}/%{efi_vendor}", "efi_esp_root" => "/boot/efi", "efi_has_arch" => "%{expand:%{_efi_srpm_macros_setup}}0%{_efi_has_arch}", "efi_vendor" => "%{expand:%{_efi_srpm_macros_setup}}%{expand:%{_efi_vendor}}", "exists" => "<builtin>", "expr" => "<builtin>", "extension_cxxflags" => "%{__extension_strip_flags cxxflags}", "extension_ldflags" => "%{__extension_strip_flags ldflags}", "fedora" => "35", "filter_from_requires" => "%{expand: \n%global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \n}", "filter_requires_in(P)" => "%{expand: \n%global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \n}", "find_lang" => "%{_rpmconfigdir}/find-lang.sh %{buildroot}", "fontcontact" => "fonts@lists.fedoraproject.org", "fontmetapkg(n:s:d:z:)" => "%{lua:\nlocal        fonts = require \"fedora.srpm.fonts\"\nlocal         name = rpm.expand(\"%{?-n*}\")\nlocal      summary = rpm.expand(\"%{?-s*}\")\nif (summary ~= \"\") then\n           summary = \"%{\" .. summary .. \"}\"\nend\nlocal  description = rpm.expand(\"%{?-d*}\")\nif (description ~= \"\") then\n       description = \"%{\" .. description .. \"}\"\nend\nlocal     suffixes = rpm.expand(\"%{?-z*}\")\nfonts.metapkg(name, summary, description, suffixes)\n}", "fontpkg(z:avms)" => "%{lua:\nlocal      fonts =  require \"fedora.srpm.fonts\"\nlocal     suffix =  rpm.expand(\"%{?-z*}\")\nlocal processall = (rpm.expand(\"%{-a}\") ~= \"\") and (rpm.expand(\"%{-z}\") == \"\")\nlocal    verbose = (rpm.expand(\"%{-v}\") ~= \"\")\nlocal  forcemain = (rpm.expand(\"%{-m}\") ~= \"\")\nlocal   forcesub = (rpm.expand(\"%{-s}\") ~= \"\")\nfonts.pkg(forcemain, forcesub, suffix, processall, verbose)\n}", "forgeautosetup(z:vNS:p:q)" => "%{lua:\nprint(rpm.expand(\"%autosetup %{-v} %{-N} %{?-S} %{?-p} %{?forgesetupargs\" .. rpm.expand(\"%{-z*}\") .. \"}\\n\"))\n}", "forgesetup(z:va)" => "%{lua:\nlocal fedora = require \"fedora.common\"\nif (rpm.expand(\"%{-z}\") == \"\") and (rpm.expand(\"%{-a}\") ~= \"\") then\n  for _,s in pairs(fedora.getsuffixes(\"forgesetupargs\")) do\n    print(rpm.expand(\"%setup %{!-v:-q} %{?forgesetupargs\" .. s                     .. \"}\\n\"))\n  end\nelse\n  print(  rpm.expand(\"%setup %{!-v:-q} %{?forgesetupargs\" .. rpm.expand(\"%{-z*}\") .. \"}\\n\"))\nend\n}", "gccgo_arches" => "mips mipsel mipsr6 mipsr6el mips64 mips64el mips64r6 mips64r6el", "getconfdir" => "<builtin>", "getncpus" => "<builtin>", "ghc_arches_with_ghci" => "%{ix86} x86_64 armv7hl ppc64 ppc64le aarch64 s390 s390x %{mips}", "global" => "<builtin>", "go_compiler" => "1", "goaltfiles(z:av)" => "%{lua:\nlocal         go =  require \"fedora.srpm.go\"\nlocal     suffix =  rpm.expand(\"%{-z*}\")\nlocal processall = (rpm.expand(\"%{-a}\") ~= \"\") and (rpm.expand(\"%{-z}\") == \"\")\nlocal    verbose = (rpm.expand(\"%{-v}\") ~= \"\")\ngo.files(\"alt\", suffix, processall, verbose)\n}", "goaltpkg(z:av)" => "%{lua:\nlocal         go =  require \"fedora.srpm.go\"\nlocal     suffix =  rpm.expand(\"%{-z*}\")\nlocal processall = (rpm.expand(\"%{-a}\") ~= \"\") and (rpm.expand(\"%{-z}\") == \"\")\nlocal    verbose = (rpm.expand(\"%{-v}\") ~= \"\")\ngo.pkg(\"alt\", suffix, processall, verbose)\n}", "gobuildflags" => "%{expand:%{gocompilerflags} -tags=\\\"rpm_crashtraceback \\\" -ldflags \\\"${LDFLAGS:-} %{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -compressdwarf=false -extldflags '%__global_ldflags %{?__golang_extldflags}'\\\" -a -v -x}", "gocheck(z:ai:b:s:vd:t:rV:T:C:B:p:g:w)" => "%{lua:\nlocal       fedora =  require \"fedora.common\"\nlocal   processall = (rpm.expand(\"%{-a}\") ~= \"\") and (rpm.expand(\"%{-z}\") == \"\")\nlocal   myenvflags =  rpm.expand('%{?-i} %{?-v} %{?-V} %{?-T} %{?-C} %{?-B}')\nlocal mycheckflags =  rpm.expand('%{!-i:-i \"%%{currentgoipath}\" }'                     ..\n                                 '%{!-b:-b \"%%{gobuilddir}/bin\" }'                     ..\n                                 '%{!-s:-s \"%%{gobuilddir}\" }'                         ..\n                                 '%{!-V:-V \"%{version}-%{release}\" }'                  ..\n                                 '%{!-T:%%{?currenttag:    -T \"%%{?currenttag}\" }}'    ..\n                                 '%{!-C:%%{?currentcommit: -C \"%%{?currentcommit}\" }}' ..\n                                 '%{!-B:%%{?currentbranch: -B \"%%{?currentbranch}\" }}' ..\n                                 '%{!-p:-p \"%{buildroot}\" }'                           ..\n                                 '%{!-g:-g \"%{gopath}\" }'                              ..\n                                 '%{?gocheckflags} %{?**}')", "gochecks(z:ai:b:s:vd:t:rV:T:C:B:p:g:w)" => "%{expand:\n%{warn:%%gochecks is obsolete, use %%gocheck in %%check instead!}\n%gocheck %{-z} %{-a} %{-i} %{-b} %{-s} %{-v} %{-d} %{-t} %{-r} %{-V} %{-T} %{-C} %{-B} %{-p} %{-g} %{-w}\n}", "gocompilerflags" => "-buildmode pie -compiler gc", "godevelfiles(z:av)" => "%{lua:\nlocal         go =  require \"fedora.srpm.go\"\nlocal     suffix =  rpm.expand(\"%{-z*}\")\nlocal processall = (rpm.expand(\"%{-a}\") ~= \"\") and (rpm.expand(\"%{-z}\") == \"\")\nlocal    verbose = (rpm.expand(\"%{-v}\") ~= \"\")\ngo.files(\"devel\", suffix, processall, verbose)\n}", "godevelpkg(z:av)" => "%{lua:\nlocal         go =  require \"fedora.srpm.go\"\nlocal     suffix =  rpm.expand(\"%{-z*}\")\nlocal processall = (rpm.expand(\"%{-a}\") ~= \"\") and (rpm.expand(\"%{-z}\") == \"\")\nlocal    verbose = (rpm.expand(\"%{-v}\") ~= \"\")\ngo.pkg(\"devel\", suffix, processall, verbose)\n}", "gofilelist" => "devel.file-list", "goinstall(z:ai:b:s:o:O:ve:d:t:rV:T:C:B:p:g:)" => "%{lua:\nlocal         fedora =  require \"fedora.common\"\nlocal     processall = (rpm.expand(\"%{-a}\") ~= \"\") and (rpm.expand(\"%{-z}\") == \"\")\nlocal     myenvflags =  rpm.expand('%{?-i} %{?-v} %{?-V} %{?-T} %{?-C} %{?-B}')\nlocal myinstallflags =  rpm.expand('%{!-i:-i \"%%{currentgoipath}\" }'                     ..\n                                   '%{!-b:-b \"%%{gobuilddir}/bin\" }'                     ..\n                                   '%{!-s:-s \"%%{gobuilddir}\" }'                         ..\n                                   '%{!-o:-o \"%%{thisgofilelist}\" }'                     ..\n                                   '%{!-O:-O \"%%{goworkdir}\" }'                          ..\n                                   '%{!-V:-V \"%{version}-%{release}\" }'                  ..\n                                   '%{!-T:%%{?currenttag:    -T \"%%{?currenttag}\" }}'    ..\n                                   '%{!-C:%%{?currentcommit: -C \"%%{?currentcommit}\" }}' ..\n                                   '%{!-B:%%{?currentbranch: -B \"%%{?currentbranch}\" }}' ..\n                                   '%{!-p:-p \"%{buildroot}\" }'                           ..\n                                   '%{!-g:-g \"%{gopath}\" }'                              ..\n                                   '%{?goinstallflags} %{?**}')", "golang_arches" => "i386 i486 i586 i686 pentium3 pentium4 athlon geode x86_64 armv3l armv4b armv4l armv4tl armv5tl armv5tel armv5tejl armv6l armv6hl armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl aarch64 ppc64le s390x", "gomkdir(z:i:b:s:kv)" => "%{expand:\n%goenv %{?-z} %{?-i} %{?-v}\n%define mybuilddir  %{?-b*}%{!-b:%{gobuilddir}}\n%define mygoipath   %{?-i*}%{!-i:%{currentgoipath}}\n%define mysourcedir %{?-s*}%{!-s:%{currentgosourcedir}}\n%{!?-k:rm -fr         \"%{mysourcedir}/vendor\"}\nif [[ ! -e            \"%{mybuilddir}/bin\" ]] ; then\n  install -m 0755 -vd \"%{mybuilddir}/bin\"\n  export GOPATH=\"%{mybuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}\"\nfi\nif [[ ! -e                      \"%{mybuilddir}/src/%{mygoipath}\" ]] ; then\n  install -m 0755 -vd \"$(dirname %{mybuilddir}/src/%{mygoipath})\"\n  ln -fs \"%{mysourcedir}\"       \"%{mybuilddir}/src/%{mygoipath}\"\nfi\ncd                              \"%{mybuilddir}/src/%{mygoipath}\"\n}", "gopath" => "/usr/share/gocode", "gopkgfiles(av)" => "%{expand:\n%godevelfiles -a %{-v}\n%goaltfiles   -a %{-v}\n}", "goprep(z:ai:b:s:kerv)" => "%{lua:\nlocal        fedora =  require \"fedora.common\"\nlocal       extract = (rpm.expand(\"%{-e}\") == \"\")\nlocal   installdeps = (rpm.expand(\"%{-r}\") == \"\")\nlocal    processall = (rpm.expand(\"%{-a}\") ~= \"\") and (rpm.expand(\"%{-z}\") == \"\")\nlocal    setupflags =  rpm.expand(\"%{!-v:-q}\")\nlocal  gomkdirflags =  rpm.expand(\"%{?-i} %{?-b} %{?-s} %{-k} %{-v}\")\nlocal buildrequires = {}\nlocal function process(suffix)\n  local zsuffix = \"\"\n  if (suffix ~= \"\") and (suffix ~= nil) then\n        zsuffix = \"-z \" .. suffix .. \" \"\n  end\n  if extract then\n    print(rpm.expand(\"%setup \" .. setupflags .. \" %{?forgesetupargs\" .. suffix .. \"}\\n\"))\n  end\n  print(  rpm.expand(\"%gomkdir \" .. zsuffix .. gomkdirflags .. \"\\n\"))\nend", "goprovflags" => "%{godefaultflags}", "gorpmname(c:)" => "%{lua:\nlocal go = require \"fedora.srpm.go\"\nprint(go.rpmname(\"%1\", \"%{-c*}\"))\n}", "gotestextldflags" => "%__global_ldflags %{?__golang_extldflags}", "gpgverify(k:s:d:)" => "%{lua:\nlocal script = rpm.expand(\"%{_rpmconfigdir}/redhat/gpgverify \")\nlocal keyring = rpm.expand(\"%{-k*}\")\nlocal signature = rpm.expand(\"%{-s*}\")\nlocal data = rpm.expand(\"%{-d*}\")\nprint(script)\nif keyring ~= \"\" then\n  print(rpm.expand(\"--keyring='%{SOURCE\" .. keyring ..  \"}' \"))\nend\nif signature ~= \"\" then\n  print(rpm.expand(\"--signature='%{SOURCE\" .. signature ..  \"}' \"))\nend\nif data ~= \"\" then\n  print(rpm.expand(\"--data='%{SOURCE\" .. data ..  \"}' \"))\nend\n}", "ix86" => "i386 i486 i586 i686 pentium3 pentium4 athlon geode", "java" => "%(. /usr/share/java-utils/java-functions; set_javacmd; echo $JAVACMD)", "javac" => "%{java_home}/bin/javac", "journal_catalog_update" => "%{nil}", "kernel_arches" => "x86_64 s390x ppc64le aarch64 %{arm}", "ldconfig_post(n:)" => "%{?ldconfig:%post -p %ldconfig %{?*} %{-n:-n %{-n*}}\n%end}", "ldconfig_scriptlets(n:)" => "%{?ldconfig:\n%ldconfig_post %{?*} %{-n:-n %{-n*}}\n%ldconfig_postun %{?*} %{-n:-n %{-n*}}\n}", "listfiles(i:x:)" => "%{expand:\n%if %{lua: print(string.len(rpm.expand(\"%{?-i*}%{?listfiles_include}%*\")))}\n  listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u)\n  %if  %{lua: print(string.len(rpm.expand(\"%{?-x*}%{?listfiles_exclude}\")))}\n    while IFS= read -r finc ; do\n      realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\\n        | sort -u | grep -q \"${finc}\" || echo \"${finc}\"\n    done <<< \"${listfiles_include}\"\n  %else\n    echo \"${listfiles_include}\"\n  %endif\n%endif\n}", "lua" => "<builtin>", "lua_version" => "%{lua: print(string.sub(_VERSION, 5))}", "make_build" => "%{__make} %{_make_output_sync} %{?_smp_mflags} %{_make_verbose}", "makeinstall" => "\n  echo \"warning: %%makeinstall is deprecated, try %%make_install instead\" 1>&2\n  %{__make} \\\n\tprefix=%{?buildroot:%{buildroot}}%{_prefix} \\\n\texec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\n\tbindir=%{?buildroot:%{buildroot}}%{_bindir} \\\n\tsbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\n\tsysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\n\tdatadir=%{?buildroot:%{buildroot}}%{_datadir} \\\n\tincludedir=%{?buildroot:%{buildroot}}%{_includedir} \\\n\tlibdir=%{?buildroot:%{buildroot}}%{_libdir} \\\n\tlibexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\n\tlocalstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\n\tsharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\n\tmandir=%{?buildroot:%{buildroot}}%{_mandir} \\\n\tinfodir=%{?buildroot:%{buildroot}}%{_infodir} \\\n  install", "meson_build" => "\n    %{shrink:%{__meson} compile \n        -C %{_vpath_builddir} \n        -j %{_smp_build_ncpus} \n        --verbose \n        %{nil}}", "meson_test" => "\n    %{shrink:%{__meson} test \n        -C %{_vpath_builddir} \n        --num-processes %{_smp_build_ncpus} \n        --print-errorlogs \n        %{nil}}", "mips32" => "mips mipsel mipsr6 mipsr6el", "mipseb" => "mips mipsr6 mips64 mips64r6", "mono_arches" => "%{ix86} x86_64 sparc sparcv9 ia64 %{arm} aarch64 alpha s390x ppc ppc64 ppc64le", "nil" => "%{!?nil}", "ninja_build" => "\n    %{__ninja} %{__ninja_common_opts}", "ninja_test" => "\n    %{__ninja} test %{__ninja_common_opts}", "nodejs_default_filter" => "%{expand: \n%global __provides_exclude_from ^%{nodejs_sitearch}/.*\\.node$\n}", "nodejs_fixdep" => "%{_rpmconfigdir}/nodejs-fixdep", "nodejs_sitearch" => "%{nodejs_sitelib}", "nodejs_symlink_deps" => "%{_rpmconfigdir}/nodejs-symlink-deps %{nodejs_sitelib}", "ocaml_natdynlink" => "aarch64 %{arm} %{ix86} ppc ppc64 ppc64le riscv64 s390x sparc sparcv9 x86_64", "ocaml_native_profiling" => "%{nil}", "optflags" => "%{__global_compiler_flags} -m64 %{__cflags_arch_x86_64} -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection", "pkgconfig_personalitydir" => "/usr/share/pkgconfig/personality.d", "py2_build" => "%{expand:\\\n  sleep 1\n  CFLAGS=\"${CFLAGS:-${RPM_OPT_FLAGS}}\" LDFLAGS=\"${LDFLAGS:-${RPM_LD_FLAGS}}\"\\\n  %{__python2} %{py_setup} %{?py_setup_args} build --executable=\"%{__python2} %{py2_shbang_opts}\" %{?*}\n  sleep 1\n}", "py2_build_wheel" => "%{expand:\\\n  sleep 1\n  CFLAGS=\"${CFLAGS:-${RPM_OPT_FLAGS}}\" LDFLAGS=\"${LDFLAGS:-${RPM_LD_FLAGS}}\"\\\n  %{__python2} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}\n  sleep 1\n}", "py2_install" => "%{expand:\\\n  CFLAGS=\"${CFLAGS:-${RPM_OPT_FLAGS}}\" LDFLAGS=\"${LDFLAGS:-${RPM_LD_FLAGS}}\"\\\n  %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}\n  rm -rfv %{buildroot}%{_bindir}/__pycache__\n}", "py2_install_wheel" => "%{expand:\\\n  %{__python2} -m pip install -I dist/%{1} --root %{buildroot} --no-deps --no-index --no-warn-script-location\n  rm -rfv %{buildroot}%{_bindir}/__pycache__\n  for distinfo in %{buildroot}%{python2_sitelib}/*.dist-info %{buildroot}%{python2_sitearch}/*.dist-info; do\n    if [ -f ${distinfo}/direct_url.json ]; then\n      rm -fv ${distinfo}/direct_url.json\n      sed -i '/direct_url.json/d' ${distinfo}/RECORD\n    fi\n  done\n}", "py2_shbang_opts_nodash" => "%(opts=%{py2_shbang_opts}; echo ${opts#-})", "py2_shebang_flags" => "%(opts=%{py2_shbang_opts}; echo ${opts#-})", "py3_build_egg" => "%{expand:\\\n  CFLAGS=\"${CFLAGS:-${RPM_OPT_FLAGS}}\" LDFLAGS=\"${LDFLAGS:-${RPM_LD_FLAGS}}\"\\\n  %{__python3} %{py_setup} %{?py_setup_args} bdist_egg %{?*}\n}", "py3_check_import(e:tf:)" => "%{expand:\\\n  PATH=\"%{buildroot}%{_bindir}:$PATH\"\\\n  PYTHONPATH=\"${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}\"\\\n  _PYTHONSITE=\"%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}\"\\\n  PYTHONDONTWRITEBYTECODE=1\\\n  %{lua:\n  local command = \"%{__python3} \"\n  if rpm.expand(\"%{?py3_shebang_flags}\") ~= \"\" then\n    command = command .. \"-%{py3_shebang_flags}\"\n  end\n  command = command .. \" %{_rpmconfigdir}/redhat/import_all_modules.py \"\n  -- handle multiline arguments correctly, see https://bugzilla.redhat.com/2018809\n  local args=rpm.expand('%{?**}'):gsub(\"[%s\\\\]*%s+\", \" \")\n  print(command .. args)\n  }\n}", "py3_install" => "%{expand:\\\n  CFLAGS=\"${CFLAGS:-${RPM_OPT_FLAGS}}\" LDFLAGS=\"${LDFLAGS:-${RPM_LD_FLAGS}}\"\\\n  %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}\n  rm -rfv %{buildroot}%{_bindir}/__pycache__\n}", "py3_install_wheel" => "%{expand:\\\n  %{__python3} -m pip install -I dist/%{1} --root %{buildroot} --no-deps --no-index --no-warn-script-location\n  rm -rfv %{buildroot}%{_bindir}/__pycache__\n  for distinfo in %{buildroot}%{python3_sitelib}/*.dist-info %{buildroot}%{python3_sitearch}/*.dist-info; do\n    if [ -f ${distinfo}/direct_url.json ]; then\n      rm -fv ${distinfo}/direct_url.json\n      sed -i '/direct_url.json/d' ${distinfo}/RECORD\n    fi\n  done\n}", "py3_shbang_opts_nodash" => "%(opts=%{py3_shbang_opts}; echo ${opts#-})", "py3_shebang_flags" => "%(opts=%{py3_shbang_opts}; echo ${opts#-})", "py_auto_byte_compile" => "1", "py_build_egg" => "%{expand:\\\n  CFLAGS=\"${CFLAGS:-${RPM_OPT_FLAGS}}\" LDFLAGS=\"${LDFLAGS:-${RPM_LD_FLAGS}}\"\\\n  %{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*}\n}", "py_byte_compile" => "\npy2_byte_compile () {\n    python_binary=\"env PYTHONHASHSEED=0 %1\"\n    bytecode_compilation_path=\"%2\"\n    failure=0\n    find $bytecode_compilation_path -type f -a -name \"*.py\" -print0 | xargs -0 $python_binary -s -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition(\"'\"$RPM_BUILD_ROOT\"'\")[2], doraise=True) for f in sys.argv[1:]]' || failure=1\n    find $bytecode_compilation_path -type f -a -name \"*.py\" -print0 | xargs -0 $python_binary -s -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition(\"'\"$RPM_BUILD_ROOT\"'\")[2], doraise=True) for f in sys.argv[1:]]' || failure=1\n    test $failure -eq 0\n}\n\npy3_byte_compile () {\n    python_binary=\"env PYTHONHASHSEED=0 %1\"\n    bytecode_compilation_path=\"%2\"\n    PYTHONPATH=\"%{_rpmconfigdir}/redhat\" $python_binary -s -B -m compileall2 -o 0 -o 1 -s $RPM_BUILD_ROOT -p / $bytecode_compilation_path \n}\n\npy39_byte_compile () {\n    python_binary=\"env PYTHONHASHSEED=0 %1\"\n    bytecode_compilation_path=\"%2\"\n    $python_binary -s -B -m compileall -o 0 -o 1 -s $RPM_BUILD_ROOT -p / $bytecode_compilation_path \n}\n\n# Path to intepreter should not contain any arguments \n[[ \"%1\" =~ \" -\" ]] && echo \"ERROR py_byte_compile: Path to interpreter should not contain any arguments\" >&2 && exit 1 \n# Get version without a dot (36 instead of 3.6), bash doesn't compare floats well \npython_version=$(%1 -c \"import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))\") \n# compileall2 is an enhanced fork of stdlib compileall module for Python >= 3.4 \n# and it was merged back to stdlib in Python >= 3.9 \nif [ \"$python_version\" -ge 39 ]; then \npy39_byte_compile \"%1\" \"%2\"; \nelif [ \"$python_version\" -ge 34 ]; then \npy3_byte_compile \"%1\" \"%2\"; \nelse \npy2_byte_compile \"%1\" \"%2\"; \nfi", "py_dist_name" => "%{lua:\n        name = rpm.expand(\"%{?1:%{1}}\");\n        canonical = string.gsub(string.lower(name), \"[^%w%[%]]+\", \"-\");\n        print(canonical);\n}", "py_install_egg" => "%{expand:\\\n  mkdir -p %{buildroot}%{python_sitelib}\n  %{__python} -m easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*}\n  rm -rfv %{buildroot}%{_bindir}/__pycache__\n}", "py_provides" => "%{lua:\n    local python = require 'fedora.srpm.python'\n    local name = rpm.expand('%1')\n    if name == '%1' then\n        rpm.expand('%{error:%%py_provides requires at least 1 argument, the name to provide}')\n    end\n    local evr = rpm.expand('%2')\n    if evr == '%2' then\n        evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')\n    end\n    print('Provides: ' .. name .. ' = ' .. evr .. '\\n')\n    local provides = python.python_altprovides(name, evr)\n    for i, provide in ipairs(provides) do\n        print('Provides: ' .. provide .. '\\n')\n    end\n}", "py_shbang_opts" => "-s", "py_shebang_fix" => "%{expand:\\\n  if [ -f /usr/bin/pathfix%{python_version}.py ]; then\n    pathfix=/usr/bin/pathfix%{python_version}.py\n  else\n    # older versions of Python don't have it and must BR /usr/bin/pathfix.py from python3-devel explicitly\n    pathfix=/usr/bin/pathfix.py\n  fi\n  if [ -z \"%{?py_shebang_flags}\" ]; then\n    shebang_flags=\"-k\"\n  else\n    shebang_flags=\"-ka%{py_shebang_flags}\"\n  fi\n  $pathfix -pni %{__python} $shebang_flags}", "pycached" => "%{lua:\n  path = rpm.expand(\"%{?*}\")\n  if (string.sub(path, \"-3\") ~= \".py\") then\n    rpm.expand(\"%{error:%%pycached can only be used with paths explicitly ending with .py}\")\n  else\n    print(path)\n    pyminor = path:match(\"/python3.(%d+)/\") or \"*\"\n    dirname = path:match(\"(.*/)\")\n    modulename = path:match(\".*/([^/]+).py\")\n    print(\"\\n\" .. dirname .. \"__pycache__/\" .. modulename .. \".cpython-3\" .. pyminor .. \"{,.opt-?}.pyc\")\n  end\n}", "pyproject_buildrequires(rxtNe:)" => "%{expand:\\\n%{-N:\n%{-r:%{error:The -N and -r options are mutually exclusive}}\n%{-x:%{error:The -N and -x options are mutually exclusive}}\n%{-e:%{error:The -N and -e options are mutually exclusive}}\n%{-t:%{error:The -N and -t options are mutually exclusive}}\n}\n%{-e:%{expand:%global toxenv %(%{__python3} -s %{_rpmconfigdir}/redhat/pyproject_construct_toxenv.py %{?**})}}\necho 'python%{python3_pkgversion}-devel'\necho 'python%{python3_pkgversion}dist(pip) >= 19'\necho 'python%{python3_pkgversion}dist(packaging)'\n%{!-N:if [ -f pyproject.toml ]; then\n  echo 'python%{python3_pkgversion}dist(toml)'\nelif [ -f setup.py ]; then\n  # Note: If the default requirements change, also change them in the script!\n  echo 'python%{python3_pkgversion}dist(setuptools) >= 40.8'\n  echo 'python%{python3_pkgversion}dist(wheel)'\nelse\n  echo 'ERROR: Neither pyproject.toml nor setup.py found, consider using %%%%pyproject_buildrequires -N <requirements-file> if this is not a Python package.' >&2\n  exit 1\nfi}\n# setuptools assumes no pre-existing dist-info\nrm -rfv *.dist-info/ >&2\nif [ -f %{__python3} ]; then\n  RPM_TOXENV=\"%{toxenv}\" HOSTNAME=\"rpmbuild\" %{__python3} -s %{_rpmconfigdir}/redhat/pyproject_buildrequires.py %{?!_python_no_extras_requires:--generate-extras} --python3_pkgversion %{python3_pkgversion} %{?**}\nfi\n}", "pyproject_extras_subpkg(n:i:f:F)" => "%{expand:%{?python_extras_subpkg:%{python_extras_subpkg%{?!-i:%{?!-f:%{?!-F: -f %{_pyproject_ghost_distinfo}}}} %**}}}", "pyproject_install" => "%{expand:\\\nspecifier=$(ls %{_pyproject_wheeldir}/*.whl | xargs basename --multiple | sed -E 's/([^-]+)-([^-]+)-.+\\.whl/\\1==\\2/')\nTMPDIR=\"%{_pyproject_builddir}\" %{__python3} -m pip install --root %{buildroot} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links %{_pyproject_wheeldir} $specifier\nif [ -d %{buildroot}%{_bindir} ]; then\n  %py3_shebang_fix %{buildroot}%{_bindir}/*\n  rm -rfv %{buildroot}%{_bindir}/__pycache__\nfi\nrm -f %{_pyproject_ghost_distinfo}\nsite_dirs=()\n# Process %%{python3_sitelib} if exists\nif [ -d %{buildroot}%{python3_sitelib} ]; then\n  site_dirs+=( \"%{python3_sitelib}\" )\nfi\n# Process %%{python3_sitearch} if exists and does not equal to %%{python3_sitelib}\nif [ %{buildroot}%{python3_sitearch} != %{buildroot}%{python3_sitelib} ] && [ -d %{buildroot}%{python3_sitearch} ]; then\n  site_dirs+=( \"%{python3_sitearch}\" )\nfi\n# Process all *.dist-info dirs in sitelib/sitearch\nfor site_dir in ${site_dirs[@]}; do\n  for distinfo in %{buildroot}$site_dir/*.dist-info; do\n    echo \"%ghost ${distinfo#%{buildroot}}\" >> %{_pyproject_ghost_distinfo}\n    sed -i 's/pip/rpm/' ${distinfo}/INSTALLER\n    PYTHONPATH=%{_rpmconfigdir}/redhat \\\n      %{__python3} -B %{_rpmconfigdir}/redhat/pyproject_preprocess_record.py \\\n      --buildroot %{buildroot} --record ${distinfo}/RECORD --output %{_pyproject_record}\n    rm -fv ${distinfo}/RECORD\n    rm -fv ${distinfo}/REQUESTED\n  done\ndone\nlines=$(wc -l %{_pyproject_ghost_distinfo} | cut -f1 -d\" \")\nif [ $lines -ne 1 ]; then\n  echo -e \"\\n\\nWARNING: %%%%pyproject_extras_subpkg won't work without explicit -i or -F, found $lines dist-info directories.\\n\\n\" >&2\n  rm %{_pyproject_ghost_distinfo}  # any attempt to use this will fail\nfi\n}", "pyproject_wheel" => "%{expand:\\\n%_set_pytest_addopts\nmkdir -p \"%{_pyproject_builddir}\"\nCFLAGS=\"${CFLAGS:-${RPM_OPT_FLAGS}}\" LDFLAGS=\"${LDFLAGS:-${RPM_LD_FLAGS}}\" TMPDIR=\"%{_pyproject_builddir}\" \\\n%{__python3} -m pip wheel --wheel-dir %{_pyproject_wheeldir} --no-deps --use-pep517 --no-build-isolation --disable-pip-version-check --no-clean --progress-bar off --verbose .\n}", "python" => "%__python", "python2_platform" => "%(%{__python2} -Esc \"import sysconfig; print(sysconfig.get_platform())\")", "python2_sitelib" => "%(%{__python2} -Esc \"from distutils.sysconfig import get_python_lib; print(get_python_lib())\")", "python2_version_nodots" => "%(%{__python2} -Esc \"import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))\")", "python3_ext_suffix" => "%(%{__python3} -Ic \"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))\")", "python3_platform" => "%(%{__python3} -Ic \"import sysconfig; print(sysconfig.get_platform())\")", "python3_sitearch" => "%(%{__python3} -Ic \"import sysconfig; print(sysconfig.get_path('platlib'))\")", "python3_version" => "%(%{__python3} -Ic \"import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))\")", "python_disable_dependency_generator" => "\n%undefine __pythondist_requires \n%{nil}", "python_extras_subpkg(n:i:f:F)" => "%{expand:%{lua:\n    local option_n = '-n (name of the base package)'\n    local option_i = '-i (buildroot path to metadata)'\n    local option_f = '-f (builddir path to a filelist)'\n    local option_F = '-F (skip %%files section)'\n    local value_n = rpm.expand('%{-n*}')\n    local value_i = rpm.expand('%{-i*}')\n    local value_f = rpm.expand('%{-f*}')\n    local value_F = rpm.expand('%{-F}')\n    local args = rpm.expand('%{*}')\n    if value_n == '' then\n        rpm.expand('%{error:%%%0: missing option ' .. option_n .. '}')\n    end\n    if value_i == '' and value_f == '' and value_F == '' then\n        rpm.expand('%{error:%%%0: missing option ' .. option_i .. ' or ' .. option_f .. ' or ' .. option_F .. '}')\n    end\n    if value_i ~= '' and value_f ~= '' then\n        rpm.expand('%{error:%%%0: simultaneous ' .. option_i .. ' and ' .. option_f .. ' options are not possible}')\n    end\n    if value_i ~= '' and value_F ~= '' then\n        rpm.expand('%{error:%%%0: simultaneous ' .. option_i .. ' and ' .. option_F .. ' options are not possible}')\n    end\n    if value_f ~= '' and value_F ~= '' then\n        rpm.expand('%{error:%%%0: simultaneous ' .. option_f .. ' and ' .. option_F .. ' options are not possible}')\n    end\n    if args == '' then\n        rpm.expand('%{error:%%%0 requires at least one argument with \"extras\" name}')\n    end\n    local requires = 'Requires: ' .. value_n .. ' = %{?epoch:%{epoch}:}%{version}-%{release}'\n    for extras in args:gmatch('[^%s,]+') do\n        local rpmname = value_n .. '+' .. extras\n        local pkgdef = '%package -n ' .. rpmname\n        local summary = 'Summary: Metapackage for ' .. value_n .. ': ' .. extras .. ' extras'\n        local description = '%description -n ' .. rpmname .. '\\n'\n        local current_line = 'This is a metapackage bringing in'\n        for _, word in ipairs({extras, 'extras', 'requires', 'for', value_n .. '.'}) do\n          local line = current_line .. ' ' .. word\n          if line:len() > 79 then\n            description = description .. current_line .. '\\n'\n            current_line = word\n          else\n            current_line = line\n          end\n        end\n        description = description .. current_line .. '\\n' ..\n                      'It makes sure the dependencies are installed.\\n'\n        local files = ''\n        if value_i ~= '' then\n            files = '%files -n ' .. rpmname .. '\\n' .. '%ghost ' .. value_i\n        elseif value_f ~= '' then\n            files = '%files -n ' .. rpmname .. ' -f ' .. value_f\n        end\n        for i, line in ipairs({pkgdef, summary, requires, description, files, ''}) do\n            print(line .. '\\n')\n        end\n    end\n}}", "python_platform_triplet" => "%(%{__python} -Esc \"import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))\")", "python_sitearch" => "%(%{__python} -Esc \"import sysconfig; print(sysconfig.get_path('platlib'))\")", "python_version" => "%(%{__python} -Esc \"import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))\")", "python_wheel_dir" => "%{_datadir}/%{python_wheel_pkg_prefix}-wheels", "qt5_qtwebengine_arches" => "%{ix86} x86_64 %{arm} aarch64 mips mipsel mips64el", "riscv" => "%{riscv32} %{riscv64} %{riscv128}", "riscv32" => "riscv32", "rpmmacrodir" => "/usr/lib/rpm/macros.d", "selinux_modules_install(\"s:p:\")" => "\nif [ -e /etc/selinux/config ]; then \n  . /etc/selinux/config \nfi \n_policytype=%{-s*} \nif [ -z \"${_policytype}\" ]; then \n  _policytype=\"targeted\" \nfi \nif [ \"${SELINUXTYPE}\" = \"${_policytype}\" ]; then \n  %{_sbindir}/semodule -n -s ${_policytype} -X %{!-p:200}%{-p*} -i %* || : \n  %{_sbindir}/selinuxenabled && %{_sbindir}/load_policy || : \nfi \n%{nil}", "selinux_relabel_post(\"s:\")" => "\nif [ -e /etc/selinux/config ]; then \n  . /etc/selinux/config \nfi \n_policytype=%{-s*} \nif [ -z \"${_policytype}\" ]; then \n  _policytype=\"targeted\" \nfi \nif %{_sbindir}/selinuxenabled && [ \"${SELINUXTYPE}\" = \"${_policytype}\" ]; then \n   if [ -f %{_file_context_file_pre} ]; then \n     %{_sbindir}/fixfiles -C %{_file_context_file_pre} restore &> /dev/null \n     rm -f %{_file_context_file_pre} \n   fi \nfi \n%{nil}", "selinux_requires" => "\nRequires: selinux-policy >= %{_selinux_policy_version} \nBuildRequires: pkgconfig(systemd) \nBuildRequires: selinux-policy \nBuildRequires: selinux-policy-devel \nRequires(post): selinux-policy-base >= %{_selinux_policy_version} \nRequires(post): libselinux-utils \nRequires(post): policycoreutils \n%if 0%{?fedora} || 0%{?rhel} > 7\nRequires(post): policycoreutils-python-utils \n%else \nRequires(post): policycoreutils-python \n%endif \n%{nil}", "selinux_unset_booleans(\"s:\")" => "\nif [ -e /etc/selinux/config ]; then \n  . /etc/selinux/config \nfi \n_policytype=%{-s*} \nif [ -z \"${_policytype}\" ]; then \n  _policytype=\"targeted\" \nfi \nif [ -d \"%{_selinux_store_policy_path}\" ]; then \n  semanage_import='' \n  for boolean in %*; do \n      boolean_name=${boolean%=*} \n      boolean_customized_string=$(grep \"$boolean_name$\" %_file_custom_defined_booleans | tail -n 1) \n      if [ -n \"$boolean_customized_string\" ]; then \n          awk \"/$boolean_customized_string/ && !f{f=1; next} 1\" %_file_custom_defined_booleans > %_file_custom_defined_booleans_tmp && mv %_file_custom_defined_booleans_tmp %_file_custom_defined_booleans \n          if ! grep -q \"$boolean_name$\" %_file_custom_defined_booleans; then \n              semanage_import=\"${semanage_import}\\n${boolean_customized_string}\" \n          fi \n      fi \n  done; \n  if %{_sbindir}/selinuxenabled && [ \"${SELINUXTYPE}\" = \"${_policytype}\" ]; then \n      /bin/echo -e \"$semanage_import\" | %{_sbindir}/semanage import -S \"${_policytype}\" \n  elif test -d /usr/share/selinux/\"${_policytype}\"/base.lst; then \n      /bin/echo -e \"$semanage_import\" | %{_sbindir}/semanage import -S \"${_policytype}\" -N \n  fi \nfi \n%{nil}", "shrink" => "<builtin>", "sources" => "%{lua: for i, s in ipairs(sources) do print(s..\" \") end}", "suffix" => "<builtin>", "systemd_ordering" => "\nOrderWithRequires(post): systemd \nOrderWithRequires(preun): systemd \nOrderWithRequires(postun): systemd \n%{nil}", "systemd_postun" => "\n%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_postun}} \n%{nil}", "systemd_preun" => "\n%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_preun}} \nif [ $1 -eq 0 ] && [ -x \"/usr/lib/systemd/systemd-update-helper\" ]; then \n    # Package removal, not upgrade \n    /usr/lib/systemd/systemd-update-helper remove-system-units %{?*} || : \nfi \n%{nil}", "systemd_user_post" => "\n%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_user_post}} \nif [ $1 -eq 1 ] && [ -x \"/usr/lib/systemd/systemd-update-helper\" ]; then \n    # Initial installation \n    /usr/lib/systemd/systemd-update-helper install-user-units %{?*} || : \nfi \n%{nil}", "systemd_user_postun_with_restart" => "\n%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_user_postun_with_restart}} \nif [ $1 -ge 1 ] && [ -x \"/usr/lib/systemd/systemd-update-helper\" ]; then \n    # Package upgrade, not uninstall \n    /usr/lib/systemd/systemd-update-helper mark-restart-user-units %{?*} || : \nfi \n%{nil}", "sysusers_create" => "\n%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# sysusers_create}} \ncommand -v systemd-sysusers >/dev/null && systemd-sysusers %{?*} || : \n%{nil}", "sysusers_create_inline" => "\ncommand -v systemd-sysusers >/dev/null && systemd-sysusers - <<SYSTEMD_INLINE_EOF || : \n%{?*} \nSYSTEMD_INLINE_EOF\n%{nil}", "sysusers_requires_compat" => "Requires(pre): shadow-utils", "texlive_posttrans" => "\nif [ -e /var/run/texlive/run-texhash ] && [ -e %{_bindir}/texhash ]; then %{_bindir}/texhash 2> /dev/null; rm -f /var/run/texlive/run-texhash; fi \nif [ -e /var/run/texlive/run-mtxrun ]; then export TEXMF=/usr/share/texlive/texmf-dist; export TEXMFCNF=/usr/share/texlive/texmf-dist/web2c; export TEXMFCACHE=/var/lib/texmf; %{_bindir}/mtxrun --generate &> /dev/null; rm -f /var/run/texlive/run-mtxrun; fi \n:", "tmpfiles_create" => "\n%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# tmpfiles_create}} \ncommand -v systemd-tmpfiles >/dev/null && systemd-tmpfiles --create %{?*} || : \n%{nil}", "toolchain" => "gcc", "toxenv" => "%{default_toxenv}", "u2p" => "<builtin>", "udev_rules_update" => "%{nil}", "undefine" => "<builtin>", "url2path" => "<builtin>", "valgrind_arches" => "%{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64", "version_no_tilde" => "%{lua:\n    local sep = rpm.expand('%1')\n    local ver = rpm.expand('%2')\n\n    if sep == '%1' then\n        sep = '-'\n    end\n\n    if ver == '%2' then\n        ver = rpm.expand('%version')\n    end\n    ver = ver:gsub('~', sep)\n\n    print(ver)\n}", "warn" => "<builtin>", "without" => "%{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}" },
      "macro_path" => ["/usr/lib/rpm/macros", "/usr/lib/rpm/macros.d/macros.*", "/usr/lib/rpm/platform/%{_target}/macros", "/usr/lib/rpm/fileattrs/*.attr", "/usr/lib/rpm/redhat/macros", "/etc/rpm/macros.*", "/etc/rpm/macros", "/etc/rpm/%{_target}/macros", "~/.rpmmacros"],
      "rpmrc" => { "archcolor" => "2", "optflags" => "%{__global_compiler_flags} -m64 %{__cflags_arch_x86_64} -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection" },
      "version" => "4.17.0",
    })
  end

  it "does not populate rpm if rpm is not found" do
    allow(plugin).to receive(:which).with("rpm").and_return(false)
    plugin.run
    expect(plugin[:rpm]).to be(nil)
  end
end