Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
1 ##
2 ## rpmmacros -- OpenPKG RPM Macros
3 ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
4 ##
5 ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
6 ## All rights reserved. Licenses which grant limited permission to use,
7 ## copy, modify and distribute this software are available from the
8 ## OpenPKG GmbH.
9 ##
10 ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 ##
25 ## The purpose of this macro set is to override the default
26 ## macros in the OpenPKG RPM installation for the @l_prefix@ hierarchy.
27 ##
29 # utility macro for "delayed one-time expansion" of macro bodies
30 # (works by redefining a macro in-place to its expanded body on its first usage)
31 %l_once() %{expand:%%global %{*}}%{expand:%%{%{1}}}
33 # the OpenPKG release identification (for the current package or as a fallback for the bootstrap package)
34 %l_openpkg_release(F:) %(%{l_prefix}/libexec/openpkg/release \\\
35 --release="%{?release}%{!?release:%(%{l_rpm} -q --qf '%{release}' openpkg)}" \\\
36 %{?-F:-F "%{-F*}"}%{!?-F:-F "OpenPKG-%%t"})
38 # the OpenPKG OIDs (root is officially registered at IANA)
39 %l_openpkg_oid 1.3.6.1.4.1.18749
40 %l_openpkg_oid_bootstrap %{l_openpkg_oid}.4.1
41 %l_openpkg_oid_instance %{l_openpkg_oid_bootstrap}.1
42 %l_openpkg_oid_platform %{l_openpkg_oid_bootstrap}.2
43 %l_openpkg_oid_tagfmtopt %{l_openpkg_oid_bootstrap}.3
45 # the OpenPKG package tagging
46 %l_tag_fmt @TAG@
47 %l_tag_fmt_compat %(prefix="%{l_prefix_static}"; \
48 if [ ".`expr $prefix : '/[^/][^/]*$'`" != .0 ]; then \
49 loc=`echo $prefix | cut -c2-4`; \
50 else \
51 loc=`echo $prefix | sed -e 's;/\\(.\\)[^/]*;\\1;g' | cut -c1-3`; \
52 fi; \
53 echo $loc)
54 %l_tag_fmt_loc %(echo "%{l_prefix_static}" | \\\
55 sed -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2\\3;' \\\
56 -e 's;^/\\([^/]\\)[^/]*/\\([^/][^/]\\).*;\\1\\2;' \\\
57 -e 's;^/\\([^/][^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' \\\
58 -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' \\\
59 -e 's;^/\\([^/][^/][^/]\\).*;\\1;' \\\
60 -e 's;^/\\([^/][^/]\\).*;\\1;' \\\
61 -e 's;^/\\([^/]\\).*;\\1;' \\\
62 )
63 %l_tag_fmt_opt %(uuid_ns="`%{l_uuid} -v3 ns:OID %{l_openpkg_oid_tagfmtopt}`"; \
64 %{l_uuid} -v3 $uuid_ns '%{?_options}')
65 %l_tag_fmt_uuid %(%{l_uuid} -v1)
66 %l_tag_fmt_time %(date '+%%Y%%m%%d%%H%%M%%S')
67 %l_tag_fmt_user %(%{l_shtool} echo -e '%%u')
68 %l_tag_fmt_host %(%{l_shtool} echo -e '%%h%%d')
69 %l_tag_gen %{expand:%(echo '%{l_tag_fmt}' | \\\
70 sed -e 's/<\\([a-zA-Z][_a-zA-Z0-9]*\\)>/%%{l_tag_fmt_\\1}/g')}
71 %l_tag %{l_once l_tag %(echo "%{l_tag_gen}" | sed -e 's;-;;g')}
73 # the OpenPKG instance location (backward compatibility only)
74 %l_location %{l_tag}
76 # standard RPM host platform identification
77 # (defaults via "shtool platform" and uname(3); used internally)
78 #%_host_cpu ...USE INTERNAL DEFAULT...
79 #%_host_vendor ...USE INTERNAL DEFAULT...
80 #%_host_os ...USE INTERNAL DEFAULT...
81 %_host_alias %{nil}
82 %_host %{_host_cpu}-%{_host_os}
84 # standard RPM build platform identification
85 # (defaults via %{_host*} macros; not used internally AFAIK)
86 %_build_cpu %{_host_cpu}
87 %_build_vendor %{_host_vendor}
88 %_build_os %{_host_os}
89 %_build_alias %{_host_alias}
90 %_build %{_host}
92 # standard RPM target platform identification
93 # (defaults via %{_host*} macros; used internally for %ifarch/%ifnarch)
94 %_target_cpu %{_host_cpu}
95 %_target_vendor %{_host_vendor}
96 %_target_os %{_host_os}
97 %_target_alias %{_host_alias}
98 %_target %{_host}
100 # legacy RPM platform macros
101 # (defaults via config.guess/config.sub under RPM build-time)
102 %_arch %{_host_cpu}
103 %_vendor %{_host_vendor}
104 %_os %{_host_os}
106 # legacy RPM platform macros
107 # (defaults via various other macros; partly used internally)
108 %_build_arch %{_arch}
109 %_target_platform %{_target_cpu}-%{_target_vendor}-%{_target_os}
110 %_gnu %{nil}
112 # official OpenPKG host platform identification
113 %l_host_arch %{_host_cpu}
114 %l_host_vendor %{_host_vendor}
115 %l_host_os %{_host_os}
116 %l_host %{_host_cpu}-%{_host_os}
118 # host name or FQDN identification
119 %l_hostname(f) %(%{l_shtool} echo -n -e '%%h%{?-f:%%d}')
121 # new OpenPKG platform identification
122 %l_platform(cptF:) %(if [ ".%{?-F}" != . ]; then \
123 fmt="%{-F*}"; \
124 else \
125 T="%{?-c:c}%{?-p:p}%{?-t:t}"; \
126 [ ".$T" = . ] && T="p"; \
127 fmt="%%<a$T>-%%<s$T>"; \
128 fi; \
129 %{l_shtool} platform -n -L -S "" -C "+" -F "$fmt")
131 # old OpenPKG platform identification
132 %l_target %{l_platform -t}
134 # UID/GID lookup
135 %l_xuid_lookup() %(( getent passwd '%1'; \
136 grep '^%1:' /etc/passwd; \
137 ypmatch '%1' passwd; \
138 nismatch '%1' passwd; \
139 nidump passwd . | grep '^%1:' \
140 ) 2>/dev/null | \
141 sed -e 'q' | \\\
142 awk -F: '{ print $3; }' \
143 )
144 %l_xgid_lookup() %(( getent group '%2'; \
145 grep '^%2:' /etc/group; \
146 ypmatch '%2' group; \
147 nismatch '%2' group; \
148 nidump group . | grep '^%1:' \
149 ) 2>/dev/null | \
150 sed -e 'q' | \\\
151 awk -F: '{ print $3; }' \
152 )
154 # the *S*uper-user user/group name/id pair
155 %l_susr @SUSR@
156 %l_sgrp @SGRP@
157 %l_suid %{expand:%%{l_xuid_lookup %{l_susr} %{l_sgrp}}}
158 %l_sgid %{expand:%%{l_xgid_lookup %{l_susr} %{l_sgrp}}}
160 # the *M*anagement user/group name/id pair
161 %l_musr @MUSR@
162 %l_mgrp @MGRP@
163 %l_muid %{expand:%%{l_xuid_lookup %{l_musr} %{l_mgrp}}}
164 %l_mgid %{expand:%%{l_xgid_lookup %{l_musr} %{l_mgrp}}}
166 # the *R*restricted user/group name/id pair
167 %l_rusr @RUSR@
168 %l_rgrp @RGRP@
169 %l_ruid %{expand:%%{l_xuid_lookup %{l_rusr} %{l_rgrp}}}
170 %l_rgid %{expand:%%{l_xgid_lookup %{l_rusr} %{l_rgrp}}}
172 # the *N*on-privileged user/group name/id pair
173 %l_nusr @NUSR@
174 %l_ngrp @NGRP@
175 %l_nuid %{expand:%%{l_xuid_lookup %{l_nusr} %{l_ngrp}}}
176 %l_ngid %{expand:%%{l_xgid_lookup %{l_nusr} %{l_ngrp}}}
178 # backward compatibility (openpkg < 20020204)
179 %l_fsusr %{l_musr}
180 %l_fsgrp %{l_mgrp}
181 %l_npuid %{l_nuid}
182 %l_npgid %{l_ngid}
184 # whether we are intended to operate in an environment where
185 # only a single unprivileged user account can be used
186 %l_unprivileged @l_unprivileged@
188 # define the installation hierarchy (used parts)
189 %l_prefix @l_prefix@
190 %l_prefix_static @l_prefix_static@
192 # define the installation hierarchy (unused parts)
193 %l_exec_prefix %{l_prefix}
194 %l_bindir %{l_prefix}/bin
195 %l_sbindir %{l_prefix}/sbin
196 %l_libexecdir %{l_prefix}/libexec
197 %l_datadir %{l_prefix}/share
198 %l_sysconfdir %{l_prefix}/etc
199 %l_sharedstatedir %{l_prefix}/com
200 %l_localstatedir %{l_prefix}/var
201 %l_libdir %{l_prefix}/lib
202 %l_includedir %{l_prefix}/include
203 %l_infodir %{l_prefix}/info
204 %l_mandir %{l_prefix}/man
205 %l_docdir %{l_prefix}/doc
207 # provide killer macro "%{l_value -s|-b|-c (l_xxx ...|-a|-A)}" which
208 # expands to the values of previous l_xxx variables in this file. With
209 # option "-s" it expands into a chain of "-e 's;<name>;<value>;g'"
210 # constructs for used with Stream Editor sed(1), with option "-b" it
211 # expands into a chain of "<name>='<value>';" constructs for use with
212 # Bourne-Shell sh(1), with option "-c" it expands into a chain of "set
213 # <name> = '<value>';" constructs for use with C-Shell csh(1). But
214 # be careful, <value> currently (for expansion speed reasons) is not
215 # escaped, so make sure the values of the above macros do not contain
216 # ";" for "-s" and ";" for "-b" and "-c". You can either specify one
217 # or more names of variables to expand or use "-a" for mostly all
218 # variables and "-A" for really all variables.
219 %l_value(sbcaA) %{expand:%(\
220 l=""; \
221 for x in \\\
222 `if [ ".%*" != . ]; then \
223 echo "%* "; \
224 else \
225 p=""; \
226 if [ ".%{-a:yes}" = .yes ]; then \
227 p="^%%l_(prefix|[smrn](usr|grp|uid|gid))"; \
228 elif [ ".%{-A:yes}" = .yes ]; then \
229 p="^%%l_"; \
230 fi; \
231 if [ ".$p" != . ]; then \
232 egrep "$p" %{l_prefix}/etc/openpkg/rpmmacros |\\\
233 sed -e '/^%%l_value/,$d' \\\
234 -e 's;^%%\\(l_[a-z1-9_]*\\).*;\\1;'; \
235 fi; \
236 fi`; do \
237 e=""; \
238 if [ ".%{-s:yes}" = .yes ]; then \
239 e="-e 's;@$x@;%%{$x};g'"; \
240 elif [ ".%{-b:yes}" = .yes ]; then \
241 e="$x='%%{$x}';"; \
242 elif [ ".%{-c:yes}" = .yes ]; then \
243 e="set $x = '%%{$x}';"; \
244 else \
245 e="%%{$x}"; \
246 fi; \
247 if [ ".$l" = . ]; then \
248 l="$e"; \
249 else \
250 l="$l $e"; \
251 fi; \
252 done; \
253 echo "$l" \
254 )}
256 # local version of the empty macro
257 %l_nil %{nil}
259 # local version of the tab character
260 %l_tab %{lua: print "\t" }
262 # override the internal RPM hierarchy variables
263 %_usr %{nil}
264 %_var %{nil}
265 %_usrsrc %{nil}
266 %_topdir %{nil}
267 %_dbpath %{l_prefix}/RPM/DB
268 %_builddir %{l_prefix}/RPM/TMP
269 %_tmppath %{l_prefix}/RPM/TMP
270 %_sourcedir %{l_prefix}/RPM/SRC/%{name}
271 %_specdir %{l_prefix}/RPM/SRC/%{name}
272 %_rpmdir %{l_prefix}/RPM/PKG
273 %_srcrpmdir %{l_prefix}/RPM/PKG
274 %_repackage_dir %{l_prefix}/RPM/TR
275 %_cache_dbpath %{l_prefix}/RPM/CACHE
276 %_solve_dbpath %{l_prefix}/RPM/CACHE
277 %_solve_pkgsdir %{l_prefix}/RPM/CACHE
278 %_defaultdocdir %{l_docdir}
280 # complement the %{SOURCE<n>} and %{PATCH<n>} with %{SOURCE <file>} and %{PATCH <file>}
281 %_SOURCE_PATCH() %{lua: \
282 local source1 = rpm.expand("%{_specdir}/%1") \
283 local source2 = rpm.expand("%{_sourcedir}/%1") \
284 if posix.stat(source1) ~= nil then \
285 print(source1) \
286 else \
287 print(source2) \
288 end }
289 %SOURCE() %{expand:%%{_SOURCE_PATCH %1}}
290 %PATCH() %{expand:%%{_SOURCE_PATCH %1}}
292 # override RPM's absolute tool paths with relative ones
293 # (because if you upgrade RPM it would hard-code tools in own hierarchy, too)
294 %__awk awk
295 %__bzip2 %{_bzip2bin}
296 %__cat cat
297 %__chgrp chgrp
298 %__chmod chmod
299 %__chown chown
300 %__cp cp
301 %__grep grep
302 %__gzip %{_gzipbin}
303 %__id id
304 %__install install
305 %__ln_s ln -s
306 %__make make
307 %__mkdir mkdir
308 %__mkdir_p %{l_shtool} mkdir -p
309 %__mv mv
310 %__patch %{_patchbin}
311 %__perl perl
312 %__pgp %{_pgpbin}
313 %__rm rm
314 %__rsh rsh
315 %__sed sed
316 %__ssh ssh
317 %__tar %{_tarbin}
318 %__xz %{_xzbin}
320 # override some more RPM macros where the default value is not acceptable
321 %_dbapi %{l_once _dbapi %(if [ -f "%{_dbpath}/VERSION" ]; then \
322 . "%{_dbpath}/VERSION"; \
323 fi; \
324 echo "${DBAPI:-3}")}
325 %__dbi_other %{?_tmppath:tmpdir=%{_tmppath}} %{?__dbi_cdb} %{?__dbi_private:private}
326 %__file_context_path %{nil}
327 %__check_files %{nil}
328 %_patch_suffix -b --suffix .orig
329 %_excludedocs 1
330 %_dependency_whiteout %{nil}
331 %__debug_install_post %{nil}
332 %_unpackaged_files_terminate_build 0
334 # provide fixed paths to tools (standard)
335 %_gzipbin %{l_prefix}/lib/openpkg/gzip
336 %_bzip2bin %{l_prefix}/lib/openpkg/bzip2
337 %_xzbin %{l_prefix}/lib/openpkg/xz
338 %_patchbin %{l_prefix}/lib/openpkg/patch
339 %_tarbin %{l_prefix}/lib/openpkg/tar
340 %__bsdtar %{l_prefix}/lib/openpkg/bsdtar
341 %__cpio %{l_prefix}/lib/openpkg/bsdcpio
342 %__unzip %{__bsdtar}
344 # provide path to platform identification file
345 %__platform %{l_prefix}/etc/openpkg/platform
347 # provide fixed paths to tools (additional)
348 %l_rc %{l_prefix}/bin/openpkg --keep-privileges rc
349 %l_rpm %{l_prefix}/libexec/openpkg/rpm
350 %l_rpm2cpio %{l_prefix}/libexec/openpkg/rpm2cpio
351 %l_rpm_config %{l_prefix}/libexec/openpkg/rpm-config
352 %l_lsync %{l_prefix}/libexec/openpkg/lsync
353 %l_rpmtool %{l_prefix}/lib/openpkg/rpmtool
354 %l_shtool %{l_prefix}/lib/openpkg/shtool
355 %l_curl %{l_prefix}/lib/openpkg/curl
356 %l_bash %{l_prefix}/lib/openpkg/bash
357 %l_uuid %{l_prefix}/lib/openpkg/uuid
359 # provide smart paths to tools
360 %l_tool_locate() %{lua: \
361 if rpm.expand("%{expand:%%{?use_%1}}") ~= "" then \
362 print(rpm.expand("%{expand:%%{use_%1}}")) \
363 elseif posix.stat(rpm.expand("%{l_prefix}/bin/%2")) ~= nil then \
364 print(rpm.expand("%{l_prefix}/bin/%2")) \
365 elseif posix.stat(rpm.expand("%{l_prefix}/lib/openpkg/%2")) ~= nil then \
366 print(rpm.expand("%{l_prefix}/lib/openpkg/%2")) \
367 else \
368 print(rpm.expand("%2")) \
369 end }
370 %l_gzip %{l_once l_gzip %{l_tool_locate gzip gzip}}
371 %l_bzip2 %{l_once l_bzip2 %{l_tool_locate bzip2 bzip2}}
372 %l_xz %{l_once l_xz %{l_tool_locate xz xz}}
373 %l_tar %{l_once l_tar %{l_tool_locate tar tar}}
374 %l_make %{l_once l_make %{l_tool_locate make make}}
375 %l_cc %{l_once l_cc %{l_tool_locate cc cc}}
376 %l_ar %{l_once l_ar %{l_tool_locate ar ar}}
377 %l_ld %{l_once l_ld %{l_tool_locate ld ld}}
378 %l_as %{l_once l_as %{l_tool_locate as as}}
379 %l_strip %{l_once l_strip %{l_tool_locate strip strip}}
380 %l_cxx %{l_once l_cxx %{l_tool_locate cxx c++}}
381 %l_patch %{l_once l_patch %{l_tool_locate patch patch}}
382 %l_sed %{l_once l_sed %{l_tool_locate sed sed}}
383 %l_grep %{l_once l_grep %{l_tool_locate grep grep}}
384 %l_awk %{l_once l_awk %{l_tool_locate awk awk}}
385 %l_autoconf %{l_once l_autoconf %{l_tool_locate autoconf autoconf}}
386 %l_automake %{l_once l_automake %{l_tool_locate automake automake}}
387 %l_libtool %{l_once l_libtool %{l_tool_locate libtool libtool}}
388 %l_flex %{l_once l_flex %{l_tool_locate flex flex}}
389 %l_bison %{l_once l_bison %{l_tool_locate bison bison}}
390 %l_perl %{l_once l_perl %{l_tool_locate perl perl}}
391 %l_miniperl %{l_once l_miniperl %{l_tool_locate miniperl miniperl}}
392 %l_openssl %{l_once l_openssl %{l_tool_locate openssl openssl}}
393 %l_xmkmf %{l_once l_xmkmf %{l_tool_locate xmkmf xmkmf}}
394 %l_vcheck %{l_once l_vcheck %{l_tool_locate vcheck vcheck}}
396 # tool options
397 %l_mflags(O) %(%{l_sane_env}; %{l_rpmtool} mflags %{-O:-O} "%{l_make}")
398 %l_cflags(O) %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cc}")
399 %l_cxxflags(O) %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cxx}")
400 %l_cppflags(i) %(%{l_sane_env}; %{l_rpmtool} cppflags -p%{l_prefix} %{-i:-i} -- %*)
401 %l_ldflags() %(%{l_sane_env}; %{l_rpmtool} ldflags -p%{l_prefix} -- %*)
403 # OSSP fake syslog library
404 %l_fsl_ldflags() %(if [ ".%{with_fsl}" = ".yes" ]; then \
405 flags=`(%{l_prefix}/bin/fsl-config --all --ldflags) 2>/dev/null`; \
406 else \
407 flags=''; \
408 fi; \
409 echo $flags)
410 %l_fsl_libs() %(if [ ".%{with_fsl}" = ".yes" ]; then \
411 flags=`(%{l_prefix}/bin/fsl-config --all --libs) 2>/dev/null`; \
412 else \
413 flags=''; \
414 fi; \
415 echo $flags)
417 # determine the current username
418 %l_whoami %{l_once l_whoami %((id -un) 2>/dev/null || \\\
419 (whoami) 2>/dev/null || \\\
420 (who am i | cut "-d " -f1) 2>/dev/null || \\\
421 echo $LOGNAME)}
423 # macros for dynamically generating a %files list
424 %l_files_defattr '%%defattr(-,%{l_musr},%{l_mgrp})'
425 %l_files_all '%{l_prefix}'
426 %l_files_noshared '%%not %%dir {%{l_prefix},%{l_prefix}/*,%{l_prefix}/etc/rc.d,%{l_prefix}/man/*}'
427 %l_files_std() %l_files_defattr %l_files_all %l_files_noshared
429 # default %defattr when rolling SRPMS
430 %_srcdefattr (-,openpkg,openpkg)
432 # path to local build root
433 %l_buildroot %{_tmppath}/%{name}-%{version}-%{release}-buildroot
434 %buildroot %{l_buildroot}
436 # path to local temporary location
437 %l_tmpdir() %{_tmppath}
438 %l_tmpfile() %{l_tmpdir}/%{name}-%{version}-%{release}-tmp%{?1:-%1}
440 # executable path for %post/%pre
441 %_install_script_path %{l_prefix}/bin:%{l_prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
443 # names of RPM files
444 %l_srcrpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.src.rpm
445 %l_binrpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-%{l_tag}.rpm
447 # override the name scheme for RPM files
448 %_rpmfilename %{l_binrpmfilename}
449 %_build_name_fmt %{l_binrpmfilename}
450 %_repackage_name_fmt %{l_binrpmfilename}
451 %_solve_name_fmt %{?_solve_pkgsdir}/%{l_binrpmfilename}
452 %_query_all_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}
453 %___NVRA %%{NAME}-%%{VERSION}-%%{RELEASE}
455 # do not repackage automatically
456 %_repackage_all_erasures 0
458 # override the payload compression for the CPIO parts of an RPM
459 # (we use the equivalent of "bzip2 -9")
460 %_source_payload w9.bzdio
461 %_binary_payload w9.bzdio
463 # package signature type is OpenPGP via GnuPG
464 %__gpg %{l_tool_locate gpg gpg}
465 %_signature gpg
467 # two macro-processor add-ons (should be part of forthcoming RPM releases)
468 %ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
469 %ifndef() %if %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
471 # macro for package option configuration
472 %option() %{lua: \
473 local package_name = rpm.expand("%{name}") \
474 local option_name = rpm.expand("%1") \
475 if rpm.expand("%{?" .. option_name .. ":defined}") ~= "defined" then \
476 rpm.expand("%global " .. rpm.expand("%*")) \
477 end \
478 local option_value = rpm.expand("%{" .. option_name .. "}") \
479 option_value = util.rsubst(option_value, "(?s)%", "%%%%") \
480 option_value = util.rsubst(option_value, "(?s) ", "%%20") \
481 option_value = util.rsubst(option_value, "(?s)\\t", "%%09") \
482 rpm.expand("%global _options %{?_options:%{_options}:}" .. option_name .. "=" .. option_value) \
483 print(string.format("Provides: %s::%s = %s\\n", package_name, option_name, option_value)) \
484 }
486 # macros for NoSource/NoPatch (distribution restriction) integrity handling
487 %NoSource() %(if [ ".%{?restriction}" != ".no" ]; then \
488 echo "NoSource: %1"; \
489 fi) \
490 %{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{SOURCEURL%1}}
491 %NoPatch() %(if [ ".%{?restriction}" != ".no" ]; then \
492 echo "NoPatch: %1"; fi) \
493 %{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{PATCHURL%1}}
494 %integrity() %{l_check_nosource}
496 # macros for checking build environment
497 %l_check_nosource() %(%{l_sane_env}; checkok=1; \
498 checkinfo=`echo "Sorry, this OpenPKG package contains a DISTRIBUTION RESTRICTED source file."; \\\
499 echo "Before you can proceed building this package, fetch missing files MANUALLY:"`; \
500 for url in . %{?_restricted}; do \
501 [ ".$url" = .. ] && continue; \
502 eval `echo "$url" | \\\
503 sed -e 's!^\\(.*\\)::/\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' \\\
504 -e 's!^\\([^:;][^:]*://.*/\\)\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' \\\
505 -e 's:^\\([^;].*\\)$:;url="(unknown location) "; file="\\1":' \\\
506 -e 's:^;::'`; \
507 if [ ! -f "%{_specdir}/$file" ] && [ ! -f "%{_sourcedir}/$file" ]; then \\\
508 checkok=0; \
509 checkinfo=`echo "${checkinfo}"; \\\
510 echo ""; \\\
511 echo "from ${url}"; \\\
512 echo "file ${file}"; \\\
513 echo "here %{_sourcedir}/$file"`; \
514 fi; \
515 done; \
516 if [ $checkok -ne 1 ]; then \
517 echo "set +x"; \
518 echo "$checkinfo" | \\\
519 %{l_rpmtool} msg -b -t error | \\\
520 sed -e 's;^;echo ";' -e 's;$;";'; \
521 echo "exit 1"; \
522 fi)
523 %l_check_class() %(%{l_sane_env}; \
524 class=`echo "@:%{?class}:%{?distribution}" | \\\
525 sed -e 's;^@:\\([^:][^:]*\\):.*$;\\1;' \\\
526 -e 's;^@:.*\\[\\(.*\\)\\].*$;\\1;' \\\
527 -e 's;^@:.*$;JUNK;'`; \
528 %{l_rpmtool} check-class "$class")
529 %prep %%prep\
530 %{l_check_nosource} \
531 %{l_check_class} \
532 %{nil}
534 # macro-processor add-on for testing external conditions
535 %l_test(pfd) %(if [ ".%{?-p:yes}" = .yes ]; then \
536 %{l_rpm} -q %1 >/dev/null 2>&1; rc=$?; \
537 elif [ ".%{?-f:yes}" = .yes ]; then \
538 test -f %1; rc=$?; \
539 elif [ ".%{?-d:yes}" = .yes ]; then \
540 test -d %1; rc=$?; \
541 fi; \
542 if [ ".$rc" = .0 ]; then \
543 echo "yes"; \
544 else \
545 echo "no"; \
546 fi)
548 # sane build environment setup
549 %l_build_path %{l_once l_build_path %(if [ -d %{l_prefix}/lib/openpkg/override ]; then \
550 echo "%{l_prefix}/lib/openpkg/override:"; \
551 fi)%{l_prefix}/bin:%{l_prefix}/sbin:@l_build_path@%(\
552 if [ -d %{l_prefix}/lib/openpkg/fallback ]; then \
553 echo ":%{l_prefix}/lib/openpkg/fallback"; \
554 fi)}
555 %l_build_ldlp %{l_prefix}/lib:@l_build_ldlp@
556 %l_build_ulim @l_build_ulim@
557 %l_build_shell_cmd %{l_prefix}/lib/openpkg/bash
558 %l_build_shell_opt --norc --noprofile --posix
560 # sane build environment for manual usage in macros (currently just $PATH)
561 %l_sane_env PATH="%{l_build_path}"; \
562 export PATH; \
563 LD_LIBRARY_PATH="%{l_build_ldlp}"; \
564 export LD_LIBRARY_PATH
566 # sane build environment for %prep/%build/%install
567 %_buildshell env -i %{l_build_shell_cmd} %{l_build_shell_opt}
568 %___build_pre HOME="%{l_prefix}"\
569 SHELL="%{l_build_shell_cmd}"\
570 TERM="%{getenv:TERM}"\
571 TMPDIR="%{_tmppath}"\
572 USER="%{getenv:USER}"\
573 LOGNAME="%{getenv:LOGNAME}"\
574 PATH="%{l_build_path}"\
575 LD_LIBRARY_PATH="%{l_build_ldlp}"\
576 export HOME SHELL TMPDIR USER LOGNAME PATH LD_LIBRARY_PATH\
577 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
578 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
579 RPM_OPT_FLAGS=\"%{optflags}\"\
580 RPM_ARCH=\"%{l_host_arch}\"\
581 RPM_OS=\"%{l_host_os}\"\
582 RPM_DOC_DIR=\"%{_docdir}\"\
583 RPM_PACKAGE_NAME=\"%{name}\"\
584 RPM_PACKAGE_VERSION=\"%{version}\"\
585 RPM_PACKAGE_RELEASE=\"%{release}\"\
586 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_DOC_DIR\
587 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
588 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
589 export RPM_BUILD_ROOT}\
590 %{l_build_ulim}\
591 umask 022\
592 %{verbose:set -x}%{!verbose:exec >/dev/null}\
593 cd %{u2p:%{_builddir}}
595 # improved %patch macro
596 %patch(b:p:P:REz:F:d:e:m:) %{lua: \
597 local subst = "" \
598 local options = rpm.expand("%**") \
599 local regex = "-e\\\\s*('[^']*'|\\"[^\\"]*\\"|\\\\S+)" \
600 local pcre = rex_pcre.new(regex) \
601 local n = 0 \
602 while true do \
603 local s, e, t = pcre:tfind(options, n) \
604 if s == nil then break end \
605 subst = subst .. " -e " .. t[1] \
606 n = e + 1 \
607 end \
608 local regex = "-m\\\\s*('[^']*'|\\"[^\\"]*\\"|\\\\S+)" \
609 local pcre = rex_pcre.new(regex) \
610 local n = 0 \
611 while true do \
612 local s, e, t = pcre:tfind(options, n) \
613 if s == nil then break end \
614 subst = subst .. " -e 's;@" .. t[1] .. "@;%{" .. t[1] .. "};g'" \
615 n = e + 1 \
616 end \
617 if subst ~= "" then \
618 subst = "| sed" .. subst \
619 rpm.define("__patch_subst " .. subst) \
620 else \
621 rpm.define("__patch_subst %{nil}") \
622 end \
623 }%{shrink: \
624 %define __patch_number %{-P:%{-P*}}%{!-P:0} \
625 %define __patch_file %{P:%{__patch_number}} \
626 %define __patch_suffix %{-b:-b --suffix %{-b*}}%{!-b:-b --suffix .orig} %{-z:--suffix %{-z*}} \
627 %define __patch_options -s %{-p:-p%{-p*}} %{-F:-F%{-F*}} %{-d:-d%{-d*}} %{-R} %{-E} %{__patch_suffix} \
628 echo "Patch #%{__patch_number} (%{basename:%{__patch_file}}):"; \
629 %{uncompress:%{__patch_file}} %{__patch_subst} | %{__patch} %{__patch_options}}\
630 %{nil}
632 # special %track section support
633 %__spec_track_pre\
634 VCFILE="%{_tmppath}/%{name}-%{version}-%{release}.track.vc"\
635 rm -f $VCFILE\
636 set -o noclobber\
637 sed -e 's;^ *#.*$;;' -e 's;^ ;;' >$VCFILE <<'EOF'\
638 %{nil}
639 %__spec_track_post EOF\
640 if [ ".%{?___track_dump}" = .yes ]; then\
641 cat $VCFILE\
642 else\
643 if [ ! -f "%{l_vcheck}" ]; then\
644 echo "rpm:ERROR: Vendor source tracking functionality currently not available because"\
645 echo "rpm:ERROR: URL tracking tool vcheck(1) not found under \\"%{l_vcheck}\\"."\
646 echo "rpm:ERROR: You have to install the OpenPKG \\"vcheck\\" package first or set"\
647 echo "rpm:ERROR: the RPM macro \\"%%{l_vcheck}\\" to the path of your vcheck(1) tool."\
648 exit 0\
649 fi\
650 ( echo "config = {"\
651 echo "}"\
652 ) >>$VCFILE\
653 %{l_vcheck} %{verbose:--verbose}%{!verbose:--noverbose} -f $VCFILE || true\
654 fi\
655 rm -f $VCFILE\
656 %{nil}
658 # support additional .spec tags
659 %_arbitrary_tags Class:Track:TrackProg:BuildDependency:BuildEnvironment:My*:Local*
661 # disable /bin/sh dependency (which doesn't fit into OpenPKG's environment)
662 %_disable_shell_interpreter_deps 1
664 # support downloading files via cURL (instead of internal RPMIO)
665 # and optionally also from global and local mirror and backup location(s)
666 %__urlgetfile_urls_mirror() \
667 %{nil}
668 %__urlgetfile_urls_backup() %{lua: \
669 local url = rpm.expand("%1") \
670 local name = rpm.expand("%{name}") \
671 if name ~= "" and url ~= "" then \
672 local cache = "http://download.openpkg.org/components/cache/" .. name .. "/" \
673 url = util.rsubst(url, "^.+/([^/]+)$", cache .. "%1") \
674 print(url) \
675 end \
676 }
677 %__urlgetfile_urls() \
678 %{?__urlgetfile_urls_mirror %1} %1 %{?__urlgetfile_urls_backup %1}
679 %__urlgetfile() %{lua: \
680 local url_orig = rpm.expand("%1") \
681 local file = rpm.expand("%2") \
682 local urls = util.rsplit(rpm.expand("%{?__urlgetfile_urls " .. url_orig .. "}"), "\\\\s+") \
683 local result = "ERROR" \
684 local type = "mirror" \
685 for i, url in ipairs(urls) do \
686 if url ~= "" then
687 if url == url_orig then \
688 type = "original" \
689 elseif type == "original" then \
690 type = "backup" \
691 end \
692 io.stdout:write(string.format("Fetching(%s): %s\\n", type, url)) \
693 local rc = rpm.expand( \
694 "%(%{l_prefix}/bin/openpkg curl '-#' -L -R -k " .. \
695 "-o '" .. file .. "'" .. " '" .. url .. "' 1>&2; echo $?)" \
696 ) \
697 if rc == "0" then \
698 result = "OK" \
699 break \
700 end \
701 end
702 end \
703 print(result) \
704 }
706 # increase size of line buffer for .spec file parsing
707 # from 10KB to 4MB to support rather large BuildEnvironment tags
708 %_spec_line_buffer_size 4000000
710 # configure auto-generation of OpenPKG "BuildDependency" and "BuildEnvironment" tags
711 %__autogen_builddependency 0
712 %__autogen_buildenvironment 0
714 # hook into %description
715 %description\
716 %{?__hook_description_1}\
717 %{?__hook_description_2}\
718 %{?__hook_description_3}\
719 %{?__hook_description_4}\
720 %{?__hook_description_5}\
721 %{?__hook_description_6}\
722 %{?__hook_description_7}\
723 %{?__hook_description_8}\
724 %{?__hook_description_9}\
725 %%description
727 # magically provide additional tags which are required but are always the same
728 %__hook_description_1 %{lua: \
729 local prefix = rpm.expand("%{l_prefix_static}") \
730 if rpm.expand("%{?prefix}") ~= prefix then \
731 print(string.format("Prefix: %s\\n", prefix)) \
732 end \
733 print("AutoReq: no\\n") \
734 print("AutoReqProv: no\\n") \
735 }
737 # auto-generate arbitrary tag "Marker" (via "rpm --marker <marker>")
738 %__hook_description_2 %{?__marker:Marker: %{__marker}}\
739 %{nil}
741 # auto-generate arbitrary tag "BuildDependency" from the standard tag(s) "BuildPreReq"
742 # in order to forward-carry this build-time information to the binary RPM and to the RPMDB.
743 %__hook_description_3 %{?__autogen_builddependency:%{?buildprereq:BuildDependency: %{@buildprereq:, }}}\
744 %{nil}
746 # magically pickup all patched packaging source files (.orig/.rej)
747 %__hook_description_4 %{lua: \
748 -- assemble RPM's information about SourceN and PatchN \
749 local sources = {} \
750 local macros = rpm.macros() \
751 for name, value in pairs(macros) do \
752 local s, _, m = util.rmatch(name, "^(?i)(SOURCE|PATCH)((?:URL)?)(\\\\d+)$") \
753 if s ~= nil and value["body"] ~= nil then \
754 local n = string.upper(string.sub(m[1], 1, 1)) .. string.lower(string.sub(m[1], 2)) .. m[3] \
755 if sources[n] == nil then \
756 sources[n] = { url = "", file = "" } \
757 end \
758 if m[2] ~= nil and m[2] ~= "" then \
759 sources[n].url = value["body"] \
760 else \
761 sources[n].file = value["body"] \
762 end \
763 end \
764 end \
765 \
766 -- add implicit .spec source file \
767 sources["Source999"] = { \
768 url = rpm.expand("%{name}.spec"), \
769 file = rpm.expand("%{_specdir}/%{name}.spec") \
770 } \
771 \
772 -- auto-generate tags for local SourceN and PatchN files \
773 -- where any corresponding .orig/.rej files exists \
774 for id, s in pairs(sources) do \
775 if util.rmatch(s.url, "^(?:ftp|https?)://.+") == nil then \
776 for i, ext in ipairs({ ".orig", ".rej" }) do \
777 if posix.access(s.file .. ext, "r") == 0 then \
778 local _, _, m = util.rmatch(id, "^(?i)(Source|Patch)(\\\\d+)$") \
779 local tag = string.format("%s%d: %s\\n", m[1], 10000 * i + m[2], s.url .. ext) \
780 print(tag) \
781 end \
782 end \
783 end \
784 end \
785 }
787 # recursive package environment tracking configuration
788 %__environment_delete_nve_regex ^gpg-pubkey-[^-]+-[^-]+$
789 %__environment_prune_nve_regex ^%{name}-[^-]+-[^-]+$
790 %__environment_prune_depth_number 3
791 %__environment_debug 0
793 # recursive package environment implementation
794 %__hook_description_5 %{nil}
795 %__hook_description_5_orig %{?__autogen_buildenvironment:%{lua: \
796 -- determine current debug status quo
797 local debug = tonumber(rpm.expand("%{?__environment_debug}%{!?__environment_debug:0}")) \
798 \
799 -- determine current environment in serialized format \
800 -- (which actually is the Lua table constructor syntax) \
801 local result = {} \
802 for _, line in ipairs(rpm.query( \
803 "Q:\\\\[\\"%{name}-%{version}-%{release}\\"\\\\]=" .. \
804 "%|buildenvironment?{%{buildenvironment}}:{\\\\{\\\\}}|,", \
805 true, "*")) do \
806 local s, _, m = util.rmatch(line, "(?s)^Q:(.+)$") \
807 if s ~= nil then \
808 table.insert(result, m[1]) \
809 end \
810 end \
811 local constructor = "{" .. table.concat(result , "") .. "}" \
812 \
813 -- parse current environment \
814 -- (by evaluating the constructor as a Lua script) \
815 local environment = {} \
816 local f = loadstring("return " .. constructor) \
817 if f ~= nil then \
818 environment = f() \
819 else \
820 io.stderr:write("rpm: WARNING: failed to parse Lua table constructor: " .. constructor .. "\\n") \
821 end \
822 if debug > 0 then \
823 io.stdout:write("BuildEnvironment(original): " .. util.dump_object(environment, false) .. "\\n") \
824 end
825 \
826 -- prune environment according to configuration \
827 function prune_environment (environment, depth) \
828 local delete_nve_regex = tostring(rpm.expand("%{?__environment_delete_nve_regex}")) \
829 local prune_nve_regex = tostring(rpm.expand("%{?__environment_prune_nve_regex}")) \
830 local prune_depth_number = tonumber(rpm.expand("%{?__environment_prune_depth_number}")) \
831 if type(environment) == "table" then \
832 for nve, _ in pairs(environment) do \
833 if (prune_depth_number ~= nil and prune_depth_number > 0 and depth > prune_depth_number) or \
834 (delete_nve_regex ~= "" and util.rmatch(nve, delete_nve_regex) ~= nil) then \
835 environment[nve] = nil \
836 elseif prune_nve_regex ~= nil and util.rmatch(nve, prune_nve_regex) ~= nil then \
837 environment[nve] = {} \
838 else \
839 prune_environment(environment[nve], depth + 1) \
840 end \
841 end \
842 end \
843 end \
844 prune_environment(environment, 1) \
845 if debug > 0 then \
846 io.stdout:write("BuildEnvironment(pruned): " .. util.dump_object(environment, false) .. "\\n") \
847 end \
848 \
849 -- export serialized environment as an RPM tag \
850 if type(environment) == "table" then \
851 local tag = "BuildEnvironment: " .. util.dump_object(environment, true) .. "\\n" \
852 print(tag) \
853 if debug > 0 then \
854 io.stdout:write(tag) \
855 end \
856 end \
857 }}
859 # recursive package environment XML query support
860 %__environment_to_xml %{lua: \
861 local lua = io.stdin:read("*all") \
862 local f = loadstring("return " .. lua) \
863 local xml = ""
864 if f ~= nil then \
865 xml = xml .. "<?xml version=\\"1.0\\" encoding=\\"ISO-8859-1\\" standalone=\\"no\\"?>\\n" \
866 xml = xml .. "<!DOCTYPE environment\\n" \
867 xml = xml .. " PUBLIC \\"-//rpm5.org//DTD BuildEnvironment 1.0//EN\\"\\n" \
868 xml = xml .. " \\"http://rpm5.org/dtd/environment-1.0.dtd\\">\\n" \
869 function genxml (environment, prefix) \
870 local xml = prefix .. "<environment>\\n" \
871 for id, e in pairs(environment) do \
872 xml = xml .. prefix .. " <package>\\n" \
873 xml = xml .. prefix .. " <id>" .. id .. "</id>\\n" \
874 if e ~= nil and next(e) ~= nil then \
875 xml = xml .. genxml(e, prefix .. " ") \
876 end \
877 xml = xml .. prefix .. " </package>\\n" \
878 end \
879 xml = xml .. prefix .. "</environment>\\n" \
880 return xml
881 end \
882 local environment = f() \
883 xml = xml .. genxml(environment, "") \
884 end \
885 print(xml)
886 }
888 # PGP public key information
889 %l_pgpkey(n:F:) %{lua: \
890 local name = rpm.expand("%{?-n:%{-n*}}%{!?-n:openpkg.org}") \
891 local format = rpm.expand("%{?-F:%{-F*}}%{!?-F:%%f:%%i}") \
892 local fn = "?" \
893 local id = "?" \
894 if name == "openpkg.com" then \
895 fn = rpm.expand("%{l_prefix}/etc/openpkg/openpkg.com.pgp") \
896 id = "7D121A8FC05DC18A4329E9EF67042EC961B7AE34" \
897 elseif name == "openpkg.net" then \
898 fn = rpm.expand("%{l_prefix}/etc/openpkg/openpkg.net.pgp") \
899 id = "3BD10E1171B22598D7708C48AEBE764552197903" \
900 elseif name == "openpkg.org" then \
901 fn = rpm.expand("%{l_prefix}/etc/openpkg/openpkg.org.pgp") \
902 id = "6D96EFCFCF75328810DB40C2807593E063C4CB9F" \
903 end \
904 local result = util.rsubst(format, "%([nfi])", { ["n"] = name, ["f"] = fn, ["i"] = id }) \
905 print(result) \
906 }
908 # integrity checking configuration
909 %_integrity_spec_cfg_idx %{l_prefix}/etc/openpkg/license
910 %_integrity_spec_cfg_dir %{l_prefix}/etc/openpkg/license.d
911 %_integrity_spec_cfg %{lua: \
912 local idx = rpm.slurp(rpm.expand("%{_integrity_spec_cfg_idx}")) \
913 idx = util.rsubst(idx, "(?s)\\\\s*(.+?)\\\\s*$", "%1") \
914 local cfg = rpm.expand("%{_integrity_spec_cfg_dir}") .. "/" .. idx \
915 print(cfg) \
916 }
917 %_integrity_proc_lua %{l_prefix}/lib/openpkg/license.lua
918 %_integrity_pkey_pgp %{l_prefix}/etc/openpkg/openpkg.com.pgp
920 ##
921 ## Support for OpenPKG Flexible Filesystem Layout
922 ##
924 # layout definition: RPM to OpenPKG variable mapping
925 %_specdir %{expand:%%global _specdir %%{__openpkg_layout variable=specdir %{?openpkg_layout_specdir} %{!?openpkg_layout_specdir: %{openpkg_layout}}}}%{_specdir}
926 %_sourcedir %{expand:%%global _sourcedir %%{__openpkg_layout variable=sourcedir %{?openpkg_layout_sourcedir}%{!?openpkg_layout_sourcedir:%{openpkg_layout}}}}%{_sourcedir}
927 %_builddir %{expand:%%global _builddir %%{__openpkg_layout variable=builddir %{?openpkg_layout_builddir} %{!?openpkg_layout_builddir: %{openpkg_layout}}}}%{_builddir}
928 %_tmppath %{expand:%%global _tmppath %%{__openpkg_layout variable=tmppath %{?openpkg_layout_tmppath} %{!?openpkg_layout_tmppath: %{openpkg_layout}}}}%{_tmppath}
929 %_rpmdir %{expand:%%global _rpmdir %%{__openpkg_layout variable=rpmdir %{?openpkg_layout_rpmdir} %{!?openpkg_layout_rpmdir: %{openpkg_layout}}}}%{_rpmdir}
930 %_srcrpmdir %{expand:%%global _srcrpmdir %%{__openpkg_layout variable=srcrpmdir %{?openpkg_layout_srcrpmdir}%{!?openpkg_layout_srcrpmdir:%{openpkg_layout}}}}%{_srcrpmdir}
932 # default OpenPKG filesystem layout
933 %openpkg_layout macrosfile=%{macrosfile} layout=global
935 # layout determination: RPM macro to RPM Lua entry point
936 %__openpkg_layout() %{lua: print(openpkg.layout(rpm.expand("%*"))) }
938 # calculated base directory (placeholder definition only)
939 %__openpkg_basedir %{l_prefix}
941 # temporary path determination
942 %__openpkg_tmpdir %{lua: print(openpkg.tmpdir()) }
944 # shared environment (SE) support
945 %__openpkg_SE_id %{l_hostname}-%{l_platform}-%{l_tag}
946 %__openpkg_SE_subdir %{?__openpkg_shared:/%{__openpkg_SE_id}}
948 # layout definition: GLOBAL filesystem layout
949 %__openpkg_layout_global_specdir() %{l_prefix}/RPM/SRC/%{?name}
950 %__openpkg_layout_global_sourcedir() %{l_prefix}/RPM/SRC/%{?name}
951 %__openpkg_layout_global_builddir() %{l_prefix}/RPM/TMP
952 %__openpkg_layout_global_tmppath() %{l_prefix}/RPM/TMP
953 %__openpkg_layout_global_rpmdir() %{l_prefix}/RPM/PKG
954 %__openpkg_layout_global_srcrpmdir() %{l_prefix}/RPM/PKG
956 # layout definition: LOCAL filesystem layout
957 %__openpkg_layout_local_specdir() %{__openpkg_basedir}
958 %__openpkg_layout_local_sourcedir() %{__openpkg_basedir}
959 %__openpkg_layout_local_builddir() %{__openpkg_basedir}/.openpkg-tmp:+%{__openpkg_SE_subdir}
960 %__openpkg_layout_local_tmppath() %{__openpkg_basedir}/.openpkg-tmp:+%{__openpkg_SE_subdir}
961 %__openpkg_layout_local_rpmdir() %{__openpkg_basedir}
962 %__openpkg_layout_local_srcrpmdir() %{__openpkg_basedir}
964 # layout definition: SIMPLE local filesystem layout
965 %__openpkg_layout_simple_specdir() %{__openpkg_basedir}
966 %__openpkg_layout_simple_sourcedir() %{__openpkg_basedir}
967 %__openpkg_layout_simple_builddir() %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
968 %__openpkg_layout_simple_tmppath() %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
969 %__openpkg_layout_simple_rpmdir() %{realpath:%{__openpkg_basedir}/..}
970 %__openpkg_layout_simple_srcrpmdir() %{realpath:%{__openpkg_basedir}/..}
972 # layout definition: STRUCTURED local filesystem layout
973 %__openpkg_layout_structured_specdir() %{__openpkg_basedir}/src
974 %__openpkg_layout_structured_sourcedir() %{__openpkg_basedir}/dst %{__openpkg_basedir}/src
975 %__openpkg_layout_structured_builddir() %{__openpkg_basedir}/tmp:+%{__openpkg_SE_subdir} %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
976 %__openpkg_layout_structured_tmppath() %{__openpkg_basedir}/tmp:+%{__openpkg_SE_subdir} %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
977 %__openpkg_layout_structured_rpmdir() %{__openpkg_basedir}/pkg/bin %{__openpkg_basedir}/pkg %{__openpkg_basedir}
978 %__openpkg_layout_structured_srcrpmdir() %{__openpkg_basedir}/pkg/src %{__openpkg_basedir}/pkg %{__openpkg_basedir}
980 # layout definition: DISTRIBUTED local filesystem layout
981 %__openpkg_layout_distributed_specdir() %{__openpkg_basedir}/src/%{?name}
982 %__openpkg_layout_distributed_sourcedir() %{__openpkg_basedir}/dst/%{?name} %{__openpkg_basedir}/src/%{?name}
983 %__openpkg_layout_distributed_builddir() %{__openpkg_basedir}/tmp:+%{__openpkg_SE_subdir} %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
984 %__openpkg_layout_distributed_tmppath() %{__openpkg_basedir}/tmp:+%{__openpkg_SE_subdir} %{__openpkg_tmpdir}:+%{__openpkg_SE_subdir}
985 %__openpkg_layout_distributed_rpmdir() %{__openpkg_basedir}/pkg/bin %{__openpkg_basedir}/pkg %{__openpkg_basedir}
986 %__openpkg_layout_distributed_srcrpmdir() %{__openpkg_basedir}/pkg/src %{__openpkg_basedir}/pkg %{__openpkg_basedir}