]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- use readlink -m instead of readlink -f to allow missing paths
[packages/rpm-build-macros.git] / rpm.macros
index 3fb984d8b7d5d296680b67da5ae9a5c0548dd04f..648a95450817cf5b04dfbb95a405566044caab05 100644 (file)
@@ -1,5 +1,9 @@
 # $Revision$, $Date$
-# PLD Linux rpm macros
+# PLD Linux rpm macros.
+# <http://www.pld-linux.org/>
+
+# can be used by builder script to check for version
+%rpm_build_macros      %(R="$Revision$"; RR="${R##: }"; echo ${RR%%?})
 
 %epoch         0
 %x8664         x86_64 amd64 ia32e
 %kgcc_package  gcc
 
 # compiler version
-%cc_version            %{expand:%%global cc_version %(%{__cc} -dumpversion || echo ERROR)}%cc_version
+%cc_version    %{expand:%%global cc_version %(%{__cc} -dumpversion || echo ERROR)}%cc_version
 %cxx_version   %{expand:%%global cxx_version %(%{__cxx} -dumpversion || echo ERROR)}%cxx_version
 
-%__rm                  /bin/rm --interactive=never
+%__rm          /bin/rm --interactive=never
 
 # Build system path macros.
+%__autoconf    autoconf %{?debug:-Wall}
+%__automake    automake -a -c -f --foreign
+%__autopoint   autopoint --force
+
+# add parallel build flags: -jN
+#
+# if you want to disable parallel build do:
+# echo '%_smp_mflags %{nil}' >> ~/.rpmmacros
 #
-%__autoconf            autoconf %{?debug:-Wall}
-%__automake            automake -a -c -f --foreign
-%__autopoint           autopoint --force
+%__make                /usr/bin/make %{?_smp_mflags}
+%__scons       /usr/bin/scons %{?_smp_mflags}
+%__waf         /usr/bin/waf %{?_smp_mflags}
+%__cmake       /usr/bin/cmake
+
+%_smp_mflags %(_NCPUS=$(/usr/bin/getconf _NPROCESSORS_ONLN); \\\
+                               [ "$_NCPUS" -gt 1 ] && echo "-j$(($_NCPUS * 2))")
 
 %__gettextize { \
        if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
 %__intltoolize         intltoolize --copy --force
 %__libtoolize          libtoolize --copy --force --install
 
-#      Path to top of build area.
-%_topdir               %{expand:%%global _topdir %(test -d ../SPECS -a -d ../SOURCES && (cd ..; pwd) || echo $HOME/rpm)}%_topdir
+# topdir is where builder script lives,
+# fallback to old style if SPECS/SOURCES dirs were found.
+%_topdir    %{expand:%%global _topdir %(
+       if [ -d SPECS -a -d SOURCES ]; then
+               # old style rpmdir: in topdir
+               readlink -m .
+       elif [ -d ../SPECS -a -d ../SOURCES ]; then
+               # old style rpmdir: in subdir
+               readlink -m ..
+       elif [ -d $HOME/rpm/SPECS -a -d $HOME/rpm/SOURCES ]; then \
+               # if old style rpm dir exist, go with it
+               echo $HOME/rpm; \
+       elif [ -x ../builder -a ! -d ../builder ]; then
+               # relative new style rpmdir: in package dir
+               readlink -m ..
+       elif [ -x builder -a ! -d builder ]; then
+               # relative new style rpmdir: in packages
+               readlink -m .
+       elif [ -x packages/builder -a ! -d packages/builder ]; then
+               # relative new style rpmdir: packages dir in current dir
+               readlink -m packages
+       else
+               # fallback to new style rpmdir
+               echo $HOME/rpm/packages
+       fi; \
+)}%_topdir
+
+# if %{_topdir}/SPECS exists, it's old style structure
+%_specdir       %{expand:%%global _specdir %([ ! -d %{_topdir}/SPECS ] && echo %{_topdir}/%{name} || echo %{_topdir}/SPECS)}%_specdir
+%_sourcedir            %{expand:%%global _sourcedir %([ ! -d %{_topdir}/SOURCES ] && echo %{_specdir} || echo %{_topdir}/SOURCES)}%_sourcedir
+
+# BUILD/RPMS/SRPMS are one same level by default as packages dir, if these exist
+# if they don't exist assume we are having custom topdir (which is not named as
+# "packages", i.e ~/rpm/kde/{kdelibs,BUILD/RPMS/SRPMS})
+%_builddir             %{expand:%%global _builddir %(if [ -d %{_topdir}/../BUILD ]; then readlink -m %{_topdir}/../BUILD; else echo %{_topdir}/BUILD; fi)}%_builddir
+%_rpmdir               %{expand:%%global _rpmdir %(if [ -d %{_topdir}/../RPMS ]; then readlink -m %{_topdir}/../RPMS; else echo %{_topdir}/RPMS; fi)}%_rpmdir
+%_srcrpmdir            %{expand:%%global _srcrpmdir %(if [ -d %{_topdir}/../SRPMS ]; then readlink -m %{_topdir}/../SRPMS; else echo %{_topdir}/SRPMS; fi)}%_srcrpmdir
 
 #      The number of cvs changelog entries kept when building package.
 %_buildchangelogtruncate 20
 #      and that both p and q are package names (i.e. no version/release).
 %_dependency_whiteout  %{nil}
 
-%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
-       && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
-       [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS")
-
 #-----------------------------------------------------------------
 #
 # (re)definition of %{rpm*flags} with %filterout_* support
 # Flags specified in %filterout_* are removed from %rpm*flags, exactly:
 # %rpmcflags    = %optflags - %filterout - %filterout_c   - %filterout_ld
 # %rpmcxxflags  = %optflags - %filterout - %filterout_cxx - %filterout_ld
+# %rpmcppflags  = %optcppflags - %filterout - %filterout_cpp - %filterout_ld
 # %rpmldflags   = %optldflags - %filterout_ld
 #
 # Regular expressions are supported, but to avoid some character be treated
        %{filter_out}
 }')
 
+%rpmcppflags %(awk 'BEGIN {
+       split("%{?debug:%debugcppflags}%{!?debug:%optcppflags}%{?debuginfocppflags}",I);
+       split("%{?filterout} %{?filterout_cpp} %{?filterout_cpp}",F);
+       %{filter_out}
+}')
+
 %rpmldflags %(awk 'BEGIN {
        split("%{?optldflags}",I);
        split("%{?filterout_ld}",F)
         };
 }')
 
+#-----------------------------------------------------------------
+#
+#  Generate a command which cleans environment, leaving only the
+# most important variables.
+#  If any spec requires any additional environment it should
+# redefine %_preserve_env in following manner:
+#
+#      # ADDITIONAL_VAR is required because [a good reason here]
+#      %define _preserve_env ADDITIONAL_VAR
+
+%_preserve_env_base    PATH HOME TMP TMPDIR SSH_AUTH_SOCK
+
+# "env -i" must end in first line of expaned macros because it's used as first line of shell script (#! env...)
+%_clean_env            %{!?_preserve_env:%global _preserve_env %{nil}}%{expand:%%global _preserve_env %{_preserve_env} %_preserve_env_base} env -i %(awk -vq="'" -vqq="\\"'\\"" -vq2q="'\\"'" 'BEGIN {
+       split("%{?_preserve_env}", P);
+       for (i in P) {
+               p = P[i];
+               if (!ENVIRON[p] || d[p]) {
+                       continue;
+               }
+               d[p] = 1;
+               split(ENVIRON[p], V, "");
+               val = p "=";
+               for (j = 1; j in V; j++) {
+                       v = V[j];
+                       if (v == q)
+                               v = qq;
+                       else if (v == "\\"")
+                               v = q2q;
+                       else if (v == "\\\\")
+                               v = "\\\\\\\\";
+                       else
+                               gsub("[^a-zA-Z0-9/:._-]", "\\"&\\"", v);
+                       val = val "" v;
+               }
+               printf(val " ");
+       }
+}')
+
 #-----------------------------------------------------------------
 %configure2_13 { \
  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
  CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
  FCFLAGS="${FCFLAGS:-%rpmcflags}" ; export FCFLAGS ; \
- CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
+ CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" ; export CPPFLAGS ; \
  %{?__cc:CC="%{__cc}" ; export CC ; } \
  %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
  %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
        %{dependencytracking} \
 }
 
-# override __cmake to add -j4 in your ~/.rpmmacros for parallel make
-%__cmake       /usr/bin/cmake
 %cmake { \
 CC="%{__cc}" \
 CXX="%{__cxx}" \
 CFLAGS="%{rpmcflags}" \
 CXXFLAGS="%{rpmcxxflags}" \
+LDFLAGS="%{rpmldflags}" \
 %{__cmake} \
 }
 
-# override __scons to add -j4 in your ~/.rpmmacros for parallel make
-%__scons       /usr/bin/scons
 %scons { \
 %{__scons} \
        LDFLAGS="${LDFLAGS:-%rpmldflags}" \
        CFLAGS="${CFLAGS:-%rpmcflags}" \
        CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
        FFLAGS="${FFLAGS:-%rpmcflags}" \
-       CPPFLAGS="${CPPFLAGS:-}" \
+       CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" \
        %{?__cc:CC="%{__cc}"} \
        %{?__cxx:CXX="%{__cxx}"} \
        libsuffix=%{_lib} \
@@ -170,8 +260,6 @@ CXXFLAGS="%{rpmcxxflags}" \
 }
 
 # waf. see waf.spec
-# override __waf to add -j4 in your ~/.rpmmacros for parallel make
-%__waf /usr/bin/waf
 %waf { \
 CC="%{__cc}" \
 CXX="%{__cxx}" \
@@ -191,7 +279,7 @@ CXXFLAGS="%{rpmcxxflags}" \
        CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
        FFLAGS="${FFLAGS:-%rpmcflags}" \
        FCFLAGS="${FCFLAGS:-%rpmcflags}" \
-       CPPFLAGS="${CPPFLAGS:-}" \
+       CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" \
        %{?__cc:CC="%{__cc}"} \
        %{?__cxx:CXX="%{__cxx}"} \
        --host=%{_target_platform} \
@@ -214,6 +302,44 @@ CXXFLAGS="%{rpmcxxflags}" \
        %{?configure_cache:--cache-file=%{configure_cache_file}} \
 }
 
+# Simple macros to simplify adding bconded options to configure scripts.
+#   Each macro requires bcond name and accepts optional option name, if option
+# isn't specified bcond name is used as option name. Options returning
+# --with and --enable also allow third argument which will be added as value
+# ( --with-option=value or --enable-option=value ) in case or positive
+# condition, but won't be added otherwise ( nothing or just --disable-option ).
+
+# Requirements:
+# BuildRequires: rpmbuild(macros) >= 1.527
+
+# Usage example:
+# %{__enable bcond} - returns --enable-bcond iff build condition is set
+# %{__disable bcond option} - returns --enable-option iff bcond is not set
+# %{__enable_disable bcond option value} - returns --enable-option=value if
+#    bcond is set, returns --disable-option otherwise
+
+# expand bconds to --enable-something and --disable-something
+%__enable() %{expand:%%{?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
+%__disable() %{expand:%%{!?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
+%__enable_disable() %{expand:%%{?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{!?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
+
+# same as above, but condition inverted
+%__enable_unless() %{expand:%%{!?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
+%__disable_if() %{expand:%%{?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
+%__enable_disable_not() %{expand:%%{!?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
+
+# expand bconds to --with-something and --without-something
+%__with() %{expand:%%{?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
+%__without() %{expand:%%{!?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
+%__with_without() %{expand:%%{?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{!?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
+
+# same as above, but condition inverted
+%__with_unless() %{expand:%%{!?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
+%__without_if() %{expand:%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
+%__with_without_not() %{expand:%%{!?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
+
+#-----------------------------------------------------------------
+
 # overload to insert debuginfo package
 %prep \
 %if 0%{?_enable_debug_packages}\
@@ -256,7 +382,7 @@ CXXFLAGS="%{rpmcxxflags}" \
 %__unsermake /usr/share/unsermake/unsermake
 
 # Current date
-%date          %(LC_ALL="C" date +"%a %b %d %Y")
+%date          %(LC_ALL=C date +"%a %b %d %Y")
 
 # Example files, programs, scripts...
 %_examplesdir  /usr/src/examples
@@ -267,22 +393,28 @@ CXXFLAGS="%{rpmcxxflags}" \
 # The directory holding Linux kernel sources
 %_kernelsrcdir /usr/src/linux%{_alt_kernel}
 
+# SysV-style initscripts dir
+%_initddir             /etc/rc.d/init.d
+
 # If non-empty "debug" macro defined, add "dbg" suffix to release number
 %_rpmfilename          %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
 
-# Requires name = version-release
-%requires_releq()              %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %{N} = %|E?{%{E}:}|%{V}-%{R}\\n' | grep -v 'is not')
+# -n drm to generate kernel%{_alt_kernel}-drm dependency
+%releq_kernel(n:)              %{expand:%%global releq_kernel %(R=$(LC_ALL=C rpm -q --qf '%{N}%{?-n:-%{-n*}} = %|E?{%{E}:}|%{V}-%{R}' -f %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | grep -v 'is not' | sed -e 's:-headers::;s:-config::'); echo ${R:-ERROR})}%releq_kernel
+%releq_kernel_up(n:)   %{expand:%%global releq_kernel_up %(R=$(LC_ALL=C rpm -q --qf '%{N}%{?-n:-%{-n*}}-up = %|E?{%{E}:}|%{V}-%{R}' -f %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | grep -v 'is not' | sed -e 's:-headers::;s:-config::'); echo ${R:-ERROR})}%releq_kernel_up
+%releq_kernel_smp(n:)  %{expand:%%global releq_kernel_smp %(R=$(LC_ALL=C rpm -q --qf '%{N}%{?-n:-%{-n*}}-smp = %|E?{%{E}:}|%{V}-%{R}' -f %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | grep -v 'is not' | sed -e 's:-headers::;s:-config::'); echo ${R:-ERROR})}%releq_kernel_smp
 
-%releq_kernel                  %{expand:%%global releq_kernel %(R=$(LC_ALL=C rpm -q --qf '%{N} = %|E?{%{E}:}|%{V}-%{R}' -f %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | grep -v 'is not' | sed -e 's:-headers::;s:-config::'); echo ${R:-ERROR})}%releq_kernel
-%releq_kernel_up               %{expand:%%global releq_kernel_up %(R=$(LC_ALL=C rpm -q --qf '%{N}-up = %|E?{%{E}:}|%{V}-%{R}' -f %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | grep -v 'is not' | sed -e 's:-headers::;s:-config::'); echo ${R:-ERROR})}%releq_kernel_up
-%releq_kernel_smp()            %{expand:%%global releq_kernel_smp %(R=$(LC_ALL=C rpm -q --qf '%{N}-smp = %|E?{%{E}:}|%{V}-%{R}' -f %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | grep -v 'is not' | sed -e 's:-headers::;s:-config::'); echo ${R:-ERROR})}%releq_kernel_smp
-%requires_releq_kernel(s:)             Requires%{-s:(%{-s*})}: %releq_kernel
-%requires_releq_kernel_up(s:)  Requires%{-s:(%{-s*})}: %releq_kernel_up
-%requires_releq_kernel_smp(s:) Requires%{-s:(%{-s*})}: %releq_kernel_smp
+# -s post to generate Requires(post) dependency
+%requires_releq_kernel(s:n:)           Requires%{-s:(%{-s*})}: %releq_kernel
+%requires_releq_kernel_up(s:n:)                Requires%{-s:(%{-s*})}: %releq_kernel_up
+%requires_releq_kernel_smp(s:n:)       Requires%{-s:(%{-s*})}: %releq_kernel_smp
 
-# XXX: why epoch 0 is stripped?
-%requires_eq()         %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %{N} = %|E?{%{E}:}|%{V}\\n' | sed -e 's/ 0:/ /' | grep -v 'is not')
-%requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %|E?{%{E}:}|%{V}' %2 | grep -v "is not")
+# Requires name = version-release
+%requires_releq()      %{!?1:ERROR}%{?2:ERROR}%{?1:%{!?2:%{expand:%%requires_eq_to -r %1 %1}}}
+# Requires: name = version
+%requires_eq()         %{!?1:ERROR}%{?2:ERROR}%{?1:%{!?2:%{expand:%%requires_eq_to %1 %1}}}
+# Requires: name = version (version based on querying package %2)
+%requires_eq_to(r)     %{!?2:ERROR}%{?3:ERROR}%{?2:%{!?3:%(if ! LC_ALL=C rpm -q --qf 'Requires: %1 = %|E?{%{E}:}|%{V}%{?-r:-%{R}}\\n' %2 | grep '^Requires:'; then echo "BuildRequires: %2"; fi)}}
 
 %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
 
@@ -480,6 +612,23 @@ if [ -d "$RPM_BUILD_ROOT" ]; then \
        fi; \
 fi; }; __spec_install_post_chrpath } } }
 
+# vim: "
+
+#-----------------------------------------------------------------
+# Find all shared object files with unresolved symbols. Warn
+# and terminate if any found (termination can be turned off by define).
+#%no_install_post_check_so 1
+%__spec_install_post_check_so { \
+ __spec_install_post_check_so() { \
+    fail=0; \
+    printf "Searching for shared objects with unresolved symbols..."; \
+    for f in $(find $RPM_BUILD_ROOT -type f -name '*.so.*' -print); do \
+        LC_ALL=C objdump -T $f 2> /dev/null | LC_ALL=C awk -v "file=$f" 'BEGIN { found=0; skip["program_name"]=1; symbols = "" } /^[0-9a-z]+ +D +\*UND\*/ { if ($NF in skip) { next; }; found = 1; symbols = symbols "\n\t" $NF } END { if (found) { print "\nUnresolved symbols found in: " file symbols; exit(1); } } ' || fail=1 ; \
+    done ; \
+    echo " DONE"; \
+    %{!?no_install_post_check_so:[ $fail -eq 1 ] && : || :;} \
+}; __spec_install_post_check_so }}
+
 #-----------------------------------------------------------------
 # Find and gzip all kernel modules
 #
@@ -513,13 +662,15 @@ fi; }; __spec_install_post_chrpath } } }
 #
 %gconf_schema_install() \
        umask 022; \
-       GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-install-rule /etc/gconf/schemas/%{?1}%{!?1:*.schemas} > /dev/null; \
+       GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \\\
+       /usr/bin/gconftool-2 --makefile-install-rule /etc/gconf/schemas/%{?1}%{!?1:*.schemas} > /dev/null; \
 %{nil}
 
 %gconf_schema_uninstall() \
-if [ $1 = 0 ]; then \
+if [ $1 = 0 -a -x /usr/bin/gconftool-2 ]; then \
        umask 022; \
-       GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
+       GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \\\
+       /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
 fi; \
 %{nil}
 
@@ -529,15 +680,17 @@ fi; \
 %update_desktop_database() {{ \
        umask 022; \
        /usr/bin/update-desktop-database -q; \
-}}%{nil}
+};} \
+%{nil}
 
 %update_desktop_database_post %update_desktop_database
 
 %update_desktop_database_postun() {{ \
 if [ "$1" = "0" ]; then \
-       %update_desktop_database; \
+       %update_desktop_database \
 fi; \
-}}%{nil}
+};} \
+%{nil}
 
 #-----------------------------------------------------------------
 # Update shared MIME info database
@@ -546,7 +699,8 @@ fi; \
 %update_mime_database() {{ \
        umask 022; \
        /usr/bin/update-mime-database %{_datadir}/mime; \
-}}%{nil}
+};} \
+%{nil}
 
 #-----------------------------------------------------------------
 # Update icon cache
@@ -555,7 +709,8 @@ fi; \
 %update_icon_cache() {{ \
        umask 022; \
        /usr/bin/gtk-update-icon-cache -qf %{_datadir}/icons/%1; \
-}}%{nil}
+};} \
+%{nil}
 
 #-----------------------------------------------------------------
 # Update scrollkeeper database
@@ -621,6 +776,7 @@ fi; \
 %ruby_vendorlibdir     %{expand:%%global ruby_vendorlibdir %(%{__ruby} -r rbconfig -e 'print Config::CONFIG["vendorlibdir"]' 2>/dev/null || echo ERROR)}%ruby_vendorlibdir
 %ruby_sitearchdir      %{expand:%%global ruby_sitearchdir %(%{__ruby} -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR)}%ruby_sitearchdir
 %ruby_sitelibdir       %{expand:%%global ruby_sitelibdir %(%{__ruby} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR)}%ruby_sitelibdir
+%ruby_rdocdir          /usr/share/rdoc
 %ruby_version          %{expand:%%global ruby_version %(%{__ruby} -r rbconfig -e 'print Config::CONFIG["ruby_version"]' 2>/dev/null || echo ERROR)}%ruby_version
 %ruby_ver_requires_eq  Requires:       ruby(ver) = %ruby_version
 %ruby_mod_ver_requires_eq      Requires:       ruby-modules(ver) = %ruby_version
@@ -633,6 +789,7 @@ fi; \
 
 # extract php/zend api versions
 %php_major_version             %{expand:%%global php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)}%php_major_version
+%php_minor_version             %{expand:%%global php_minor_version %(awk '/#define PHP_MINOR_VERSION/{print $3}' %{php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)}%php_minor_version
 %php_api_version               %{expand:%%global php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{php_includedir}/main/php.h 2>/dev/null || echo ERROR)}%php_api_version
 %php_pdo_api_version   %{expand:%%global php_pdo_api_version %(awk '/#define PDO_DRIVER_API/{print $3}' %{php_includedir}/ext/pdo/php_pdo_driver.h 2>/dev/null || echo ERROR)}%php_pdo_api_version
 %php_debug                             %{expand:%%global php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{php_includedir}/main/php_config.h 2>/dev/null || echo ERROR)}%php_debug
@@ -663,19 +820,22 @@ fi; \
 %php_webserver_restart \
 [ ! -f /etc/apache/conf.d/??_mod_php.conf ] || %service -q apache restart \
 [ ! -f /etc/httpd/conf.d/??_mod_php.conf ] || %service -q httpd restart \
-if [ -f /etc/rc.d/init.d/php-fcgi ]; then \
+if [ -x /etc/rc.d/init.d/php-fcgi ]; then \
        PHP_FCGI_BINARY=; . /etc/sysconfig/php-fcgi 2>/dev/null \
        if [[ ${PHP_FCGI_BINARY:-php.fcgi} = *php.fcgi* ]]; then \
                %service -q php-fcgi restart \
        fi \
 fi \
+if [ -x /etc/rc.d/init.d/php-fpm ]; then \
+       %service -q php-fpm restart \
+fi \
 %{nil}
 
 # for using php post scripts. for PHP >= 4.0 && PHP < 5.0
 %php4_webserver_restart \
 [ ! -f /etc/apache/conf.d/??_mod_php4.conf ] || %service -q apache restart \
 [ ! -f /etc/httpd/conf.d/??_mod_php4.conf ] || %service -q httpd restart \
-if [ -f /etc/rc.d/init.d/php-fcgi ]; then \
+if [ -x /etc/rc.d/init.d/php-fcgi ]; then \
        PHP_FCGI_BINARY=; . /etc/sysconfig/php-fcgi 2>/dev/null \
        if [[ ${PHP_FCGI_BINARY:-php.fcgi} = *php4.fcgi* ]]; then \
                %service -q php-fcgi restart \
@@ -683,31 +843,57 @@ if [ -f /etc/rc.d/init.d/php-fcgi ]; then \
 fi \
 %{nil}
 
-
 # X.org helper macros
-%__xorg_abi_requires() Requires: xorg-xserver-server(%{expand:%1}-abi) = %{expand:%{%{!?2:%{1}}%{?2}}}
-#
+%__xorg_abi_requires_ge() Requires: xorg-xserver-server(%{expand:%1}-abi) >= %{expand:%{%2}}
+%__xorg_abi_requires_lt() Requires: xorg-xserver-server(%{expand:%1}-abi) < %(awk -vv=%{expand:%{%2}} 'BEGIN{split(v, a, "."); printf("%s.0", a[1] + 1); exit}')
+
 %xorg_xserver_ansic_abi                %{expand:%%global xorg_xserver_ansic_abi %(awk '/#define ABI_ANSIC_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)}%xorg_xserver_ansic_abi
 %xorg_xserver_extension_abi    %{expand:%%global xorg_xserver_extension_abi %(awk '/#define ABI_EXTENSION_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)}%xorg_xserver_extension_abi
 %xorg_xserver_font_abi         %{expand:%%global xorg_xserver_font_abi %(awk '/#define ABI_FONT_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null | echo ERROR)}%xorg_xserver_font_abi
 %xorg_xserver_videodrv_abi     %{expand:%%global xorg_xserver_videodrv_abi %(awk '/#define ABI_VIDEODRV_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)}%xorg_xserver_videodrv_abi
 %xorg_xserver_xinput_abi       %{expand:%%global xorg_xserver_xinput_abi %(awk '/#define ABI_XINPUT_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)}%xorg_xserver_xinput_abi
+# vim: '
+
+%requires_xorg_xserver_extension \
+%{__xorg_abi_requires_ge ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires_lt ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires_ge extension xorg_xserver_extension_abi} \
+%{__xorg_abi_requires_lt extension xorg_xserver_extension_abi} \
+%{nil}
+
+%requires_xorg_xserver_xinput \
+%{__xorg_abi_requires_ge ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires_lt ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires_ge xinput xorg_xserver_xinput_abi} \
+%{__xorg_abi_requires_lt xinput xorg_xserver_xinput_abi} \
+%{nil}
+
+%requires_xorg_xserver_font \
+%{__xorg_abi_requires_ge ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires_lt ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires_ge font xorg_xserver_font_abi} \
+%{__xorg_abi_requires_lt font xorg_xserver_font_abi} \
+%{nil}
+
+%requires_xorg_xserver_videodrv \
+%{__xorg_abi_requires_ge ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires_lt ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires_ge videodrv xorg_xserver_videodrv_abi} \
+%{__xorg_abi_requires_lt videodrv xorg_xserver_videodrv_abi} \
+%{nil}
 
-%requires_xorg_xserver_extension %{__xorg_abi_requires ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires extension xorg_xserver_extension_abi}
-%requires_xorg_xserver_xinput %{__xorg_abi_requires ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires xinput xorg_xserver_xinput_abi}
-%requires_xorg_xserver_font %{__xorg_abi_requires ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires font xorg_xserver_font_abi}
-%requires_xorg_xserver_videodrv %{__xorg_abi_requires ansic xorg_xserver_ansic_abi} \
-%{__xorg_abi_requires videodrv xorg_xserver_videodrv_abi}
+# TCL specific macro definitions.
+# TODO: when th tcl is fixed use tclsh to get version: %(echo 'puts $tcl_version' | tclsh)
+%tcl_version   %{expand:%%global tcl_version %(v=$(rpm -q --qf %{V} tcl | cut -d. -f1,2); echo ${v:-ERROR})}%tcl_version
+%tcl_sitearch  %{_libdir}/tcl%{tcl_version}
+%tcl_sitelib   %{_datadir}/tcl%{tcl_version}
 
 # Python specific macro definitions.
 # python main version
-%py_ver                        %{expand:%%global py_ver %(%{__python} -c "import sys; print sys.version[:3]" || echo ERROR)}%py_ver
+%py_ver                        %{expand:%%global py_ver %(%{__python} -c "import sys; print sys.version[:3]" 2>/dev/null || echo ERROR)}%py_ver
 
 # directories
-%py_prefix             %{expand:%%global py_prefix %(%{__python} -c "import sys; print sys.prefix" || echo ERROR)}%py_prefix
+%py_prefix             %{expand:%%global py_prefix %(%{__python} -c "import sys; print sys.prefix" 2>/dev/null || echo ERROR)}%py_prefix
 %py_libdir             %{py_prefix}/%{_lib}/python%{py_ver}
 %py_scriptdir  %{py_prefix}/share/python%{py_ver}
 %py_incdir             /usr/include/python%{py_ver}
@@ -723,26 +909,57 @@ fi \
 # Software written in Python language require Python with main version
 %pyrequires_eq() Requires:     %1
 
+# Python 3.x
+# python main version
+%__python3                     python3
+%py3_ver                       %{expand:%%global py3_ver %(%{__python3} -c "import sys; print(sys.version[:3])" 2>/dev/null || echo ERROR)}%py3_ver
+
+# directories
+%py3_prefix            %{expand:%%global py3_prefix %(%{__python3} -c "import sys; print(sys.prefix)" 2>/dev/null || echo ERROR)}%py3_prefix
+%py3_libdir            %{py3_prefix}/%{_lib}/python%{py3_ver}
+%py3_scriptdir %{py3_prefix}/share/python%{py3_ver}
+%py3_incdir            /usr/include/python%{py3_ver}
+%py3_sitedir           %{py3_libdir}/site-packages
+%py3_sitescriptdir %{py3_scriptdir}/site-packages
+%py3_dyndir            %{py3_libdir}/lib-dynload
+
+# pure python modules compilation
+%py3_comp              %{__python3} -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
+
+%py3_ocomp             %{__python3} -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
+
 # Hardlink binary identical .pyc and .pyo files
-# (idea by glen <at> pld-linux <dot> org)
 %__spec_install_post_py_hardlink {\
 %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
-[ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
-       b="${a%.pyc}.pyo"; \
-       if cmp -s "$a" "$b"; then \
-               ln -f "$a" "$b"; \
-       fi; \
-done \
+local a b c=0 t=0; \
+if [ -d "$RPM_BUILD_ROOT" ]; then \
+       find "$RPM_BUILD_ROOT" -name '*.pyc' > __rpm_pyc; \
+       while read a; do \
+               b="${a%.pyc}.pyo"; \
+               if cmp -s "$a" "$b"; then \
+                       ln -f "$a" "$b"; \
+                       c=$((c + 1)); \
+               fi; \
+               t=$((t + 1)); \
+       done < __rpm_pyc; \
+       [ $t -gt 0 ] && printf "Hardlink Python files: %d/%d files hardlinked\n" $c $t; \
+       rm -f __rpm_pyc; \
+fi; \
 }; __spec_install_post_py_hardlink } }
 
 # remove python sources, so that check-files won't complain
-# (idea by glen <at> pld-linux <dot> org)
 %py_postclean() \
 for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
  [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
 done \
 %{nil}
 
+%py3_postclean() \
+for d in %{py3_sitescriptdir} %{py3_sitedir} %*; do \
+ [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
+done \
+%{nil}
+
 # depmod macro
 %depmod() { \
 umask 022; \
@@ -769,7 +986,7 @@ fi; \
 %xmms_effect_plugindir         %{expand:%%global xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null || echo ERROR)}%xmms_effect_plugindir
 %xmms_general_plugindir                %{expand:%%global xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null || echo ERROR)}%xmms_general_plugindir
 
-%_target_base_arch     %{expand:%%global _target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/;s/ia32e/x86_64/')}%_target_base_arch
+%_target_base_arch     %{expand:%%global _target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/;s/ia32e/x86_64/;s/sparcv./sparc/')}%_target_base_arch
 
 # user/group checking macros
 #
@@ -792,9 +1009,14 @@ fi; \
 # user group membership management macros
 #
 # Usage:
-#      %addusertogroup myuser agroup
+#      %addusertogroup [-q] myuser agroup
 #
-%addusertogroup        /usr/lib/rpm/user_group.sh user addtogroup
+#  -q if user or group don't exist, don't make big noise of it (MISSINGOK behaviour)
+#
+# Requirements:
+# BuildRequires:       rpmbuild(macros) >= 1.515
+%addusertogroup(q)     quiet=%{-q:1} /usr/lib/rpm/user_group.sh user addtogroup %*; \
+%{nil}
 
 # banner support (useful in {pre,post}{,un} and triggers)
 #
@@ -867,6 +1089,7 @@ else \
                %{expand:%{%{#}}} 1>&2 || exit $? \
        [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || : \
 fi;
+# vim: "
 
 # Usage:
 #   %groupadd [-P package] [-g gid] group
@@ -879,7 +1102,7 @@ fi;
 %groupadd(g:P:rfo)     \
 %{!-g:%{error:groupadd: Required argument -g missing}} \
 %{!?1:%{error:groupadd: Required parameter group missing}} \
-if [ -n "`/usr/bin/getgid %{1}`" ]; then \
+if /usr/bin/getgid %{1} > /dev/null 2>&1; then \
        if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \
                echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
                exit 1 \
@@ -903,11 +1126,11 @@ fi;
 #
 # Add package's webserver config to webserver webapps dir.
 # Usage:
-#   %webapp_register WEBSERVER WEBAPP
+#   %webapp_register [-f] WEBSERVER WEBAPP
 #
-%webapp_register() \
+%webapp_register(f) \
 %{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
-if [ "$1" = "1" ] && [ "$2" = "1" ]; then\
+if [ -n "%{-f:1}" ] || [ "$1" = "1" ] && [ "$2" = "1" ]; then\
        /usr/sbin/webapp register %1 %2\
 fi\
 # reload webserver if the config symlink is there and skip reload if webserver is upgraded\
@@ -983,7 +1206,7 @@ fi \
 
 %java_home             %{expand:%%global java_home %([ -f %{_javadir}-utils/java-functions ] || { echo ERROR; exit 0; }; unset JAVA_HOME; . %{_javadir}-utils/java-functions; set_jvm; echo ${JAVA_HOME:-ERROR})}%java_home
 
-%ant                   JAVA_HOME=%{java_home} ant
+%ant                   JAVA_HOME=%{java_home} CLASSPATH=$CLASSPATH ant
 %jar                   %{java_home}/bin/jar
 %java                  %{expand:%%global java %([ -f %{_javadir}-utils/java-functions ] || { echo ERROR; exit 0; }; unset JAVACMD; . %{_javadir}-utils/java-functions; set_javacmd; echo $JAVACMD)}%java
 %javac                 %{java_home}/bin/javac
@@ -1074,16 +1297,22 @@ cat %{_mavendepmapfragdir}/* >> %{_mavendepmapdir}/maven2-depmap.xml\
 fi\
 echo -e "</dependencies>\\n" >> %{_mavendepmapdir}/maven2-depmap.xml
 
+# JAVA macros specific for PLD
+
+# Directory for tomcat context configuration files
+%_tomcatconfdir        %{_sharedstatedir}/tomcat/conf/Catalina/localhost
 
 # PEAR install macros
 # Author: Elan Ruusamäe <glen@pld-linux.org>
 #
 # Usage:
-#      %%pear_package_setup [-a #] [-n FMT]
+#      %%pear_package_setup ...
 #
 # -a #   - also unpack SOURCE#. for PEAR bootstrapping
 # -n FMT - create builddir with FMT, instead of default %%{_pearname}-%%{version}
 # -z     - unpack pear package and let pear use package.xml (not tarball) for install. for PEAR bootstrapping
+# -D     - pass -D to %setup (so the build dir is not removed)
+# -c     - register channel from local channel.xml file
 #
 # unpack PEAR package to %%{_builddir}/FMT. package is extracted with already
 # destination hierarchy. you should copy the tree to buildroot after
@@ -1105,7 +1334,7 @@ echo -e "</dependencies>\\n" >> %{_mavendepmapdir}/maven2-depmap.xml
 %__pear_install_log \
 tee install.log \
 # make post message of optional packages \
-grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,' > optional-packages.txt \
+grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,;s,^pear/,php-pear-,;s,^channel://.*/,,' > optional-packages.txt \
 if [ -s optional-packages.txt ]; then \
        awk -F'"' '/use package/{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
 else \
@@ -1118,9 +1347,10 @@ fi \
 
 %pear_install(a:n:zD) \
 %__pear \\\
-       -c pearrc \\\
+       -c %{builddir}/pearrc \\\
        -d doc_dir=/docs \\\
-       -d php_dir=%{php_pear_dir} \\\
+       -d temp_dir=/tmp \\\
+       -d php_dir=%{-c:%{builddir}/}%{php_pear_dir} \\\
        -d bin_dir=%{_bindir} \\\
        -d data_dir=%{php_pear_dir}/data \\\
        -d test_dir=%{php_pear_dir}/tests \\\
@@ -1130,18 +1360,20 @@ fi \
        --nodeps \\\
        %{-f:--force} \\\
        %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$_P} > .install.log || { c=$?; cat .install.log; exit $c; }; \
+       %{-c:cp -a %{builddir}/%{builddir}/%{php_pear_dir} %{builddir}/%(dirname %{php_pear_dir}); rm -rf %{builddir}/%{builddir}; } \
 %{nil}
 
 # The main macro.
 # using this macro will append optional-packages.txt to the nocompressdoc list
 # as it's displayed to user after package install. and adding additional gzip
 # dep is just waste ;)
-%pear_package_setup(a:n:zD) \
+%pear_package_setup(a:n:zDc:) \
 %define srcdir %{-n*}%{!-n:%{_pearname}-%{version}} \
 %define builddir %{_builddir}/%{srcdir} \
 %setup -q -c -T %{-D:-D} -n %{srcdir} \
 %{-z:tar zxf %{S:0}; %{-a:tar zxf %{S:%{-a*}}}} \
 %{-z:_P=package2.xml; [ -f $_P ] || _P=package.xml; _N=%{srcdir}; mv $_P $_N; cd $_N} \
+%{-c:%{__pear} -c pearrc config-set php_dir %{builddir}/%{php_pear_dir}; %__pear -c %{builddir}/pearrc channel-add %{-c*}} \
 %pear_install \
 %{-z:cd ..} \
 cat %{-z:$_N/}.install.log | %__pear_install_log \
@@ -1270,7 +1502,7 @@ for cfg in ${cfgs:-dist}; do                                        \
        [ -r "%{_kernelsrcdir}/config-$cfg" ] || exit 1                                 \
                                                                                                                                        \
        rm -rf o                                                                                                                \
-       install -d o/include/linux                                                                              \
+       install -d o/include/linux o/arch/powerpc/lib                                   \
        ln -sf %{_kernelsrcdir}/config-$cfg o/.config                                   \
        ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers    \
        ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h \
@@ -1279,13 +1511,14 @@ for cfg in ${cfgs:-dist}; do                                        \
        [ -z "$PATCH_SH" ] || echo "$PATCH_SH" | %__spec_build_shell    \
        set -x                                                                                                                  \
                                                                                                                                        \
-       %if %{with dist_kernel}                                                                                 \
+       %if %{with dist_kernel} || %(test -f %{_kernelsrcdir}/scripts/bin2c ; echo $?)  \
                %{__make} -j1 -C %{_kernelsrcdir} prepare scripts                       \\\
                        %{-p*} %{-P*}                                                                                   \\\
                        %{MakeOpts}                                                                                             \
        %else                                                                                                                   \
                install -d o/include/config                                                                     \
                touch o/include/config/MARKER                                                           \
+               ln -sf %{_kernelsrcdir}/include/config/auto-$cfg.conf o/include/config/auto.conf        \
                ln -sf %{_kernelsrcdir}/scripts o/scripts                                       \
        %endif                                                                                                                  \
                                                                                                                                        \
@@ -1332,6 +1565,7 @@ compile %{*}\
 %define KernelD $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}                     \
 %define ModprobeD $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{_kernel_ver} \
                                                                                                                                        \
+__install_kernel_modules() {                                                                           \
 local cfgs='%{?with_dist_kernel:%{?with_smp: smp}%{?with_up: up}}%{!?with_dist_kernel: nondist}' \
                                                                                                                                        \
 for MODULE in {%{-m*},}; do                                                                                    \
@@ -1346,6 +1580,8 @@ for MODULE in {%{-m*},}; do                                                                                       \
                        >> %{ModprobeD}$suf/%{-n*}.conf}                                                \
        done                                                                                                                    \
 done                                                                                                                           \
+}                                                                                                                                      \
+__install_kernel_modules                                                                                       \
 %{nil}
 
 # patchset macros
@@ -1496,4 +1732,56 @@ io.open("/etc/shells", "w"):write(s)\
 %{-p:end} \
 %{nil}
 
-# vim:ts=4 sw=4 noet syn=spec
+# Check syntax for Python files
+#
+# Author: Elan Ruusamäe <glen@pld-linux.org>
+# Author: Arkadiusz Miśkiewicz <arekm@pld-linux.org>
+#
+# Usage:
+#   %py_lint src
+#
+# Requirements:
+# BuildRequires:       python
+# BuildRequires:       rpmbuild(macros) >= 1.469
+
+%py_lint() \
+__py_lint() { \
+find "$@" -type f -name '*.py' | python -c ' \
+import sys \
+import compiler \
+\
+err = 0\
+for f in sys.stdin: \
+       fd = open(f.strip()) \
+       c = fd.read() \
+       fd.close() \
+       try: \
+               compiler.parse(c) \
+       except SyntaxError, e: \
+               print "py_lint: %s: %s" % (f.strip(), e) \
+               err = err + 1\
+\
+if err: \
+       print >> sys.stderr, "\\npy_lint: ERROR: Syntax errors in %d files.\\n" % err \
+       sys.exit(1) \
+else: \
+       print >> sys.stderr,  "py_lint: Found no syntax errors." \
+' \
+}; __py_lint %* \
+%{nil}
+
+# Undos files
+#
+# Author: Paweł Zuzelski <pawelz@pld-linux.org>
+#
+# Usage:
+#   %undos list_of_files
+#
+# Requirements:
+# BuildRequires:       sed >= 4.0
+# BuildRequires:       rpmbuild(macros) >= 1.533
+
+%undos \
+%{__sed} -i -e 's,\\r$,,'
+
+# vim:ts=4 sw=4 noet ft=spec
This page took 0.941201 seconds and 4 git commands to generate.