diff -r 333964c621f1 -r cb59d6afeb61 openpkg/rpmmacros
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/openpkg/rpmmacros Tue Jan 06 23:40:39 2009 +0100
@@ -0,0 +1,432 @@
+##
+## rpmmacros -- OpenPKG RPM Macros
+## Copyright (c) 2000-2007 OpenPKG Foundation e.V.
+## Copyright (c) 2000-2007 Ralf S. Engelschall
+##
+## Permission to use, copy, modify, and distribute this software for
+## any purpose with or without fee is hereby granted, provided that
+## the above copyright notice and this permission notice appear in all
+## copies.
+##
+## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+## SUCH DAMAGE.
+##
+## The purpose of this macro set is to override the default
+## macros in the OpenPKG RPM installation for the @l_prefix@ hierarchy.
+##
+
+# the OpenPKG release identification (for the current package or as a fallback for the bootstrap package)
+%l_openpkg_release(F:) %(%{l_prefix}/libexec/openpkg/release --release="%{?release}%{!?release:%(%{l_rpm} -q --qf '%{release}' openpkg)}" %{?-F:-F "%{-F*}"}%{!?-F:-F "OpenPKG-%%t"})
+
+# the OpenPKG OIDs (root is officially registered at IANA)
+%l_openpkg_oid 1.3.6.1.4.1.18749
+%l_openpkg_oid_bootstrap %{l_openpkg_oid}.4.1
+%l_openpkg_oid_instance %{l_openpkg_oid_bootstrap}.1
+%l_openpkg_oid_platform %{l_openpkg_oid_bootstrap}.2
+%l_openpkg_oid_tagfmtopt %{l_openpkg_oid_bootstrap}.3
+
+# the OpenPKG package tagging
+%l_tag_fmt @TAG@
+%l_tag_fmt_compat %(prefix="%{l_prefix_static}"; if [ ".`expr $prefix : '/[^/][^/]*$'`" != .0 ]; then loc=`echo $prefix | cut -c2-4`; else loc=`echo $prefix | sed -e 's;/\\(.\\)[^/]*;\\1;g' | cut -c1-3`; fi; echo $loc)
+%l_tag_fmt_loc %(echo "%{l_prefix_static}" | sed -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2\\3;' -e 's;^/\\([^/]\\)[^/]*/\\([^/][^/]\\).*;\\1\\2;' -e 's;^/\\([^/][^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' -e 's;^/\\([^/][^/][^/]\\).*;\\1;' -e 's;^/\\([^/][^/]\\).*;\\1;' -e 's;^/\\([^/]\\).*;\\1;')
+%l_tag_fmt_opt %(uuid_ns="`%{l_uuid} -v3 ns:OID %{l_openpkg_oid_tagfmtopt}`"; %{l_uuid} -v3 $uuid_ns '%{?_options}')
+%l_tag_fmt_uuid %(%{l_uuid} -v1)
+%l_tag_fmt_time %(date '+%%Y%%m%%d%%H%%M%%S')
+%l_tag_fmt_user %(%{l_shtool} echo -e '%%u')
+%l_tag_fmt_host %(%{l_shtool} echo -e '%%h%%d')
+%l_tag_gen %{expand:%(echo '%{l_tag_fmt}' | sed -e 's/<\\([a-zA-Z][_a-zA-Z0-9]*\\)>/%%{l_tag_fmt_\\1}/g')}
+%l_tag %(echo "%{l_tag_gen}" | sed -e 's;-;;g')
+
+# the OpenPKG instance location (backward compatibility only)
+%l_location %{l_tag}
+
+# standard RPM host platform identification
+# (defaults via "shtool platform" and uname(3); used internally)
+#%_host_cpu ...USE INTERNAL DEFAULT...
+#%_host_vendor ...USE INTERNAL DEFAULT...
+#%_host_os ...USE INTERNAL DEFAULT...
+%_host_alias %{nil}
+%_host %{_host_cpu}-%{_host_os}
+
+# standard RPM build platform identification
+# (defaults via %{_host*} macros; not used internally AFAIK)
+%_build_cpu %{_host_cpu}
+%_build_vendor %{_host_vendor}
+%_build_os %{_host_os}
+%_build_alias %{_host_alias}
+%_build %{_host}
+
+# standard RPM target platform identification
+# (defaults via %{_host*} macros; used internally for %ifarch/%ifnarch)
+%_target_cpu %{_host_cpu}
+%_target_vendor %{_host_vendor}
+%_target_os %{_host_os}
+%_target_alias %{_host_alias}
+%_target %{_host}
+
+# legacy RPM platform macros
+# (defaults via config.guess/config.sub under RPM build-time)
+%_arch %{_host_cpu}
+%_vendor %{_host_vendor}
+%_os %{_host_os}
+
+# legacy RPM platform macros
+# (defaults via various other macros; partly used internally)
+%_build_arch %{_arch}
+%_target_platform %{_target_cpu}-%{_target_vendor}-%{_target_os}
+%_gnu %{nil}
+
+# official OpenPKG host platform identification
+%l_host_arch %{_host_cpu}
+%l_host_vendor %{_host_vendor}
+%l_host_os %{_host_os}
+%l_host %{_host_cpu}-%{_host_os}
+
+# new OpenPKG platform identification
+%l_platform(cptF:) %(if [ ".%{?-F}" != . ]; then fmt="%{-F*}"; else T="%{?-c:c}%{?-p:p}%{?-t:t}"; [ ".$T" = . ] && T="p"; fmt="%%-%%"; fi; %{l_shtool} platform -n -L -S "" -C "+" -F "$fmt")
+
+# old OpenPKG platform identification
+%l_target %{l_platform -t}
+
+# the *S*uper-user user/group name/id pair
+%l_susr @SUSR@
+%l_sgrp @SGRP@
+%l_suid %((getent passwd "%{l_susr}"; grep "^%{l_susr}:" /etc/passwd; ypmatch "%{l_susr}" passwd; nismatch "%{l_susr}" passwd; nidump passwd . | grep "^%{l_susr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
+%l_sgid %((getent group "%{l_sgrp}"; grep "^%{l_sgrp}:" /etc/group; ypmatch "%{l_sgrp}" group; nismatch "%{l_sgrp}" group; nidump group . | grep "^%{l_susr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
+
+# the *M*anagement user/group name/id pair
+%l_musr @MUSR@
+%l_mgrp @MGRP@
+%l_muid %((getent passwd "%{l_musr}"; grep "^%{l_musr}:" /etc/passwd; ypmatch "%{l_musr}" passwd; nismatch "%{l_musr}" passwd; nidump passwd . | grep "^%{l_musr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
+%l_mgid %((getent group "%{l_mgrp}"; grep "^%{l_mgrp}:" /etc/group; ypmatch "%{l_mgrp}" group; nismatch "%{l_mgrp}" group; nidump group . | grep "^%{l_musr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
+
+# the *R*restricted user/group name/id pair
+%l_rusr @RUSR@
+%l_rgrp @RGRP@
+%l_ruid %((getent passwd "%{l_rusr}"; grep "^%{l_rusr}:" /etc/passwd; ypmatch "%{l_rusr}" passwd; nismatch "%{l_rusr}" passwd; nidump passwd . | grep "^%{l_rusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
+%l_rgid %((getent group "%{l_rgrp}"; grep "^%{l_rgrp}:" /etc/group; ypmatch "%{l_rgrp}" group; nismatch "%{l_rgrp}" group; nidump group . | grep "^%{l_rusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
+
+# the *N*on-privileged user/group name/id pair
+%l_nusr @NUSR@
+%l_ngrp @NGRP@
+%l_nuid %((getent passwd "%{l_nusr}"; grep "^%{l_nusr}:" /etc/passwd; ypmatch "%{l_nusr}" passwd; nismatch "%{l_nusr}" passwd; nidump passwd . | grep "^%{l_nusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
+%l_ngid %((getent group "%{l_ngrp}"; grep "^%{l_ngrp}:" /etc/group; ypmatch "%{l_ngrp}" group; nismatch "%{l_ngrp}" group; nidump group . | grep "^%{l_nusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
+
+# backward compatibility (openpkg < 20020204)
+%l_fsusr %{l_musr}
+%l_fsgrp %{l_mgrp}
+%l_npuid %{l_nuid}
+%l_npgid %{l_ngid}
+
+# define the installation hierarchy (used parts)
+%l_prefix @l_prefix@
+%l_prefix_static @l_prefix_static@
+
+# define the installation hierarchy (unused parts)
+%l_exec_prefix %{l_prefix}
+%l_bindir %{l_prefix}/bin
+%l_sbindir %{l_prefix}/sbin
+%l_libexecdir %{l_prefix}/libexec
+%l_datadir %{l_prefix}/share
+%l_sysconfdir %{l_prefix}/etc
+%l_sharedstatedir %{l_prefix}/com
+%l_localstatedir %{l_prefix}/var
+%l_libdir %{l_prefix}/lib
+%l_includedir %{l_prefix}/include
+%l_infodir %{l_prefix}/info
+%l_mandir %{l_prefix}/man
+%l_docdir %{l_prefix}/doc
+
+# provide killer macro "%{l_value -s|-b|-c (l_xxx ...|-a|-A)}" which
+# expands to the values of previous l_xxx variables in this file. With
+# option "-s" it expands into a chain of "-e 's;;;g'"
+# constructs for used with Stream Editor sed(1), with option "-b" it
+# expands into a chain of "='';" constructs for use with
+# Bourne-Shell sh(1), with option "-c" it expands into a chain of "set
+# = '';" constructs for use with C-Shell csh(1). But
+# be careful, currently (for expansion speed reasons) is not
+# escaped, so make sure the values of the above macros do not contain
+# ";" for "-s" and ";" for "-b" and "-c". You can either specify one
+# or more names of variables to expand or use "-a" for mostly all
+# variables and "-A" for really all variables.
+%l_value(sbcaA) %{expand:%(l=""; for x in `if [ ".%*" != . ]; then echo "%* "; else p=""; if [ ".%{-a:yes}" = .yes ]; then p="^%%l_(prefix|[smrn](usr|grp|uid|gid))"; elif [ ".%{-A:yes}" = .yes ]; then p="^%%l_"; fi; if [ ".$p" != . ]; then egrep "$p" %{l_prefix}/etc/openpkg/rpmmacros | sed -e '/^%%l_value/,$d' -e 's;^%%\\(l_[a-z1-9_]*\\).*;\\1;'; fi; fi`; do e=""; if [ ".%{-s:yes}" = .yes ]; then e="-e 's;@$x@;%%{$x};g'"; elif [ ".%{-b:yes}" = .yes ]; then e="$x='%%{$x}';"; elif [ ".%{-c:yes}" = .yes ]; then e="set $x = '%%{$x}';"; else e="%%{$x}"; fi; if [ ".$l" = . ]; then l="$e"; else l="$l $e"; fi; done; echo "$l")}
+
+# local version of the empty macro
+%l_nil %{nil}
+
+# override the internal RPM hierarchy variables
+%_usr %{nil}
+%_var %{nil}
+%_usrsrc %{nil}
+%_topdir %{nil}
+%_dbpath %{l_prefix}/RPM/DB
+%_builddir %{l_prefix}/RPM/TMP
+%_tmppath %{l_prefix}/RPM/TMP
+%_sourcedir %{l_prefix}/RPM/SRC/%{name}
+%_specdir %{l_prefix}/RPM/SRC/%{name}
+%_rpmdir %{l_prefix}/RPM/PKG
+%_srcrpmdir %{l_prefix}/RPM/PKG
+%_repackage_dir %{l_prefix}/RPM/PKG
+%_cache_dbpath %{l_prefix}/RPM/PKG
+%_solve_dbpath %{l_prefix}/RPM/PKG
+%_solve_pkgsdir %{l_prefix}/RPM/PKG
+%_defaultdocdir %{l_docdir}
+
+# complement the %{SOURCE} and %{PATCH} with %{SOURCE } and %{PATCH }
+%SOURCE() %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
+%PATCH() %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
+
+# override RPM's absolute tool paths with relative ones
+# (because if you upgrade RPM it would hard-code tools in own hierarchy, too)
+%__awk awk
+%__bzip2 %{_bzip2bin}
+%__cat cat
+%__chgrp chgrp
+%__chmod chmod
+%__chown chown
+%__cp cp
+%__cpio cpio
+%__grep grep
+%__gzip %{_gzipbin}
+%__id id
+%__install install
+%__ln_s ln -s
+%__make make
+%__mkdir mkdir
+%__mkdir_p %{l_shtool} mkdir -p
+%__mv mv
+%__patch %{_patchbin}
+%__perl perl
+%__pgp %{_pgpbin}
+%__rm rm
+%__rsh rsh
+%__sed sed
+%__ssh ssh
+%__tar %{_tarbin}
+%__unzip %{_unzipbin}
+
+# override some more RPM macros where the default value is not acceptable
+%_dependency_whiteout %{nil}
+%__debug_install_post %{nil}
+%_unpackaged_files_terminate_build 0
+
+# provide fixed paths to tools (standard)
+%_gzipbin %{l_prefix}/lib/openpkg/gzip
+%_bzip2bin %{l_prefix}/lib/openpkg/bzip2
+%_patchbin %{l_prefix}/lib/openpkg/patch
+%_tarbin %{l_prefix}/lib/openpkg/tar
+%_unzipbin %{l_prefix}/lib/openpkg/unzip
+
+# provide path to platform identification file
+%__platform %{l_prefix}/etc/openpkg/platform
+
+# provide fixed paths to tools (additional)
+%l_rc %{l_prefix}/etc/rc
+%l_rpm %{l_prefix}/libexec/openpkg/rpm
+%l_rpm2cpio %{l_prefix}/libexec/openpkg/rpm2cpio
+%l_rpm_config %{l_prefix}/libexec/openpkg/rpm-config
+%l_lsync %{l_prefix}/libexec/openpkg/lsync
+%l_rpmtool %{l_prefix}/lib/openpkg/rpmtool
+%l_shtool %{l_prefix}/lib/openpkg/shtool
+%l_curl %{l_prefix}/lib/openpkg/curl
+%l_bash %{l_prefix}/lib/openpkg/bash
+%l_uuid %{l_prefix}/lib/openpkg/uuid
+
+# provide smart paths to tools
+%l_tool_locate() %(if [ ".%{expand:%%{?use_%1}}" != . ]; then tool="%{expand:%%{use_%1}}"; elif [ -f "%{l_prefix}/bin/%2" ]; then tool="%{l_prefix}/bin/%2"; elif [ -f "%{l_prefix}/lib/openpkg/%2" ]; then tool="%{l_prefix}/lib/openpkg/%2"; else tool="%2"; fi; echo $tool)
+%l_gzip %{l_tool_locate gzip gzip}
+%l_bzip2 %{l_tool_locate bzip2 bzip2}
+%l_tar %{l_tool_locate tar tar}
+%l_make %{l_tool_locate make make}
+%l_cc %{l_tool_locate cc cc}
+%l_ar %{l_tool_locate ar ar}
+%l_ld %{l_tool_locate ld ld}
+%l_as %{l_tool_locate as as}
+%l_strip %{l_tool_locate strip strip}
+%l_cxx %{l_tool_locate cxx c++}
+%l_patch %{l_tool_locate patch patch}
+%l_sed %{l_tool_locate sed sed}
+%l_grep %{l_tool_locate grep grep}
+%l_awk %{l_tool_locate awk awk}
+%l_autoconf %{l_tool_locate autoconf autoconf}
+%l_automake %{l_tool_locate automake automake}
+%l_libtool %{l_tool_locate libtool libtool}
+%l_flex %{l_tool_locate flex flex}
+%l_bison %{l_tool_locate bison bison}
+%l_perl %{l_tool_locate perl perl}
+%l_miniperl %{l_tool_locate miniperl miniperl}
+%l_openssl %{l_tool_locate openssl openssl}
+%l_xmkmf %{l_tool_locate xmkmf xmkmf}
+%l_vcheck %{l_tool_locate vcheck vcheck}
+
+# tool options
+%l_mflags(O) %(%{l_sane_env}; %{l_rpmtool} mflags %{-O:-O} "%{l_make}")
+%l_cflags(O) %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cc}")
+%l_cxxflags(O) %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cxx}")
+%l_cppflags(i) %(%{l_sane_env}; %{l_rpmtool} cppflags -p%{l_prefix} %{-i:-i} -- %*)
+%l_ldflags() %(%{l_sane_env}; %{l_rpmtool} ldflags -p%{l_prefix} -- %*)
+
+# OSSP fake syslog library
+%l_fsl_ldflags() %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --ldflags) 2>/dev/null`; else flags=''; fi; echo $flags)
+%l_fsl_libs() %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --libs ) 2>/dev/null`; else flags=''; fi; echo $flags)
+
+# determine the current username
+%l_whoami %((id -un) 2>/dev/null || (whoami) 2>/dev/null || (who am i | cut "-d " -f1) 2>/dev/null || echo $LOGNAME)
+
+# macros for dynamically generating a %files list
+%l_files_defattr '%%defattr(-,%{l_musr},%{l_mgrp})'
+%l_files_all '%{l_prefix}'
+%l_files_noshared '%%not %%dir {%{l_prefix},%{l_prefix}/*,%{l_prefix}/etc/rc.d,%{l_prefix}/man/*}'
+%l_files_std() %l_files_defattr %l_files_all %l_files_noshared
+
+# path to local build root
+%l_buildroot %{_tmppath}/%{name}-%{version}-root
+
+# path to local temporary location
+%l_tmpdir() %{_tmppath}
+%l_tmpfile() %{l_tmpdir}/%{name}-%{version}-%{release}-tmp%{?1:-%1}
+
+# executable path for %post/%pre
+%_install_script_path %{l_prefix}/bin:%{l_prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
+
+# names of RPM files
+%l_srcrpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.src.rpm
+%l_binrpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-%{l_tag}.rpm
+
+# override the name scheme for RPM files
+%_rpmfilename %{l_binrpmfilename}
+%_build_name_fmt %{l_binrpmfilename}
+%_repackage_name_fmt %{l_binrpmfilename}
+%_solve_name_fmt %{_solve_pkgsdir}/%{l_binrpmfilename}
+
+# override the payload compression for the CPIO parts of an RPM
+# (we use the equivalent of "bzip2 -9")
+%_source_payload w9.bzdio
+%_binary_payload w9.bzdio
+
+# package signature type is OpenPGP via GnuPG
+%__gpg %{l_prefix}/bin/gpg
+%_signature gpg
+%__vsflags 1
+
+# two macro-processor add-ons (should be part of forthcoming RPM releases)
+%ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
+%ifndef() %if %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
+
+# macro for package option configuration
+%option() %{expand:%%{!?%{1}:%%global %*}} %{expand:%%global _options %{?_options:%{_options}:}%{1}=%%%{1}} \
+Provides: %{name}::%{1} = %(echo '%{expand:%%{%{1}}}' | sed -e 's;%%;%%%%;g' -e 's; ;%%20;g' -e 's; ;%%09;g')
+
+# macros for NoSource/NoPatch (distribution restriction) integrity handling
+%NoSource() %(if [ ".%{?restriction}" != ".no" ]; then echo "NoSource: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{SOURCEURL%1}}
+%NoPatch() %(if [ ".%{?restriction}" != ".no" ]; then echo "NoPatch: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{PATCHURL%1}}
+%integrity() %{l_check_nosource}
+
+# macros for checking build environment
+%l_check_nosource() %(%{l_sane_env}; checkok=1; checkinfo=`echo "Sorry, this OpenPKG package contains a DISTRIBUTION RESTRICTED source file."; echo "Before you can proceed building this package, fetch missing files MANUALLY:"`; for url in . %{?_restricted}; do [ ".$url" = .. ] && continue; eval `echo "$url" | sed -e 's!^\\(.*\\)::/\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' -e 's!^\\([^:;][^:]*://.*/\\)\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' -e 's:^\\([^;].*\\)$:;url="(unknown location) "; file="\\1":' -e 's:^;::'`; if [ ! -f "%{_specdir}/$file" ] && [ ! -f "%{_sourcedir}/$file" ]; then checkok=0; checkinfo=`echo "${checkinfo}"; echo ""; echo "from ${url}"; echo "file ${file}"; echo "here %{_sourcedir}/$file"`; fi; done; if [ $checkok -ne 1 ]; then echo "set +x"; echo "$checkinfo" | %{l_rpmtool} msg -b -t error | sed -e 's;^;echo ";' -e 's;$;";'; echo "exit 1"; fi)
+%l_check_class() %(%{l_sane_env}; class=`echo "@:%{?class}:%{?distribution}" | sed -e 's;^@:\\([^:][^:]*\\):.*$;\\1;' -e 's;^@:.*\\[\\(.*\\)\\].*$;\\1;' -e 's;^@:.*$;JUNK;'`; %{l_rpmtool} check-class "$class")
+%prep %%prep\
+ %{l_check_nosource} \
+ %{l_check_class} \
+ %{nil}
+
+# macro-processor add-on for testing external conditions
+%l_test(pfd) %(if [ ".%{?-p:yes}" = .yes ]; then %{l_rpm} -q %1 >/dev/null 2>&1; rc=$?; elif [ ".%{?-f:yes}" = .yes ]; then test -f %1; rc=$?; elif [ ".%{?-d:yes}" = .yes ]; then test -d %1; rc=$?; fi; if [ ".$rc" = .0 ]; then echo "yes"; else echo "no"; fi)
+
+# default list of vendor source fetching locations
+%l_fetch_mirror_0 -
+%l_fetch_mirror_1 -
+%l_fetch_mirror_2 -
+%l_fetch_mirror_3 -
+%l_fetch_mirror_4 -
+%l_fetch_mirror_5 -
+%l_fetch_mirror_6 -
+%l_fetch_mirror_7 -
+%l_fetch_mirror_8 -
+%l_fetch_mirror_9 -
+%l_fetch_backup_0 -
+%l_fetch_backup_1 -
+%l_fetch_backup_2 -
+%l_fetch_backup_3 -
+%l_fetch_backup_4 -
+%l_fetch_backup_5 -
+%l_fetch_backup_6 -
+%l_fetch_backup_7 -
+%l_fetch_backup_8 -
+%l_fetch_backup_9 ftp://ftp.openpkg.org/sources/DST/%{name}/
+
+# sane build environment setup
+%l_build_path %(if [ -d %{l_prefix}/lib/openpkg/override ]; then echo "%{l_prefix}/lib/openpkg/override:"; fi)%{l_prefix}/bin:%{l_prefix}/sbin:@l_build_path@%(if [ -d %{l_prefix}/lib/openpkg/fallback ]; then echo ":%{l_prefix}/lib/openpkg/fallback"; fi)
+%l_build_ldlp %{l_prefix}/lib:@l_build_ldlp@
+%l_build_ulim @l_build_ulim@
+%l_build_shell_cmd %{l_prefix}/lib/openpkg/bash
+%l_build_shell_opt --norc --noprofile --posix
+
+# sane build environment for manual usage in macros (currently just $PATH)
+%l_sane_env PATH="%{l_build_path}"; export PATH; LD_LIBRARY_PATH="%{l_build_ldlp}"; export LD_LIBRARY_PATH
+
+# sane build environment for %prep/%build/%install
+%_buildshell env -i %{l_build_shell_cmd} %{l_build_shell_opt}
+%___build_pre \
+HOME="%{l_prefix}"\
+SHELL="%{l_build_shell_cmd}"\
+TERM="%(echo $TERM)"\
+TMPDIR="%{_tmppath}"\
+USER="%(echo $USER)"\
+LOGNAME="%(echo $LOGNAME)"\
+PATH="%{l_build_path}"\
+LD_LIBRARY_PATH="%{l_build_ldlp}"\
+export HOME SHELL TMPDIR USER LOGNAME PATH LD_LIBRARY_PATH\
+RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
+RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
+RPM_OPT_FLAGS=\"%{optflags}\"\
+RPM_ARCH=\"%{l_host_arch}\"\
+RPM_OS=\"%{l_host_os}\"\
+RPM_DOC_DIR=\"%{_docdir}\"\
+RPM_PACKAGE_NAME=\"%{name}\"\
+RPM_PACKAGE_VERSION=\"%{version}\"\
+RPM_PACKAGE_RELEASE=\"%{release}\"\
+export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_DOC_DIR\
+export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
+%{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
+export RPM_BUILD_ROOT}\
+%{l_build_ulim}\
+umask 022\
+%{verbose:set -x}%{!verbose:exec >/dev/null}\
+cd %{u2p:%{_builddir}}
+
+# special %track section support
+%__spec_track_template VCFILE="%{_tmppath}/%{name}-%{version}-%{release}.vc"\
+rm -f $VCFILE\
+set -o noclobber\
+sed -e 's;^ *#.*$;;' -e 's;^ ;;' >$VCFILE <<'EOF'\
+%{nil}
+%__spec_track_post EOF\
+if [ ".%{?___track_dump}" = .yes ]; then\
+ cat $VCFILE\
+else\
+ if [ ! -f "%{l_vcheck}" ]; then\
+ echo "rpm:ERROR: Vendor source tracking functionality currently not available because"\
+ echo "rpm:ERROR: URL tracking tool vcheck(1) not found under \\"%{l_vcheck}\\"."\
+ echo "rpm:ERROR: You have to install the OpenPKG \\"vcheck\\" package first or set"\
+ echo "rpm:ERROR: the RPM macro \\"%%{l_vcheck}\\" to the path of your vcheck(1) tool."\
+ exit 0\
+ fi\
+ ( echo "config = {"\
+ echo "}"\
+ ) >>$VCFILE\
+ %{l_vcheck} -v -f $VCFILE || true\
+fi\
+rm -f $VCFILE\
+%{nil}
+