]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- close only if f is valid
[packages/rpm-build-macros.git] / rpm.macros
index e435d6d3e222fb33813a579d8d8685a74b2a2ace..8064a617355b118a39bcc11c77b7b1344ce49091 100644 (file)
@@ -946,7 +946,10 @@ fi; \
 %php_name                              php%{?php_suffix}
 # use rpmbuild -D 'php_suffix 54' to build php extension for php 5.4
 # NOTE: error output must be empty. otherwise can't build pecl packages if no php*-devel is installed
-%php_suffix             %(c=$(php-config --sysconfdir 2>/dev/null) || echo '' && echo ${c#/etc/php})
+%php_suffix                            %{expand:%%global php_suffix %(c=$(php-config --sysconfdir 2>/dev/null) || echo '' && echo ${c#/etc/php})%%{nil}}%php_suffix
+
+# php cli. version that php headers are installed for
+%__php                                 /usr/bin/%{php_name}
 
 # helper macro
 %__php_api_requires(v:) Requires: %{php_name}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
@@ -1605,6 +1608,7 @@ fi \
 f = io.open("%{_docdir}/%{name}-%{version}/optional-packages.txt", "r") \
 if f then \
        for l in f:lines() do print(l); end \
+       f.close() \
 end \
 %{nil}
 
@@ -1985,7 +1989,11 @@ s=""\
 for _, l in pairs(t) do\
        s=s..l.."\\n"\
 end\
-io.open("/etc/shells", "w"):write(s)\
+f = io.open("/etc/shells", "w")\
+if f then\
+       write(s)\
+       f:close()\
+end\
 %{nil}
 
 # Backwards compat. Use of %lua_ prefixed macros is preferred as these are cleaner to read.
This page took 0.030558 seconds and 4 git commands to generate.