packages: rpm-build-macros/rpm.macros - update topdir locating magic, to fa...
glen
glen at pld-linux.org
Fri Feb 19 11:04:47 CET 2010
Author: glen Date: Fri Feb 19 10:04:47 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- update topdir locating magic, to fallback to old style if SPECS/SOURCES found, otherwise to new style
---- Files affected:
packages/rpm-build-macros:
rpm.macros (1.540 -> 1.541)
---- Diffs:
================================================================
Index: packages/rpm-build-macros/rpm.macros
diff -u packages/rpm-build-macros/rpm.macros:1.540 packages/rpm-build-macros/rpm.macros:1.541
--- packages/rpm-build-macros/rpm.macros:1.540 Thu Feb 18 15:49:03 2010
+++ packages/rpm-build-macros/rpm.macros Fri Feb 19 11:04:40 2010
@@ -54,22 +54,43 @@
%__intltoolize intltoolize --copy --force
%__libtoolize libtoolize --copy --force --install
-# 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?)
-# XXX: fixed location for now: ~/rpm/packages
-%_topdir %{expand:%%global _topdir %(echo $HOME/rpm/packages)}%_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 -f .
+ elif [ -d ../SPECS -a -d ../SOURCES ]; then
+ # old style rpmdir: in subdir
+ readlink -f ..
+ 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 -f ..
+ elif [ -x builder -a ! -d builder ]; then
+ # relative new style rpmdir: in packages
+ readlink -f .
+ elif [ -x packages/builder -a ! -d packages/builder ]; then
+ # relative new style rpmdir: packages dir in current dir
+ readlink -f packages
+ else
+ # fallback to new style rpmdir
+ echo $HOME/rpm/packages
+ fi; \
+)}%_topdir
-# if %{_topdir}/builder exists, it's new style structure
-# XXX: fixed location for now: topdir/{SPECS,SOURCES}
-%_specdir %{_topdir}/SPECS
-%_sourcedir %{_topdir}/SOURCES
+# 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 %([ -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
+%_builddir %{expand:%%global _builddir %(if [ -d %{_topdir}/../BUILD ]; then readlink -f %{_topdir}/../BUILD; else echo %{_topdir}/BUILD; fi)}%_builddir
+%_rpmdir %{expand:%%global _rpmdir %(if [ -d %{_topdir}/../RPMS ]; then readlink -f %{_topdir}/../RPMS; else echo %{_topdir}/RPMS; fi)}%_rpmdir
+%_srcrpmdir %{expand:%%global _srcrpmdir %(if [ -d %{_topdir}/../SRPMS ]; then readlink -f %{_topdir}/../SRPMS; else echo %{_topdir}/SRPMS; fi)}%_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.540&r2=1.541&f=u
More information about the pld-cvs-commit
mailing list