shell bypass 403

GrazzMean Shell

: /proc/thread-self/root/proc/self/cwd/ [ drwxr-xr-x ]
Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.137.169.102
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : macros.d.tar
macros.mono-srpm000064400000000265147511534000007704 0ustar00# arches that mono builds on
%mono_arches %{ix86} x86_64 sparc sparcv9 ia64 %{arm} aarch64 alpha s390x ppc ppc64 ppc64le

%_monodir %{_prefix}/lib/mono
%_monogacdir %{_monodir}/gac
macros.firewalld000064400000000357147511534000007730 0ustar00# RPM macros for packages installing firewalld services/zones

# put this into %post otherwise firewalld won't load new service/zone file
%firewalld_reload() \
test -x %{_bindir}/firewall-cmd && firewall-cmd --reload --quiet || : \
%{nil}
macros.clang000064400000000734147511534000007042 0ustar00%clang_major_version 17
%clang_minor_version 0
%clang_patch_version 6

%clang_version %{clang_major_version}.%{clang_minor_version}.%{clang_patch_version}

# This is the path to the clang resource directory that has clang's internal
# headers and libraries.  This path should be used by packages that need to
# install files into this directory.  This macro's value changes every time
# clang's version changes.
%clang_resource_dir %{_prefix}/lib/clang/%{clang_major_version}
macros.ldconfig000064400000000463147511534000007542 0ustar00#%ldconfig /sbin/ldconfig
%ldconfig_post(n:) %{?ldconfig:%post -p %ldconfig %{?*} %{-n:-n %{-n*}}\
%end}
%ldconfig_postun(n:) %{?ldconfig:%postun -p %ldconfig %{?*} %{-n:-n %{-n*}}\
%end}
%ldconfig_scriptlets(n:) %{?ldconfig:\
%ldconfig_post %{?*} %{-n:-n %{-n*}}\
%ldconfig_postun %{?*} %{-n:-n %{-n*}}\
}
macros.dist000064400000000751147511534000006720 0ustar00# dist macros.

%__bootstrap ~bootstrap
%rocky_ver 8
%rocky 8
%centos_ver 8
%centos 8
%rhel 8
%distcore .el8
%dist %{!?distprefix0:%{?distprefix}}%{expand:%{lua:for i=0,9999 do print("%{?distprefix" .. i .."}") end}}%{distcore}%{?distsuffix}%{?with_bootstrap:~bootstrap}
%el8 1

%dist_vendor         RESF
%dist_name           Rocky Linux
%dist_home_url       https://rockylinux.org/
%dist_bug_report_url https://bugs.rockylinux.org/
%dist_debuginfod_url https://debuginfod.rockylinux.org/
macros.valgrind-srpm000064400000000177147511534000010544 0ustar00# valgrind_arches lists what arches Valgrind works on

%valgrind_arches %{ix86} x86_64 ppc ppc64 ppc64le armv7hl aarch64 s390x
macros.pybytecompile000064400000001566147511534000010647 0ustar00# Note that the path could itself be a python file, or a directory

# Python's compile_all module only works on directories, and requires a max
# recursion depth

# Usage:
#    %py_byte_compile <interpereter> <path>
# Example:
#    %py_byte_compile %{__python3} %{buildroot}%{_datadir}/spam/plugins/

# This will terminate build on SyntaxErrors, if you want to avoid that,
# use it in a subshell like this:
#    (%{py_byte_compile <interpereter> <path>}) || :

%py_byte_compile()\
python_binary="%1"\
buildroot_path="%2"\
bytecode_compilation_path=".${buildroot_path/#$RPM_BUILD_ROOT}"\
failure=0\
pushd $RPM_BUILD_ROOT\
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -O -m py_compile || failure=1\
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -m py_compile || failure=1\
popd\
test $failure -eq 0
macros.ldc-srpm000064400000000111147511534000007464 0ustar00# arches that ldc builds on
%ldc_arches %{ix86} x86_64 %{arm} %{power64}
macros.ocaml-srpm000064400000001341147511534000010023 0ustar00# Note that OCaml is compiled on all architectures.  However
# on some (rare) architectures, only bytecode compilation is
# available.  Use these macros to find out if native code
# compilation is available on a particular architecture.

# Architectures that support the OCaml native code compiler.
%ocaml_native_compiler  aarch64 %{arm} %{ix86} ppc ppc64 ppc64le riscv64 s390x sparc sparcv9 x86_64

# Architectures that support native dynamic linking of OCaml code.
%ocaml_natdynlink       aarch64 %{arm} %{ix86} ppc ppc64 ppc64le riscv64 s390x sparc sparcv9 x86_64

# Architectures that support profiling of native code (ocamlopt -p).
%ocaml_native_profiling         %{arm} %{ix86} ppc ppc64 ppc64le               sparc sparcv9 x86_64
macros.fedora-misc-srpm000064400000000357147511534000011127 0ustar00# Some miscellaneous Fedora-related macros

# A directory for rpm macros
%rpmmacrodir /usr/lib/rpm/macros.d

# A directory for appdata metainfo.  This has changed between releases so a
# macro is useful.
%_metainfodir %{_datadir}/metainfo
macros.ghc-srpm000064400000000636147511534000007477 0ustar00# Macros needed for building srpms of Haskell packages

# from ghc-7.8 ghci is supported on all arch's
# former archs: armv5tel ppc sparcv9
%ghc_arches_with_ghci %{ix86} x86_64 armv7hl ppc64 ppc64le aarch64 s390 s390x %{mips}

# ghc_arches is not used in current packages but still here for back compat
# former archs: alpha ppc sparcv9 armv5tel
%ghc_arches %{ix86} x86_64 armv7hl ppc64 ppc64le aarch64 s390 s390x
macros.dwz000064400000003416147511534000006562 0ustar00# Macros for reducing debug info size using dwz(1) utility.

# The two default values below should result in dwz taking at most
# 3GB of RAM or so on 64-bit hosts and 2.5GB on 32-bit hosts
# on the largest *.debug files  (in mid 2012 those are
# libreoffice-debuginfo, debuginfos containing
# libxul.so.debug and libwebkitgtk-*.so.*.debug).
# This needs to be tuned based on the amount of available RAM
# on build boxes for each architecture as well as virtual address
# space limitations if dwz is 32-bit program.  While it needs less
# memory than 64-bit program because pointers are smaller, it can
# never have more than 4GB-epsilon of RAM and on some architecture
# even less than that (e.g. 2GB).

# Number of debugging information entries (DIEs) above which
# dwz will stop considering file for multifile optimizations
# and enter a low memory mode, in which it will optimize
# in about half the memory needed otherwise.
%_dwz_low_mem_die_limit		 10000000
# Number of DIEs above which dwz will stop processing
# a file altogether.
%_dwz_max_die_limit     	 50000000

# On x86_64 increase the higher limit to make libwebkit* optimizable.
# libwebkit* in mid 2012 contains roughly 87mil DIEs, and 64-bit
# dwz is able to optimize it from ~1.1GB to ~410MB using 5.2GB of RAM.
%_dwz_max_die_limit_x86_64	110000000

# On ARM, build boxes often have only 512MB of RAM and are very slow.
# Lower both the limits.
%_dwz_low_mem_die_limit_armv5tel  4000000
%_dwz_low_mem_die_limit_armv7hl	  4000000
%_dwz_max_die_limit_armv5tel	 10000000
%_dwz_max_die_limit_armv7hl	 10000000

%_dwz_limit() %{expand:%%{?%{1}_%{_arch}}%%{!?%{1}_%{_arch}:%%%{1}}}
%_find_debuginfo_dwz_opts --run-dwz\\\
   --dwz-low-mem-die-limit %{_dwz_limit _dwz_low_mem_die_limit}\\\
   --dwz-max-die-limit %{_dwz_limit _dwz_max_die_limit}
macros.info000064400000000606147511534000006707 0ustar00%info_requires \
Requires(post): /sbin/install-info \
Requires(preun): /sbin/install-info

%info_post() \
if [ -f %{_infodir}/%1 ]; then # --excludedocs? \
  /sbin/install-info %{_infodir}/%1 %{_infodir}/dir || : \
fi

%info_preun() \
if [ $1 == 0 ]; then \
  if [ -f %{_infodir}/%1 ]; then # --excludedocs? \
    /sbin/install-info --delete %{_infodir}/%1 %{_infodir}/dir || : \
  fi \
fi
macros.kernel-srpm000064400000000164147511534000010212 0ustar00# kernel_arches lists what arches the full kernel is built for.

%kernel_arches x86_64 s390x ppc64le aarch64 %{arm}
macros.systemtap000064400000000316147511534000010003 0ustar00#  -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
#
# RPM macros for packages installing systemtap tapset files

%_systemtap_tapsetdir /usr/share/systemtap/tapset
%_systemtap_datadir /usr/share/systemtap
macros.perl000064400000012100147511534000006706 0ustar00# Sensible Perl-specific RPM build macros.
#
# Note that these depend on the generic filtering system being in place in
# rpm core; but won't cause a build to fail if they're not present.
#
# Chris Weyl <cweyl@alumni.drew.edu> 2009
# Marcela Mašláňová <mmaslano@redhat.com> 2011

# This macro unsets several common vars used to control how Makefile.PL (et
# al) build and install packages.  We also set a couple to help some of the
# common systems be less interactive.  This was blatantly stolen from
# cpanminus, and helps building rpms locally when one makes extensive use of
# local::lib, etc.
#
# Usage, in %build, before "%{__perl} Makefile.PL ..."
#
#   %{?perl_ext_env_unset}

%perl_ext_env_unset %{expand:
unset PERL_MM_OPT MODULEBUILDRC PERL5INC
export PERL_AUTOINSTALL="--defaultdeps"
export PERL_MM_USE_DEFAULT=1
}

#############################################################################
# Filtering macro incantations

# keep track of what "revision" of the filtering we're at.  Each time we
# change the filter we should increment this.

%perl_default_filter_revision 3

# By default, for perl packages we want to filter all files in _docdir from 
# req/prov scanning.
# Filtering out any provides caused by private libs in vendorarch/archlib
# (vendor/core) is done by rpmbuild since Fedora 20
# <https://fedorahosted.org/fpc/ticket/353>.
#
# Note that this must be invoked in the spec file, preferably as 
# "%{?perl_default_filter}", before any %description block.

%perl_default_filter %{expand: \
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_docdir}
%global __requires_exclude_from %{?__requires_exclude_from:%__requires_exclude_from|}^%{_docdir}
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\\\(VMS|^perl\\\\(Win32|^perl\\\\(DB\\\\)|^perl\\\\(UNIVERSAL\\\\)
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\\\(VMS|^perl\\\\(Win32
}

#############################################################################
# Macros to assist with generating a "-tests" subpackage in a semi-automatic
# manner.
#
# The following macros are still in a highly experimental stage and users
# should be aware that the interface and behaviour may change. 
#
# PLEASE, PLEASE CONDITIONALIZE THESE MACROS IF YOU USE THEM.
#
# See http://gist.github.com/284409

# These macros should be invoked as above, right before the first %description
# section, and conditionalized.  e.g., for the common case where all our tests
# are located under t/, the correct usage is:
#
#   %{?perl_default_subpackage_tests}
#
# If custom files/directories need to be specified, this can be done as such:
#
#   %{?perl_subpackage_tests:%perl_subpackage_tests t/ one/ three.sql}
#
# etc, etc.

%perl_version   %(eval "`%{__perl} -V:version`"; echo $version)
%perl_testdir   %{_libexecdir}/perl5-tests
%cpan_dist_name %(eval echo %{name} | %{__sed} -e 's/^perl-//')

# easily mark something as required by -tests and BR to the main package
%tests_req() %{expand:\
BuildRequires: %*\
%%tests_subpackage_requires %*\
}

# fixup (and create if needed) the shbang lines in tests, so they work and
# rpmlint doesn't (correctly) have a fit
%fix_shbang_line() \
TMPHEAD=`mktemp`\
TMPBODY=`mktemp`\
for file in %* ; do \
    head -1 $file > $TMPHEAD\
    tail -n +2 $file > $TMPBODY\
    %{__perl} -pi -e '$f = /^#!/ ? "" : "#!%{__perl}$/"; $_="$f$_"' $TMPHEAD\
    cat $TMPHEAD $TMPBODY > $file\
done\
%{__perl} -MExtUtils::MakeMaker -e "ExtUtils::MM_Unix->fixin(qw{%*})"\
%{__rm} $TMPHEAD $TMPBODY\
%{nil}

# additional -tests subpackage requires, if any
%tests_subpackage_requires() %{expand: \
%global __tests_spkg_req %{?__tests_spkg_req} %* \
}

# additional -tests subpackage provides, if any
%tests_subpackage_provides() %{expand: \
%global __tests_spkg_prov %{?__tests_spkg_prov} %* \
}

#
# Runs after the body of %check completes.
#

%__perl_check_pre %{expand: \
%{?__spec_check_pre} \
pushd %{buildsubdir} \
%define perl_br_testdir %{buildroot}%{perl_testdir}/%{cpan_dist_name} \
%{__mkdir_p} %{perl_br_testdir} \
%{__tar} -cf - %{__perl_test_dirs} | ( cd %{perl_br_testdir} && %{__tar} -xf - ) \
find . -maxdepth 1 -type f -name '*META*' -exec %{__cp} -vp {} %{perl_br_testdir} ';' \
find %{perl_br_testdir} -type f -exec %{__chmod} -c -x {} ';' \
T_FILES=`find %{perl_br_testdir} -type f -name '*.t'` \
%fix_shbang_line $T_FILES \
%{__chmod} +x $T_FILES \
%{_fixperms} %{perl_br_testdir} \
popd \
}

#
# The actual invoked macro
#

%perl_subpackage_tests() %{expand: \
%global __perl_package 1\
%global __perl_test_dirs %* \
%global __spec_check_pre %{expand:%{__perl_check_pre}} \
%package tests\
Summary: Test suite for package %{name}\
Group: Development/Debug\
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}\
Requires: /usr/bin/prove \
%{?__tests_spkg_req:Requires: %__tests_spkg_req}\
%{?__tests_spkg_prov:Provides: %__tests_spkg_prov}\
AutoReqProv: 0 \
%description tests\
This package provides the test suite for package %{name}.\
%files tests\
%defattr(-,root,root,-)\
%{perl_testdir}\
}

# shortcut sugar
%perl_default_subpackage_tests %perl_subpackage_tests t/

macros.go-srpm000064400000016256147511534000007350 0ustar00# Copyright (c) 2015-2021 Jakub Cajka <jcajka@redhat.com>,
#                         Jan Chaloupka <jchaloup@redhat.com>,
#                         Nicolas Mailhot <nim@fedoraproject.org>
#                         Alejandro Saez Morollon <asm@redhat.com>
# This file is distributed under the terms of GNU GPL license version 3, or
# any later version.

# This file contains macros for building projects in golang for packages
# with golang compiler or gcc-go compiler based on an architecture.
# Golang is primarly for primary architectures, gcc-go for secondary.
#
# This file provides only macros and must not use any other package except
# redhat-rpm-macros.

# Define arches for PA and SA
%golang_arches   x86_64 %{arm} aarch64 ppc64le s390x
%gccgo_arches    %{mips}
%go_arches       %{golang_arches} %{gccgo_arches}

# Where to set GOPATH for builds
%gopath          %{_datadir}/gocode

# Define go_compilers macro to signal go-compiler package is available
%go_compiler     1

# Sanitize a Go import path that can then serve as rpm package name
# Mandatory parameter: a Go import path
%gorpmname() %{lua:
local goname = rpm.expand("%1")
-- lowercase and end with '/'
goname       = string.lower(goname .. "/")
-- remove eventual protocol prefix
goname       = string.gsub(goname, "^http(s?)://",         "")
-- add golang prefix
goname       = "golang-" .. goname
-- remove FQDN root (.com, .org, etc)
goname       = string.gsub(goname, "^([^/]+)%.([^%./]+)/", "%1/")
-- special-case x.y.z number-strings as that’s an exception in our naming
-- guidelines
repeat
  goname, i = string.gsub(goname, "(%d)%.(%d)",            "%1:%2")
until i == 0
-- replace various separators rpm does not like with -
goname       = string.gsub(goname, "[%._/%-]+",            "-")
-- because of the Azure sdk
goname       = string.gsub(goname, "%-for%-go%-",          "-")
-- Tokenize along - separators and remove duplicates to avoid
-- golang-foo-foo-bar-foo names
local result = ""
local tokens = {}
tokens["go"]     = true
tokens["git"]    = true
for token in string.gmatch(goname, "[^%-]+") do
   if not tokens[token] then
      result = result .. "-" .. token
      tokens[token] = true
   end
end
-- reassemble the string, restore x.y.z runs, convert the vx.y.z
-- Go convention to x.y.z as prefered in rpm naming
result = string.gsub(result, "^-", "")
result = string.gsub(result, ":", ".")
-- some projects have a name that end up in a number, and *also* add release
-- numbers on top of it, keep a - prefix before version strings
result = string.gsub(result, "%-v([%.%d])", "-%1")
print(result)
}

# Map Go information to rpm metadata. This macro will compute default spec
# variable values.
#
# The following spec variable MUST be set before calling the macro:
#
#   goipath   the packaged Go project import path
#
# The following spec variables SHOULD be set before calling the macro:
#
#   forgeurl  the project url on the forge, strongly recommended, if it can not
#             be deduced from goipath; alternatively, use -u <url>
#   Version   if applicable, set it with Version: <version>
#   tag       if applicable
#   commit    if applicable
#
# The macro will attempt to compute and set the following variables if they are
# not already set by the packager:
#
#   goname         an rpm-compatible package name derived from goipath
#   gosource       an URL that can be used as SourceX: value
#   gourl          an URL that can be used as URL: value
#
# It will delegate processing to the forgemeta macro for:
#
#   forgesource    an URL that can be used as SourceX: value
#   forgesetupargs the correct arguments to pass to %setup for this source
#                  used by %forgesetup and %forgeautosetup
#   archivename    the source archive filename, without extentions
#   archiveext     the source archive filename extensions, without leading dot
#   archiveurl     the url that can be used to download the source archive,
#                  without renaming
#   scm            the scm type, when packaging code snapshots: commits or tags
#
# If the macro is unable to parse your forgeurl value set at least archivename
# and archiveurl before calling it.
#
# Most of the computed variables are both overridable and optional. However,
# the macro WILL REDEFINE %{dist} when packaging a snapshot (commit or tag).
# The previous %{dist} value will be lost. Don’t call the macro if you don’t
# wish %{dist} to be changed.
#
# Optional parameters:
#   -u <url>  Ignore forgeurl even if it exists and use <url> instead. Note
#             that the macro will still end up setting <url> as the forgeurl
#             spec variable if it manages to parse it.
#   -s  Silently ignore problems in forgeurl, use it if it can be parsed,
#       ignore it otherwise.
#   -p  Restore problem handling, override -s.
#   -v  Be verbose and print every spec variable the macro sets.
#   -i  Print some info about the state of spec variables the macro may use or
#       set at the end of the processing.
%gometa(u:spvi) %{expand:%{lua:
local forgeurl    = rpm.expand("%{?-u*}")
if (forgeurl == "") then
  forgeurl        = rpm.expand("%{?forgeurl}")
end
-- Be explicit about the spec variables we’re setting
local function explicitset(rpmvariable,value)
  rpm.define(rpmvariable .. " " .. value)
  if (rpm.expand("%{?-v}") ~= "") then
    rpm.expand("%{echo:Setting %%{" .. rpmvariable .. "} = " .. value .. "\\n}")
  end
end
-- Never ever stomp on a spec variable the packager already set
local function safeset(rpmvariable,value)
  if (rpm.expand("%{?" .. rpmvariable .. "}") == "") then
    explicitset(rpmvariable,value)
  end
end
-- All the Go packaging automation relies on goipath being set
local goipath = rpm.expand("%{?goipath}")
if (goipath == "") then
  rpm.expand("%{error:Please set the Go import path in the “goipath” variable before calling “gometa”!}")
end
-- Compute and set spec variables
if (forgeurl ~= "") then
  rpm.expand("%forgemeta %{?-v} %{?-i} %{?-s} %{?-p} -u " .. forgeurl .. "\\n")
  safeset("gourl", forgeurl)
else
  safeset("gourl", "https://" .. goipath)
  rpm.expand("%forgemeta %{?-v} %{?-i} -s     %{?-p} -u %{gourl}\\n")
end
if (rpm.expand("%{?forgesource}") ~= "") then
  safeset("gosource", "%{forgesource}")
else
  safeset("gosource", "%{gourl}/%{archivename}.%{archiveext}")
end
safeset("goname", "%gorpmname %{goipath}")
-- Final spec variable summary if the macro was called with -i
if (rpm.expand("%{?-i}") ~= "") then
  rpm.expand("%{echo:Go-specific packaging variables}")
  rpm.expand("%{echo:  goipath:         %{?goipath}}")
  rpm.expand("%{echo:  goname:          %{?goname}}")
  rpm.expand("%{echo:  gourl:           %{?gourl}}")
  rpm.expand("%{echo:  gosource:        %{?gosource}}")
end}
BuildRequires: compiler(go-compiler)
ExclusiveArch: %{go_arches}
}

# Define commands for building
# BUILD_ID can be generated for golang build no matter of debuginfo
%gobuild(o:) \
CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" go build -compiler gc -buildmode pie '-tags=rpm_crashtraceback libtrust_openssl ' -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};\

# Define commands for testing
%gotest() go test -compiler gc -ldflags "${LDFLAGS:-}" %{?**};
macros.cmake000064400000004315147511534000007035 0ustar00#
# Macros for cmake
#
%_cmake_lib_suffix64 -DLIB_SUFFIX=64
%_cmake_shared_libs -DBUILD_SHARED_LIBS:BOOL=ON
%_cmake_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=ON
%_cmake_version 3.26.5
%__cmake /usr/bin/cmake
%__ctest /usr/bin/ctest
%__cmake_in_source_build 1
%__cmake_builddir %{!?__cmake_in_source_build:%{_vpath_builddir}}%{?__cmake_in_source_build:.}

# - Set default compile flags
# - CMAKE_*_FLAGS_RELEASE are added *after* the *FLAGS environment variables
# and default to -O3 -DNDEBUG.  Strip the -O3 so we can override with *FLAGS
# - Turn on verbose makefiles so we can see and verify compile flags
# - Set default install prefixes and library install directories
# - Turn on shared libraries by default
%cmake \
%if 0%{?set_build_flags:1} \
  %set_build_flags \
%else \
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \
  FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \
  %{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \
%endif \
  %__cmake \\\
        %{!?__cmake_in_source_build:-S "%{_vpath_srcdir}"} \\\
        %{!?__cmake_in_source_build:-B "%{__cmake_builddir}"} \\\
        -DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
        -DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
        -DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
        -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\
        -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
        -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
        -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
        -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
        -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\
%if "%{?_lib}" == "lib64" \
        %{?_cmake_lib_suffix64} \\\
%endif \
        %{?_cmake_shared_libs}

%cmake_build \
  %__cmake --build "%{__cmake_builddir}" %{?_smp_mflags} --verbose

%cmake_install \
  DESTDIR="%{buildroot}" %__cmake --install "%{__cmake_builddir}"

%ctest(:-:) \
  cd "%{__cmake_builddir}" \
  %__ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} %{**} \
  cd -


%cmake3 %cmake
%cmake3_build %cmake_build
%cmake3_install %cmake_install
%ctest3(:-:) %ctest %{**}
macros.javapackages-filesystem000064400000003617147511534000012563 0ustar00#
# RPM macros for Java filesystem layout.
#
# JPackage Project  <http://www.jpackage.org/>
#   David Walluck   <david@jpackage.org>
#   Ville Skyttä    <scop at jpackage.org>
#   Nicolas Mailhot <Nicolas.Mailhot@laPoste.net>
#

#==============================================================================
# ---- default Java directories

#
# Root directory where all Java VMs/SDK/JREs are installed.
#
%_jvmdir        %{_prefix}/lib/jvm

#
# Root directory for all Java VM/SDK/JRE's private things.
#
%_jvmprivdir    %{_prefix}/lib/jvm-private

#
# Root directory for all architecture dependent parts of Java VM/SDK/JRE's
#
%_jvmlibdir     %{_prefix}/lib/jvm

#
# Root directory for all architecture independent parts of Java VM/SDK/JRE's
#
%_jvmdatadir    %{_datadir}/jvm

#
# Root directory for all configurations parts of Java VM/SDK/JRE's
#
%_jvmsysconfdir %{_sysconfdir}/jvm

#
# Root directory for all common architecture dependent parts of Java VM/SDK/JRE's
#
%_jvmcommonlibdir %{_prefix}/lib/jvm-commmon

#
# Root directory for all common architecture independent parts of Java VM/SDK/JRE's
#
%_jvmcommondatadir %{_datadir}/jvm-commmon

#
# Root directory for all common configurations parts of Java VM/SDK/JRE's
#
%_jvmcommonsysconfdir %{_sysconfdir}/jvm-commmon

#
# Directory containing Java configuration file (java.conf)
#
%_javaconfdir %{_sysconfdir}/java

#
# Directory where arch and version independent jars are installed.
# This has already been integrated in RH macros following our request.
#
%_javadir       %{_datadir}/java

#
# Directory where arch-specific (JNI) version-independent jars are installed.
#
%_jnidir        %{_prefix}/lib/java

#
# Root directory where all javadoc is installed. Also already in RH macros.
#
%_javadocdir    %{_datadir}/javadoc

#
# Directory for Maven POM files
#
%_mavenpomdir   %{_datadir}/maven-poms

#
# Directory for Ivy XML files
#
%_ivyxmldir     %{_datadir}/ivy-xmls
macros.systemd000064400000010036147511534000007442 0ustar00#  -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  Copyright 2012 Lennart Poettering

# RPM macros for packages installing systemd unit files

%_unitdir /usr/lib/systemd/system
%_userunitdir /usr/lib/systemd/user
%_presetdir /usr/lib/systemd/system-preset
%_userpresetdir /usr/lib/systemd/user-preset
%_udevhwdbdir /usr/lib/udev/hwdb.d
%_udevrulesdir /usr/lib/udev/rules.d
%_journalcatalogdir /usr/lib/systemd/catalog
%_binfmtdir /usr/lib/binfmt.d
%_sysctldir /usr/lib/sysctl.d
%_sysusersdir /usr/lib/sysusers.d
%_tmpfilesdir /usr/lib/tmpfiles.d
%_environmentdir /usr/lib/environment.d
%_modulesloaddir /usr/lib/modules-load.d
%_modprobedir /usr/lib/modprobe.d
%_systemdgeneratordir /usr/lib/systemd/system-generators
%_systemdusergeneratordir /usr/lib/systemd/user-generators
%_systemd_system_env_generator_dir /usr/lib/systemd/system-environment-generators
%_systemd_user_env_generator_dir /usr/lib/systemd/user-environment-generators

# Because we had one release with a typo...
# This is temporary (Remove after systemd 240 is released)
%_environmnentdir %{warn:Use %%_environmentdir instead}%_environmentdir

%systemd_requires \
Requires(post): systemd \
Requires(preun): systemd \
Requires(postun): systemd \
%{nil}

%systemd_ordering \
OrderWithRequires(post): systemd \
OrderWithRequires(preun): systemd \
OrderWithRequires(postun): systemd \
%{nil}

%systemd_post() \
if [ $1 -eq 1 ] ; then \
        # Initial installation \
        systemctl --no-reload preset %{?*} &>/dev/null || : \
fi \
%{nil}

%systemd_user_post() %{expand:%systemd_post \\--global %%{?*}}

%systemd_preun() \
if [ $1 -eq 0 ] ; then \
        # Package removal, not upgrade \
        systemctl --no-reload disable --now %{?*} &>/dev/null || : \
fi \
%{nil}

%systemd_user_preun() \
if [ $1 -eq 0 ] ; then \
        # Package removal, not upgrade \
        systemctl --global disable %{?*} &>/dev/null || : \
fi \
%{nil}

%systemd_postun() %{nil}

%systemd_user_postun() %{nil}

%systemd_postun_with_restart() \
if [ $1 -ge 1 ] ; then \
        # Package upgrade, not uninstall \
        systemctl try-restart %{?*} &>/dev/null || : \
fi \
%{nil}

%systemd_user_postun_with_restart() %{nil}

%udev_hwdb_update() %{nil}

%udev_rules_update() %{nil}

%journal_catalog_update() %{nil}

# Deprecated. Use %tmpfiles_create_package instead
%tmpfiles_create() \
systemd-tmpfiles --create %{?*} &>/dev/null || : \
%{nil}

# Deprecated. Use %sysusers_create_package instead
%sysusers_create() \
systemd-sysusers %{?*} &>/dev/null || : \
%{nil}

%sysusers_create_inline() \
systemd-sysusers - <<SYSTEMD_INLINE_EOF &>/dev/null || : \
%{?*} \
SYSTEMD_INLINE_EOF \
%{nil}

# This should be used by package installation scripts which require users or
# groups to be present before the files installed by the package are present on
# disk (for example because some files are owned by those users or groups).
#
# Example:
#   Source1: %{name}-sysusers.conf
#   ...
#   %install
#   install -D %SOURCE1 %{buildroot}%{_sysusersdir}/%{name}.conf
#   %pre
#   %sysusers_create_package %{name} %SOURCE1
#   %files
#   %{_sysusersdir}/%{name}.conf
%sysusers_create_package() \
systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF &>/dev/null || : \
%(cat %2) \
SYSTEMD_INLINE_EOF \
%{nil}

# This may be used by package installation scripts to create files according to
# their tmpfiles configuration from a package installation script, even before
# the files of that package are installed on disk.
#
# Example:
#   Source1: %{name}-tmpfiles.conf
#   ...
#   %install
#   install -D %SOURCE1 %{buildroot}%{_tmpfilesdir}/%{name}.conf
#   %pre
#   %tmpfiles_create_package %{name} %SOURCE1
#   %files
#   %{_tmpfilesdir}/%{name}.conf
%tmpfiles_create_package() \
systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - <<SYSTEMD_INLINE_EOF &>/dev/null || : \
%(cat %2) \
SYSTEMD_INLINE_EOF \
%{nil}

%sysctl_apply() \
/usr/lib/systemd/systemd-sysctl %{?*} &>/dev/null || : \
%{nil}

%binfmt_apply() \
/usr/lib/systemd/systemd-binfmt %{?*} &>/dev/null || : \
%{nil}
macros.vpath000064400000000344147511534000007075 0ustar00# ---- VPATH default settings

# directory where CMakeLists.txt/meson.build/etc. are placed
%_vpath_srcdir .

# directory (doesn't need to exist) where all generated build files will be placed
%_vpath_builddir %_target_platform
macros.openblas-srpm000064400000000150147511534000010530 0ustar00# Architectures that OpenBLAS supports
%openblas_arches x86_64 %{ix86} armv7hl %{power64} aarch64 s390x
macros.python000064400000006557147511534000007310 0ustar00# %%__python is defined in /usr/lib/rpm/macros to raise an error
# so if you don't redefine it, you'll get the same error from %%python
%python %__python

%python_platform_triplet %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
%python_ext_suffix %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")

%py_setup setup.py
%py_shbang_opts -s

%py_shbang_opts_nodash %(opts=%{py_shbang_opts}; echo ${opts#-})
%py_shebang_flags %(opts=%{py_shbang_opts}; echo ${opts#-})
%py_shebang_fix %{expand:\\\
  if [ -f /usr/bin/pathfix%{python_version}.py ]; then
    pathfix=/usr/bin/pathfix%{python_version}.py
  else
    # unversioned pathfix.py provided by platform-python-devel
    pathfix=/usr/bin/pathfix.py
  fi
  if [ -z "%{?py_shebang_flags}" ]; then
    shebang_flags="-k"
  else
    shebang_flags="-ka%{py_shebang_flags}"
  fi
  $pathfix -pni %{__python} $shebang_flags}

# Use the slashes after expand so that the command starts on the same line as
# the macro
%py_build() %{expand:\\\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
  %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python} %{py_shbang_opts}" %{?*}
  sleep 1
}

%py_build_egg() %{expand:\\\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
  %{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
  sleep 1
}

%py_build_wheel() %{expand:\\\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
  %{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
  sleep 1
}

%py_install() %{expand:\\\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
  %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
}

%py_install_egg() %{expand:\\\
  mkdir -p %{buildroot}%{python_sitelib}
  easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*}
}

%py_install_wheel() %{expand:\\\
  pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
}

%python_provide() %{lua:
  function string.starts(String,Start)
    return string.sub(String,1,string.len(Start))==Start
  end
  package = rpm.expand("%{?1}")
  vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
  if (string.starts(package, "python2-")) then
    --No unversioned provides as python2 is not default
  elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then
    --No unversioned provides as python3 is not default
  elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then
    --No unversioned provides as python3_other is not default
  elseif (string.starts(package, "pypy-")) then
    --No unversioned provides as pypy is not default
  elseif (string.starts(package, "pypy3-")) then
    --No unversioned provides as pypy is not default
  elseif (string.starts(package, "python-")) then
    --Providing the current default python
    print("Provides: python2-")
    print(string.sub(package,8,string.len(package)))
    print(" = ")
    print(vr)
  else
    print("%python_provide: ERROR: ")
    print(package)
    print(" not recognized.")
  end
}

%python_enable_dependency_generator() \
%global __python_requires %{_rpmconfigdir}/pythondistdeps.py --requires \
%{nil}
macros.selinux-policy000064400000015156147511534000010746 0ustar00# Copyright (C) 2017 Red Hat, Inc. All rights reserved.
#
#   Author: Petr Lautrbach <plautrba@redhat.com>
#   Author: Lukáš Vrabec <lvrabec@redhat.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# RPM macros for packages installing SELinux modules

%_selinux_policy_version 3.14.3

%_selinux_store_path /var/lib/selinux
%_selinux_store_policy_path %{_selinux_store_path}/${_policytype}

%_file_context_file %{_sysconfdir}/selinux/${SELINUXTYPE}/contexts/files/file_contexts
%_file_context_file_pre %{_localstatedir}/lib/rpm-state/file_contexts.pre

%_file_custom_defined_booleans %{_selinux_store_policy_path}/rpmbooleans.custom
%_file_custom_defined_booleans_tmp %{_selinux_store_policy_path}/rpmbooleans.custom.tmp

# %selinux_requires
%selinux_requires \
Requires: selinux-policy >= %{_selinux_policy_version} \
BuildRequires: git \
BuildRequires: pkgconfig(systemd) \
BuildRequires: selinux-policy \
BuildRequires: selinux-policy-devel \
Requires(post): selinux-policy-base >= %{_selinux_policy_version} \
Requires(post): libselinux-utils \
Requires(post): policycoreutils \
%if 0%{?fedora} || 0%{?rhel} > 7\
Requires(post): policycoreutils-python-utils \
%else \
Requires(post): policycoreutils-python \
%endif \
%{nil}

# %selinux_modules_install [-s <policytype>] [-p <modulepriority>] module [module]...
%selinux_modules_install("s:p:") \
. /etc/selinux/config \
_policytype=%{-s*} \
if [ -z "${_policytype}" ]; then \
  _policytype="targeted" \
fi \
if [ "${SELINUXTYPE}" = "${_policytype}" ]; then \
  %{_sbindir}/semodule -n -s ${_policytype} -X %{!-p:200}%{-p*} -i %* \
  %{_sbindir}/selinuxenabled && %{_sbindir}/load_policy || : \
fi \
%{nil}

# %selinux_modules_uninstall [-s <policytype>] [-p <modulepriority>] module [module]...
%selinux_modules_uninstall("s:p:") \
. /etc/selinux/config \
_policytype=%{-s*} \
if [ -z "${_policytype}" ]; then \
  _policytype="targeted" \
fi \
if [ $1 -eq 0 ]; then \
  if [ "${SELINUXTYPE}" = "${_policytype}" ]; then \
    %{_sbindir}/semodule -n -X %{!-p:200}%{-p*} -s ${_policytype} -r %* &> /dev/null || : \
    %{_sbindir}/selinuxenabled && %{_sbindir}/load_policy || : \
  fi \
fi \
%{nil}

# %selinux_relabel_pre [-s <policytype>]
%selinux_relabel_pre("s:") \
. /etc/selinux/config \
_policytype=%{-s*} \
if [ -z "${_policytype}" ]; then \
  _policytype="targeted" \
fi \
if %{_sbindir}/selinuxenabled && [ "${SELINUXTYPE}" = "${_policytype}" ]; then \
  [ -f %{_file_context_file_pre} ] || cp -f %{_file_context_file} %{_file_context_file_pre} \
fi \
%{nil}


# %selinux_relabel_post [-s <policytype>]
%selinux_relabel_post("s:") \
. /etc/selinux/config \
_policytype=%{-s*} \
if [ -z "${_policytype}" ]; then \
  _policytype="targeted" \
fi \
if %{_sbindir}/selinuxenabled && [ "${SELINUXTYPE}" = "${_policytype}" ]; then \
   if [ -f %{_file_context_file_pre} ]; then \
     %{_sbindir}/fixfiles -C %{_file_context_file_pre} restore &> /dev/null \
     rm -f %{_file_context_file_pre} \
   fi \
fi \
%{nil}

# %selinux_set_booleans [-s <policytype>] boolean [boolean]...
%selinux_set_booleans("s:") \
. /etc/selinux/config \
_policytype=%{-s*} \
if [ -z "${_policytype}" ]; then \
  _policytype="targeted" \
fi \
if [ -d "%{_selinux_store_policy_path}" ]; then \
  LOCAL_MODIFICATIONS=$(%{_sbindir}/semanage boolean -E) \
  if [ ! -f %_file_custom_defined_booleans ]; then \
      /bin/echo "# This file is managed by macros.selinux-policy. Do not edit it manually" > %_file_custom_defined_booleans \
  fi \
  semanage_import='' \
  for boolean in %*; do \
      boolean_name=${boolean%=*} \
      boolean_value=${boolean#*=} \
      boolean_local_string=$(grep "$boolean_name\$" <<<$LOCAL_MODIFICATIONS) \
      if [ -n "$boolean_local_string" ]; then \
          semanage_import="${semanage_import}\\nboolean -m -$boolean_value $boolean_name" \
          boolean_customized_string=$(grep "$boolean_name\$" %_file_custom_defined_booleans | tail -n 1) \
          if [ -n "$boolean_customized_string" ]; then \
              /bin/echo $boolean_customized_string >> %_file_custom_defined_booleans \
          else \
              /bin/echo $boolean_local_string >> %_file_custom_defined_booleans \
          fi \
      else \
          semanage_import="${semanage_import}\\nboolean -m -$boolean_value $boolean_name" \
          boolean_default_value=$(LC_ALL=C %{_sbindir}/semanage boolean -l | grep "^$boolean_name " | sed 's/[^(]*([^,]*, *\\(on\\|off\\).*/\\1/') \
          /bin/echo "boolean -m --$boolean_default_value $boolean_name" >> %_file_custom_defined_booleans \
      fi \
  done; \
  if %{_sbindir}/selinuxenabled && [ "${SELINUXTYPE}" = "${_policytype}" ]; then \
      /bin/echo -e "$semanage_import" | %{_sbindir}/semanage import -S "${_policytype}" \
  elif test -d /usr/share/selinux/"${_policytype}"/base.lst; then \
      /bin/echo -e "$semanage_import" | %{_sbindir}/semanage import -S "${_policytype}" -N \
  fi \
fi \
%{nil}

# %selinux_unset_booleans [-s <policytype>] boolean [boolean]...
%selinux_unset_booleans("s:") \
. /etc/selinux/config \
_policytype=%{-s*} \
if [ -z "${_policytype}" ]; then \
  _policytype="targeted" \
fi \
if [ -d "%{_selinux_store_policy_path}" ]; then \
  semanage_import='' \
  for boolean in %*; do \
      boolean_name=${boolean%=*} \
      boolean_customized_string=$(grep "$boolean_name\$" %_file_custom_defined_booleans | tail -n 1) \
      if [ -n "$boolean_customized_string" ]; then \
          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 \
          if ! grep -q "$boolean_name\$" %_file_custom_defined_booleans; then \
              semanage_import="${semanage_import}\\n${boolean_customized_string}" \
          fi \
      fi \
  done; \
  if %{_sbindir}/selinuxenabled && [ "${SELINUXTYPE}" = "${_policytype}" ]; then \
      /bin/echo -e "$semanage_import" | %{_sbindir}/semanage import -S "${_policytype}" \
  elif test -d /usr/share/selinux/"${_policytype}"/base.lst; then \
      /bin/echo -e "$semanage_import" | %{_sbindir}/semanage import -S "${_policytype}" -N \
  fi \
fi \
%{nil}
macros.fedora-misc000064400000005415147511534000010150 0ustar00# Some miscellaneous Fedora-related macros

# List files matching inclusion globs, excluding files matching exclusion blogs
# Optional parameters:
#  – -i "<globs>" inclusion globs
#  – -x "<globs>" exclusion globs
# Globs are space-separated lists of shell globs. Such lists require %{quote:}
# use for safe rpm argument passing.
# Alternatively, set the following rpm variables before calling the macro:
#  – “listfiles_include” inclusion globs
#  — “listfiles_exclude” exclusion globs
# Arguments passed to the macro without flags will be interpreted as inclusion
# globs.
%listfiles(i:x:) %{expand:
%if %{lua: print(string.len(rpm.expand("%{?-i*}%{?listfiles_include}%*")))}
  listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u)
  %if  %{lua: print(string.len(rpm.expand("%{?-x*}%{?listfiles_exclude}")))}
    while IFS= read -r finc ; do
      realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\
        | sort -u | grep -q "${finc}" || echo "${finc}"
    done <<< "${listfiles_include}"
  %else
    echo "${listfiles_include}"
  %endif
%endif
}

# https://github.com/rpm-software-management/rpm/issues/581
# Write the contents of a list of rpm variables to a macro file.
# The target file must contain the corresponding anchors.
# For example %writevars -f myfile foo bar will replace:
#  @@FOO@@ with the rpm evaluation of %{foo} and
#  @@BAR@@ with the rpm evaluation of %{bar}
# in myfile
%writevars(f:) %{lua:
local    fedora = require "fedora.common"
local macrofile = rpm.expand("%{-f*}")
local   rpmvars = {}
for i = 1, rpm.expand("%#") do
  table.insert(rpmvars, rpm.expand("%" .. i))
end
fedora.writevars(macrofile,rpmvars)
}

# gpgverify verifies signed sources. There is documentation in the script.
%gpgverify(k:s:d:) %{lua:
local script = rpm.expand("%{_rpmconfigdir}/redhat/gpgverify ")
local keyring = rpm.expand("%{-k*}")
local signature = rpm.expand("%{-s*}")
local data = rpm.expand("%{-d*}")
print(script)
if keyring ~= "" then
  print(rpm.expand("--keyring='%{SOURCE" .. keyring ..  "}' "))
end
if signature ~= "" then
  print(rpm.expand("--signature='%{SOURCE" .. signature ..  "}' "))
end
if data ~= "" then
  print(rpm.expand("--data='%{SOURCE" .. data ..  "}' "))
end
}

# gpgverify verifies signed sources. There is documentation in the script.
%gpgverify(k:s:d:) %{lua:
local script = rpm.expand("%{_rpmconfigdir}/redhat/gpgverify ")
local keyring = rpm.expand("%{-k*}")
local signature = rpm.expand("%{-s*}")
local data = rpm.expand("%{-d*}")
print(script)
if keyring ~= "" then
  print(rpm.expand("--keyring='%{SOURCE" .. keyring ..  "}' "))
end
if signature ~= "" then
  print(rpm.expand("--signature='%{SOURCE" .. signature ..  "}' "))
end
if data ~= "" then
  print(rpm.expand("--data='%{SOURCE" .. data ..  "}' "))
end
}
macros.python-srpm000064400000013715147511534000010261 0ustar00# python3_pkgversion specifies the version of Python 3 in the distro.  It can be
# a specific version (e.g. 34 in Fedora EPEL7)
%python3_pkgversion 3

# Set to /bin/true to avoid %ifdefs and %{? in specfiles
%__python3_other /bin/true
%py3_other_build /bin/true
%py3_other_install /bin/true

# Define where Python wheels will be stored and the prefix of -wheel packages
# - In Fedora we want wheel subpackages named e.g. `python-pip-wheel` that
#   install packages into `/usr/share/python-wheels`. Both names are not
#   versioned, because they're used by all Python 3 stacks.
# - In RHEL we want wheel packages named e.g. `python3-pip-wheel` and
#   `python3.11-pip-wheel` that install packages into similarly versioned
#   locations. We want each Python stack in RHEL to have their own wheels,
#   because the main python3 wheels (which we can't upgrade) will likely be
#   quite old by the time we're adding new alternate Python stacks.
# - In ELN we want to follow Fedora, because builds for ELN and Fedora rawhide
#   need to be interoperable.
%python_wheel_pkg_prefix python%{?rhel:%{!?eln:%{python3_pkgversion}}}
%python_wheel_dir %{_datadir}/%{python_wheel_pkg_prefix}-wheels


# === Macros for Build/Requires tags using Python dist tags ===
# - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
# - These macros need to be in macros.python-srpm, because BuildRequires tags
#   get rendered as runtime requires into the metadata of SRPMs.

# Converts Python dist name to a canonical format
%py_dist_name() %{lua:\
        name = rpm.expand("%{?1:%{1}}");\
        canonical = string.gsub(string.lower(name), "[^%w%.]+", "-");\
        print(canonical);\
}

# Creates Python 2 dist tag(s) after converting names to canonical format
#   Needs to first put all arguments into a list, because invoking a different
#   macro (%py_dist_name) overwrites them
%py2_dist() %{lua:\
        args = {}\
        arg = 1\
        while (true) do\
                name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
                if (name == nil or name == '') then\
                        break\
                end\
                args[arg] = name\
                arg = arg + 1\
        end\
        for arg, name in ipairs(args) do\
                canonical = rpm.expand("%py_dist_name " .. name);\
                print("python2dist(" .. canonical .. ") ");\
        end\
}

# RHEL 9+ and Fedora compatibility macro
# Only use in macro backports, not intended to be used in spec files!
# In the future, the %%python3_pkgversion macro has a dot, e.g. 3.9 or 3.11
# However, in RHEL 8 at least, it does not, e.g. 38, 39
# This is a helpful macro that determines the proper "Python version" string with dot
# from %%python3_pkgversion without actually having Python installed.
# For values other than 3X, it should expand to %%python3_pkgversion unchanged.
# Examples of %%python3_pkgversion -> %%_python3_pkgversion_with_dot:
#   3    -> 3
#   38   -> 3.8
#   39   -> 3.9
#   310  -> 3.10
#   3.12 -> 3.12
#   4    -> 4
#   412  -> 412
%_python3_pkgversion_with_dot %{lua:print((rpm.expand("%python3_pkgversion"):gsub('^3(%d)', '3.%1')))}

# Creates Python 3 dist tag(s) after converting names to canonical format
#   Needs to first put all arguments into a list, because invoking a different
#   macro (%py_dist_name) overwrites them
%py3_dist() %{lua:\
        python3_pkgversion_with_dot = rpm.expand("%_python3_pkgversion_with_dot")\
        args = {}\
        arg = 1\
        while (true) do\
                name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
                if (name == nil or name == '') then\
                        break\
                end\
                args[arg] = name\
                arg = arg + 1\
        end\
        for arg, name in ipairs(args) do\
                canonical = rpm.expand("%py_dist_name " .. name);\
                print("python" .. python3_pkgversion_with_dot .. "dist(" .. canonical .. ") ");\
        end\
}

# Macro to replace overly complicated references to PyPI source files.
# Expands to the pythonhosted URL for a package
# Accepts zero to three arguments:
# 1:  The PyPI project name, defaulting to %srcname if it is defined, then
#     %pypi_name if it is defined, then just %name.
# 2:  The PYPI version, defaulting to %version with tildes stripped.
# 3:  The file extension, defaulting to "tar.gz".  (A period will be added
#     automatically.)
# Requires %__pypi_url and %__pypi_default_extension to be defined.
%__pypi_url https://files.pythonhosted.org/packages/source/
%__pypi_default_extension tar.gz

%pypi_source() %{lua:
    local src = rpm.expand('%1')
    local ver = rpm.expand('%2')
    local ext = rpm.expand('%3')
    local url = rpm.expand('%__pypi_url')
\
    -- If no first argument, try %srcname, then %pypi_name, then %name
    -- Note that rpm leaves macros unchanged if they are not defined.
    if src == '%1' then
        src = rpm.expand('%srcname')
    end
    if src == '%srcname' then
        src = rpm.expand('%pypi_name')
    end
    if src == '%pypi_name' then
        src = rpm.expand('%name')
    end
\
    -- If no second argument, use %version
    if ver == '%2' then
        ver = rpm.expand('%version'):gsub('~', '')
    end
\
    -- If no third argument, use the preset default extension
    if ext == '%3' then
        ext = rpm.expand('%__pypi_default_extension')
    end
\
    local first = string.sub(src, 1, 1)
\
    print(url .. first .. '/' .. src .. '/' .. src .. '-' .. ver .. '.' .. ext)
}

# Python packages in RHEL 8 should not provide unversioned python- names
# so this macro here is just a compatibility layer and only provides the given name.
%py_provides() %{lua:
    local name = rpm.expand('%1')
    if name == '%1' then
        rpm.expand('%{error:%%py_provides requires at least 1 argument, the name to provide}')
    end
    local evr = rpm.expand('%2')
    if evr == '%2' then
        evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')
    end
    print('Provides: ' .. name .. ' = ' .. evr .. '\\n')
}
macros.forge000064400000030675147511534000007067 0ustar00# Map forge information to rpm metadata. This macro will compute default spec
# variable values.
#
# The following spec variables SHOULD be set before calling the macro:
#
#   forgeurl  the project url on the forge, strongly recommended;
#             alternatively, use -u <url>
#   Version   if applicable, set it with Version: <version>
#   tag       if applicable
#   commit    if applicable
#
# The macro will attempt to compute and set the following variables if they are
# not already set by the packager:
#
#   forgesource    an URL that can be used as SourceX: value
#   forgesetupargs the correct arguments to pass to %setup for this source
#                  used by %forgesetup and %forgeautosetup
#   archivename    the source archive filename, without extentions
#   archiveext     the source archive filename extensions, without leading dot
#   archiveurl     the url that can be used to download the source archive,
#                  without renaming
#   scm            the scm type, when packaging code snapshots: commits or tags
#
# If the macro is unable to parse your forgeurl value set at least archivename
# and archiveurl before calling it.
#
# Most of the computed variables are both overridable and optional. However,
# the macro WILL REDEFINE %{dist} when packaging a snapshot (commit or tag).
# The previous %{dist} value will be lost. Don’t call the macro if you don’t
# wish %{dist} to be changed.
#
# Optional parameters:
#   -u <url>  Ignore forgeurl even if it exists and use <url> instead. Note
#             that the macro will still end up setting <url> as the forgeurl
#             spec variable if it manages to parse it.
#   -s  Silently ignore problems in forgeurl, use it if it can be parsed,
#       ignore it otherwise.
#   -p  Restore problem handling, override -s.
#   -v  Be verbose and print every spec variable the macro sets.
#   -i  Print some info about the state of spec variables the macro may use or
#       set at the end of the processing.
%forgemeta(u:spvi) %{lua:
local forgeurl    = rpm.expand("%{?-u*}")
if (forgeurl == "") then
  forgeurl        = rpm.expand("%{?forgeurl}")
end
local silent      = false
local verbose     = false
local informative = false
if (rpm.expand("%{?-s}") ~= "") then
  silent          = true
end
if (rpm.expand("%{?-p}") ~= "") then
  silent          = false
end
if (rpm.expand("%{?-v}") ~= "") then
  verbose         = true
end
if (rpm.expand("%{?-i}") ~= "") then
  informative     = true
end
local tag         = rpm.expand("%{?tag}")
local commit      = rpm.expand("%{?commit}")
-- Be explicit about the spec variables we’re setting
local function explicitset(rpmvariable,value)
  rpm.define(rpmvariable .. " " .. value)
  if verbose then
    rpm.expand("%{echo:Setting %%{" .. rpmvariable .. "} = " .. value .. "\\n}")
  end
end
-- Never ever stomp on a spec variable the packager already set
local function safeset(rpmvariable,value)
  if (rpm.expand("%{?" .. rpmvariable .. "}") == "") then
    explicitset(rpmvariable,value)
  end
end
-- Set spec variable values for each known software publishing service
if (forgeurl ~= "") then
  local forge          = string.match(forgeurl, "^[^:]+://([^/]+)/")
  if (forge == nil) then
    if not silent then
      rpm.expand("%{error:URLs must include a protocol such as https:// and a path starting with / !\\n}")
    end
  else
    if (string.match(forge, "^gitlab[%.-]") or string.match(forge, "[%.-]gitlab[%.]")) then
      forgeurl = string.match(forgeurl, "https://[^/]+/[^/]+/[^/#?]+")
      if (forgeurl == nil) then
        if not silent then
          rpm.expand("%{error:Gitlab URLs must match https://(…[-.])gitlab[-.]…/owner/repo !\\n}")
        end
      else
        explicitset("forgeurl",   forgeurl)
        if (commit == "") then
          rpm.expand("%{error:All Gitlab URLs require commit value knowledge: you need to define %{commit}!\\nPlease vote on https://gitlab.com/gitlab-org/gitlab-ce/issues/38830\\n}")
        end
        safeset("archiveext",     "tar.bz2")
        safeset("forgesetupargs", "-n %{archivename}")
        if (commit ~= "") or (tag ~= "") then
          safeset("scm", "git")
        end
        local owner   = string.match(forgeurl, "^[^:]+://[^/]+/([^/]+)")
        local repo    = string.match(forgeurl, "^[^:]+://[^/]+/[^/]+/([^/]+)")
        local version = rpm.expand("%{?version}")
        if (version ~= "") and (version ~= "0") and (tag == "") then
          -- GitLab does not have strong versionning semantics
          -- Some projects use "version" as release tag, others "v" + "version"
          -- Tag value needs to be explicitly declared before calling the macro
          -- in the second case
          tag = version
          safeset("tag", tag)
        end
        if (tag ~= "") then
          safeset("archivename", repo .. "-%{tag}-%{commit}")
          safeset("archiveurl",  "%{forgeurl}/repository/%{tag}/archive.%{archiveext}")
        else
          safeset("archivename", repo .. "-%{commit}")
          safeset("archiveurl",  "%{forgeurl}/repository/%{commit}/archive.%{archiveext}")
        end
      end
    end
    if (string.match(forge, "^github[%.-]") or string.match(forge, "[%.-]github[%.]")) then
      forgeurl = string.match(forgeurl, "https://[^/]+/[^/]+/[^/#?]+")
      if (forgeurl == nil) then
        if not silent then
          rpm.expand("%{error:GitHub URLs must match https://(…[-.])github[-.]…/owner/repo !\\n}")
        end
      else
        explicitset("forgeurl",   forgeurl)
        safeset("archiveext",     "tar.gz")
        local forgesetupargs = "-n %{archivename}"
        if (commit ~= "") or (tag ~= "") then
          safeset("scm", "git")
        end
        local owner = string.match(forgeurl, "^[^:]+://[^/]+/([^/]+)")
        local repo  = string.match(forgeurl, "^[^:]+://[^/]+/[^/]+/([^/]+)")
        if (tag ~= "") then
          -- if upstream used a version suffix such as -rc1 or -beta it will not
          -- be a valid version string for rpm but github will accept it fine and
          -- use the same naming as for other versions: v prefix in the tag and
          -- archivename, no v prefix in the topdir naming inside the archive
          local version = rpm.expand("%{?version}")
          if version ~= "" and
             (string.match(tag, "^v" .. version .. "[^%d]") or
              string.match(tag, "^v" .. version .. "$"))    then
            forgesetupargs = "-n " .. repo .. "-" .. string.gsub(tag, "^v", "")
          end
          safeset("archivename",   repo .. "-%{tag}")
          safeset("archiveurl",    "%{forgeurl}/archive/%{tag}.%{archiveext}")
        else
          if (commit ~= "") then
            safeset("archivename", repo .. "-%{commit}")
            safeset("archiveurl",  "%{forgeurl}/archive/%{commit}/" .. repo .. "-%{commit}.%{archiveext}")
          else
            safeset("archivename", repo .. "-%{version}")
            safeset("archiveurl",   "%{forgeurl}/archive/v%{version}.%{archiveext}")
          end
        end
        safeset("forgesetupargs", forgesetupargs)
      end
    end
    if (forge == "code.googlesource.com") then
      forgeurl = string.match(forgeurl, "https://code.googlesource.com/[^#?]*[^/#?]+")
      if (forgeurl == nil) then
        if not silent then
          rpm.expand("%{error:Googlesource URLs must match https://code.googlesource.com/…/repo !\\n}")
        end
      else
        explicitset("forgeurl",   forgeurl)
        safeset("archiveext",     "tar.gz")
        safeset("forgesetupargs", "-c")
        if (commit ~= "") or (tag ~= "") then
          safeset("scm", "git")
        end
        local repo = string.match(forgeurl, "^[^:]+://.+/([^/?#]+)")
        if (tag ~= "") then
          safeset("archivename",   repo .. "-%{tag}")
          safeset("archiveurl",    "%{forgeurl}/+archive/%{tag}.%{archiveext}")
        else
          if (commit ~= "") then
            safeset("archivename", repo .. "-%{commit}")
            safeset("archiveurl",  "%{forgeurl}/+archive/%{commit}.%{archiveext}")
          else
            safeset("archivename", repo .. "-v%{version}")
            safeset("archiveurl",  "%{forgeurl}/+archive/v%{version}.%{archiveext}")
          end
        end
      end
    end
    if (forge == "bitbucket.org") then
      forgeurl = string.match(forgeurl, "https://[^/]+/[^/]+/[^/#?]+")
      if (forgeurl == nil) then
        if not silent then
          rpm.expand("%{error:BitBucket URLs must match https://bitbucket.org/owner/repo !\\n}")
        end
      else
        explicitset("forgeurl",   forgeurl)
        if (commit == "") then
          rpm.expand("%{error:All BitBucket URLs require commit value knowledge: you need to define %{commit}!\\n}")
        end
        local shortcommit = string.sub(commit, 1, 12)
        safeset("archiveext", "tar.bz2")
        -- Default to git even though BitBucket allows choosing between several SCMs
        -- Set scm to hg for example before calling the macro if your project does not use git
        safeset("scm", "git")
        local owner = string.match(forgeurl, "^[^:]+://[^/]+/([^/]+)")
        local repo  = string.match(forgeurl, "^[^:]+://[^/]+/[^/]+/([^/]+)")
        safeset("archivename",    owner .. "-" .. repo .. "-" .. shortcommit)
        safeset("forgesetupargs", "-n %{archivename}")
        if (tag ~= "") then
          safeset("archiveurl",  "%{forgeurl}/get/%{tag}.%{archiveext}")
        else
          safeset("archiveurl",  "%{forgeurl}/get/%{commit}.%{archiveext}")
        end
      end
    end
    if (forge == "pagure.io") then
      if not silent then
        rpm.expand("%{error:https://pagure.io/pagure/issue/861 needs to be resolved before the “pagure.io”\\nsoftware publishing service can be supported.\\n}")
      end
    end
    -- Final tests to check forgeurl was successfuly parsed
    if not silent then
      if (rpm.expand("%{?archivename}") == "") or (rpm.expand("%{?archiveurl}") == "") then
        rpm.expand("%{error:Automation for the “" .. forge .. "”\\nsoftware publishing service is not implemented yet.\\nPlease extend the %%forgemeta macro!\\n}")
      end
    end
  end
end
-- Set defaults if forgeurl is missing or does not parse
local archivename = rpm.expand("%{?archivename}")
safeset("archiveext",       "tar.gz")
if (archivename ~= "") then
  safeset("forgesetupargs", "-n %{archivename}")
end
if (commit ~= "") or (tag ~= "") then
  safeset("scm",            "git")
end
-- Source URL processing (computing the forgesource spec variable)
local archiveurl  = rpm.expand("%{?archiveurl}")
local archiveext  = rpm.expand("%{?archiveext}")
if (archivename ~= "") and (archiveurl ~= "") then
  if (string.match(archiveurl, "/([^/]+)$") == archivename .. "." .. archiveext) then
    safeset("forgesource", "%{archiveurl}")
  else
    safeset("forgesource", "%{?archiveurl}#/%{?archivename}.%{archiveext}")
  end
end
-- dist processing (computing the correct pefix for snapshots)
local distprefix = rpm.expand("%{?tag}")
local version    = rpm.expand("%{?version}")
if (distprefix == version) or (distprefix == "v" .. version) then
  distprefix = ""
end
if (distprefix == "") then
  distprefix = string.sub(rpm.expand("%{?commit}"), 1, 7)
end
if (distprefix ~= "") then
  local dist = ".%([ -r %{_sourcedir}/%{archivename}.%{archiveext} ] && date +%Y%m%d -u -r %{_sourcedir}/%{archivename}.%{archiveext})%{scm}" .. string.gsub(distprefix, "-",".") .. rpm.expand("%{?dist}")
  explicitset("dist", dist)
end
-- Final spec variable summary if the macro was called with -i
if informative then
  rpm.expand("%{echo:Forge-specific packaging variables\\n}")
  rpm.expand("%{echo:  forgeurl:        %{?forgeurl}\\n}")
  rpm.expand("%{echo:  forgesource:     %{?forgesource}\\n}")
  rpm.expand("%{echo:  forgesetupargs:  %{?forgesetupargs}\\n}")
  rpm.expand("%{echo:Generic variables\\n}")
  rpm.expand("%{echo:  archivename:     %{?archivename}\\n}")
  rpm.expand("%{echo:  archiveext:      %{?archiveext}\\n}")
  rpm.expand("%{echo:  archiveurl:      %{?archiveurl}\\n}")
  rpm.expand("%{echo:  scm:             %{?scm}\\n}")
  rpm.expand("%{echo:  tag:             %{?tag}\\n}")
  rpm.expand("%{echo:  commit:          %{?commit}\\n}")
  rpm.expand("%{echo:  dist:            %{?dist} (snapshot date is computed once %%{_sourcedir}/%%{archivename}.%%{archiveext} is available)\\n}")
end
}

# Convenience macro to relay computed arguments to %setup
%forgesetup(a:b:cDn:Tq) %setup %{?forgesetupargs} %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{-q}

# Convenience macro to relay computed arguments to %autosetup
%forgeautosetup(a:b:cDn:TvNS:p:) %autosetup %{?forgesetupargs} %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{-v} %{-N} %{-S} %{-p}
macros.efi-srpm000064400000006005147511534000007475 0ustar00#
# EFI specific SRPM macro definitions
#
# Copyright 2018 Peter M Jones <pjones@redhat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
#

%_efi_srpm_macros_setup() %{expand:%{lua:
  -- test if our arch matches
  local function arch(archmacro)
    local target = rpm.expand(" %{_target_cpu} ")
    local arches = rpm.expand(" " .. archmacro .. " ")
    local match = string.match(arches, target)
    return (match ~= nil)
  end
  -- give us the arch...
  local function getarch()
    if arch("ia64") then
      return("ia64")
    elseif arch("x86_64") then
      return("x64")
    elseif arch("%{ix86}") then
      return("ia32")
    elseif arch("aarch64") then
      return("aa64")
    elseif arch("%{arm}") then
      return("arm")
    else
      return("none")
    end
  end
  -- alt arch
  local function getaltarch()
    if arch("x86_64") then
      return("ia32")
    else
      return("none")
    end
  end
  -- make some macros
  local done = rpm.expand("%{?_efi}")
  if done == nil or done == "" then
    local arch = getarch()
    local alt = getaltarch()
    print("%global _efi x86_64 aarch64 %{arm} %{ix86}\\n")
    print("%global _efi_vendor rocky\\n")
    if arch == "none" then
      print("%global _efi_has_arch 0\\n")
    else
      print("%global _efi_has_arch 1\\n")
    end
    print("%global _efi_arch " .. getarch() .. "\\n")
    print("%global _efi_arch_upper " .. string.upper(getarch()) .. "\\n")
    if alt == "none" then
      print("%global _efi_has_alt_arch 0\\n")
    else
      print("%global _efi_has_alt_arch 1\\n")
    end
    print("%global _efi_alt_arch " .. alt .. "\\n")
    print("%global _efi_alt_arch_upper " .. string.upper(alt) .. "\\n")
  end
}}

%efi_srpm_macros_version %{expand:%{_efi_srpm_macros_setup}}3

%efi %{expand:%{_efi_srpm_macros_setup}}%{expand:%{_efi}}
%efi_vendor %{expand:%{_efi_srpm_macros_setup}}%{expand:%{_efi_vendor}}

%efi_esp_root /boot/efi
%efi_esp_efi %{efi_esp_root}/EFI
%efi_esp_boot %{efi_esp_efi}/BOOT
%efi_esp_dir %{expand:%{_efi_srpm_macros_setup}}%{efi_esp_efi}/%{efi_vendor}

%efi_arch %{expand:%{_efi_srpm_macros_setup}}%{_efi_arch}
%efi_arch_upper %{expand:%{_efi_srpm_macros_setup}}%{_efi_arch_upper}
%efi_has_arch %{expand:%{_efi_srpm_macros_setup}}0%{_efi_has_arch}
%efi_has_alt_arch %{expand:%{_efi_srpm_macros_setup}}0%{_efi_has_alt_arch}
%efi_alt_arch %{expand:%{_efi_srpm_macros_setup}}%{?_efi_alt_arch}%{nil}
%efi_alt_arch_upper %{expand:%{_efi_srpm_macros_setup}}%{?_efi_alt_arch_upper}%{nil}
macros.environment-modules000064400000000113147511534000011757 0ustar00# RPM macros for environment modules

%_modulesdir %{_datadir}/modulefiles
macros.nodejs-srpm000064400000000504147511534000010212 0ustar00# nodejs_arches lists what arches Node.js and dependent packages run on.
#
# Enabling Node.js on other arches requires porting the V8 JavaScript JIT to
# those arches. Support for POWER and aarch64 arrived in nodejs v4. Support
# for s390x arrived in nodejs v6

%nodejs_arches %{ix86} x86_64 %{arm} aarch64 %{power64} s390x
macros.rust-srpm000064400000000075147511534000007730 0ustar00%rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x
macros.vim000064400000000050147511534000006540 0ustar00%vimfiles_root %{_datadir}/vim/vimfiles
macros.perl-srpm000064400000001432147511534000007673 0ustar00# Copyright (c) 2012  Petr Pisar <ppisar@redhat.com>.
# This file is distributed under the terms of GNU GPL license version 3, or
# any later version.

# This file contains macros that can be used for building source RPM package
# from git source repository. This file must present in minimal build root to
# take effect.
# This file must not use Perl or any non-minimal-build-root package. The
# purpose is to enable bootstrapping perl.
 
# Perl bootstrap For rebuild of Perl and all related packages is needed
# switch, which enable only vital build requires. This could help cyclic
# dependencies, for example: perl-Test-Minimum-Version <->
# perl-Perl-Minimum-Version Defined for bootstraping, undefined otherwise.
# Usage: %%if !%%{defined perl_bootstrap} ... %%endif
#%%perl_bootstrap 1

macros.python3000064400000007202147511534000007357 0ustar00%__python3 /usr/libexec/platform-python
%python3 %__python3
%python3_sitelib %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python3_sitearch %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
%python3_version %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
%python3_version_nodots %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info).replace('.',''))")
%python3_platform %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_platform())")
%python3_platform_triplet %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
%python3_ext_suffix %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
%py3dir %{_builddir}/python3-%{name}-%{version}-%{release}

%py3_shbang_opts -s
%py3_shbang_opts_nodash %(opts=%{py3_shbang_opts}; echo ${opts#-})
%py3_shebang_flags %(opts=%{py3_shbang_opts}; echo ${opts#-})
%py3_shebang_fix %{expand:\\\
  if [ -f /usr/bin/pathfix%{python3_version}.py ]; then
    pathfix=/usr/bin/pathfix%{python3_version}.py
  else
    # unversioned pathfix.py provided by platform-python-devel
    pathfix=/usr/bin/pathfix.py
  fi
  if [ -z "%{?py3_shebang_flags}" ]; then
    shebang_flags="-k"
  else
    shebang_flags="-ka%{py3_shebang_flags}"
  fi
  $pathfix -pni %{__python3} $shebang_flags}

# Use the slashes after expand so that the command starts on the same line as
# the macro
%py3_build() %{expand:\\\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
  %{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*}
  sleep 1
}

%py3_build_egg() %{expand:\\\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
  %{__python3} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
  sleep 1
}

%py3_build_wheel() %{expand:\\\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
  %{__python3} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
  sleep 1
}

%py3_install() %{expand:\\\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
  %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
}

%py3_install_egg() %{expand:\\\
  mkdir -p %{buildroot}%{python3_sitelib}
  CFLAGS="%{optflags}" %{__python3} -m easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python3_version}.egg %{?*}
}

%py3_install_wheel() %{expand:\\\
  CFLAGS="%{optflags}" %{__python3} -m pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
}

# This only supports Python 3.5+ and will never work with Python 2.
# Hence, it has no Python version in the name.
%pycached() %{lua:
  path = rpm.expand("%{?*}")
  if (string.sub(path, "-3") ~= ".py") then
    rpm.expand("%{error:%%pycached can only be used with paths explicitly ending with .py}")
  else
    print(path)
    pyminor = path:match("/python3.(%d+)/") or "*"
    dirname = path:match("(.*/)")
    modulename = path:match(".*/([^/]+).py")
    print("\\n" .. dirname .. "__pycache__/" .. modulename .. ".cpython-3" .. pyminor .. "{,.opt-?}.pyc")
  end
}

# This is intended for Python 3 only, hence also no Python version in the name.
%__pytest /usr/bin/pytest-%{_python3_pkgversion_with_dot}
%pytest %{expand:\\\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
  PATH="%{buildroot}%{_bindir}:$PATH"\\\
  PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
  PYTHONDONTWRITEBYTECODE=1\\\
  %__pytest}
© 2025 GrazzMean