Modify how to make symbolic link in 'find-debuginfo.sh' script
[platform/upstream/rpm.git] / macros.in
index 10a97cc..e285ce1 100644 (file)
--- a/macros.in
+++ b/macros.in
 #
 %_usr                  @prefix@
 %_usrsrc               %{_usr}/src
-%_var                  @varprefix@
+%_var                  @localstatedir@
 
 #==============================================================================
 # ---- Generally useful path macros.
 #
+%__7zip                        @__7ZIP@
 %__awk                 @AWK@
 %__bzip2               @__BZIP2@
 %__cat                 @__CAT@
 %__grep                        @__GREP@
 %__gzip                        @__GZIP@
 %__id                  @__ID@
+%__id_u                        %{__id} -u
 %__install             @__INSTALL@
 %__ln_s                        @LN_S@
-%__lzma                        @__LZMA@
+%__lrzip               @__LRZIP@
+%__lzip                        @__LZIP@
+# Deprecated, use %__xz instead.
+%__lzma                        %__xz --format=lzma
+%__xz                  @__XZ@
 %__make                        @__MAKE@
 %__mkdir               @__MKDIR@
-%__mkdir_p             @MKDIR_P@
+%__mkdir_p             @__MKDIR_P@
 %__mv                  @__MV@
 %__patch               @__PATCH@
 %__perl                        @__PERL@
-%__pgp                 @__PGP@
 %__python              @__PYTHON@
+%__restorecon          @__RESTORECON@
 %__rm                  @__RM@
 %__rsh                 @__RSH@
 %__sed                 @__SED@
+%__semodule            @__SEMODULE@
 %__ssh                 @__SSH@
 %__tar                 @__TAR@
 %__unzip               @__UNZIP@
+%__git                 @__GIT@
+%__hg                  @__HG@
+%__bzr                 @__BZR@
+%__quilt               @__QUILT@
 
 #==============================================================================
 # ---- Build system path macros.
 #      These are the default values that can be overridden by other
 #      (e.g. per-platform, per-system, per-packager, per-package) macros.
 #
+#      The directory where rpm's configuration and scripts live
+%_rpmconfigdir         %{getconfdir}
+
 #      The directory where sources/patches will be unpacked and built.
 %_builddir             %{_topdir}/BUILD
 
 #      the script.  See the script for details.
 #
 %__debug_install_post   \
-   @RPMCONFIGDIR@/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
+   %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
 %{nil}
 
 #      Template for debug information sub-package.
 %debug_package \
-%ifnarch noarch\
 %global __debug_package 1\
-%package debug\
-Summary: Debug information for package %{name}\
+%package debugsource\
+Summary: Debug sources for package %{name}\
 Group: Development/Debug\
 AutoReqProv: 0\
-%description debug\
-This package provides debug information for package %{name}.\
-Debug information is useful when developing applications that use this\
+%description debugsource\
+This package provides debug sources for package %{name}.\
+Debug sources are useful when developing applications that use this\
 package or when debugging this package.\
-%files debug -f debugfiles.list\
+%files debugsource -f debugsources.list\
 %defattr(-,root,root)\
-%endif\
 %{nil}
 
-%_defaultdocdir                %{_datadir}/doc
+%_defaultdocdir                %{_datadir}/doc/packages
+%_defaultlicensedir    %{_datadir}/licenses
+%_docdir_fmt          %%{NAME}
 
 #      The path to the gzip executable (legacy, use %{__gzip} instead).
 %_gzipbin              %{__gzip}
 
-#      The number of changelog entries kept when installing (legacy, unused in
-#      rpm-4.0.1 and later).
-%_instchangelog                5
-
-#      The path to the pgp executable (legacy, use %{__pgp} instead).
-%_pgpbin               %{__pgp}
+#      The Unix time of the latest kept changelog entry in binary packages.
+#      Any older entry is not packaged in binary packages.
+%_changelog_trimtime   0
 
 #      The directory where newly built binary packages will be written.
 %_rpmdir               %{_topdir}/RPMS
@@ -205,9 +216,6 @@ package or when debugging this package.\
 #      (legacy).
 %_rpmfilename          %{_build_name_fmt}
 
-#      The default signature type.
-%_signature            gpg
-
 #      The directory where sources/patches from a source package will be
 #      installed. This is also where sources/patches are found when building.
 %_sourcedir            %{_topdir}/SOURCES
@@ -229,7 +237,8 @@ package or when debugging this package.\
 %_tmppath              %{_var}/tmp
 
 #      Path to top of build area.
-%_topdir               %(echo $HOME)/rpmbuild
+%_topdir               %{expand:%%global _topdir %{lua:if posix.access(rpm.expand("%{_usrsrc}/packages"), "w") then print "%{_usrsrc}/packages" else print "%{getenv:HOME}/rpmbuild" end} \
+}%_topdir
 
 #      The path to the unzip executable (legacy, use %{__unzip} instead).
 %_unzipbin             %{__unzip}
@@ -260,6 +269,12 @@ package or when debugging this package.\
 #
 #%disturl
 
+#      Configurable bug URL, same as BugURL: tag in a specfile.
+#      The URL will be used to supply reliable information to where
+#      to file bugs.
+#
+#%bugurl
+
 #      Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
 #      marked as %doc should be installed.
 #%_excludedocs
@@ -322,10 +337,11 @@ package or when debugging this package.\
 #      Compression type and level for source/binary package payloads.
 #              "w9.gzdio"      gzip level 9 (default).
 #              "w9.bzdio"      bzip2 level 9.
-#              "w7.lzdio"      lzma level 7, lzma's default.
+#              "w7.xzdio"      xz level 7, xz's default.
+#              "w7.lzdio"      lzma-alone level 7, lzma's default
 #
 #%_source_payload      w9.gzdio
-#%_binary_payload      w9.gzdio
+%_binary_payload       w5.lzdio
 
 #      Algorithm to use for generating file checksum digests on build.
 #      If not specified or 0, MD5 is used.
@@ -341,12 +357,6 @@ package or when debugging this package.\
 #%_source_filedigest_algorithm 1
 #%_binary_filedigest_algorithm 1
 
-#      The signature to use and the location of configuration files for
-#      signing packages with PGP.
-#
-#%_pgp_name
-#%_pgp_path
-
 #      Configurable vendor information, same as Vendor: in a specfile.
 #
 #%vendor
@@ -354,6 +364,9 @@ package or when debugging this package.\
 #      Default fuzz level for %patch in spec file.
 %_default_patch_fuzz   0
 
+#      Default patch flags
+#%_default_patch_flags -s
+
 #==============================================================================
 # ---- Build configuration macros.
 #
@@ -361,7 +374,7 @@ package or when debugging this package.\
 # Returns list of unpackaged files, i.e. files in $RPM_BUILD_ROOT not packaged.
 #
 # Note: Disable (by commenting out) for legacy compatibility.
-%__check_files         @RPMCONFIGDIR@/check-files %{buildroot}
+%__check_files         %{_rpmconfigdir}/check-files %{buildroot}
 
 #
 # Should unpackaged files in a build root terminate a build?
@@ -376,6 +389,40 @@ package or when debugging this package.\
 %_missing_doc_files_terminate_build    1
 
 #
+# Should binaries in noarch packages terminate a build?
+%_binaries_in_noarch_packages_terminate_build  1
+
+#
+# Should rpm try to download missing sources at build-time?
+# Enabling this is dangerous as long as rpm has no means to validate
+# the integrity of the download with a digest or signature.
+%_disable_source_fetch 1
+
+#
+# Program to call for each successfully built and written binary package.
+# The package name is passed to the program as a command-line argument.
+#
+#%_build_pkgcheck      %{_bindir}/rpmlint
+
+#
+# Program to call for the whole binary package set after build.
+# The package set is passed to the program via command-line arguments.
+#
+#%_build_pkgcheck_set  %{_bindir}/rpmlint
+
+#
+# Program to call for successfully built and written SRPM.
+# The package name is passed to the program as a command-line argument.
+#
+#%_build_pkgcheck_srpm %{_bindir}/rpmlint
+
+#
+# Should the build of packages fail if package checker (if defined) returns
+# non-zero exit status?
+#
+#%_nonzero_exit_pkgcheck_terminate_build       1
+
+#
 # Should an ELF file processed by find-debuginfo.sh having no build ID
 # terminate a build?  This is left undefined to disable it and defined to
 # enable.
@@ -390,78 +437,50 @@ package or when debugging this package.\
 # Filter GLIBC_PRIVATE Provides: and Requires:
 %_filter_GLIBC_PRIVATE                 0
 
-# Desired selinux policy tree
-%__policy_tree %{expand:%%global __policy_tree %{lua:\
-t="targeted"\
-f = io.open("/etc/selinux/config")\
-if f then\
-  for l in f:lines() do\
-    if "SELINUXTYPE=" == string.sub(l,0,12) then t=string.sub(l,13); end\
-  end\
-  f:close()\
-end\
-print (t)\
-}}%{__policy_tree}
-
-# Path to selinux file context patterns.
-%__file_context_path /etc/selinux/%{__policy_tree}/contexts/files/file_contexts
-
 # Directories whose contents should be considered as documentation.
 %__docdir_path %{_datadir}/doc:%{_datadir}/man:%{_datadir}/info:%{_datadir}/gtk-doc/html:%{?_docdir}:%{?_mandir}:%{?_infodir}:%{?_javadocdir}:/usr/doc:/usr/man:/usr/info:/usr/X11R6/man
 
-#
-# Path to selinux file context patterns used to add
-# RPMTAG_FILECONTEXTS to packages when building.
-#
-# Undefined, missing or %{nil} will disable.
-%_build_file_context_path      %{nil}
-
-#
-# Path to selinux file context patterns used to set
-# (or override package content) file contexts when installing.
-#
-# Undefined, missing or %{nil} will use package content (if available).
-%_install_file_context_path    %{__file_context_path}
-
-#
-# Path to selinux file context patterns used to verify
-# file contexts on file system.
-#
-# Undefined, missing or %{nil} will use package content (if available).
-%_verify_file_context_path     %{__file_context_path}
+# maxnum,cuttime,minnum
+# 2009/03/01 (SLES11 GA)
+%_binarychangelogtrim 0,1235862000,10
 
 #
 # Path to scripts to autogenerate package dependencies,
 #
+%__set_helper_env %{lua:
+posix.setenv("RPMBUILD_SPECFILE",rpm.expand("%?_specfile"));
+posix.setenv("RPMBUILD_SOURCEDIR",rpm.expand("%?_sourcedir"));
+}
 # Note: Used iff _use_internal_dependency_generator is zero.
-#%__find_provides      @RPMCONFIGDIR@/rpmdeps --provides
-#%__find_requires      @RPMCONFIGDIR@/rpmdeps --requires
-%__find_provides       @RPMCONFIGDIR@/find-provides
-%__find_requires       @RPMCONFIGDIR@/find-requires
+#%__find_provides      %{_rpmconfigdir}/rpmdeps --provides
+#%__find_requires      %{_rpmconfigdir}/rpmdeps --requires
+%__find_provides       %{__set_helper_env}%{_rpmconfigdir}/find-provides %name
+%__find_requires       %{__set_helper_env}%{_rpmconfigdir}/find-requires %name
 #%__find_conflicts     ???
 #%__find_obsoletes     ???
-
-#
-# Path to scripts to autogenerate per-interpreter package dependencies,
-#
-# Note: Used iff _use_internal_dependency_generator is non-zero. The
-# helpers are also used by @RPMCONFIGDIR@/rpmdeps {--provides|--requires}.
-#%__perl_provides      @RPMCONFIGDIR@/perldeps.pl --provides
-#%__perl_requires      @RPMCONFIGDIR@/perldeps.pl --requires
-%__perl_provides       @RPMCONFIGDIR@/perl.prov
-%__perl_requires       @RPMCONFIGDIR@/perl.req
-
-%__python_provides     @RPMCONFIGDIR@/pythondeps.sh --provides
-%__python_requires     @RPMCONFIGDIR@/pythondeps.sh --requires
-
-%__mono_provides        @RPMCONFIGDIR@/mono-find-provides %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir}
-%__mono_requires        @RPMCONFIGDIR@/mono-find-requires %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir}
-
-%__libtool_provides    @RPMCONFIGDIR@/libtooldeps.sh --provides %{buildroot} %{name}
-%__libtool_requires     @RPMCONFIGDIR@/libtooldeps.sh --requires %{buildroot} %{name}
-
-%__pkgconfig_provides   @RPMCONFIGDIR@/pkgconfigdeps.sh --provides
-%__pkgconfig_requires   @RPMCONFIGDIR@/pkgconfigdeps.sh --requires
+%__find_supplements    %{__set_helper_env}%{_rpmconfigdir}/find-supplements %name
+#%__find_enhances      ???
+
+# 
+# Path to file attribute classifications for automatic dependency 
+# extraction, used when _use_internal_dependency_generator
+# is used (on by default). Files can have any number of attributes
+# attached to them, and dependencies are separately extracted for
+# each attribute.
+# 
+# To define a new file attribute called "myattr", add a file named
+# "myattr" to this directory, defining the requires and/or provides
+# finder script(s) + magic and/or path pattern regex(es).
+# provides finder and 
+# %__myattr_requires   path + args to requires finder script for <myattr>
+# %__myattr_provides   path + args to provides finder script for <myattr>
+# %__myattr_magic      libmagic classification match regex
+# %__myattr_path       path based classification match regex
+# %__myattr_flags      flags to control behavior (just "exeonly" for now)
+# %__myattr_exclude_magic      exclude by magic regex
+# %__myattr_exclude_path       exclude by path regex
+#
+%_fileattrsdir         %{_rpmconfigdir}/fileattrs
 
 #==============================================================================
 # ---- Database configuration macros.
@@ -471,14 +490,7 @@ print (t)\
 # list of tokens, with an optional '!' negation to explicitly disable bit
 # values, or a "=value" if a parameter. A per-tag value is used (e.g.
 # %_dbi_config_Packages) if defined, otherwise a per-rpmdb default
-# (e.g. %_dbi_config). The configuration is also conditioned on the
-# existence of an internal %{_rpmdb_rebuild} switch to permit changing
-# the configuration while rebuilding an rpmdb database.
-#
-# The rpmdb configuration tokens are in a popt table in rpmdb/dbconfig.c,
-# see that for the latest gory details. Note carefully that, unless you
-# are writing an rpm installer, you shouldn't have to touch *any* of these
-# parameters.
+# (e.g. %_dbi_config).
 #
 # Here's a short list of the tokens, with a guess of whether the option is
 # useful:
@@ -494,132 +506,26 @@ print (t)\
 #    I believe that you will find pagesize=512 "best".
 # 3) Adding nofsync increases speed, but risks total data loss. Fiddle shared
 #    and/or mp_size instead.
-# 4) btree is faster than hash, but would require some painful rpm release
-#    engineering to convert everbody's databases to btree, not gonna happen
-#    soon.
-#
-# See the db3-devel package, or http://www.sleepycat.com for Berkeley db-3.x
-# documentation.
 #
 #   token      works?  Berkeley db flag or value
 #==================================================
-#---------------------- DBENV->open parameters and tunable values:
+#---------------------- DBENV tunable values:
 #   mmapsize=16Mb      DBENV->set_mp_mmapsize
 #   cachesize=1Mb      DBENV->set_cachesize, DB->set_cachesize
-#---------------------- DBENV->open and DB->open common bits:
-#   create             DB_CREATE
-#   thread     ???     DB_THREAD       (useless w/o posix mutexes on linux)
-#---------------------- DBENV->open bits:
-#   joinenv            DB_JOIN_ENV
-#   mpool              DB_INIT_MPOOL
-#   cdb                +++     DB_INIT_CDB
-#   txn                ???     DB_INIT_TXN
-#   log                ???     DB_INIT_LOG
-#   lock       ???     DB_INIT_LOCK
-#   recover    ???     DB_RECOVER
-#   recover_fatal ???  DB_RECOVER_FATAL
-#   use_environ        ???     DB_USE_ENVIRON
-#   use_environ_root ??? DB_USE_ENVIRON_ROOT
-#   private    +++     DB_PRIVATE
-#   lockdown   ???     DB_LOCKDOWN
-#   shared     +++     DB_SYSTEM_MEM
-#---------------------- DB->open parameters and tunable values:
-#   pagesize=512 +++   DB->set_pagesize
 #---------------------- DB->open bits:
-#   excl       ???     DB_EXCL
 #   nommap     ???     DB_NOMMAP
-#   rdonly             DB_RDONLY
-#---------------------- DB->open types:
-#   btree              DB_BTREE
-#   hash               DB_HASH
-#   recno      ???     DB_RECNO
-#   queue      ???     DB_QUEUE
-#   unknown    +++     DB_UNKNOWN
-#---------------------- DB->set_flags bits:
-#   bt_dup     +++     (btree only) DB_DUP
-#   bt_dupsort +++     (btree only) DB_DUPSORT
-#   ht_dup     +++     (hash only) DB_DUP
-#   ht_dupsort +++     (hash only) DB_DUPSORT
 #----------------------- rpmdb specific configuration:
-#   usedbenv           (always on) Use db3 environment?
-#   verify             (db3 only) Verify Packages db after RW close?
 #   lockdbfd           (always on for Packages) Use fcntl(2) locking ?
 #   nofsync            Disable fsync(2) call performed after db3 writes?
-#   temporary          Unlink file when closing.
-#
-
-# XXX Use transactions and logs for rpmdb durability (no clue yet):
-#%__dbi_other                  create joinenv mpool txn log \
-#                              mp_mmapsize=8Mb mp_size=512Kb
-
-# Use a CDB database model for concurrent access.
-# XXX Add "private" here for legacy interoperation transiting to glibc+nptl.
-%__dbi_cdb                     create cdb mpool mp_mmapsize=16Mb mp_size=1Mb
-
-%__dbi_other                   %{?_tmppath:tmpdir=%{_tmppath}} %{?__dbi_cdb}
-
-# Note: adding nofsync here speeds up --rebuilddb a lot.
-%__dbi_rebuild                 nofsync !log !txn !cdb
-%__dbi_transient               %{__dbi_rebuild} temporary private
-%__dbi_perms                   perms=0644
-
 #
-#--- Hash database configuration
-%__dbi_htconfig        \
-  hash         \
-  %{__dbi_other}\
-  %{__dbi_perms}\
-%{nil}
 
-%__dbi_htconfig_current                %{__dbi_htconfig}
-%__dbi_htconfig_rebuild                %{__dbi_htconfig} %{__dbi_rebuild}
+# Misc BDB tuning options
+%__dbi_other                   mp_mmapsize=128Mb mp_size=1Mb
 
-%_dbi_htconfig         \
-  %{?_rpmdb_rebuild:%{__dbi_htconfig_rebuild}}\
-  %{!?_rpmdb_rebuild:%{__dbi_htconfig_current}}\
-%{nil}
-
-#
-#--- Btree database configuration
-%__dbi_btconfig        \
-  btree                \
-  %{__dbi_other}\
-  %{__dbi_perms}\
-%{nil}
-
-%__dbi_btconfig_current                %{__dbi_btconfig}
-%__dbi_btconfig_rebuild                %{__dbi_btconfig} %{__dbi_rebuild}
-
-%_dbi_btconfig         \
-  %{?_rpmdb_rebuild:%{__dbi_btconfig_rebuild}}\
-  %{!?_rpmdb_rebuild:%{__dbi_btconfig_current}}\
-%{nil}
-
-# The list of tags for which indices will be built.
-%_dbi_tags     Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filemd5s:Depends:Pubkeys
+%_dbi_config                   %{?__dbi_other} nofsync
 
 # "Packages" should have shared/exclusive fcntl(2) lock using "lockdbfd".
-%_dbi_config_Packages          %{_dbi_htconfig} lockdbfd
-
-# "Depends" is a per-transaction cache of known dependency resolutions.
-%_dbi_config_Depends           %{_dbi_htconfig} temporary private
-
-%_dbi_config_Dirnames          %{_dbi_btconfig}
-%_dbi_config_Requireversion    %{_dbi_btconfig}
-%_dbi_config_Provideversion    %{_dbi_btconfig}
-%_dbi_config_Installtid                %{_dbi_btconfig}
-%_dbi_config_Removetid         %{_dbi_btconfig}
-
-%_dbi_config   %{_dbi_htconfig}
-
-# XXX legacy configuration.
-# Choose db interface:
-#      3       native db3 interface.
-#
-# There are two macros so that --rebuilddb can convert db1 -> db3.
-#
-%_dbapi                        3
-%_dbapi_rebuild                3
+%_dbi_config_Packages          %{?__dbi_other} lockdbfd
 
 #==============================================================================
 # ---- GPG/PGP/PGP5 signature macros.
@@ -628,33 +534,17 @@ print (t)\
 #
 %__gpg_check_password_cmd      %{__gpg} \
        gpg --batch --no-verbose --passphrase-fd 3 -u "%{_gpg_name}" -so -
-%__pgp_check_password_cmd      %{__pgp} \
-       pgp +batchmode=on +verbose=0 "%{_pgp_name}" -sf
-%__pgp5_check_password_cmd     %{__pgp} \
-       pgps +batchmode=on +verbose=0 +armor=off "%{_pgp_name}" -f
 
 %__gpg_sign_cmd                        %{__gpg} \
-       gpg --batch --no-verbose --no-armor --passphrase-fd 3 --no-secmem-warning \
+       gpg --batch --no-verbose --no-armor --passphrase-fd 3 \
+       %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}} \
+       --no-secmem-warning \
        -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}
-%__pgp_sign_cmd                        %{__pgp} \
-       pgp +batchmode=on +verbose=0 +armor=off \
-       "+myname=%{_pgp_name}" -sb %{__plaintext_filename} %{__signature_filename}
-%__pgp5_sign_cmd               %{__pgp} \
-       pgps +batchmode=on +verbose=0 +armor=off \
-       "+myname=%{_pgp_name}" -b %{__plaintext_filename} -o %{__signature_filename}
 
 # XXX rpm >= 4.1 verifies signatures internally
 #%__gpg_verify_cmd             %{__gpg} \
 #      gpg --batch --no-verbose --verify --no-secmem-warning \
 #      %{__signature_filename} %{__plaintext_filename}
-#%__pgp_verify_cmd             %{__pgp} \
-#      pgp +batchmode=on +verbose=0 \
-#      %{__signature_filename} %{__plaintext_filename}
-#%__pgp5_verify_cmd            %{__pgp} \
-#      pgpv +batchmode=on +verbose=0 \
-#      +OutputInformationFD=1 +OutputWarningFD=1 \
-#      -o %{__signature_filename} %{__plaintext_filename}
-
 #
 # XXX rpm-4.1 verifies prelinked libraries using a prelink undo helper.
 #      Normally this macro is defined in /etc/rpm/macros.prelink, installed
@@ -682,13 +572,6 @@ print (t)\
 # XXX  Note: escaped %% for use in headerSprintf()
 %_build_name_fmt       %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
 
-#      The default transaction color. This value is a set of bits to
-#      determine file and dependency affinity for this arch.
-#              0       uncolored (i.e. use only arch as install hint)
-#              1       Elf32 permitted
-#              2       Elf64 permitted
-%_transaction_color    @RPMCANONCOLOR@
-
 #      Verify digest/signature flags for various rpm modes:
 #      0x30300 (_RPMVSF_NODIGESTS)    --nohdrchk      if set, don't check digest(s)
 #      0xc0c00 (_RPMVSF_NOSIGNATURES) --nosignature   if set, don't check signature(s)
@@ -719,55 +602,18 @@ print (t)\
 %_vsflags_erase                %{__vsflags}
 %_vsflags_install      %{__vsflags}
 %_vsflags_query                %{__vsflags}
-%_vsflags_rebuilddb    %{__vsflags}
+%_vsflags_rebuilddb    0xc0c00
 %_vsflags_verify       %{__vsflags}
 
-#      Relations between package names that cause dependency loops
-#      with legacy packages that cannot be fixed. Relations are
-#      specified as
-#              p>q
-#      where package p has a Requires: on something that package q Provides:
-#
-# XXX  Note: that there cannot be any whitespace within the string "p>q",
-#      and that both p and q are package names (i.e. no version/release).
-#
-
-%_dependency_whiteout                  \
-       %{nil}
-
-#
-# Default headerSprintf() output format string for rpm -qa
-#
-# XXX  Note: escaped %% for use in headerSprintf()
-%_query_all_fmt                %%{name}-%%{version}-%%{release}%%|arch?{.%%{arch}}:{}|
-
-#
-# Default path to the file used for transaction fcmtl lock.
-#
-# The previous, FHS clompliant, name was /var/lock/run/transaction,
-# but the transaction lock needs to be per-database, not global, for
-# some rpmdb operations.
 #
-# XXX Note: the file name is chosen as __db.000 to expedite
-# support issues, many users are doing "rm -f /var/lib/rpm/__db*"
-# these days.
-%_rpmlock_path %{_dbpath}/__db.000
-
-#==============================================================================
-# ---- per-platform macros.
-#      Macros that are specific to an individual platform. The values here
-#      will be used if the per-platform macro file does not exist..
+# Default output format string for rpm -qa
 #
-%_arch                 @RPMCANONARCH@
-%_build_arch           @RPMCANONARCH@
-%_vendor               @RPMCANONVENDOR@
-%_os                   @RPMCANONOS@
-%_gnu                  @RPMCANONGNU@
-%_target_platform      %{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}
+# XXX  Note: escaped %% for use in headerFormat()
+%_query_all_fmt                %%{nvra}
 
 #
-# Define a generic value for optflags. Normally overridden by per-target macros.
-%optflags              -O2
+# Default path to the file used for transaction fcntl lock.
+%_rpmlock_path %{_dbpath}/.rpm.lock
 
 #
 # ISA dependency marker, none for noarch and name-bitness for others
@@ -778,6 +624,9 @@ print (t)\
 %__arch_install_post   %{nil}
 %__os_install_post     %{___build_post}
 
+# Macro to fix broken permissions in sources
+%_fixperms      %{__chmod} -Rf @FIXPERMS@
+
 #==============================================================================
 # ---- Scriptlet template templates.
 #      Global defaults used for building scriptlet templates.
@@ -799,6 +648,9 @@ print (t)\
   RPM_PACKAGE_VERSION=\"%{version}\"\
   RPM_PACKAGE_RELEASE=\"%{release}\"\
   export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
+  LANG=C\
+  export LANG\
+  unset CDPATH DISPLAY ||:\
   %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
   export RPM_BUILD_ROOT}\
   %{?_javaclasspath:CLASSPATH=\"%{_javaclasspath}\"\
@@ -972,7 +824,7 @@ print (t)\
 %_build_vendor         %{_host_vendor}
 %_build_os             %{_host_os}
 %_host                 @host@
-%_host_alias           @host_alias@%{nil}
+%_host_alias           @host@%{nil}
 %_host_cpu             @host_cpu@
 %_host_vendor          @host_vendor@
 %_host_os              @host_os@
@@ -987,29 +839,21 @@ print (t)\
 #      Macro(s) here can be used reliably for reproducible builds.
 #      (Note: Above is the goal, below are the macros under development)
 #
-# The configure macro does the following:
-#      optionally change to a subdirectory (not implemented).
-#      attempt to update config.guess and config.sub.
-#      run configure with correct prefix, platform, and CFLAGS.
-#      optionally restore current directory (not implemented).
+# The configure macro runs autoconf configure script with platform specific
+# directory structure (--prefix, --libdir etc) and compiler flags
+# such as CFLAGS.
+#
 # The configure macro should be invoked as %configure (rather than %{configure})
 # because the rest of the arguments will be expanded using %*.
 #
-# This is the version of %configure used through rpm-3.0.4.
-#%configure    \
-#  %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
-#  CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
-#
-#------------------------------------------------------------------------------
-# This is an improved version of %configure (from PLD team).
 %_configure ./configure
 %configure \
   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
   CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
   FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
   %{_configure} --host=%{_host} --build=%{_build} \\\
-       --target=%{_target_platform} \\\
        --program-prefix=%{?_program_prefix} \\\
+       --disable-dependency-tracking \\\
        --prefix=%{_prefix} \\\
        --exec-prefix=%{_exec_prefix} \\\
        --bindir=%{_bindir} \\\
@@ -1022,12 +866,18 @@ print (t)\
        --localstatedir=%{_localstatedir} \\\
        --sharedstatedir=%{_sharedstatedir} \\\
        --mandir=%{_mandir} \\\
-       --infodir=%{_infodir}
+       --infodir=%{_infodir} \\\
+       --disable-dependency-tracking
 
 #------------------------------------------------------------------------------
-# The make install analogue of %configure:
+# The make install analogue of %configure for modern autotools:
+%make_install %{__make} install DESTDIR=%{?buildroot}
+
+#------------------------------------------------------------------------------
+# Former make install analogue, kept for compatibility and for old/broken
+#  packages that don't support DESTDIR properly.
 %makeinstall \
-  make \\\
+  %{__make} \\\
        prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
        exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
        bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
@@ -1096,7 +946,7 @@ else \
     ); \
   fi \
 done \
-  %{-C:${_mydir}}%{!-C:.}/configure %{_target_platform} --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir} %* ; \
+  %{-C:${_mydir}}%{!-C:.}/configure --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir} %* ; \
   %{-C:cd ${_mydir}; unset _mydir}
 
 %patches %{lua: for i, p in ipairs(patches) do print(p.." ") end}
@@ -1133,6 +983,47 @@ done \
 %perl_privlib  %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
 
 #------------------------------------------------------------------------------
+# Useful python macros for determining python version and paths
+#
+%python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")
+%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
+%python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")
+
+# More useful perl macros (from Raul Dias <rsd@swi.com.br>)
+#
+%perl_version          %(perl -V:version | sed "s!.*='!!;s!'.*!!")
+%perl_man1ext          %(perl -V:man1ext | sed "s!.*='!!;s!'.*!!")
+%perl_man3ext          %(perl -V:man3ext | sed "s!.*='!!;s!'.*!!")
+%perl_man1dir          %(perl -V:man1dir | sed "s!.*='!!;s!'.*!!")
+%perl_man3dir          %(perl -V:man3dir | sed "s!.*='!!;s!'.*!!")
+%perl_installman1dir   %(perl -V:installman1dir | sed "s!.*='!!;s!'.*!!")
+%perl_installman3dir   %(perl -V:installman3dir | sed "s!.*='!!;s!'.*!!")
+%perl_installarchlib   %(perl -V:installarchlib | sed "s!.*='!!;s!'.*!!")
+%perl_prefix           %{buildroot}
+
+#------------------------------------------------------------------------------
+# Python specific macro definitions (originally from PLD).
+#
+%py_ver                        %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
+%py_prefix             %(python -c "import sys; print sys.prefix" 2>/dev/null || echo PYTHON-NOT-FOUND)
+%py_libdir             %{py_prefix}/%{_lib}/python%{py_ver}
+%py_incdir             %{py_prefix}/include/python%{py_ver}
+%py_sitedir            %{py_libdir}/site-packages
+%py_compile(O) \
+find %1 -name '*.pyc' -exec rm -f {} \\; \
+python -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+%{-O: \
+find %1 -name '*.pyo' -exec rm -f {} \\; \
+python -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+}
+%py_requires(d) \
+%define minver %py_ver \
+%define maxver %(python -c "import sys; a,b=sys.version_info[:2]; print '%%d.%%d'%%(a,b+1)" 2>/dev/null || echo PYTHON-NOT-FOUND) \
+BuildRequires: python %{-d:python-devel} \
+PreReq: python >= %minver, python < %maxver
+
+
+#------------------------------------------------------------------------------
 # arch macro for all Intel i?86 compatibile processors
 #  (Note: This macro (and it's analogues) will probably be obsoleted when
 #   rpm can use regular expressions against target platforms in macro
@@ -1142,7 +1033,9 @@ done \
 
 #------------------------------------------------------------------------------
 # arch macro for all supported ARM processors
-%arm   armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l
+%arm   armv3l armv4b armv4l armv4tl armv5b armv5l armv5teb armv5tel armv5tejl armv6l armv7l armv7hl
+%arml  armv3l armv4l armv5l armv5tel armv6l armv7l armv7hl
+%armb  armv4b armv5b armv5teb
 
 #------------------------------------------------------------------------------
 # arch macro for all supported Sparc processors
@@ -1152,6 +1045,10 @@ done \
 # arch macro for all supported Alpha processors
 %alpha alpha alphaev56 alphaev6 alphaev67
 
+#------------------------------------------------------------------------------
+# arch macro for all supported PowerPC 64 processors
+%power64       ppc64 ppc64p7
+
 #------------------------------------------------------------------------
 # Use in %install to generate locale specific file lists. For example,
 #
@@ -1161,13 +1058,127 @@ done \
 # ...
 # %files -f %{name}.lang
 #
-%find_lang     @RPMCONFIGDIR@/find-lang.sh %{buildroot}
+%find_lang     %{_rpmconfigdir}/find-lang.sh %{buildroot}
+%no_lang_C  --without-C
+
 
 # Commands + opts to use for retrieving remote files
+# Proxy opts can be set through --httpproxy/--httpport popt aliases,
+# for any special local needs use %__urlhelper_localopts in system-wide
+# or per-user macro configuration.
 %__urlhelpercmd         @__CURL@
 %__urlhelperopts        --silent --show-error --fail --location -o
-%_urlhelper             %{__urlhelpercmd} %{__urlhelperopts}
+%__urlhelper_proxyopts   %{?_httpproxy:--proxy %{_httpproxy}%{?_httpport::%{_httpport}}}%{!?_httpproxy:%{nil}}
+%_urlhelper             %{__urlhelpercmd} %{?__urlhelper_localopts} %{?__urlhelper_proxyopts} %{__urlhelperopts}
 
+#------------------------------------------------------------------------------
+# Collection specific macros
+%__plugindir           %{_libdir}/rpm-plugins
+%__collection_font     %{__plugindir}/exec.so /usr/bin/fc-cache
+%__collection_java     %{__plugindir}/exec.so /usr/bin/rebuild-gcj-db
+%__collection_sepolicy         %{__plugindir}/sepolicy.so
+%__collection_sepolicy_flags   1
+
+#------------------------------------------------------------------------------
+# transaction specific macros
+%__transaction_plugins     msm
+%__plugindir                           %{_libdir}/rpm-plugins
+%__transaction_msm                     %{__plugindir}/msm.so
+%__transaction_msm_default_policy      %{_libdir}/rpm-plugins/msm-device-sec-policy
+#------------------------------------------------------------------------------
+# Macros for further automated spec %setup and patch application
+
+# default to plain patch
+%__scm patch
+# meh, figure something saner
+%__scm_username rpm-build
+%__scm_usermail <rpm-build>
+%__scm_author %{__scm_username} %{__scm_usermail}
+
+# Plain patch (-m is unused)
+%__scm_setup_patch(q) %{nil}
+%__scm_apply_patch(qp:m:)\
+%{__patch} %{-p:-p%{-p*}} %{-q:-s}
+
+# Mercurial (aka hg)
+%__scm_setup_hg(q)\
+%{__hg} init %{-q} .\
+%{__hg} add %{-q} .\
+%{__hg} commit %{-q} --user "%{__scm_author}" -m "%{name}-%{version} base"
+
+%__scm_apply_hg(qp:m:)\
+%{__hg} import - %{-p:-p%{-p*}} %{-q} -m %{-m*} --user "%{__scm_author}"
+
+# Git
+%__scm_setup_git(q)\
+%{__git} init %{-q}\
+%{__git} config user.name "%{__scm_username}"\
+%{__git} config user.email "%{__scm_usermail}"\
+%{__git} add .\
+%{__git} commit %{-q} -a\\\
+       --author "%{__scm_author}" -m "%{name}-%{version} base"
+
+%__scm_apply_git(qp:m:)\
+%{__git} apply %{-p:-p%{-p*}} -\
+%{__git} commit %{-q} -a -m %{-m*} --author "%{__scm_author}"
+
+# Quilt
+%__scm_setup_quilt(q) %{nil}
+%__scm_apply_quilt(qp:m:)\
+%{__quilt} import %{-p:-p%{-p*}} %{1} && %{__quilt} push
+
+# Bzr
+%__scm_setup_bzr(q)\
+%{__bzr} init %{-q}\
+%{__bzr} whoami --branch "%{__scm_author}"\
+%{__bzr} add .\
+%{__bzr} commit %{-q} -m "%{name}-%{version} base"
+
+# bzr doesn't seem to have its own command to apply patches?
+%__scm_apply_bzr(qp:m:)\
+%{__patch} %{-p:-p%{-p*}} %{-q:-s}\
+%{__bzr} commit %{-q} -m %{-m*}
+
+# Single patch application
+%apply_patch(qp:m:)\
+%{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}}
+
+# Automatically apply all patches
+%autopatch(vp:)\
+%{lua:\
+for i, p in ipairs(patches) do\
+    print(rpm.expand("%apply_patch -m %{basename:"..p.."}  "..rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")..p.."\\n"))\
+end}
+
+# One macro to (optionally) do it all.
+# -S<scm name> Sets the used patch application style, eg '-S git' enables
+#              usage of git repository and per-patch commits.
+# -N           Disable automatic patch application
+# -p<num>      Use -p<num> for patch application       
+%autosetup(a:b:cDn:TvNS:p:)\
+%setup %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{!-v:-q}\
+%{-S:%global __scm %{-S*}}\
+%{-S:%{expand:%__scm_setup_%{-S*} %{!-v:-q}}}\
+%{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}
 
 # \endverbatim
 #*/
+
+
+#------------------------------------------------------------------------
+# standard build service macros
+#
+%ext_info .gz
+%ext_man .gz
+
+%info_add() test -x /sbin/install-info -a -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
+%{nil}
+
+%info_del() test -x /sbin/install-info -a ! -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --quiet --delete --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
+%{nil}
+
+%user_group_add() \
+/usr/sbin/groupadd -o -r %{1} 2>/dev/null || :\
+/usr/sbin/useradd -o -r -g %{1} -d %{2} -s %{3} -c %{4} %{1} 2>/dev/null || :\
+%{nil}
+