packages: rpm-build-macros/rpm.macros - introduce default new packages dir ...

glen glen at pld-linux.org
Thu Feb 11 20:23:08 CET 2010


Author: glen                         Date: Thu Feb 11 19:23:08 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- introduce default new packages dir layout to macros, so that rpm -ihv would install to proper place if ran from new tree, works on old trees too if detected

---- Files affected:
packages/rpm-build-macros:
   rpm.macros (1.533 -> 1.534) 

---- Diffs:

================================================================
Index: packages/rpm-build-macros/rpm.macros
diff -u packages/rpm-build-macros/rpm.macros:1.533 packages/rpm-build-macros/rpm.macros:1.534
--- packages/rpm-build-macros/rpm.macros:1.533	Sun Feb  7 16:01:33 2010
+++ packages/rpm-build-macros/rpm.macros	Thu Feb 11 20:23:02 2010
@@ -51,8 +51,25 @@
 %__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 builder script was not found and
+# SPECS/SOURCES dirs exist (XXX: should be reverse?)
+%_topdir    %{expand:%%global _topdir %(d=;\
+    d=${d:-$([ -d ../SPECS -a -d ../SOURCES ] && (cd .. && pwd))};\
+    d=${d:-$([ -x ../builder ] && (cd ..; pwd))};\
+    d=${d:-$([ -x builder ] && pwd)};\
+    echo ${d:-$HOME/rpm};\
+)}%_topdir
+
+# if %{_topdir}/builder exists, it's new style structure
+%_specdir       %{expand:%%global _specdir %([ -x %{_topdir}/builder ] && echo %{_topdir}/%{name} || echo %{_topdir}/SPECS)}%_specdir
+%_sourcedir		%{expand:%%global _sourcedir %([ -x %{_topdir}/builder ] && 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 %([ -d %{_topdir}/../BUILD ] && (cd %{_topdir}/../BUILD; pwd) || echo %{_topdir}/BUILD)}%_builddir
+%_rpmdir		%{expand:%%global _rpmdir %([ -d %{_topdir}/../RPMS ] && (cd %{_topdir}/../RPMS; pwd) || echo %{_topdir}/RPMS)}%_rpmdir
+%_srcrpmdir		%{expand:%%global _srcrpmdir %([ -d %{_topdir}/../SRPMS ] && (cd %{_topdir}/../SRPMS; pwd) || echo %{_topdir}/SRPMS)}%_srcrpmdir
 
 #	The number of cvs changelog entries kept when building package.
 %_buildchangelogtruncate 20
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm-build-macros/rpm.macros?r1=1.533&r2=1.534&f=u



More information about the pld-cvs-commit mailing list