From 5d6c98b886882ef8c6edd4e1e5e8702acf91005b Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 8 Dec 2020 02:00:58 +0100 Subject: [PATCH] - PLD merge --- attr.php | 4 ++-- gem_helper.rb | 2 +- macros.ruby | 11 +++++++---- macros.tld | 21 +++++++++++++++++++++ rpm-find-spec-bcond | 28 ++++++++++++++-------------- rpm-tld-macros.spec | 2 +- 6 files changed, 46 insertions(+), 22 deletions(-) diff --git a/attr.php b/attr.php index 2b739e4..adb9e47 100644 --- a/attr.php +++ b/attr.php @@ -1,5 +1,5 @@ -%__php_provides %{_rpmhome}/php.prov +#__php_provides %{_rpmhome}/php.prov # define 'php_req_new' in ~/.rpmmacros to use php version of req finder -%__php_requires env PHP_MIN_VERSION=%{?php_min_version} %{_rpmhome}/php.req%{?php_req_new:.php} +#__php_requires env PHP_MIN_VERSION=%{?php_min_version} %{_rpmhome}/php.req%{?php_req_new:.php} %__php_magic ^PHP script.* %__php_path \\.php$ diff --git a/gem_helper.rb b/gem_helper.rb index 6457a7a..3a82737 100755 --- a/gem_helper.rb +++ b/gem_helper.rb @@ -60,7 +60,7 @@ if ARGV[0] == "build" or ARGV[0] == "install" or ARGV[0] == "spec" opts.on("--fix-permissions", "Force standard permissions for files installed") do ARGV.delete("--fix-permissions") fixperms = true - end + end opts.on("-i", "--install-dir GEMDIR", "Gem repository directory") do |val| gemdir = val end diff --git a/macros.ruby b/macros.ruby index e0d309a..5289c12 100644 --- a/macros.ruby +++ b/macros.ruby @@ -2,18 +2,21 @@ %__ruby /usr/bin/ruby +# helpers to get rbconfig parameter +%__ruby_rbconfig() %(%{__ruby} -r rbconfig -e 'print RbConfig::CONFIG["%1"]' 2>/dev/null || echo ERROR) +%__ruby_rbconfig_path() %(%{__ruby} -r rbconfig -r pathname -e 'print Pathname(RbConfig::CONFIG["%1"]).cleanpath' 2>/dev/null || echo ERROR) + # Ruby ABI version # NOTE: %ruby_version may be empty, depending how Ruby was built %ruby_abi %{expand:%%global ruby_abi %(%{__ruby} -r rbconfig -e 'print [RbConfig::CONFIG["MAJOR"], RbConfig::CONFIG["MINOR"]].join(".")' 2>/dev/null || echo ERROR)}%ruby_abi - -# get rbconfig parameter -%__ruby_rbconfig() %(%{__ruby} -r rbconfig -e 'print RbConfig::CONFIG["%1"]' 2>/dev/null || echo ERROR) -%__ruby_rbconfig_path() %(%{__ruby} -r rbconfig -r pathname -e 'print Pathname(RbConfig::CONFIG["%1"]).cleanpath' 2>/dev/null || echo ERROR) +# Ruby arch combo (CPU-OS, e.g. i686-linux) +%ruby_arch %{expand:%%global ruby_arch %{__ruby_rbconfig arch}}%ruby_arch %ruby_archdir %{expand:%%global ruby_archdir %{__ruby_rbconfig_path archdir}}%ruby_archdir %ruby_libdir %{expand:%%global ruby_libdir %{__ruby_rbconfig rubylibdir}}%ruby_libdir %ruby_ridir %{expand:%%global ruby_ridir %(%{__ruby} -r rbconfig -e 'print File.join(RbConfig::CONFIG["datadir"], "ri", "system")' 2>/dev/null || echo ERROR)}%ruby_ridir %ruby_rubylibdir %{expand:%%global ruby_rubylibdir %{__ruby_rbconfig_path rubylibdir}}%ruby_rubylibdir +%ruby_rubyhdrdir %{expand:%%global ruby_rubyhdrdir %{__ruby_rbconfig_path rubyhdrdir}}%ruby_rubyhdrdir %ruby_vendorarchdir %{expand:%%global ruby_vendorarchdir %{__ruby_rbconfig vendorarchdir}}%ruby_vendorarchdir %ruby_vendorlibdir %{expand:%%global ruby_vendorlibdir %{__ruby_rbconfig_path vendorlibdir}}%ruby_vendorlibdir %ruby_sitearchdir %{expand:%%global ruby_sitearchdir %{__ruby_rbconfig sitearchdir}}%ruby_sitearchdir diff --git a/macros.tld b/macros.tld index 2d0e896..08928ab 100644 --- a/macros.tld +++ b/macros.tld @@ -516,6 +516,19 @@ LC_ALL=C.UTF-8 %{__meson} \ Obsoletes: %{1} < %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}} \ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}} +# for package versions comparison (incl. cc_version or _rpmversion) +# BuildRequires: rpmbuild(macros) >= 1.750 +%_ver_lt() %(test $(rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1; echo $?) -ne 2; echo $?) +%_ver_ge() %(test $(rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1; echo $?) -eq 2; echo $?) + +# noarch subpackage helper +# BuildRequires: rpmbuild(macros) >= 1.752 +%noarchpackage \ +%if %{_ver_ge '%{_rpmversion}' '4.6'} \ +BuildArch: noarch \ +%endif \ +%{nil} + %apache_modules_api %{expand:%%global apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)}%apache_modules_api # sgml macros @@ -925,6 +938,14 @@ fi; \ };} \ %{nil} +# BuildRequires: rpmbuild(macros) >= 1.751 +# Requires(post,postun): /usr/bin/texhash # if you want to ensure cache is updated +%texhash() {{ \ + umask 022; \ + /usr/bin/texhash >&2; \ +};} \ +%{nil} + #----------------------------------------------------------------- # post %install sequence: # - autodeps exceptions diff --git a/rpm-find-spec-bcond b/rpm-find-spec-bcond index a11dece..21fdd63 100644 --- a/rpm-find-spec-bcond +++ b/rpm-find-spec-bcond @@ -1,5 +1,5 @@ #!/bin/sh -# Display bcond (_with_*, _without_*) macros from given spec +# Display bcond (_with_*, _without_*) macros from given spec # $Id$ if [ "$#" = 0 ]; then @@ -25,8 +25,8 @@ bconds=`awk -F"\n" 'BEGIN { chlog=0 } /^%changelog/ { chlog=1 } /_with(out)?_[_a-zA-Z0-9]+/ && chlog == 0 { match($0, /_with(out)?_[_a-zA-Z0-9]+/); - print substr($0, RSTART, RLENGTH) - } + print substr($0, RSTART, RLENGTH) + } /^%bcond_with/ && chlog == 0 { match($0, /bcond_with(out)?[ \t]+[_a-zA-Z0-9]+/); bcond = substr($0, RSTART +5 , RLENGTH -5); @@ -39,7 +39,7 @@ for c in $bconds; do if ! echo `rpm --eval "%$c"` | grep $c >/dev/null; then echo " (on)" - else + else echo "" fi done @@ -47,18 +47,18 @@ done for bcond in $bconds; do isset=`awk -F"\n" "BEGIN { val=0 } - /^%define[\t ]+$bcond/ { - if (match(\\$0, /$bcond[\t ]+0[\t ]*$/)) { - val = 0 - } else if (match(\\$0, /$bcond[\t ]+1[\t ]*$/)) { - val = 1 - } else { - print \"couldn't determine $bcond value from \", \\$0 - } - } END { print val }" $SPEC`; + /^%define[\t ]+$bcond/ { + if (match(\\$0, /$bcond[\t ]+0[\t ]*$/)) { + val = 0 + } else if (match(\\$0, /$bcond[\t ]+1[\t ]*$/)) { + val = 1 + } else { + print \"couldn't determine $bcond value from \", \\$0 + } + } + END { print val }" $SPEC`; if [ x"$isset" = x"1" ]; then echo "WARN: $bcond defined in spec"; fi done - diff --git a/rpm-tld-macros.spec b/rpm-tld-macros.spec index 63b5496..15d8480 100644 --- a/rpm-tld-macros.spec +++ b/rpm-tld-macros.spec @@ -1,4 +1,4 @@ -%define rpm_macros_rev 1.747 +%define rpm_macros_rev 1.754 %define find_lang_rev 1.40 # split into individual X_prov_ver if there is a reason to desync %define prov_ver 4.15 -- 2.46.0