Sisyphus
: 15 2018 | : 18651 | : 12369976
en ru br
ALT

:: /
: rpm-build

             Sources      Gear   Bugs and FR  Repocop 

# python-module-rpm overrides %%version
%define rpm_version 4.0.4

%define oname rpm

Name: rpm-build
Version: 4.0.4
Release: alt119

%define ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
%define get_dep() %(rpm -q --qf '%%{NAME} >= %%|SERIAL?{%%{SERIAL}:}|%%{VERSION}-%%{RELEASE}' %1 2>/dev/null || echo '%1 >= unknown')
%define def_with() %{expand:%%{!?_with_%{1}: %%{!?_without_%{1}: %%global _with_%{1} --with-%{1}}}}
%define def_without() %{expand:%%{!?_with_%{1}: %%{!?_without_%{1}: %%global _without_%{1} --without-%{1}}}}
%define if_with() %if %{expand:%%{?_with_%{1}:1}%%{!?_with_%{1}:0}}
%define if_without() %if %{expand:%%{?_without_%{1}:1}%%{!?_without_%{1}:0}}
%define _rpmlibdir %_prefix/lib/rpm

%def_without python
%def_with libelf
%def_without apidocs
%def_without db
%def_without build_topdir
%def_with selinux
%def_with profile

# XXX enable at your own risk, CDB access to rpmdb isn't cooked yet.

%define enable_cdb create cdb

Summary: Scripts and executable programs used to build packages
Summary(ru_RU.UTF-8): Файлы, необходимые для установки SRPM-пакетов и сборки RPM-пакетов
License: GPL
Group: Development/Other
Obsoletes: spec-helper
PreReq: librpmbuild = %version-%release
PreReq: shadow-utils
Requires: autoconf autoconf-common automake automake-common bison coreutils cpio
Requires: gcc gettext-tools glibc-devel gnu-config file kernel-headers libtool m4
Requires: procps psmisc sed service which
Requires: bash >= 0:3.1.17-alt4
Requires: bzip2 >= 1:1.0.2-alt4
Requires: xz
Requires: gzip >= 0:1.3.3-alt2
# due to -O option in $MAKEFLAGS
Requires: make >= 4.0
Requires: mktemp >= 1:1.3.1
Requires: patch >= 2.5
Requires: tar >= 0:1.13.22-alt1
Requires: %_bindir/subst
Requires: elfutils >= 0.143-alt1
Requires: info-install >= 4.11
Requires: pkgconfig-reqprov pkgconfig-recursion
Requires: rpm-build-perl >= 0.76
Requires: rpm-build-python >= 0.31
Conflicts: rpm-build-tcl <= 0.2
Conflicts: rpm-build-mono <= 1.0
# Due to 'readelf --dyn-syms':
Requires: binutils >= 1:2.20.51.0.7
Requires: rpmspec

Url: http://www.rpm.org/

# http://git.altlinux.org/gears/r/rpm.git

Source: rpm-%version-%release.tar

%{?_with_python:BuildPreReq: python-devel}
%{?_with_apidocs:BuildPreReq: ctags doxygen}
%{?_with_libelf:BuildPreReq: libelf-devel}
%{?_with_selinux:BuildPreReq: libselinux-devel >= 2.0.96}
%{?_with_profile:BuildPreReq: coreutils >= 6.0}

BuildPreReq: automake >= 1.7.1, autoconf >= 2.53, libbeecrypt-devel >= 4.2.1,
BuildPreReq: rpm >= 3.0.6-ipl24mdk, %_bindir/subst

# For debugedit.

BuildPreReq: elfutils-devel

# Automatically added by buildreq on Thu Apr 23 2009 and edited manually.

BuildRequires: libdb4.7-devel libelf-devel liblzma-devel libpopt-devel python-devel zlib-devel

%package -n lib%oname
Summary: Shared libraries required for applications which will manipulate RPM packages
Summary(ru_RU.UTF-8): Файлы, необходимые для разработки приложений, взаимодействующих с RPM-пакетами
License: GPL/LGPL
Group: System/Libraries
PreReq: zlib >= 1.1.4
PreReq: libpopt >= 1:1.7-alt3
PreReq: libdb4.7

%package -n librpmbuild
Summary: Shared library required for applications which will build RPM packages
Summary(ru_RU.UTF-8): Разделяемая библиотека для разработки приложений, собирающих RPM-пакеты
License: GPL/LGPL
Group: System/Libraries
Requires: lib%oname = %version-%release

%package -n lib%oname-devel
Summary: Development files for applications which will manipulate RPM packages
Summary(ru_RU.UTF-8): Файлы, необходимые для разработки приложений, взаимодействующих с RPM-пакетами
License: GPL/LGPL
Group: Development/C
Provides: %oname-devel = %version-%release
Obsoletes: %oname-devel
Requires: lib%oname = %version-%release, librpmbuild = %version-%release
Requires: libpopt-devel

%package -n lib%oname-devel-static
Summary: Static libraries for developing statically linked applications which will manipulate RPM packages
Summary(ru_RU.UTF-8): Статические библиотеки, необходимые для разработки статических приложений, взаимодействующих с RPM-пакетами
License: GPL/LGPL
Group: Development/C
Requires: lib%oname-devel = %version-%release
Requires: libbeecrypt-devel-static, libdb4.7-devel-static, libpopt-devel-static, zlib-devel-static


%package build-topdir
Summary: RPM package installation and build directory tree
Summary(ru_RU.UTF-8): Сборочное дерево, используемое для установки SRPM-пакетов и сборки RPM-пакетов
License: GPL
Group: Development/Other
PreReq: %oname-build = %version-%release

%package static
Summary: Static version of the RPM package management system
Summary(ru_RU.UTF-8): Статическая версия менеджера пакетов RPM
License: GPL
Group: System/Configuration/Packaging
PreReq: %oname = %version-%release

%description -l ru_RU.UTF-8
RPM - это мощный неинтерактивный менеджер пакетов, используемый для сборки,
установки, инспекции, проверки, обновления и удаления отдельных программных
пакетов.  Каждый такой пакет состоит из набора файлов и информации о пакете,
включающей название, версию, описание пакета, и т.д.

%description -n lib%oname
This package contains shared libraries required to run dynamically linked
programs manipulating with RPM packages and databases.

%description -n librpmbuild
This package contains shared library required to run dynamically linked
programs building RPM packages.

%description -n lib%oname-devel
This package contains the RPM C library and header files.  These
development files will simplify the process of writing programs
which manipulate RPM packages and databases and are intended to make
it easier to create graphical package managers or any other tools
that need an intimate knowledge of RPM packages in order to function.

This package should be installed if you want to develop programs that
will manipulate RPM packages and databases.

%description -n lib%oname-devel-static
This package contains the RPM C library and header files.  These
development files will simplify the process of writing programs
which manipulate RPM packages and databases and are intended to make
it easier to create graphical package managers or any other tools
that need an intimate knowledge of RPM packages in order to function.

This package should be installed if you want to develop statically linked
programs that will manipulate RPM packages and databases.

%description
This package contains scripts and executable programs that are used to
build packages using RPM.

%description build-topdir
This package contains RPM package installation and build directory tree.

%description static
This package contains statically linked version of the RPM program.

%if_with python
%package -n python-module-rpm
Version: %{rpm_version}_%__python_version
Summary: Python bindings for apps which will manipulate RPM packages
Summary(ru_RU.UTF-8): Интерфейс для разработки Python-приложений, взаимодействующих с RPM-пакетами
License: GPL/LGPL
Group: Development/Python
PreReq: lib%oname = %rpm_version-%release
Requires: python = %__python_version
Provides: rpm-python = %{rpm_version}_%__python_version-%release
Obsoletes: rpm-python

%description -n python-module-rpm
This package contains a module which permits applications written in
the Python programming language to use the interface supplied by RPM
(RPM Package Manager) libraries.
%endif #with python

%prep
%setup -n rpm-%rpm_version-%release

%build
gettextize --force --quiet --no-changelog --symlink
install -pv -m0644 /usr/share/automake/mkinstalldirs .
autoreconf -fisv -I m4
# avoid extra build dependencies
export ac_cv_path___CPIO=/bin/cpio
export ac_cv_path___UNZIP=/usr/bin/unzip
export ac_cv_path___LZMA=/usr/bin/lzma
export ac_cv_path___XZ=/usr/bin/xz
export ac_cv_path___GPG=/usr/bin/gpg
export ac_cv_path___SSH=/usr/bin/ssh
export LDFLAGS="-L$PWD/stub"
%configure \
%{?_with_python} %{?_without_python} \
%{?_with_apidocs} %{?_without_apidocs} \
%{?_with_db} %{?_without_db} \
%{subst_with selinux} \
--disable-static \
--program-transform-name=

# create a stub libselinux.a so that -lselinux would work in -static mode

mkdir stub
ar cq stub/libselinux.a
ln -s %_libdir/libselinux.so stub/

set_c_cflags="$(sed -n 's/^CFLAGS = //p' lib/Makefile) -W -Wno-missing-prototypes -Wno-override-init %{!?_enable_debug:-O3} -fno-builtin-memcmp"
%make_build -C lib set.lo CFLAGS="$set_c_cflags"
%make_build

rpmquery -a --provides |fgrep '= set:' |sort >P
rpmquery -a --requires |fgrep '= set:' |sort >R
join -o 1.3,2.3 P R |shuf >setcmp-data

%if_with profile
rm lib/set.lo lib/librpm.la
%make_build -C lib set.lo librpm.la CFLAGS="$set_c_cflags -fprofile-generate"
./tools/setcmp <setcmp-data >/dev/null
ls -l lib/.libs/set.gcda
rm lib/set.lo lib/librpm.la
%make_build -C lib set.lo CFLAGS="$set_c_cflags -fprofile-use"
%make_build
%else
./tools/setcmp <setcmp-data >/dev/null
%endif #with profile

%if_with apidocs
rm -rf apidocs
make apidocs
%endif #with apidocs

# check

lib/test-set

%install
%make_install DESTDIR='%buildroot' install
chmod a-w %buildroot%_usrsrc/RPM{,/RPMS/*}

rm %buildroot%_libdir/librpm{,build,db,io}.so
%if 0
# Save list of packages through cron.
#mkdir -p %buildroot%_sysconfdir/cron.daily
#install -p -m0750 scripts/%oname.daily -T %buildroot%_sysconfdir/cron.daily/%oname
#
#mkdir -p %buildroot%_sysconfdir/logrotate.d
#install -p -m0640 scripts/%oname.log -T %buildroot%_sysconfdir/logrotate.d/%oname

mkdir -p %buildroot{%_rpmlibdir/macros.d,%_sysconfdir/%oname/macros.d}
touch %buildroot%_sysconfdir/%oname/macros
cat << E_O_F > %buildroot%_sysconfdir/%oname/macros.cdb
%{?enable_cdb:#%%__dbi_cdb %enable_cdb}
E_O_F

mkdir -p %buildroot%_localstatedir/%oname
for dbi in \
Basenames Conflictname Dirnames Group Installtid Name Providename \
Provideversion Removetid Requirename Requireversion Triggername \
Sigmd5 Sha1header Filemd5s Packages \
__db.001 __db.002 __db.003 __db.004 __db.005 __db.006 __db.007 \
__db.008 __db.009
do
   touch "%buildroot%_localstatedir/%oname/$dbi"
done
touch %buildroot%_localstatedir/%oname/files-awaiting-filetriggers

# Prepare documentation.

xz -9 CHANGES ||:
mkdir -p %buildroot%_docdir/%oname-%rpm_version
install -p -m0644 CHANGES.xz CREDITS README README.ALT* \
%buildroot%_docdir/%oname-%rpm_version/
cp -a doc/manual %buildroot%_docdir/%oname-%rpm_version/
rm -f %buildroot%_docdir/%oname-%rpm_version/manual/{Makefile*,buildroot}
#if_with apidocs
cp -a apidocs/man/man3 %buildroot%_mandir/
cp -a apidocs/html %buildroot%_docdir/%oname-%rpm_version/apidocs/
#endif #with apidocs

# rpminit(1).

install -pD -m0755 rpminit -T %buildroot%_bindir/rpminit
install -pD -m0644 rpminit.1 -T %buildroot%_man1dir/rpminit.1

# Valid groups.

install -p -m0644 GROUPS %buildroot%_rpmlibdir/
%endif

# buildreq ignore rules.

install -pD -m0644 rpm-build.buildreq -T %buildroot%_sysconfdir/buildreqs/files/ignore.d/rpm-build

chmod a+x scripts/find-lang
# Manpages have been moved to their own packages.
#./scripts/find-lang --with-man %oname rpm2cpio --output %oname.lang
RPMCONFIGDIR=./scripts ./scripts/find-lang %oname rpm2cpio --output %oname.lang

pushd %buildroot%_rpmlibdir
for f in *-alt-%_target_os; do
n=`echo "$f" |sed -e 's/-alt//'`
[ -e "$n" ] || ln -s "$f" "$n"
done
popd

ls -d %buildroot%_rpmlibdir/*-%{_target_os}* |
grep -Fv /brp- |
sed -e "s|^%buildroot|%%attr(-,root,%oname) |g" >>rpmbuild.platform

%if 0
#ifdef add_findreq_skiplist
# These shell libraries hopefully do not require anything special,
# but we want to keep the "rpm" package dependencies to bare minimum.
%add_findreq_skiplist %_rpmlibdir/functions
%add_findreq_skiplist %_rpmlibdir/find-package
#endif
# However, syntax check is still a good idea.
sh -n %buildroot%_rpmlibdir/functions
sh -n %buildroot%_rpmlibdir/find-package
%endif

%if "%_lib" == "lib"
if [ -s /lib/libc.so.6 -a -s /lib/libz.so.1 -a -s /lib/librt.so.1 -a -n "$(getconf LFS_CFLAGS)" ]; then
readelf --wide --symbols /lib/libc.so.6 /lib/libz.so.1 /lib/librt.so.1 |
sed -n 's/^[[:space:]]*[0-9]\+:[[:space:]]\+[0-9a-f]\+[[:space:]]\+[0-9]\+[[:space:]]\+FUNC[[:space:]]\+[^[:space:]]\+[[:space:]]\+DEFAULT[[:space:]]\+[0-9]\+[[:space:]]\+\([^ at [:space:]]\+\) at \?.*/\1/p' |
sort -u
fi > all-funcs
sed -r -n 's/^(.+)64(_.*|$)/\1\2/p' all-funcs |
sort -u |
egrep -v '^(wcs|str)' |
comm -12 - all-funcs |
LC_ALL=C sort -u \
> %buildroot%_rpmlibdir/verify-elf-non-lfs-funcs.list
%endif

mv -T %buildroot%_rpmlibdir/rpm{,build}rc
mv -T %buildroot%_rpmlibdir/{,build}macros

%pre
[ ! -L %_rpmlibdir/noarch-alt-%_target_os ] || rm -f %_rpmlibdir/noarch-alt-%_target_os ||:

%files -n librpmbuild
%_libdir/librpmbuild-*.so

%define rpmattr %attr(755,root,%oname)
%define rpmdirattr %attr(2755,root,%oname) %dir
%define rpmdatattr %attr(644,root,%oname)
%define rpmdbattr %attr(644,root,%oname) %verify(not md5 size mtime) %ghost %config(missingok,noreplace)

%files -n lib%oname
%rpmdirattr %_rpmlibdir
%rpmdatattr %_rpmlibdir/rpmbuildrc
%rpmdatattr %_rpmlibdir/buildmacros
%_libdir/librpm-*.so
%_libdir/librpmdb-*.so
%_libdir/librpmio-*.so

%if 0
%files -n lib%oname-devel
%_libdir/librpm.so
%_libdir/librpmdb.so
%_libdir/librpmio.so
%_libdir/librpmbuild.so
%_includedir/%oname
%if_with apidocs
%_man3dir/*
%dir %_docdir/%oname-%rpm_version
%_docdir/%oname-%rpm_version/apidocs
%endif #with apidocs

%files -n lib%oname-devel-static
%_libdir/*.a

%files -f %oname.lang
%dir %_docdir/%oname-%rpm_version
%_docdir/%oname-%rpm_version/[A-Z]*
%_docdir/%oname-%rpm_version/manual

#%config(noreplace,missingok) %_sysconfdir/cron.daily/%oname

#%config(noreplace,missingok) %_sysconfdir/logrotate.d/%oname

%rpmdirattr %_rpmlibdir/macros.d
%dir %_sysconfdir/%oname
%dir %_sysconfdir/%oname/macros.d
%config(noreplace,missingok) %_sysconfdir/%oname/macros
%config(noreplace,missingok) %_sysconfdir/%oname/macros.??*

%rpmdirattr %_localstatedir/%oname
%rpmdbattr %_localstatedir/%oname/Basenames
%rpmdbattr %_localstatedir/%oname/Conflictname
%rpmdbattr %_localstatedir/%oname/__db.0*
%rpmdbattr %_localstatedir/%oname/Dirnames
%rpmdbattr %_localstatedir/%oname/Filemd5s
%rpmdbattr %_localstatedir/%oname/Group
%rpmdbattr %_localstatedir/%oname/Installtid
%rpmdbattr %_localstatedir/%oname/Name
%rpmdbattr %_localstatedir/%oname/Packages
%rpmdbattr %_localstatedir/%oname/Providename
%rpmdbattr %_localstatedir/%oname/Provideversion
%rpmdbattr %_localstatedir/%oname/Removetid
%rpmdbattr %_localstatedir/%oname/Requirename
%rpmdbattr %_localstatedir/%oname/Requireversion
%rpmdbattr %_localstatedir/%oname/Sigmd5
%rpmdbattr %_localstatedir/%oname/Sha1header
%rpmdbattr %_localstatedir/%oname/Triggername
%rpmdbattr %_localstatedir/%oname/files-awaiting-filetriggers

/bin/rpm
%_bindir/rpm
%_bindir/rpm2cpio
%_bindir/rpmdb
%_bindir/rpm[eiu]
%_bindir/rpmsign
%_bindir/rpmquery
%_bindir/rpmverify
%_bindir/rpminit
%_bindir/rpm*cmp

%rpmattr %_rpmlibdir/pdeath_execute
%rpmattr %_rpmlibdir/rpm[dikq]
%_rpmlibdir/rpm[euv]
%rpmdatattr %_rpmlibdir/GROUPS
%_prefix/lib/rpmpopt
%_prefix/lib/rpmrc

%rpmattr %_rpmlibdir/posttrans-filetriggers
%rpmattr %_rpmlibdir/0ldconfig.filetrigger

%rpmattr %_rpmlibdir/functions
%rpmattr %_rpmlibdir/find-package
%rpmdatattr %_rpmlibdir/.provides.sh

%_man1dir/rpminit.*
%_man8dir/rpm.*
%_man8dir/rpm2cpio.*
%endif

%files -f rpmbuild.platform
%config %_sysconfdir/buildreqs/files/ignore.d/*
%rpmattr %_bindir/gendiff
%_bindir/rpmbuild
%_bindir/relative
%_rpmlibdir/rpmt
%rpmattr %_rpmlibdir/rpmb
%rpmattr %_rpmlibdir/debugedit
%rpmattr %_rpmlibdir/debuginfo.*
%rpmattr %_rpmlibdir/dump_ld_config
%rpmattr %_rpmlibdir/filesize
%rpmattr %_rpmlibdir/relative
%rpmattr %_rpmlibdir/brp-alt
%rpmattr %dir %_rpmlibdir/brp.d
%rpmattr %_rpmlibdir/brp.d/*
%rpmattr %_rpmlibdir/*_files
%rpmattr %_rpmlibdir/cpp.*
%rpmattr %_rpmlibdir/is_elf_so_executable
%rpmattr %_rpmlibdir/ldd
%rpmattr %_rpmlibdir/rpm2cpio.sh
%rpmattr %_rpmlibdir/find-lang
%rpmattr %_rpmlibdir/find-provides
%rpmattr %_rpmlibdir/find-requires
%rpmattr %_rpmlibdir/find-debuginfo-files
%rpmattr %_rpmlibdir/find-scriptlet-requires
%rpmattr %_rpmlibdir/fixup-*
%rpmattr %_rpmlibdir/files.*
%rpmattr %config %_rpmlibdir/*-files.req.list
%rpmattr %_rpmlibdir/lib.*
%rpmattr %_rpmlibdir/pam.*
%rpmattr %_rpmlibdir/percolate
%rpmattr %_rpmlibdir/pkgconfig.*
%rpmattr %_rpmlibdir/pkgconfiglib.*
%rpmattr %_rpmlibdir/rpmlib.*
%rpmattr %_rpmlibdir/shell.*
%rpmattr %_rpmlibdir/shebang.*
%rpmattr %_rpmlibdir/static.*
%rpmattr %_rpmlibdir/symlinks.*
%rpmattr %_rpmlibdir/tmpdir.sh
%rpmattr %_rpmlibdir/verify-elf
%rpmattr %_rpmlibdir/*.awk
# set-version helpers
%rpmattr %_rpmlibdir/mkset
%rpmattr %_rpmlibdir/setcmp
%if "%_lib" == "lib"
%rpmdatattr %_rpmlibdir/verify-elf-non-lfs-funcs.list
%endif
%rpmdatattr %_rpmlibdir/rpmpopt*

%_mandir/man?/gendiff.*
%_man8dir/rpmbuild.*

%if_with build_topdir
%files build-topdir
%attr(0755,root,%oname) %dir %_usrsrc/RPM
%attr(0770,root,%oname) %dir %_usrsrc/RPM/BUILD
%attr(2770,root,%oname) %dir %_usrsrc/RPM/SPECS
%attr(2770,root,%oname) %dir %_usrsrc/RPM/SOURCES
%attr(2775,root,%oname) %dir %_usrsrc/RPM/SRPMS
%attr(0755,root,%oname) %dir %_usrsrc/RPM/RPMS
%attr(2775,root,%oname) %dir %_usrsrc/RPM/RPMS/*
%endif #with build_topdir

%if_with python
%files -n python-module-rpm
%_libdir/python*/site-packages/*module.so
%endif #with python

%changelog

changelog

 
: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
: Michael Shigorin