Sync from SUSE:ALP:Source:Standard:1.0 saltbundlepy-rpm-macros revision e269c210156f7d0c15b204ac39e0cf9c

This commit is contained in:
Adrian Schröter 2024-07-15 12:59:03 +02:00
commit 74fd02139e
14 changed files with 1172 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

19
_service Normal file
View File

@ -0,0 +1,19 @@
<services>
<service mode="manual" name="tar_scm">
<param name="url">https://github.com/openSUSE/python-rpm-macros.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="revision">master</param>
<param name="versionformat">%cd.%h</param>
<param name="changesgenerate">enable</param>
<param name="filename">saltbundlepy-rpm-macros</param>
<param name="changesauthor">mcepl@cepl.eu</param>
</service>
<service mode="manual" name="recompress">
<param name="file">saltbundlepy-rpm-macros-*.tar</param>
<param name="compression">xz</param>
</service>
<service mode="manual" name="set_version">
<param name="basename">saltbundlepy-rpm-macros</param>
</service>
</services>

6
_servicedata Normal file
View File

@ -0,0 +1,6 @@
<servicedata>
<service name="tar_scm">
<param name="url">git://github.com/openSUSE/python-rpm-macros.git</param>
<param name="changesrevision">758e6d86b55ee02538db8fc3d9db2253715ef6db</param></service><service name="tar_scm">
<param name="url">https://github.com/openSUSE/python-rpm-macros.git</param>
<param name="changesrevision">6fe8111dbbd7e28323f160273364626230386503</param></service></servicedata>

21
macros.z-sb-fdupes Normal file
View File

@ -0,0 +1,21 @@
%fdupes(s) \
_target=""; \
_symlinks=0; \
%{-s:_symlinks=1;} \
fdupes -q -p -n -H -o name -r %1 | \
while read _file; do \
if test -z "$_target" ; then \
_target="$_file"; \
else \
if test -z "$_file" ; then \
_target=""; \
continue ; \
fi ; \
if test "$_symlinks" = 1; then \
ln -sf "${_target#%{buildroot}}" "$_file"; \
else \
ln -f "$_target" "$_file"; \
fi ; \
fi ; \
done \
%{nil}

10
macros.z-sb-install-post Normal file
View File

@ -0,0 +1,10 @@
%__os_install_post \
/usr/lib/rpm/redhat/brp-compress \
%{!?__debug_package:\
/usr/lib/rpm/redhat/brp-strip %{__strip} \
/usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
} \
/usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \
/usr/lib/rpm/redhat/brp-python-hardlink \
%{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
%{nil}

View File

@ -0,0 +1,107 @@
--- a/flavor.in
+++ b/flavor.in
@@ -127,14 +127,11 @@
# Commands for RPM scriptlets: These must not be empty even if there is no operation for
# either update-alternatives or libalternatives.
-%#FLAVOR#_install_alternative() \# #FLAVOR#_install_alternative: \
-%{?!with_libalternatives:%{_python_macro_init}%{lua:python_install_ualternative("#FLAVOR#") \
-}}%{?with_libalternatives:\: \# no install scriptlet action for libalternatives}
+%#FLAVOR#_install_alternative() %{_python_macro_init} \
+%{lua:python_install_alternative("#FLAVOR#")}
-%#FLAVOR#_uninstall_alternative() \# #FLAVOR#_uninstall_alternative: \
-%{?!with_libalternatives:%{uninstall_alternative -n %1 -t %{_bindir}/%1-%{#FLAVOR#_bin_suffix} \
-}}%{?with_libalternatives:\: \# no uninstall scriptlet action for libalternatives}
+%#FLAVOR#_uninstall_alternative() \
+%{uninstall_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix}
-%#FLAVOR#_reset_alternative() \# #FLAVOR#_reset_alternative: \
-%{?!with_libalternatives:\: \# reset action only for libalternatives \
-}%{?with_libalternatives:%{reset_alternative -n %1 -t %{_bindir}/%1-%{#FLAVOR#_bin_suffix}}}
+%#FLAVOR#_reset_alternative() \
+%{reset_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix}
--- a/functions.lua
+++ b/functions.lua
@@ -116,6 +116,70 @@
end
return prio
end
+function python_install_alternative(flavor)
+ local prio = alternative_prio(flavor)
+ local binsuffix = rpm.expand("%" .. flavor .. "_bin_suffix")
+ local libalternatives = rpm.expand("%{with libalternatives}")
+
+ local params = {}
+ for p in string.gmatch(rpm.expand("%*"), "%S+") do
+ table.insert(params, p)
+ end
+
+ if #params == 0 then
+ print("error")
+ return
+ end
+
+ if libalternatives == "1" then
+ for _, v in ipairs(params) do
+ local link, name, path = python_alternative_names(v, binsuffix)
+ if not v:match(".+%.%d") then
+ local group = ""
+ local man = ""
+ for _, v2 in ipairs(params) do
+ local man_match = v2:match(".+%.%d")
+ if man_match then
+ if string.sub(man_match,1,-3) == v then
+ local man_entry = v .. "-" .. binsuffix .. "." .. string.sub(man_match,man_match:len())
+ if man:len() > 0 then
+ man = man .. ", " .. man_entry
+ else
+ man = man_entry
+ end
+ end
+ else
+ if group:len() > 0 then
+ group = group .. ", " .. v2
+ else
+ group = v2
+ end
+ end
+ end
+ local bindir = rpm.expand("%_bindir")
+ local datadir = rpm.expand("%_datadir")
+ print(string.format("mkdir -p %s/libalternatives/%s\n", datadir, v))
+ print(string.format("echo binary=%s/%s-%s >%s/libalternatives/%s/%s.conf\n",
+ bindir, v, binsuffix, datadir, v, prio))
+ if man:len() > 0 then
+ print(string.format("echo man=%s >>%s/libalternatives/%s/%s.conf\n",
+ man, datadir, v, prio))
+ end
+ if group:len() > 0 then
+ print(string.format("echo group=%s >>%s/libalternatives/%s/%s.conf\n",
+ group, datadir, v, prio))
+ end
+ end
+ end
+ else
+ local link, name, path = python_alternative_names(params[1], binsuffix)
+ print(string.format("update-alternatives --quiet --install %s %s %s %s", link, name, path, prio))
+ table.remove(params, 1)
+ for _, v in ipairs(params) do
+ print(string.format(" \\\n --slave %s %s %s", python_alternative_names(v, binsuffix)))
+ end
+ end
+end
function python_install_ualternative(flavor)
local prio = alternative_prio(flavor)
local binsuffix = rpm.expand("%" .. flavor .. "_bin_suffix")
--- a/macros/001-alternatives
+++ b/macros/001-alternatives
@@ -41,7 +41,7 @@
%define alternative_name %{-n:%{-n*}}%{!-n:%1} \
%define alternative_target %{-t:%{-t*}}%{!-t:%2} \
if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ]; then \
- update-alternatives --quiet --remove "%{alternative_name}" "%{alternative_target}" \
+ update-alternatives --quiet --remove "%{alternative_name}" "%{alternative_target}" || true \
fi \
%{nil}

View File

@ -0,0 +1,113 @@
--- a/flavor.in
+++ b/flavor.in
@@ -41,49 +41,6 @@
%__#FLAVOR# %{py_setup} %{?py_setup_args} install \\\
-O1 --skip-build --force --root %{buildroot} --prefix %{_prefix}
-##### PEP517/PEP518 macros #####
-
-%#FLAVOR#_pyproject_wheel(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) \
-%{_python_use_flavor #FLAVOR#} \
-myargs="%{**}" \
-if [ -f %{_pyproject_anywheeldir}/*-none-any.whl ]; then \
- echo "Already found a compatible wheel in %{_pyproject_anywheeldir}" \
- mkdir -p %{_pyproject_wheeldir} \
- cp %{_pyproject_anywheeldir}/*-none-any.whl %{_pyproject_wheeldir}/ \
-else \
- %__#FLAVOR# -mpip wheel %{pyproject_wheel_args} ${myargs:-.}\
- if [ -f %{_pyproject_wheeldir}/*-none-any.whl ]; then \
- mkdir -p %{_pyproject_anywheeldir} \
- cp %{_pyproject_wheeldir}/*-none-any.whl %{_pyproject_anywheeldir}/ \
- fi \
-fi
-
-%#FLAVOR#_pyproject_install(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) \
-%{_python_use_flavor #FLAVOR#} \
-myargs="%{**}" \
-havereq=0 \
-if [ -n "${myargs}" ]; then \
- for a in ${myargs}; do \
- pep440req=$(echo $(basename -- ${a}) | sed -E 's/([^-]+)-([^-]+)-.+\\.whl/\\1==\\2/') \
- if [ -f ${a} -a $(basename -- ${a}) != "${pep440req}" ]; then \
- myargs=$(echo ${myargs} | sed "s|${a}|${pep440req}|") \
- mkdir -p %{_pyproject_wheeldir} \
- cp $a %{_pyproject_wheeldir} \
- havereq=1 \
- fi \
- done \
-fi \
-if [ $havereq -eq 0 ]; then \
- # Fallback for old macro usages which expect a wheel in the current directory \
- ls %{_pyproject_wheeldir}/*.whl || (mkdir -p %{_pyproject_wheeldir}/; cp *.whl %{_pyproject_wheeldir}/) \
- for w in %{_pyproject_wheeldir}/*.whl; do \
- myargs="$myargs $(echo $(basename ${w}) | sed -E 's/([^-]+)-([^-]+)-.+\\.whl/\\1==\\2/')" \
- done \
-fi \
-%__#FLAVOR# -mpip install %{pyproject_install_args} $myargs \
-%#FLAVOR#_compile \
-%#FLAVOR#_fix_shebang
-
%#FLAVOR#_compile \
for d in %{buildroot}%{#FLAVOR#_sitelib} %{buildroot}%{#FLAVOR#_sitearch}; do \
if [ -d $d ]; then \
--- a/macros/010-common-defs
+++ b/macros/010-common-defs
@@ -170,6 +170,35 @@
print(rpm.expand(intro .. args .. "}")) \
}
+##### PEP-518 macros #####
+%pyproject_wheel(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) %{lua:\
+ local args = rpm.expand("%**"); \
+ local pyexpandstart = "%{python_expand # \\n"; \
+ local buildwheel = "$python -mpip wheel --no-deps %{?py_setup_args:--build-option %{py_setup_args}}"; \
+ buildwheel = buildwheel .. " --disable-pip-version-check --use-pep517 --no-build-isolation --progress-bar off --verbose . -w build/ "; \
+ -- remove abi and platform tags from filename in case the package does define them incorrectly (see PEP427 for valid filenames) \
+ -- single percent for shell out of four percent by rpm.expand \
+ local renamewheel = "fn=(build/*.whl); fn2=${fn%%%%-*-*.whl}-none-any.whl; if [ ! $fn -ef $fn2 ]; then mv $fn $fn2; fi"; \
+ local pyexpandend = "}"; \
+ print(rpm.expand(pyexpandstart .. buildwheel .. args .. "\\n " .. renamewheel .. pyexpandend)) \
+}
+
+# No such option: --strip-file-prefix %%{buildroot}
+%pyproject_install(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) %{lua:\
+ local args = rpm.expand("%**"); \
+ local broot = rpm.expand("--root %buildroot"); \
+ local pyexpandstart = "%{python_expand # \\n"; \
+ local findwheel = "wheelinargs=0 \\n"; \
+ if args ~= "" then \
+ findwheel = findwheel .. "for a in " .. args .. "; do if [ -f $a -a ${a: -3} = 'whl' ]; then wheelinargs=1; break; fi; done \\n"; \
+ end \
+ findwheel = findwheel .. "if [ $wheelinargs -eq 0 ]; then if [ -f build/*.whl ]; then wheelname=build/*.whl; else wheelname=*.whl; fi; fi \\n"; \
+ local installwheel = "$python -mpip install " .. broot .. " --disable-pip-version-check --no-compile --no-deps --progress-bar off " .. args .. " $wheelname"; \
+ local pyexpandend = "}"; \
+ print(rpm.expand(pyexpandstart .. findwheel .. installwheel .. pyexpandend)) \
+ print(rpm.expand("%python_compileall")) \
+}
+
##### Find language files #####
%python_find_lang() \
--- a/macros.lua
+++ b/macros.lua
@@ -446,20 +446,6 @@
end
end
-function pyproject_wheel(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=)
- rpm.expand("%_python_macro_init")
- for _, python in ipairs(pythons) do
- print(rpm.expand("%" .. python .. "_pyproject_wheel %**"))
- end
-end
-
-function pyproject_install(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=)
- rpm.expand("%_python_macro_init")
- for _, python in ipairs(pythons) do
- print(rpm.expand("%" .. python .. "_pyproject_install %**"))
- end
-end
-
function python_compileall()
rpm.expand("%_python_macro_init")
for _, python in ipairs(pythons) do

22
saltbundlepy-flavor.patch Normal file
View File

@ -0,0 +1,22 @@
--- a/compile-macros.sh
+++ b/compile-macros.sh
@@ -2,7 +2,7 @@
# The set of flavors for which we produce macros. Not identical to
# the buildset predefined for specific distributions (see below)
-FLAVORS="python2 python3 python38 python39 python310 python311 python312 pypy3"
+FLAVORS="saltbundlepy"
### flavor-specific: generate from flavor.in
for flavor in $FLAVORS; do
--- a/functions.lua
+++ b/functions.lua
@@ -29,6 +29,8 @@
python2 = "py2",
python3 = "py3",
pypy = "pypy",
+
+ saltbundlepy = "py3",
}
function replace_macros(str, targetflavor)

BIN
saltbundlepy-rpm-macros-20230609.6fe8111.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,674 @@
-------------------------------------------------------------------
Wed Dec 13 13:06:23 UTC 2023 - Victor Zhestkov <vzhestkov@suse.com>
- Use Python 3.11 for saltbundlepy flavor
-------------------------------------------------------------------
Tue Sep 26 10:51:36 UTC 2023 - Victor Zhestkov <vzhestkov@suse.com>
- Readjust the patch for update-alternatives related macros to
make it compatible with openSUSE Tumbleweed
- Modified:
* revert-alternatives-macro.patch
-------------------------------------------------------------------
Wed Sep 20 16:54:23 UTC 2023 - Victor Zhestkov <vzhestkov@suse.com>
- Update to version 20230609.6fe8111:
* move compile loop to python
* remove python38
* Add %#FLAVOR#_fix_shebang macro, call in %#FLAVOR#_pyproject_install
* Add python311 to buildset
* Strip buildroot from pyc files (#151)
- Set saltbundlepy as the only flavor to build macros for
- Drop separate pyproject macro definitions patch
as included to new version
- Revert update-alternatives related macros to prevent build fails
on SLE12 and other distros with old rpm or with debbuild
- Revert pyproject macro definitions to prevent build on old distros
- Set explicit definition for pythons macro set to saltbundlepy only
- Use inline python script to prevent fails with debbuild
- Added:
* revert-alternatives-macro.patch
* revert-pyproject-macro.patch
* set-pythons-macro.patch
* use-inline-compile.patch
- Modified:
* saltbundlepy-flavor.patch
- Removed:
* add-pyproject-macro-defs.patch
-------------------------------------------------------------------
Wed Aug 16 11:32:47 UTC 2023 - Victor Zhestkov <vzhestkov@suse.com>
- Add pyproject macro definitions
- Added:
* add-pyproject-macro-defs.patch
-------------------------------------------------------------------
Wed Aug 2 08:05:55 UTC 2023 - Victor Zhestkov <vzhestkov@suse.com>
- Adding missing file references:
* macros.z-sb-install-post
* macros.z-sb-fdupes
-------------------------------------------------------------------
Tue Mar 1 07:47:05 UTC 2022 - Victor Zhestkov <victor.zhestkov@suse.com>
- Use Python 3.10 as a bundled version
-------------------------------------------------------------------
Thu Feb 3 12:16:47 UTC 2022 - Victor Zhestkov <victor.zhestkov@suse.com>
- Use saltbundlepy custom flavor to build Salt Bundle dependencies
- Added:
* saltbundlepy-flavor.patch
-------------------------------------------------------------------
Tue Jan 11 12:47:38 UTC 2022 - Victor Zhestkov <victor.zhestkov@suse.com>
- Do not call update-alternatives with --quiet on RH and Fedora
-------------------------------------------------------------------
Mon Oct 18 11:29:42 UTC 2021 - Victor Zhestkov <victor.zhestkov@suse.com>
- Fix for getting specfile for RH based systems
- Added:
* specfile.patch
-------------------------------------------------------------------
Mon Oct 18 10:45:43 UTC 2021 - mcepl@cepl.eu
- Update to version 20211001.fc6c04e:
* typo
* function for evaluating priority
* adapted suggestions
* added BuildRequires to README
* fixed termination
* handling mutiple arguments
* added docu
* added docu
* added docu
* added docu
* using libalternatives
* test
* test
-------------------------------------------------------------------
Tue Jun 29 20:51:43 UTC 2021 - mcepl@cepl.eu
- Update to version 20210628.eccf3f2:
* fix boolean split gh#openSUSE/python-rpm-macros#111
-------------------------------------------------------------------
Mon Jun 07 12:15:13 UTC 2021 - mcepl@cepl.eu
- Update to version 20210607.c22f1cc:
* increase default python3 update-alternative prio by 1000
* Update default-prjconf
* Support flavor rewriting of boolean runtime dependencies
-------------------------------------------------------------------
Thu Feb 04 22:27:24 UTC 2021 - mcepl@cepl.eu
- Update to version 20210204.937b8d8:
* fixup: last PR was missing a commit for pyproject_wheel syntax errors
-------------------------------------------------------------------
Thu Feb 04 14:39:22 UTC 2021 - mcepl@cepl.eu
- Update to version 20210204.90721de:
* mv -n does not work in SLE12
* Update PEP517/518 macro documentation in README
* Let pyproject_install search for more locations for wheels or specify explicitely
* Read .rpmmacros (= prjconf Macro: definitions) for default buildset
-------------------------------------------------------------------
Wed Feb 03 16:40:14 UTC 2021 - mcepl@cepl.eu
- Update to version 20210203.0d8a91e:
* don't define skip_python2 by default
-------------------------------------------------------------------
Sun Jan 31 20:38:20 UTC 2021 - mcepl@cepl.eu
- Update to version 20210131.ec7577b:
* remove old commented path finding section
* expand python_subpackage_only not earlier than in python_subpackages call
* make the path and var macros return a non-interrupted string even when the flavor is not installed
-------------------------------------------------------------------
Sun Jan 31 13:31:40 UTC 2021 - mcepl@cepl.eu
- Update to version 20210131.1450767:
* only add parentheses when boolean operators are used
* sync buildset definitions with Factory
* fix typo
-------------------------------------------------------------------
Wed Jan 27 22:48:28 UTC 2021 - mcepl@cepl.eu
- Update to version 20210127.3a18043:
* dont't rename wheel when it already has the same name
-------------------------------------------------------------------
Tue Jan 26 21:11:34 UTC 2021 - mcepl@cepl.eu
- Update to version 20210126.fea1c1f:
* Document python_module with boolean dependecies
* workaround undetected abi and platform tags gh#openSUSE/python-rpm-macros#93
-------------------------------------------------------------------
Thu Jan 21 11:10:22 UTC 2021 - mcepl@cepl.eu
- Update to version 20210121.ef5b8b9:
* Add %python pseudo-macro for %python_modules -- server and rpm version
-------------------------------------------------------------------
Sun Jan 17 07:07:30 UTC 2021 - mcepl@cepl.eu
- Update to version 20210117.63cf413:
* improve flavor variable naming in python_expand
-------------------------------------------------------------------
Sat Jan 16 12:29:33 UTC 2021 - mcepl@cepl.eu
- Update to version 20210116.2682657:
* remove python2 not found error
-------------------------------------------------------------------
Tue Jan 12 07:18:43 UTC 2021 - mcepl@cepl.eu
- Update to version 20210112.86f4d9d:
* fix gh#openSUSE/python-rpm-macros#84: python_sysconfig_ macros
-------------------------------------------------------------------
Mon Dec 07 17:09:23 UTC 2020 - mcepl@cepl.eu
- Update to version 20201207.2177fcf:
* README update after merge
-------------------------------------------------------------------
Mon Dec 07 16:31:52 UTC 2020 - mcepl@cepl.eu
- Update to version 20201207.259cdda:
* Update python_expand description in README
* python_expand to basename only
-------------------------------------------------------------------
Fri Dec 04 09:47:39 UTC 2020 - mcepl@cepl.eu
- Update to version 20201204.32a910e:
* fix print_provided_flavor again
-------------------------------------------------------------------
Thu Dec 03 07:08:14 UTC 2020 - mcepl@cepl.eu
- Update to version 20201203.5331183:
* fix print_provided_flavor
-------------------------------------------------------------------
Sat Nov 28 22:11:52 UTC 2020 - mcepl@cepl.eu
- Update to version 20201128.669edb3:
* fix provides (for python-numpy f2py, in gh#openSUSE/python-rpm-macros#66)
-------------------------------------------------------------------
Mon Nov 23 14:41:05 UTC 2020 - mcepl@cepl.eu
- Update to version 20201123.6978323:
* also rewrite subpackage_only default providers
* pytest: ignore _build dirs for all flavors
-------------------------------------------------------------------
Thu Nov 19 07:53:17 UTC 2020 - mcepl@cepl.eu
- Update to version 20201119.6bb5f69:
* add default provider properties
* don't replace %name, for subpackage_only
* expand parameters for subpackage_only packages
-------------------------------------------------------------------
Thu Nov 12 18:19:15 UTC 2020 - mcepl@cepl.eu
- Update to version 20201112.a4c80dc:
* handle python_subpackage_only, fixes gh#openSUSE/python-rpm-macros#73
* define default providers for pythonX from pythonXY flavors: fixes #69
-------------------------------------------------------------------
Tue Nov 03 20:59:11 UTC 2020 - mcepl@cepl.eu
- Update to version 20201103.cec67c2:
* document python_find_lang
* add python_find_lang and allow to specify in %python_files. Fixes #5
-------------------------------------------------------------------
Mon Nov 02 18:34:58 UTC 2020 - mcepl@cepl.eu
- Update to version 20201102.31ccfc2:
* fix python_clone shebang replacement
* one less expansion for python_exec
* expand default %python_ macros earlier
* update README for multiple flavors
* more command delimiters for %python_expand
-------------------------------------------------------------------
Thu Oct 22 18:47:52 UTC 2020 - mcepl@cepl.eu
- Update to version 20201022.7f87908:
* Add python36 and python38 flavours.
-------------------------------------------------------------------
Wed Oct 21 11:22:16 UTC 2020 - mcepl@cepl.eu
- Update to version 20201021.adb6953:
* Prepare for multiple python3 flavors
- Remove multiple_flavors.patch as it is included in the upstream
tarball.
-------------------------------------------------------------------
Fri Oct 16 20:05:52 UTC 2020 - mcepl@cepl.eu
- Update to version 20201016.5d22545:
* fix whitespace after escape in compileall macro
-------------------------------------------------------------------
Fri Oct 16 14:31:59 UTC 2020 - mcepl@cepl.eu
- Update to version 20201016.db09189:
* Delete pycache files before compilealll
* Update macros/010-common-defs
* Reword compileall
* mention pyproject.toml and link to PEP517 and PEP518
* add description for pyunittest macro
* add description for python_compileall macro
* add description for pyproject macros
* add python_compileall macro and use it in pyproject_install
* disable pip version check: no connection to pypi.org
-------------------------------------------------------------------
Tue Sep 22 19:29:03 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Update multiple_flavors.patch to generate correct names of the
python binary.
-------------------------------------------------------------------
Wed Sep 9 18:00:03 UTC 2020 - Matej Cepl <mcepl@suse.com>
- %__#FLAVOR# should be defined as
/usr/bin/python%{#FLAVOR#_version} not just /usr/bin/#FLAVOR#
-------------------------------------------------------------------
Wed Sep 2 11:44:33 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Add patch multiple_flavors.patch which makes compile_macros.sh
generate alternative flavours as well.
-------------------------------------------------------------------
Mon Aug 24 08:09:01 UTC 2020 - mcepl@cepl.eu
- Update to version 20200824.8fa42a7:
* Drop -v from the pyunittest macros
-------------------------------------------------------------------
Thu Aug 06 05:30:11 UTC 2020 - mcepl@cepl.eu
- Update to version 20200806.f44d3ac:
* fix unittest macros
-------------------------------------------------------------------
Tue Jul 14 08:15:22 UTC 2020 - mcepl@cepl.eu
- Update to version 20200714.252de1f:
* Add pyunittest and pyunittest_arch macros
-------------------------------------------------------------------
Thu Jul 2 10:24:38 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
- Update to version 20200701.9f5a2f6:
* add blank line between pytest and pytest_arch to fix expansion
failure in Leap gh#openSUSE/python-rpm-macros#53
-------------------------------------------------------------------
Wed Jun 24 22:05:31 UTC 2020 - mcepl@cepl.eu
- Update to version 20200625.e862151:
* fix pytest_arch PYTHONPATH
* expand calls pyproject* macros (revert #45)
* let the shell expand PYTHONPATH
-------------------------------------------------------------------
Tue Jun 23 12:14:22 UTC 2020 - tchvatal@suse.com
- Update to version 20200623.3ea9b62:
* fix PYTHONPATH on pytest_arch macro
-------------------------------------------------------------------
Mon Jun 22 19:00:48 UTC 2020 - mcepl@cepl.eu
- Update to version 20200622.1919233:
* Expand %buildroot first (avoid endless cycle; bsc#1162743)
-------------------------------------------------------------------
Mon Jun 22 12:41:25 UTC 2020 - mcepl@cepl.eu
- Update to version 20200622.1f4c5d2:
* Add missing semicolon
-------------------------------------------------------------------
Wed Jun 3 12:01:30 UTC 2020 - Matej Cepl <mcepl@suse.com>
- For Factory change %system_python to python3.
-------------------------------------------------------------------
Wed Jun 03 08:16:36 UTC 2020 - mcepl@cepl.eu
- Update to version 20200603.503823c:
* Don't add empty path to PYTHONPATH setting.
* Do not expand macros, just print them unexpanded (for %pytest* and %pyproject* macros)
* Replace py.test -> pytest
-------------------------------------------------------------------
Fri May 29 15:28:22 UTC 2020 - mcepl@cepl.eu
- Update to version 20200529.b301e36:
* update-alternatives are quiet during install
-------------------------------------------------------------------
Tue Apr 21 11:43:04 UTC 2020 - mcepl@cepl.eu
- Update to version 20200207.5feb6c1 bsc#1171561:
* Do not write .pyc files for tests
-------------------------------------------------------------------
Mon Jan 20 18:35:19 UTC 2020 - Neal Gompa <ngompa13@gmail.com>
- Add python-rpm-generators to express setuptools dependency for generator
-------------------------------------------------------------------
Fri Jan 17 13:09:29 UTC 2020 - Neal Gompa <ngompa13@gmail.com>
- Update to version 20200117.8e39013 bsc#1161770:
* Add macros related to the Python dist metadata dependency generator
-------------------------------------------------------------------
Mon Nov 04 10:10:58 UTC 2019 - mcepl@cepl.eu
- Update to version 20191104.08e6493:
* %pyproject_install macro should include --no-compile.
* Recognise the _ for the macro arguments too
-------------------------------------------------------------------
Mon Jun 10 11:34:32 UTC 2019 - mcepl@cepl.eu
- Update to version 20190610.2ee3233:
* Fix typo, missing opening brace.
* Add the first draft of pyproject_wheel and pyproject_install macros.
* Yet another attempt to preserve $PYTHONPATH set in the environment.
* Document also %pytest_arch
* Document %pytest in README.md
* Multiline macros don't work correctly on older RPMs.
* Add missing $ expansion on the pytest call
* Rewrite pytest and pytest_arch into Lua macros with multiple arguments.
* We should preserve existing PYTHONPATH.
* Add --ignore to pytest calls to ignore build directories.
-------------------------------------------------------------------
Mon Jun 10 11:27:22 UTC 2019 - mcepl@cepl.eu
- Update to version 20190610.2ee3233:
* Fix typo, missing opening brace.
-------------------------------------------------------------------
Mon May 20 12:38:10 UTC 2019 - mcepl@cepl.eu
- Update to version 20190511.2ed22b6:
* Add the first draft of pyproject_wheel and pyproject_install macros.
-------------------------------------------------------------------
Thu May 02 06:10:17 UTC 2019 - mcepl@cepl.eu
- Update to version 20190430.5260267:
* Yet another attempt to preserve $PYTHONPATH set in the environment.
* Document also %pytest_arch
* Document %pytest in README.md
-------------------------------------------------------------------
Mon Apr 08 12:43:06 UTC 2019 - mcepl@cepl.eu
- Update to version 20190408.32abece bsc#1128323:
* Multiline macros don't work correctly on older RPMs.
-------------------------------------------------------------------
Tue Apr 02 11:25:58 UTC 2019 - tchvatal@suse.com
- Update to version 20190402.c88be49:
* Add missing $ expansion on the pytest call
-------------------------------------------------------------------
Fri Mar 15 14:18:06 UTC 2019 - mcepl@cepl.eu
- Update to version 20190315.d3034bf bsc#1128323:
* Rewrite pytest and pytest_arch into Lua macros with multiple arguments.
-------------------------------------------------------------------
Thu Mar 07 13:40:24 UTC 2019 - mcepl@cepl.eu
- Update to version 20190307.81ca329:
* We should preserve existing PYTHONPATH.
-------------------------------------------------------------------
Thu Mar 07 11:18:35 UTC 2019 - mcepl@cepl.eu
- bsc#1128323: Update to version 20190307.fbaed33
* Add --ignore to pytest calls to ignore build directories.
-------------------------------------------------------------------
Thu Feb 21 17:54:59 UTC 2019 - opensuse-packaging@opensuse.org
- Update to version 20190221.08f1194:
* Actually make pytest into function to capture arguments as well
* Add pytest definitions.
-------------------------------------------------------------------
Wed Dec 19 19:29:44 UTC 2018 - Todd R <toddrme2178@gmail.com>
- Use upstream-recommended %{_rpmconfigdir}/macros.d directory
for the rpm macros.
- Include license and readme.
-------------------------------------------------------------------
Tue Dec 11 11:27:17 UTC 2018 - opensuse-packaging@opensuse.org
- Update to version 20181211.ab6f37c:
* Fix an issue with epoch printing having too many \
* Remove packaging/ dir
-------------------------------------------------------------------
Mon Dec 10 20:09:43 UTC 2018 - opensuse-packaging@opensuse.org
- Update to version 1540475376.149a499:
* add epoch while printing "Provides:"
- Update URL
- Add _service and use the tar_scm/recompress/set_version source
services to update the package.
Package updates can now be done with "osc service run"
- Drop README.packaging
- Drop update.sh . This is now handled via the source services
-------------------------------------------------------------------
Wed Oct 24 07:20:44 UTC 2018 - sjamgade@suse.com
- version bump to 2018.08.15.ada6d63
-------------------------------------------------------------------
Fri Dec 22 15:57:10 UTC 2017 - jmatejek@suse.com
- version bump to 2017.12.22.d9968ab
* better fix for macro usage in rpm 4.14
-------------------------------------------------------------------
Thu Dec 7 19:58:36 UTC 2017 - tchvatal@suse.com
- version bump to 2017.12.07.9d4e9eb
* Fix macro usage for rpm 4.14
-------------------------------------------------------------------
Wed Aug 9 13:37:32 UTC 2017 - jmatejek@suse.com
- version bump to 2017.08.09.32550d0
- use %_specfile macro to locate the spec file, this should help with
factory-auto bot problems as well as issue#3
-------------------------------------------------------------------
Thu Jun 29 13:20:02 UTC 2017 - jmatejek@suse.com
- version bump to 2017.06.29.107ac7a
- fix skip_python2 in environment where python2 is not actually present
-------------------------------------------------------------------
Wed Jun 21 13:16:38 UTC 2017 - jmatejek@suse.com
- version bump to 2017.06.21.6641889
- introduce smarter buildset support
- fix %python_files on nonstandard build sets
- introduce %python_for_executables in favor of magically taking
"last python in %pythons"
- fix %licence tag handling (gh#opensuse/python-rpm-macros#4)
-------------------------------------------------------------------
Tue May 9 15:38:41 UTC 2017 - jmatejek@suse.com
- version bump to 2017.05.09.fc237de
- fix badly generated %posttrans snippets in cases where
old %python_install_alternative syntax is used for secondary files
- rework %if-macros
- introduce %python_flavor, which configures behavior of generic %python_*
macros, and can be overriden by the user
- add --force to %python_install, to make install order fully deterministic
-------------------------------------------------------------------
Thu Apr 27 15:43:20 UTC 2017 - jmatejek@suse.com
- version bump to 2017.04.27.d2ca08c
- switch versioning scheme to date-based
- switch from using service to a custom script update.sh
- auto-generate Provides: python2-modname in old distributions
(only for main package though)
-------------------------------------------------------------------
Wed Mar 29 12:53:05 UTC 2017 - jmatejek@suse.com
- generate %posttrans sections to fix up alternatives after package
rename
- fix condition where %python_files would emit wrong thing when
%have_python2 is undefined
- add --quiet to uninstall_alternative, to silence spurious errors
- check for file existence instead of package number in uninstall_alternative
-------------------------------------------------------------------
Thu Mar 23 17:08:46 UTC 2017 - jmatejek@suse.com
- remove spurious warnings about "unknown arguments" (by making ALL
possible arguments known)
- fix a bug with %python_clone not working without
%python_install_alternative being used
- in %python_files, detect and emit an error if %python_subpackages
is not used
-------------------------------------------------------------------
Mon Mar 13 16:05:15 UTC 2017 - jmatejek@suse.com
- more intelligent %python_install_alternatives
- multiline macro support
- support for %requires_ge and %requires_eq as well as Requires(pre)
and friends
- "%python_clone -a" auto-creates alternative entries
-------------------------------------------------------------------
Thu Mar 9 17:20:12 UTC 2017 - jmatejek@suse.com
- implement %python_clone to clone files for alternatives
-------------------------------------------------------------------
Wed Mar 8 15:22:55 UTC 2017 - jmatejek@suse.com
- support "Supplements" and "Enhances" tags
- support packageand() expression
- fix handling of %name in requires
-------------------------------------------------------------------
Wed Mar 8 13:18:14 UTC 2017 - jmatejek@suse.com
- make macros more resilient to missing %python_subpackages
- expand %python_bin_suffix properly
-------------------------------------------------------------------
Fri Feb 24 13:50:03 UTC 2017 - jmatejek@suse.com
- let %python_module expand *all* its arguments, not just the first
(so that %{python_module x >= 1.0} works as intended)
-------------------------------------------------------------------
Wed Feb 22 14:38:28 UTC 2017 - jmatejek@suse.com
- copy BuildArch to subpackages
- on requires/provides etc., perform macro expansion *after* replacing
'python' name, to allow for tricking the rewriter to not replace
-------------------------------------------------------------------
Tue Feb 21 14:55:08 UTC 2017 - jmatejek@suse.com
- add BuildRoot to make SLE11 happy
- check presence of %python_files even on new-style distros
- better visibility of the %python_files error
-------------------------------------------------------------------
Mon Feb 13 14:46:25 UTC 2017 - jmatejek@suse.com
- update service, use repository and tarball name "python-rpm-macros"
-------------------------------------------------------------------
Tue Feb 7 16:31:04 UTC 2017 - jmatejek@suse.com
- introduce %python_prefix
-------------------------------------------------------------------
Mon Feb 6 14:30:38 UTC 2017 - jengelh@inai.de
- Set RPM group
-------------------------------------------------------------------
Wed Jan 11 14:28:48 UTC 2017 - jmatejek@suse.com
- change service version generator to use "1.0.git" instead of "1.0git"
-------------------------------------------------------------------
Fri Jan 6 17:36:58 UTC 2017 - jmatejek@suse.com
- rework %python_alternative and remove support for %python_alternative_man
- tell service to compress the tar file
-------------------------------------------------------------------
Fri Jan 6 14:54:21 UTC 2017 - jmatejek@suse.com
- set service to localonly mode
-------------------------------------------------------------------
Tue Jan 3 15:06:29 UTC 2017 - jmatejek@suse.com
- current macro version
-------------------------------------------------------------------
Thu Nov 24 14:57:13 UTC 2016 - jmatejek@suse.com
- initial commit

View File

@ -0,0 +1,94 @@
#
# spec file for package saltbundlepy-rpm-macros
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: saltbundlepy-rpm-macros
Version: 20230609.6fe8111
Release: 0
Summary: RPM macros for building of Python modules
License: WTFPL
URL: https://github.com/opensuse/python-rpm-macros
Source: saltbundlepy-rpm-macros-%{version}.tar.xz
Source1: macros.z-sb-install-post
Source2: macros.z-sb-fdupes
Patch0: specfile.patch
Patch1: saltbundlepy-flavor.patch
Patch2: revert-alternatives-macro.patch
Patch3: set-pythons-macro.patch
Patch4: revert-pyproject-macro.patch
Patch5: use-inline-compile.patch
%if "%_vendor" == "debbuild"
BuildRequires: debbuild
Requires: liblua5-1-5
Requires: perl-lua-api
%endif
BuildArch: noarch
%description
This package contains SUSE RPM macros for Python build automation.
You should BuildRequire this package unless you are sure that you
are only building for distros newer than Leap 42.2
%package -n saltbundlepy-rpm-generators
Summary: Dependency generator dependencies for Python RPMs
Requires: %{name} = %{version}-%{release}
# For the dep generator macros
Requires: saltbundlepy-setuptools
%description -n saltbundlepy-rpm-generators
This package contains the dependencies for Python RPMs to generate
dependencies automatically.
%prep
%autosetup -p1
sed -i -e '/^%system_python/s/python2/python3/' macros/010-common-defs
%build
./compile-macros.sh
sed -i -e '/^%__saltbundlepy/s/%%{_bindir}.*/%%{_bindir}\/python3.11/' macros.python_all
%if 0%{?rhel} || 0%{?fedora}
sed -i -e '/update-alternatives/s/ --quiet//' macros.python_all
%endif
%install
mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d/
install -m 644 macros.python_all %{buildroot}%{_rpmconfigdir}/macros.d/macros.saltbundlepy
%if 0%{?rhel} == 7
mkdir -p %{buildroot}%{_sysconfdir}/rpm
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.z-sb-install-post
%endif
%if "%_vendor" == "debbuild"
install -m 644 %{SOURCE2} %{buildroot}%{_rpmconfigdir}/macros.d/macros.z-sb-fdupes
%endif
%files
%license LICENSE
%doc README.md
%{_rpmconfigdir}/macros.d/macros.saltbundlepy
%if 0%{?rhel} == 7
%{_sysconfdir}/rpm/macros.z-sb-install-post
%endif
%if "%_vendor" == "debbuild"
%{_rpmconfigdir}/macros.d/macros.z-sb-fdupes
%endif
%files -n saltbundlepy-rpm-generators
# Nothing here for now...
%changelog

28
set-pythons-macro.patch Normal file
View File

@ -0,0 +1,28 @@
--- a/compile-macros.sh
+++ b/compile-macros.sh
@@ -18,14 +18,6 @@
# the current build target's prjconf
echo "Setting buildset:"
echo "## Python Buildset Begin" | tee macros/040-builset-start
-# First try to find the block from Factory
-sed -n '/## PYTHON MACROS BEGIN/,/## PYTHON MACROS END/ p' ~/.rpmmacros | tee macros/041-buildset
-# If that fails, find the old definitions (SUSE:SLE-15-SP?:GA, openSUSE:Leap:15.?)
-if [ ! -s macros/041-buildset ]; then
- sed -n '/%pythons/,/%add_python/ p' ~/.rpmmacros | tee macros/041-buildset
-fi
-# If we still have nothing (different distro, custom prjconf, building
-# python-rpm-macros outside of obs), use the default file
if [ ! -s macros/041-buildset ]; then
tee macros/041-buildset < default-prjconf
fi
--- a/default-prjconf
+++ b/default-prjconf
@@ -7,7 +7,7 @@
## PYTHON MACROS BEGIN
# order of %pythons is important: The last flavor overrides any operation on conflicting files and definitions during expansions,
# making it the "default" in many cases --> keep the primary python3 provider at the end.
-%pythons %{?!skip_python3:%{?!skip_python39:python39} %{?!skip_python311:python311} %{?!skip_python310:python310}}
+%pythons saltbundlepy
%add_python() %{expand:%%define pythons %1 %pythons}
%_without_python2 1

33
specfile.patch Normal file
View File

@ -0,0 +1,33 @@
--- a/macros.lua 2021-10-01 17:41:04.000000000 +0300
+++ b/macros.lua 2021-10-18 14:23:44.188532741 +0300
@@ -54,6 +54,30 @@
-- find the spec file
specpath = rpm.expand("%_specfile")
+
+ if posix.stat(specpath, "mode") == nil then
+ specpath = nil
+ local locations = { rpm.expand("%_sourcedir"), rpm.expand("%_specdir"), posix.getcwd(), posix.getcwd() .. "/" .. name }
+ for _,loc in ipairs(locations) do
+ local filename = loc .. "/" .. name .. ".spec"
+ if posix.stat(filename, "mode") ~= nil then
+ specpath = filename
+ break
+ else
+ local filename_candidate = io.popen("ls " .. loc .. "/*.spec"):read("*a"):gsub("%s+$","")
+ for filename in filename_candidate:gmatch("[^\n]+") do
+ if posix.stat(filename, "mode") ~= nil then
+ specpath = filename
+ break
+ end
+ end
+ if specpath ~= nil then
+ break
+ end
+ end
+ end
+ end
+
end
function python_subpackages()

19
use-inline-compile.patch Normal file
View File

@ -0,0 +1,19 @@
--- a/flavor.in
+++ b/flavor.in
@@ -88,14 +88,8 @@
for d in %{buildroot}%{#FLAVOR#_sitelib} %{buildroot}%{#FLAVOR#_sitearch}; do \
if [ -d $d ]; then \
find $d -iname '*.pyc' -delete \
- find $d -iname '*.py' -print0 | xargs -0 %__#FLAVOR# -c ' \
-import sys, py_compile \
-for f in sys.argv[1:]: \
- fp=f[len("%{buildroot}"):] \
- print(f"Generating cached byte-code for {fp}") \
- for o in [0, 1]: \
- py_compile.compile(f, dfile=fp, optimize=o) \
-' \
+ find $d -iname '*.py' -printf 'Generating cached byte-code for %%P\\n' -exec %__#FLAVOR# -c \\\
+ 'import py_compile; f="{}"; [py_compile.compile(f, dfile=f[len("%{buildroot}"):], optimize=o) for o in [0, 1]]' ';' \
fi \
done