]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm.macros
- the add %lua_ prefixed /etc/shell edit macros for cleaner specs
[packages/rpm.git] / rpm.macros
index 002bff25fbe548d5154ac0abb55e229fc824ffea..6b357744804288876ef66521aea18767c542aa56 100644 (file)
@@ -455,7 +455,13 @@ if [ -d "$RPM_BUILD_ROOT" ]; then \
                        rpath= ; \
                        chmod u+w "$file"; \
                        for dir in $(chrpath -l "$file" | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'); do \
-                                       dir=$(%{__python} -c 'import sys, os; print os.path.normpath(sys.argv[1]);' "$dir"); \
+                                       # translate $ORIGIN to real path, so that normalize path \
+                                       # would work with readlink and secondly we don't need to \
+                                       # relocate the binaries in rpm based distro \
+                                       local f=${file#$RPM_BUILD_ROOT}; \
+                                       local origin=${f%/*}; \
+                                       dir=$(echo $dir | sed -e "s,\$ORIGIN,$origin,g"); \
+                                       dir=$(readlink -m "$dir"); \
                                        case $dir in \
                                        /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
                                                echo "remove-rpath: $dir in $file"; \
@@ -572,7 +578,7 @@ fi; \
 
 ###################################################################
 # Requires/Provides automation
-# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
+# exceptions system by Jacek Konieczny <jajcus@pld-linux.org>
 #
 %__noautoreqfiles      %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
 %__noautoprovfiles     %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
@@ -618,6 +624,7 @@ fi; \
 %ruby_mod_ver_requires_eq      Requires:       ruby-modules(ver) = %ruby_version
 
 %php_pear_dir          /usr/share/pear
+%php_data_dir          /usr/share/php
 %php_extensiondir      %{expand:%%global php_extensiondir %(php-config --extension-dir 2>/dev/null || echo ERROR)}%php_extensiondir
 %php_sysconfdir                %{expand:%%global php_sysconfdir %(php-config --sysconfdir 2>/dev/null || echo ERROR)}%php_sysconfdir
 %php_includedir                %{expand:%%global php_includedir %(php-config --include-dir 2>/dev/null || echo ERROR)}%php_includedir
@@ -1419,15 +1426,19 @@ done                                                                                                                            \
 # Author: Elan Ruusamäe <glen@pld-linux.org>
 #
 # Usage:
-#   %post      -p %add_etc_shells -p /bin/sh /bin/pdksh
-#   %preun     -p %remove_etc_shells -p /bin/sh /bin/pdksh
+#   %post      -p <lua>
+#   %lua_add_etc_shells /bin/sh /bin/pdksh
 #
-#  -p (optional) -- specifies that result is embeded %post script (prepends <lua> as first line)
+#   %preun     -p <lua>
+#   if arg[2] == 0 then
+#       %lua_remove_etc_shells /bin/bash /bin/rbash
+#   end
 #
 # Requirements:
-# BuildRequires:       rpmbuild(macros) >= 1.429
+# BuildRequires:       rpmbuild(macros) >= 1.462
+#
 
-%add_etc_shells(p) %{-p:<lua>}\
+%lua_add_etc_shells() \
 t = {}\
 f = io.open("/etc/shells", "r")\
 if f then\
@@ -1442,23 +1453,44 @@ for _, s in ipairs({%{expand:%%__lua_split %*}}) do\
 end\
 %{nil}
 
+%lua_remove_etc_shells() \
+t = {}\
+f = io.open("/etc/shells", "r")\
+if f then\
+       for l in f:lines() do t[l]=l; end\
+       f:close()\
+end\
+for _, l in pairs({%{expand:%%__lua_split %*}}) do\
+       print("Removing "..l.." from /etc/shells")\
+       t[l] = nil\
+end\
+s=""\
+for _, l in pairs(t) do\
+       s=s..l.."\\n"\
+end\
+io.open("/etc/shells", "w"):write(s)\
+%{nil}
+
+# Backwards compat. Use of %lua_ prefixed macros is preferred as these are cleaner to read.
+#
+# Author: Elan Ruusamäe <glen@pld-linux.org>
+#
+# Usage:
+#   %post      -p %add_etc_shells -p /bin/sh /bin/pdksh
+#   %preun     -p %remove_etc_shells -p /bin/sh /bin/pdksh
+#
+#  -p (optional) -- specifies that result is embeded %post script (prepends <lua> as first line)
+#
+# Requirements:
+# BuildRequires:       rpmbuild(macros) >= 1.429
+#
+%add_etc_shells(p) %{-p:<lua>}\
+%{expand:%%lua_add_etc_shells %*}\
+%{nil}
+
 %remove_etc_shells(p) %{-p:<lua>}\
 %{-p:if arg[2] == 0 then}\
-       t = {}\
-       f = io.open("/etc/shells", "r")\
-       if f then\
-               for l in f:lines() do t[l]=l; end\
-               f:close()\
-       end\
-       for _, l in pairs({%{expand:%%__lua_split %*}}) do\
-               print("Removing "..l.." from /etc/shells")\
-               t[l] = nil\
-       end\
-       s=""\
-       for _, l in pairs(t) do\
-               s=s..l.."\\n"\
-       end\
-       io.open("/etc/shells", "w"):write(s)\
+%{expand:%%lua_remove_etc_shells %*}\
 %{-p:end} \
 %{nil}
 
This page took 0.199481 seconds and 4 git commands to generate.