From ba85c95963f9b62f237c0442f6b5aca3e355fa83 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 22 Feb 2019 12:24:40 +0200 Subject: [PATCH] Eliminate our script language helper macros and associated scripts Having these kind of macros has increasingly forced us to ponder questions like "what is the system default python", which have absolutely nothing to do with rpm. And to that issue the only possible solution is eliminating such content from rpm. And yes this will break existing packages and force distros to deal with the fallout, but we believe its for the best: these macros are also best maintained by people closer to the languages in question, as has been done with all the newer languages predating perl and python. rpm-extras exists as the place for maintaining and collaborating on such material. --- macros.in | 39 ------------------------------------- scripts/Makefile.am | 8 ++------ scripts/macros.perl | 9 --------- scripts/macros.php | 6 ------ scripts/macros.python | 18 ----------------- scripts/python-macro-helper | 25 ------------------------ 6 files changed, 2 insertions(+), 103 deletions(-) delete mode 100644 scripts/macros.perl delete mode 100644 scripts/macros.php delete mode 100644 scripts/macros.python delete mode 100644 scripts/python-macro-helper diff --git a/macros.in b/macros.in index d4bd1d0f9..b40ca07c7 100644 --- a/macros.in +++ b/macros.in @@ -49,8 +49,6 @@ %__mkdir_p @__MKDIR_P@ %__mv @__MV@ %__patch @__PATCH@ -%__perl @__PERL@ -%__python @__PYTHON@ %__restorecon @__RESTORECON@ %__rm @__RM@ %__rsh @__RSH@ @@ -1076,43 +1074,6 @@ package or when debugging this package.\ %patches %{lua: for i, p in ipairs(patches) do print(p.." ") end} %sources %{lua: for i, s in ipairs(sources) do print(s.." ") end} -#------------------------------------------------------------------------------ -# Useful perl macros (from Artur Frysiak ) -# -# For example, these can be used as (from ImageMagick.spec from PLD site) -# [...] -# BuildPrereq: perl -# [...] -# %package perl -# Summary: libraries and modules for access to ImageMagick from perl -# Group: Development/Languages/Perl -# Requires: %{name} = %{version} -# %requires_eq perl -# [...] -# %install -# rm -fr $RPM_BUILD_ROOT -# install -d $RPM_BUILD_ROOT/%{perl_sitearch} -# [...] -# %files perl -# %defattr(644,root,root,755) -# %{perl_sitearch}/Image -# %dir %{perl_sitearch}/auto/Image -# -%requires_eq() %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") -%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) -%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) -%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) -%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) -%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) -%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) - -#------------------------------------------------------------------------------ -# Useful python macros for determining python version and paths -# -%python_sitelib %(%{__python} -Es %{_rpmconfigdir}/python-macro-helper sitelib) -%python_sitearch %(%{__python} -Es %{_rpmconfigdir}/python-macro-helper sitearch) -%python_version %(%{__python} -Es %{_rpmconfigdir}/python-macro-helper version) - #------------------------------------------------------------------------------ # arch macro for all Intel i?86 compatible processors # (Note: This macro (and it's analogues) will probably be obsoleted when diff --git a/scripts/Makefile.am b/scripts/Makefile.am index ab1441d54..81140f9a1 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -14,7 +14,6 @@ EXTRA_DIST = \ debuginfo.prov \ find-debuginfo.sh find-lang.sh \ perl.prov perl.req pythondeps.sh pythondistdeps.py \ - python-macro-helper \ rpmdb_loadcvt rpm.daily rpm.log rpm.supp rpm2cpio.sh \ tgpg vpkg-provides.sh \ find-requires find-provides \ @@ -22,8 +21,7 @@ EXTRA_DIST = \ mono-find-requires mono-find-provides \ ocaml-find-requires.sh ocaml-find-provides.sh \ pkgconfigdeps.sh libtooldeps.sh metainfo.prov \ - fontconfig.prov desktop-file.prov script.req \ - macros.perl macros.php macros.python + fontconfig.prov desktop-file.prov script.req rpmconfig_SCRIPTS = \ brp-compress brp-python-bytecompile brp-java-gcjcompile \ @@ -34,7 +32,6 @@ rpmconfig_SCRIPTS = \ debuginfo.prov \ find-lang.sh find-requires find-provides \ perl.prov perl.req pythondeps.sh pythondistdeps.py \ - python-macro-helper \ metainfo.prov \ mono-find-requires mono-find-provides \ pkgconfigdeps.sh libtooldeps.sh \ @@ -43,6 +40,5 @@ rpmconfig_SCRIPTS = \ rpmdb_loadcvt rpm2cpio.sh tgpg rpmconfig_DATA = \ - rpm.daily rpm.log rpm.supp \ - macros.perl macros.php macros.python + rpm.daily rpm.log rpm.supp diff --git a/scripts/macros.perl b/scripts/macros.perl deleted file mode 100644 index bdeb863b7..000000000 --- a/scripts/macros.perl +++ /dev/null @@ -1,9 +0,0 @@ -# Perl specific macro definitions. -# To make use of these macros insert the following line into your spec file: -# %include %{_rpmconfigdir}/macros.perl - -%define perl_sitelib %(eval "`perl -V:installsitelib`"; echo $installsitelib) -%define perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch) -%define perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib) -%define perl_privlib %(eval "`perl -V:installprivlib`"; echo $installprivlib) - diff --git a/scripts/macros.php b/scripts/macros.php deleted file mode 100644 index 861c6f501..000000000 --- a/scripts/macros.php +++ /dev/null @@ -1,6 +0,0 @@ -# Perl specific macro definitions. -# To make use of these macros insert the following line into your spec file: -# %include %{_rpmconfigdir}/macros.php - -%define php_pear_dir %{_datadir}/pear - diff --git a/scripts/macros.python b/scripts/macros.python deleted file mode 100644 index ea1f200fc..000000000 --- a/scripts/macros.python +++ /dev/null @@ -1,18 +0,0 @@ -# Python specific macro definitions. -# To make use of these macros insert the following line into your spec file: -# %include %{_rpmconfigdir}/macros.python - -# python main version -%define py_ver %(echo `python -c "import sys; sys.stdout.write(sys.version[:3])"`) - -# directories -%define py_prefix %(echo `python -c "import sys; sys.stdout.write(sys.prefix)"`) -%define py_libdir %{py_prefix}/lib/python%{py_ver} -%define py_incdir /usr/include/python%{py_ver} -%define py_sitedir %{py_libdir}/site-packages -%define py_dyndir %{py_libdir}/lib-dynload - -# pure python modules compilation -%define py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" - -%define py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" diff --git a/scripts/python-macro-helper b/scripts/python-macro-helper deleted file mode 100644 index 6785f66a3..000000000 --- a/scripts/python-macro-helper +++ /dev/null @@ -1,25 +0,0 @@ -from distutils.sysconfig import get_python_lib -from platform import python_version_tuple -import sys - - -if __name__ == "__main__": - - if len(sys.argv) < 2: - sys.stderr.write("Usage: %s \n" % sys.argv[0]) - sys.exit(1) - - if sys.argv[1] == "version": - sys.stdout.write(".".join(python_version_tuple()[:2])) - sys.exit(0) - - if sys.argv[1] == "sitelib": - sys.stdout.write(get_python_lib()) - sys.exit(0) - - if sys.argv[1] == "sitearch": - sys.stdout.write(get_python_lib(1)) - sys.exit(0) - - sys.stderr.write("Unknown command: %s\n" % sys.argv[1]) - sys.exit(1)