import epel-rpm-macros-8-41.el8

i8ce changed/i8ce/epel-rpm-macros-8-41.el8
Sergey Cherevko 9 months ago
commit b812dd784d
Signed by: scherevko
GPG Key ID: D87CBBC16D2E4A72

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

@ -0,0 +1,3 @@
addFilter("no-%build-section")
addFilter("no-documentation")
addFilter("only-non-binary-in-usr-lib")

@ -0,0 +1,171 @@
'''Script to perform import of each module given to %%py_check_import
'''
import argparse
import importlib
import fnmatch
import os
import re
import site
import sys
from contextlib import contextmanager
from pathlib import Path
def read_modules_files(file_paths):
'''Read module names from the files (modules must be newline separated).
Return the module names list or, if no files were provided, an empty list.
'''
if not file_paths:
return []
modules = []
for file in file_paths:
file_contents = file.read_text()
modules.extend(file_contents.split())
return modules
def read_modules_from_cli(argv):
'''Read module names from command-line arguments (space or comma separated).
Return the module names list.
'''
if not argv:
return []
# %%py3_check_import allows to separate module list with comma or whitespace,
# we need to unify the output to a list of particular elements
modules_as_str = ' '.join(argv)
modules = re.split(r'[\s,]+', modules_as_str)
# Because of shell expansion in some less typical cases it may happen
# that a trailing space will occur at the end of the list.
# Remove the empty items from the list before passing it further
modules = [m for m in modules if m]
return modules
def filter_top_level_modules_only(modules):
'''Filter out entries with nested modules (containing dot) ie. 'foo.bar'.
Return the list of top-level modules.
'''
return [module for module in modules if '.' not in module]
def any_match(text, globs):
'''Return True if any of given globs fnmatchcase's the given text.'''
return any(fnmatch.fnmatchcase(text, g) for g in globs)
def exclude_unwanted_module_globs(globs, modules):
'''Filter out entries which match the either of the globs given as argv.
Return the list of filtered modules.
'''
return [m for m in modules if not any_match(m, globs)]
def read_modules_from_all_args(args):
'''Return a joined list of modules from all given command-line arguments.
'''
modules = read_modules_files(args.filename)
modules.extend(read_modules_from_cli(args.modules))
if args.exclude:
modules = exclude_unwanted_module_globs(args.exclude, modules)
if args.top_level:
modules = filter_top_level_modules_only(modules)
# Error when someone accidentally managed to filter out everything
if len(modules) == 0:
raise ValueError('No modules to check were left')
return modules
def import_modules(modules):
'''Procedure to perform import check for each module name from the given list of modules.
'''
for module in modules:
print('Check import:', module, file=sys.stderr)
importlib.import_module(module)
def argparser():
parser = argparse.ArgumentParser(
description='Generate list of all importable modules for import check.'
)
parser.add_argument(
'modules', nargs='*',
help=('Add modules to check the import (space or comma separated).'),
)
parser.add_argument(
'-f', '--filename', action='append', type=Path,
help='Add importable module names list from file.',
)
parser.add_argument(
'-t', '--top-level', action='store_true',
help='Check only top-level modules.',
)
parser.add_argument(
'-e', '--exclude', action='append',
help='Provide modules globs to be excluded from the check.',
)
return parser
@contextmanager
def remove_unwanteds_from_sys_path():
'''Remove cwd and this script's parent from sys.path for the import test.
Bring the original contents back after import is done (or failed)
'''
cwd_absolute = Path.cwd().absolute()
this_file_parent = Path(__file__).parent.absolute()
old_sys_path = list(sys.path)
for path in old_sys_path:
if Path(path).absolute() in (cwd_absolute, this_file_parent):
sys.path.remove(path)
try:
yield
finally:
sys.path = old_sys_path
def addsitedirs_from_environ():
'''Load directories from the _PYTHONSITE environment variable (separated by :)
and load the ones already present in sys.path via site.addsitedir()
to handle .pth files in them.
This is needed to properly import old-style namespace packages with nspkg.pth files.
See https://bugzilla.redhat.com/2018551 for a more detailed rationale.'''
for path in os.getenv('_PYTHONSITE', '').split(':'):
if path in sys.path:
site.addsitedir(path)
def main(argv=None):
cli_args = argparser().parse_args(argv)
if not cli_args.modules and not cli_args.filename:
raise ValueError('No modules to check were provided')
modules = read_modules_from_all_args(cli_args)
with remove_unwanteds_from_sys_path():
addsitedirs_from_environ()
import_modules(modules)
if __name__ == '__main__':
main()

@ -0,0 +1,42 @@
# Macros to constrain resource use during the build process
# outputs build flag overrides to be used in conjunction with
# %%make_build, %%cmake_build etc.
#
# if no override is needed, this macro outputs nothing
#
# - m memory limit in MBs per core; default is 1024
#
# Usage:
# e.g. %make_build %{limit_build -m 2048}
# => /usr/bin/make -O -j16 V=1 VERBOSE=1
# %make_build %{limit_build -m 40960}
# => /usr/bin/make -O -j16 V=1 VERBOSE=1 -j1
#
%limit_build(m:) %{lua:
local mem_per_process=rpm.expand("%{-m*}")
if mem_per_process == "" then
mem_per_process = 1024
else
mem_per_process = tonumber(mem_per_process)
end
local mem_total = 0
for line in io.lines('/proc/meminfo') do
if line:sub(1, 9) == "MemTotal:" then
local tokens = {}
for token in line:gmatch("%w+") do
tokens[#tokens + 1] = token
end
mem_total = tonumber(tokens[2])
break
end
end
local max_jobs = mem_total // (mem_per_process * 1024)
if max_jobs < 1 then
max_jobs = 1
end
cur_max_jobs=tonumber(rpm.expand("%{_smp_build_ncpus}"))
if cur_max_jobs > max_jobs then
print("-j" .. max_jobs)
end
}

@ -0,0 +1,109 @@
# epel macros
%epel 8
# Mono macros requested in rhbz 1295117
%mono_arches %{ix86} x86_64 sparc sparcv9 ia64 %{arm} alpha s390x ppc ppc64 ppc64le
%_monodir %{_prefix}/lib/mono
%_monogacdir %{_monodir}/gac
# Bash completions; not in bash to not intefere with install ordering
#
# NOTE: This macro is deprecated; point to the preferred macro from
# macros.shell-completions
%bash_completion_dir %{bash_completions_dir}
# Use the non-underscored Python macros to refer to Python in spec, etc.
%python2 %__python2
# Users can use %%python only if they redefined %%__python (e.g. to %%__python3)
%python() %{lua:\
__python = rpm.expand("%__python")\
if __python == "/usr/bin/python" then\
rpm.expand("%{error:Cannot use %%python if %%__python wasn't redefined to something other than /usr/bin/python.}")\
else\
print(__python)\
end\
}
# With $PATH and $PYTHONPATH set to the %%buildroot,
# try to import the given Python module(s).
# Useful as a smoke test in %%check when running tests is not feasible.
# Use spaces or commas as separators.
%py_check_import(e:tf:) %{expand:\\\
%{-e:echo 'WARNING: The -e option of %%%%py_check_import is not currently supported on EPEL.' >&2}
%{-t:echo 'WARNING: The -t option of %%%%py_check_import is not currently supported on EPEL.' >&2}
%{-f:echo 'WARNING: The -f option of %%%%py_check_import is not currently supported on EPEL.' >&2}
(cd %{_topdir} &&\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python_sitearch}:%{buildroot}%{python_sitelib}}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%{__python} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
)
}
%py2_check_import(e:tf:) %{expand:\\\
%{-e:echo 'WARNING: The -e option of %%%%py2_check_import is not currently supported on EPEL.' >&2}
%{-t:echo 'WARNING: The -t option of %%%%py2_check_import is not currently supported on EPEL.' >&2}
%{-f:echo 'WARNING: The -f option of %%%%py2_check_import is not currently supported on EPEL.' >&2}
(cd %{_topdir} &&\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python2_sitearch}:%{buildroot}%{python2_sitelib}}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%{__python2} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
)
}
# With $PATH and $PYTHONPATH set to the %%buildroot,
# try to import the Python 3 module(s) given as command-line args or read from file (-f).
# Respect the custom values of %%py3_shebang_flags or set nothing if it's undefined.
# Filter and check import on only top-level modules using -t flag.
# Exclude unwanted modules by passing their globs to -e option.
# Useful as a smoke test in %%check when running tests is not feasible.
# Use spaces or commas as separators if providing list directly.
# Use newlines as separators if providing list in a file.
%py3_check_import(e:tf:) %{expand:\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
_PYTHONSITE="%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%{lua:
local command = "%{__python3} "
if rpm.expand("%{?py3_shebang_flags}") ~= "" then
command = command .. "-%{py3_shebang_flags}"
end
command = command .. " %{_rpmconfigdir}/redhat/import_all_modules.py "
-- handle multiline arguments correctly, see https://bugzilla.redhat.com/2018809
local args=rpm.expand('%{?**}'):gsub("[%s\\\\]*%s+", " ")
print(command .. args)
}
}
# When packagers go against the Packaging Guidelines and disable the runtime
# dependency generator, we want it to fall back to only creating the python(abi)
# Requires instead of none at all.
#
# This macro is EPEL 8 only, as the pythondist dependency generator
# is already disabled by the default in RHEL.
%python_disable_dependency_generator() \
%undefine __pythondist_requires \
%{nil}
# 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
# qt5 macro removed from RHEL8 but needed to ensure qtwebengine, and
# its dependencies build on supported arches.
%qt5_qtwebengine_arches %{ix86} x86_64 %{arm} aarch64 mips mipsel mips64el
# Arches that OpenJDK and dependent packages run on
%java_arches aarch64 ppc64le s390x x86_64

@ -0,0 +1,16 @@
%autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = tonumber(rpm.expand("%{?_rpmautospec_release_number}%{!?_rpmautospec_release_number:1}"));
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
%autochangelog %{lua:
locale = os.setlocale(nil)
os.setlocale("C.utf8")
date = os.date("%a %b %d %Y")
os.setlocale(locale)
packager = rpm.expand("%{?packager}%{!?packager:John Doe <packager@example.com>}")
evr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
print("* " .. date .. " " .. packager .. " - " .. evr .. "\\n")
print("- local build")
}

@ -0,0 +1,3 @@
%bash_completions_dir %{_datadir}/bash-completion/completions
%zsh_completions_dir %{_datadir}/zsh/site-functions
%fish_completions_dir %{_datadir}/fish/vendor_completions.d

@ -0,0 +1,10 @@
# RPM macros for packages creating system accounts
#
# Turn a sysusers.d file into macros specified by
# https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/#_dynamic_allocation
%sysusers_requires_compat Requires(pre): shadow-utils
%sysusers_create_compat() \
%(%{_rpmconfigdir}/sysusers.generate-pre.sh %{?*}) \
%{nil}

@ -0,0 +1,27 @@
# This file is used _only_ to override macros which exist in RHEL.
# It should be used very sparingly.
# Override %__python3 here based on %%python3_pkgversion to avoid relying on the finicky
# python3X-rpm-macros packages.
# Backported from https://src.fedoraproject.org/rpms/python-rpm-macros/c/a8b26546eb699afe0dbfcef913a2aa7085fc5afb?branch=rawhide
#
# EPEL specific, RHEL defines this in the python3X-rpm-macros packages
# and the default is /usr/libexec/platform-python.
# Usually, we don't want EPEL packages to use platform-python.
# Packages that want to do that can explicitly override this.
#
# When %%python3_pkgveresion is set to 3 (i.e. the default), we override
# %%__python3 to /usr/bin/python3.6 to ensure that programs are always run with
# python3.6, even if /usr/bin/python3 is a symlink to a different interpreter.
#
# See https://lists.fedoraproject.org/archives/list/epel-devel@lists.fedoraproject.org/thread/RE3PG72B5AX7NTACPDSBGOWCMN7I3OQJ/
%__python3 %{lua:
local bin = "/usr/bin/python"
if rpm.expand("%python3_pkgversion") == "3" then
bin = bin .. "3.6"
else
bin = bin .. rpm.expand("%{_python3_pkgversion_with_dot}")
end
print(bin)
}

@ -0,0 +1,2 @@
%__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires
%__pythondist_path ^/usr/lib(64)?/python[[:digit:]]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$

@ -0,0 +1,2 @@
%__sysusers_provides %{_rpmconfigdir}/sysusers.prov
%__sysusers_path ^%{_sysusersdir}/.*\\.conf$

@ -0,0 +1,79 @@
#!/bin/bash
# This script turns sysuser.d files into scriptlets mandated by Fedora
# packaging guidelines. The general idea is to define users using the
# declarative syntax but to turn this into traditional scriptlets.
user() {
user="$1"
uid="$2"
desc="$3"
group="$4"
home="$5"
shell="$6"
[ "$desc" = '-' ] && desc=
{ [ "$home" = '-' ] || [ "$home" = '' ]; } && home=/
{ [ "$shell" = '-' ] || [ "$shell" = '' ]; } && shell=/sbin/nologin
if [ "$uid" = '-' ] || [ "$uid" = '' ]; then
cat <<EOF
getent passwd '$user' >/dev/null || \\
useradd -r -g '$group' -d '$home' -s '$shell' -c '$desc' '$user'
EOF
else
cat <<EOF
if ! getent passwd '$user' >/dev/null ; then
if ! getent passwd '$uid' >/dev/null ; then
useradd -r -u '$uid' -g '$group' -d '$home' -s /sbin/nologin -c '$desc' '$user'
else
useradd -r -g '$group' -d '$home' -s /sbin/nologin -c '$desc' '$user'
fi
fi
EOF
fi
}
group() {
group="$1"
gid="$2"
if [ "$gid" = '-' ]; then
cat <<-EOF
getent group '$group' >/dev/null || groupadd -r '$group'
EOF
else
cat <<-EOF
getent group '$group' >/dev/null || groupadd -f -g '$gid' -r '$group'
EOF
fi
}
parse() {
while read -r line || [ -n "$line" ] ; do
{ [ "${line:0:1}" = '#' ] || [ "${line:0:1}" = ';' ]; } && continue
line="${line## *}"
[ -z "$line" ] && continue
eval "arr=( $line )"
case "${arr[0]}" in
('u')
group "${arr[1]}" "${arr[2]}"
user "${arr[1]}" "${arr[2]}" "${arr[3]}" "${arr[1]}" "${arr[4]}" "${arr[5]}"
# TODO: user:group support
;;
('g')
group "${arr[1]}" "${arr[2]}"
;;
('m')
group "${arr[2]}" "-"
user "${arr[1]}" "-" "" "${arr[2]}"
;;
esac
done
}
for fn in "$@"; do
[ -e "$fn" ] || continue
echo "# generated from $(basename "$fn")"
parse <"$fn"
done

@ -0,0 +1,28 @@
#!/bin/bash
parse() {
while read line; do
[ "${line:0:1}" = '#' -o "${line:0:1}" = ';' ] && continue
line="${line## *}"
[ -z "$line" ] && continue
set -- $line
case "$1" in
('u')
echo "user($2)"
echo "group($2)"
# TODO: user:group support
;;
('g')
echo "group($2)"
;;
('m')
echo "user($2)"
echo "group($3)"
;;
esac
done
}
while read fn; do
parse < "$fn"
done

@ -0,0 +1,343 @@
Name: epel-rpm-macros
Version: 8
Release: 41
Summary: Extra Packages for Enterprise Linux RPM macros
# import_all_modules.py: MIT
License: GPLv2 and MIT
# This is a EPEL maintained package which is specific to
# our distribution. Thus the source is only available from
# within this srpm.
URL: https://download.fedoraproject.org/pub/epel
Source0: macros.epel-rpm-macros
Source1: macros.zzz-epel-override
Source3: pythondist.attr
Source9: GPL
# sysusers https://src.fedoraproject.org/rpms/systemd/c/ced9237a14d6775a98e1a2f93880990417b4ae6e
Source21: macros.sysusers
Source22: sysusers.attr
Source23: sysusers.prov
Source24: sysusers.generate-pre.sh
# misc macros
Source150: macros.build-constraints
Source151: https://src.fedoraproject.org/rpms/redhat-rpm-config/raw/rawhide/f/macros.shell-completions
# autochangelog and autorelease fallback macros
%global rpmautospec_commit 52f3c2017e10c5ab5a183fed772e9fe8a86a20fb
Source152: https://pagure.io/fedora-infra/rpmautospec/raw/%{rpmautospec_commit}/f/rpm/macros.d/macros.rpmautospec
# Python code
Source302: import_all_modules.py
BuildArch: noarch
Requires: redhat-release >= %{version}
# For FPC buildroot macros
Requires: fpc-srpm-macros
# For Lua SRPM macros
Requires: lua-srpm-macros
# For python buildroot macros
Requires: python-srpm-macros
# Since the RHEL python-devel package doesn't require them, bring them in here
Requires: python-rpm-macros
Requires: (python2-rpm-macros if python2-devel)
# Make sure EPEL8's Python 3 packages use /usr/bin/python3.{6,8,9} instead of /usr/libexec/platform-python.
# This will install the python3X-rpm-macros version corresponding to the python3X-devel version installed.
# If multiple versions are installed together, it will prefer python36-rpm-macros, the default Python version.
Requires: (python-modular-rpm-macros if (python36-devel or python38-devel or python39-devel or python3.11-devel or python3.12-devel))
# We use weak dependencies here in order to avoid creating conflicts between
# the different python3X-devel packages.
Recommends: (python36-rpm-macros if python36-devel)
Suggests: (python38-rpm-macros if python38-devel)
Suggests: (python39-rpm-macros if python39-devel)
Suggests: (python3.11-rpm-macros if python3.11-devel)
Suggests: (python3.12-rpm-macros if python3.12-devel)
# # python3-rpm-generators is already pulled in by python3X-devel
# (indirectly through platform-python-devel by python36-devel and directly by the rest),
# but we explictly Require it here, as it's needed by pythondist.attr.
Requires: (python3-rpm-generators if python-modular-rpm-macros)
#systemd additional macros https://pagure.io/epel/issue/77
Requires: (epel-rpm-macros-systemd if systemd-rpm-macros)
Requires: ansible-srpm-macros
# Provides backport from Fedora's perl-generators related to proposal
# https://fedoraproject.org/wiki/Changes/Perl_replace_MODULE_COMPAT_by_generator
Requires: (perl-generators-epel if perl-generators)
%description
This package contains the Extra Packages for Enterprise Linux (EPEL) RPM
macros for building EPEL packages.
%package systemd
Summary: Extra Packages for Enterprise Linux RPM macros (systemd)
Requires: epel-rpm-macros
Requires: systemd-rpm-macros
%description systemd
This package contains the systemd specific Extra Packages for Enterprise
Linux (EPEL) RPM macros for building EPEL packages.
%prep
%setup -cT
install -pm 644 %{SOURCE9} .
%install
#GPG Key
install -Dpm 644 %{SOURCE0} \
%{buildroot}%{_rpmmacrodir}/macros.epel-rpm-macros
install -Dpm 644 %{SOURCE1} \
%{buildroot}%{_sysconfdir}/rpm/macros.zzz-epel-override
install -Dpm 644 %{SOURCE3} \
%{buildroot}%{_fileattrsdir}/pythondist.attr
# sysusers
install -Dpm 0644 %{SOURCE21} \
%{buildroot}%{_rpmmacrodir}/macros.sysusers
install -Dpm 0644 %{SOURCE22} \
%{buildroot}%{_fileattrsdir}//sysusers.attr
install -Dpm 0755 %{SOURCE23} \
%{buildroot}%{_rpmconfigdir}/sysusers.prov
install -Dpm 0755 %{SOURCE24} \
%{buildroot}%{_rpmconfigdir}/sysusers.generate-pre.sh
# misc macros
install -Dpm 644 %{SOURCE150} \
%{buildroot}%{_rpmmacrodir}/macros.build-constraints
install -Dpm 644 %{SOURCE151} \
%{buildroot}%{_rpmmacrodir}/macros.shell-completions
install -Dpm 644 %{SOURCE152} \
%{buildroot}%{_rpmmacrodir}/macros.rpmautospec
# python scripts
mkdir -p %{buildroot}%{_rpmconfigdir}/redhat
install -Dpm 644 %{SOURCE302} %{buildroot}%{_rpmconfigdir}/redhat/
%files
%license GPL
%{_rpmmacrodir}/macros.epel-rpm-macros
%{_rpmmacrodir}/macros.rpmautospec
%{_sysconfdir}/rpm/macros.zzz-epel-override
%{_fileattrsdir}/pythondist.attr
# misc macros
%{_rpmmacrodir}/macros.build-constraints
%{_rpmmacrodir}/macros.shell-completions
# python scripts
%{_rpmconfigdir}/redhat/import_all_modules.py
%files systemd
# sysusers
%{_rpmconfigdir}/macros.d/macros.sysusers
%{_rpmconfigdir}/fileattrs/sysusers.attr
%{_rpmconfigdir}/sysusers.prov
%{_rpmconfigdir}/sysusers.generate-pre.sh
%changelog
* Thu Feb 29 2024 Sergey Cherevko <s.cherevko@msvsphere-os.ru> - 8-41
- Rebuilt for MSVSphere 8.9
* Wed Jan 03 2024 Miro Hrončok <mhroncok@redhat.com> - 8-41
- Prepare support for Python 3.12
* Fri Oct 06 2023 Orion Poplawski <orion@nwra.com> - 8-40
- Add full %%py3_check_import macro
* Fri Apr 07 2023 Miro Hrončok <mhroncok@redhat.com> - 8-39
- Prepare support for Python 3.11
* Fri Mar 10 2023 Maxwell G <maxwell@gtmx.me> - 8-38
- Backport rpmautospec fallback macros
* Wed Feb 08 2023 Maxwell G <gotmax@e.email> - 8-37
- Stop overriding macros that are now in RHEL 8.7
* Mon Jan 23 2023 Jitka Plesnikova <jplesnik@redhat.com> - 8-36
- Add perl-generators-epel to the buildroot
* Tue Nov 22 2022 Todd Zullinger <tmz@pobox.com> - 8-35
- Backport macros.shell-completions from Fedora
* Tue Nov 08 2022 Maxwell G <gotmax@e.email> - 8-34
- Set %%__python3 to /usr/bin/python3.6 by default
* Wed Aug 24 2022 Iñaki Úcar <iucar@fedoraproject.org> - 8-33
- Backport java_arches macro from Fedora
* Sat Jul 16 2022 Maxwell G <gotmax@e.email> - 8-32
- Explicitly Require python3-rpm-generators
- Remove %%__pythondist_provides from pythondist.attr.
- Ensure that packages built against alternative python stacks do not have
python3dist(x) Provides.
- Related: rhbz#1776941.
* Sat Jul 16 2022 Miro Hrončok <mhroncok@redhat.com> - 8-31
- Fix a regression in the %%pytest definition (/usr/bin/pytest: No such file or directory)
* Tue May 24 2022 Maxwell G <gotmax@e.email> - 8-30
- Pull in appropriate python3X-rpm-macros package for non-default Python
versions
- Ensure the python macros work properly when building against non-default
python interpreters.
- Only pull in python2-rpm-macros when python2-devel is present.
- Remove macros that have been added to RHEL itself.
* Tue May 17 2022 Maxwell G <gotmax@e.email> - 8-29
- Add `Requires: ansible-srpm-macros`
- Backport @churchyard's packaging nitpicks from epel9
* Tue Mar 15 2022 Miro Hrončok <mhroncok@redhat.com> - 8-28
- Remove %%gpgverify and /usr/lib/rpm/gpgverify, it is available in RHEL 8.4+
* Wed Jan 19 2022 Pablo Greco <pgreco@centosproject.org> - 8-27
- Backport systemd sysusers macros from Fedora
* Wed Oct 27 2021 Karolina Surma <ksurma@redhat.com> - 8-26
- Add -t, -f, -e options to %%py_check_import which emit warning when used
* Tue Oct 26 2021 Tomas Orsava <torsava@redhat.com> - 8-25
- Define a new macros %%python_wheel_dir and %%python_wheel_pkg_prefix
* Wed Sep 1 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 8-24
- Fix macros.build-constraints' %%limit_build
- number of CPUs will never be set to less than 1
- this now outputs build flag overrides to be used with %%make_build etc.
- add documentation
* Mon Aug 2 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 8-23
- Add macros.build-constraints
- Refactor to use standard macros, not hard-coded paths
* Wed Jul 14 2021 Miro Hrončok <mhroncok@redhat.com> - 8-22
- Introduce %%py3_check_import
* Wed May 19 2021 Neal Gompa <ngompa13@gmail.com> - 8-21
- Drop custom CMake macros, RHEL 8.4 includes them now (cf. rhbz#1858983)
* Sat May 01 2021 Todd Zullinger <tmz@pobox.com> - 8-20
- Backport %%gpgverify API simplification
- Remove exec perms from /etc/rpm/macros.zzz-epel-override-cmake
- Silence rpmlint warnings about non-issues
* Tue Dec 22 2020 Miro Hrončok <mhroncok@redhat.com> - 8-19
- Define %%python_disable_dependency_generator
* Fri Sep 25 2020 Miro Hrončok <mhroncok@redhat.com> - 8-18
- Add %%python3_platform_triplet and %%python3_ext_suffix
- https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names
* Tue Sep 8 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 8-17
- Add a Requires for lua-srpm-macros
* Thu Jul 30 2020 Neal Gompa <ngompa13@gmail.com> - 8-16
- Use legacy behavior for cmake-configure
* Wed Jul 29 2020 Neal Gompa <ngompa13@gmail.com> - 8-15
- Backport support for out-of-source builds controlled by __cmake_in_source_build macro (#1861329)
- Backport cmake_build and cmake_install macros
- Backport ctest macro
* Sun Jun 28 2020 Artur Iwicki <fedora@svgames.pl> - 8-14
- Add a Requires for fpc-srpm-macros
* Fri Jun 19 2020 Troy Dawson <tdawson@redhat.com> - 8-13
- Use Suggests for python36-rpm-macros
* Sun Jun 07 2020 Miro Hrončok <mhroncok@redhat.com> - 8-12
- Backport %%py_shebang_fix, %%pytest, %%py_provides
- Allow to combine %%pycached with other macros (e.g. %%exclude or %%ghost) (#1838992)
* Thu Apr 30 2020 Troy Dawson <tdawson@redhat.com> - 8-11
- Install python36-rpm-macros or python38-rpm-macros correctly
* Tue Apr 14 2020 Miro Hrončok <mhroncok@redhat.com> - 8-10
- Define %%python, but make it work only if %%__python is redefined
- Add the %%pycached macro
* Fri Apr 03 2020 Troy Dawson <tdawson@redhat.com> - 8-9
- Add %%qt5_qtwebengine_arches to macros
* Thu Nov 21 2019 Troy Dawson <tdawson@redhat.com> - 8-8
- Bump release to be in sync with playground build.
* Wed Nov 20 2019 Troy Dawson <tdawson@redhat.com> - 8-6
- Enable python requires generator
* Wed Nov 13 2019 Kevin Fenzi <kevin@scrye.com> - 8-5
- Bump release, because 8-4 was built in epel8-playground
* Wed Oct 30 2019 Orion Poplawski <orion@nwra.com> - 8-4
- Add gpgverify macro and script
* Mon Oct 21 2019 Miro Hrončok <mhroncok@redhat.com> - 8-3
- Make sure EPEL8's Python 3 packages use /usr/bin/python3.6 instead of /usr/libexec/platform-python
* Mon Sep 30 2019 Miro Hrončok <mhroncok@redhat.com> - 8-2
- Define %%python2 and %%python3
* Wed Jun 5 2019 Stephen Smoogen <smooge@smoogen-laptop.localdomain> - 8-1
- Make an initial macro set for 8.
* Fri Jun 15 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-19
- Add %%set_build_flags macro.
* Mon May 14 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-18
- Add various %%build_* macros from Fedora.
* Fri Apr 20 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-17
- Add %%_rpmmacrodir from Fedora.
* Fri Apr 20 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-16
- Add %%_metainfodir macro.
* Thu Feb 15 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-15
- Add %%vimfiles_root (bug #1545901)
* Mon Jan 29 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 7-14
- Backport ldconfig macros
* Thu Dec 15 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-13
- Backport vpath macros.
* Fri Dec 9 2016 Orion Poplawski <orion@cora.nwra.com> 7-12
- Fix override macro file name
* Tue Dec 6 2016 Orion Poplawski <orion@cora.nwra.com> 7-11
- Override %%_pkgdocdir (bug #1392354)
* Fri Sep 16 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-10
- Add overrides file (seems that it must be in /etc/rpm) and override
%%nodejs_arches.
* Thu Aug 11 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-9
- Add %%bash_completion_dir.
* Wed Mar 30 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-8
- Use simpler definition of %%epel.
* Thu Feb 18 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 7-7
- Add mono macros requested in rhbz 1295117.
* Mon Jan 25 2016 Orion Poplawski <orion@cora.nwra.com> 7-6
- Bring in python macros via the python-rpm-macros packages
- Use %%setup so fedpkg local works
* Mon Jan 4 2016 Orion Poplawski <orion@cora.nwra.com> 7-5
- Fix python_provide macro for EPEL7 python3 package names
* Thu Oct 8 2015 Thomas Spura <tomspur@fedoraproject.org> - 7-4
- Fix python_provide macro to use epoch and obsolete previous python- package
* Tue Aug 18 2015 Orion Poplawski <orion@cora.nwra.com> 7-3
- Fix py2_install macro
- Cleanup spec
* Sat Aug 01 2015 Kevin Fenzi <kevin@scrye.com> 7-2
- Add python macros. Fixes bug #1241655
* Wed Apr 29 2015 Kevin Fenzi <kevin@scrye.com> 7-1
- Initial version for epel.
Loading…
Cancel
Save