File rpm.spec of Package rpm

#
# spec file for package rpm (Version 4.7.1)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#



Name:           rpm
License:        GPLv2+
Group:          System/Packages
BuildRequires:  file-devel libbz2-devel libelf-devel libselinux-devel lua-devel ncurses-devel xz-devel zlib-devel
BuildRequires:  popt-devel
#!BuildIgnore:  rpmlint-Factory
Provides:       rpminst
PreReq:         %insserv_prereq %fillup_prereq permissions
AutoReqProv:    on
Summary:        The RPM Package Manager
Version:        4.7.1
Release:        6.<RELEASE9>
Source:         rpm-%{version}.tar.bz2
Source1:        RPM-HOWTO.tar.bz2
Source2:        RPM-Tips.html.tar.bz2
Source4:        rpm-suse_macros
Source5:        rpmsort
Source6:        symset-table
Source8:        rpmconfigcheck
Source9:        sysconfig.services-rpm
Source10:       beecrypt-4.1.2.tar.bz2
Source11:       rpm-4.4.2.3-db.tar.bz2
Patch1:         beecrypt-4.1.2.diff
Patch2:         db.diff
# quilt patches start here
Patch10:        rpm-beecrypt.diff
Patch11:        debugedit.diff
Patch12:        localetag.diff
Patch13:        missingok.diff
Patch14:        nameversioncompare.diff
Patch15:        chownwarn.diff
Patch16:        dbfsync.diff
Patch17:        dbrointerruptable.diff
Patch18:        diskspace.diff
Patch19:        extcond.diff
Patch20:        nodefattr.diff
Patch21:        luaroot.diff
Patch22:        refreshtestarch.diff
Patch23:        rpmrctests.diff
Patch24:        suspendlock.diff
Patch25:        waitlock.diff
Patch26:        dbprivate.diff
Patch27:        weakdeps.diff
Patch28:        autodeps.diff
Patch29:        brp.diff
Patch30:        brpcombress.diff
Patch31:        checkfilesnoinfodir.diff
Patch32:        finddebuginfo.diff
Patch33:        findksyms.diff
Patch34:        findlang.diff
Patch35:        macrosin.diff
Patch36:        modalias.diff
Patch37:        platformin.diff
Patch38:        rpmpopt.diff
Patch39:        rpmrc.diff
Patch40:        taggedfileindex.diff
Patch41:        rpmqpack.diff
Patch42:        convertdb1static.diff
Patch43:        build.diff
Patch44:        modalias-kernel_module.diff
Patch45:        files.diff
Patch46:        debugedit-comp-dir.diff
Patch47:        perlprov.diff
Patch48:        rpm-shorten-changelog.diff
Patch49:        debugsource-package.diff
Patch50:        whatrequires-doc.diff
Patch51:        remove-brp-strips.diff
Patch52:        requires-ge-macro.diff
Patch53:        mimetype.diff
Patch54:        debugedit-canon-fix.diff
Patch55:        finddebuginfo-absolute-links.diff
Patch56:        firmware.diff
Patch57:        specfilemacro.diff
Patch58:        modalias-encode.diff
Patch59:        disttag-macro.diff
Patch60:        buildidprov.diff
Patch61:        debugsubpkg.diff
Patch62:        debuglink.diff
Patch63:        debuginfo-mono.patch
Patch64:        allowufdio.diff
Patch65:        fixabsfilelists.diff
Patch66:        fixqueryreturn.diff
Patch67:        lazystatfs.diff
Patch68:        defclean.diff
Patch69:        fixsbits.diff
Patch70:        nosource.diff
Patch71:        tarrecordsize.diff
Patch72:        repackage-nomd5.diff
Patch73:        safeugid.diff
Patch74:        headerchk.diff
Patch75:        headerchk2.diff
Patch76:        verifyscript.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#
# avoid bootstrapping problem
%define _binary_payload w9.bzdio

%description
RPM Package Manager is the main tool for managing the software packages
of the SuSE Linux distribution.

RPM can be used to install and remove software packages. With rpm, it
is easy to update packages.  RPM keeps track of all these manipulations
in a central database.	This way it is possible to get an overview of
all installed packages.  RPM also supports database queries.



Authors:
--------
    Erik Troan <ewt@redhat.com>
    Marc Ewing <marc@redhat.com>

%package devel
Summary:        Include Files and Libraries mandatory for Development
License:        GPLv2+
Group:          System/Packages
Requires:       rpm = %{version}
Requires:       popt-devel

%description 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.



Authors:
--------
    Erik Troan <ewt@redhat.com>
    Marc Ewing <marc@redhat.com>

%prep
%setup -q -n rpm-%{version}
rm -rf sqlite
rm -rf beecrypt
tar xjf %{SOURCE10}
tar xjf %{SOURCE11}
ln -s beecrypt-4.1.2 beecrypt
#tar xjf %{SOURCE12}
#ln -s neon-0.24.7 neon
# will get linked from db3
rm -f rpmdb/db.h
%patch -P 1 -P 2
%patch -P 10 -P 11 -P 12 -P 13 -P 14 -P 15 -P 16 -P 17 -P 18 -P 19
%patch -P 20 -P 21 -P 22 -P 23 -P 24 -P 25 -P 26 -P 27 -P 28 -P 29
%patch -P 30 -P 31 -P 32 -P 33 -P 34 -P 35 -P 36 -P 37 -P 38 -P 39
%patch -P 40 -P 41 -P 42 -P 43 -P 44 -P 45 -P 46 -P 47 -P 48 -P 49
%patch -P 50 -P 51 -P 52 -P 53 -P 54 -P 55 -P 56 -P 57 -P 58 -P 59
%patch -P 60 -P 61 -P 62 -P 63 -P 64 -P 65 -P 66 -P 67 -P 68 -P 69
%patch -P 70 -P 71 -P 72 -P 73 -P 74 -P 75 -P 76
#chmod 755 scripts/find-supplements{,.ksyms}
#chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms
#chmod 755 scripts/firmware.prov
#chmod 755 scripts/debuginfo.prov
tar -xjvf %{SOURCE1}
tar -xjvf %{SOURCE2}
if [ -s /etc/rpm/suse_macros ]; then
	cp -a /etc/rpm/suse_macros %{SOURCE4}
fi
cp -a %{SOURCE4} suse_macros

%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -ffunction-sections"
export LDFLAGS="-Wl,-Bsymbolic-functions -ffunction-sections"
%ifarch alpha
export CFLAGS="-g -O0 -fno-strict-aliasing"
%endif
cp /usr/share/gettext/config.rpath .
cp autogen.sh beecrypt
pushd beecrypt
./autogen.sh --with-pic
make %{?jobs:-j%jobs}
popd
./autogen.sh --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} --libdir=%{_libdir} --sysconfdir=/etc --localstatedir=/var --with-lua --with-selinux --with-internal-beecrypt --enable-shared %{?with_python: --enable-python}
rm po/de.gmo
make %{?jobs:-j%jobs}
make convertdb1

%install
mkdir -p $RPM_BUILD_ROOT/usr/lib
mkdir -p $RPM_BUILD_ROOT/usr/share/locale
ln -s ../share/locale $RPM_BUILD_ROOT/usr/lib/locale
make DESTDIR="$RPM_BUILD_ROOT" install
install -m 755 convertdb1 $RPM_BUILD_ROOT/usr/lib/rpm
install -m 644 db3/db.h $RPM_BUILD_ROOT/usr/include/rpm
# remove .la file and the static variant of libpopt
# have to remove the dependency from other .la files as well
for f in $RPM_BUILD_ROOT/%{_libdir}/*.la; do
    sed -i -e "s,/%_lib/libpopt.la,-lpopt,g" $f
done
mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -m 755 %{SOURCE8} $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/usr/sbin
ln -sf ../../etc/init.d/rpmconfigcheck $RPM_BUILD_ROOT/usr/sbin/rcrpmconfigcheck
cp -a suse_macros $RPM_BUILD_ROOT/usr/lib/rpm
mkdir -p $RPM_BUILD_ROOT/usr/lib/rpm/suse
ln -s ../suse_macros $RPM_BUILD_ROOT/usr/lib/rpm/suse/macros
for d in BUILD RPMS SOURCES SPECS SRPMS BUILDROOT ; do
  mkdir -p $RPM_BUILD_ROOT/usr/src/packages/$d
  chmod 1777 $RPM_BUILD_ROOT/usr/src/packages/$d
done
for d in $RPM_BUILD_ROOT/usr/lib/rpm/platform/*-linux/macros ; do
  dd=${d%%-linux/macros}
  dd=${dd##*/}
  mkdir $RPM_BUILD_ROOT/usr/src/packages/RPMS/$dd
  chmod 1777 $RPM_BUILD_ROOT/usr/src/packages/RPMS/$dd
done
mkdir -p $RPM_BUILD_ROOT/var/lib/rpm
gzip -9 $RPM_BUILD_ROOT/%{_mandir}/man[18]/*.[18]
export RPM_BUILD_ROOT
%ifarch s390x
[ -f scripts/brp-%_arch-linux ] && sh scripts/brp-%_arch-linux
%endif
chmod 755 doc/manual
rm -rf doc/manual/Makefile*
rm -f $RPM_BUILD_ROOT/usr/lib/rpmpopt
rm -rf $RPM_BUILD_ROOT%{_mandir}/{fr,ja,ko,pl,ru,sk}
rm -f $RPM_BUILD_ROOT%{_prefix}/share/locale/de/LC_MESSAGES/rpm.mo
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
install -c -m0644 %{SOURCE9} $RPM_BUILD_ROOT/var/adm/fillup-templates/
rm -f $RPM_BUILD_ROOT/usr/lib/rpm/cpanflute $RPM_BUILD_ROOT/usr/lib/rpm/cpanflute2
find $RPM_BUILD_ROOT/usr/src/packages/* -type d | sed -e "s@$RPM_BUILD_ROOT@@" | sort > $RPM_BUILD_ROOT/usr/lib/rpm/permlist
install -m 755 %{SOURCE5} $RPM_BUILD_ROOT/usr/lib/rpm
install -m 755 %{SOURCE6} $RPM_BUILD_ROOT/usr/lib/rpm
install -m 755 scripts/find-supplements{,.ksyms} $RPM_BUILD_ROOT/usr/lib/rpm
install -m 755 scripts/firmware.prov $RPM_BUILD_ROOT/usr/lib/rpm
install -m 755 scripts/debuginfo.prov $RPM_BUILD_ROOT/usr/lib/rpm
rm -f $RPM_BUILD_ROOT/usr/lib/locale $RPM_BUILD_ROOT/usr/lib/rpmrc
mkdir -p $RPM_BUILD_ROOT/etc/rpm
chmod 755 $RPM_BUILD_ROOT/etc/rpm
# remove some nonsense or non-working scripts
pushd $RPM_BUILD_ROOT/usr/lib/rpm/
for f in rpm2cpio.sh rpm.daily rpmdiff* rpm.log rpm.xinetd freshen.sh u_pkg.sh \
         magic magic.mgc magic.mime* rpmfile *.pl javadeps brp-redhat \
         brp-strip-static-archive vpkg-provides*.sh http.req sql.req tcl.req \
         rpmdb_* brp-sparc64-linux brp-strip-comment-note brp-java-gcjcompile
do
    rm -f $f
done
for i in /usr/share/automake-*/*; do
  if test -f "$i" && test -f "${i##*/}"; then
    rm -f "${i##*/}"
  fi
done
popd
gzip -9 CHANGES
rm -rf $RPM_BUILD_ROOT/%{_libdir}/python%{py_ver}
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%clean
rm -rf $RPM_BUILD_ROOT

%post
%{fillup_only -an services}
%run_permissions
test -f var/lib/rpm/Packages || rpm --initdb
if test -s var/lib/rpm/packages.rpm ; then
  echo "converting rpm-3 database to rpm-4 format..."
  usr/lib/rpm/convertdb1 var/lib/rpm/packages.rpm
  mv -f var/lib/rpm/packages.rpm var/lib/rpm/packages.rpm3
  rm -f var/lib/rpm/conflictsindex.rpm var/lib/rpm/fileindex.rpm var/lib/rpm/groupindex.rpm var/lib/rpm/nameindex.rpm var/lib/rpm/providesindex.rpm var/lib/rpm/requiredby.rpm var/lib/rpm/triggerindex.rpm
fi
if test -s var/lib/rpm/Filemd5s -a ! -e var/lib/rpm/Filedigests ; then
  ln var/lib/rpm/Filemd5s var/lib/rpm/Filedigests
fi

%postun
%{insserv_cleanup}
%verifyscript
%verify_permissions -f /usr/lib/rpm/permlist

%files
%defattr(-,root,root)
%doc 	CHANGES.gz COPYING GROUPS
%doc 	doc/manual
%doc    RPM-HOWTO RPM-Tips
	/etc/rpm
	/bin/rpm
	/usr/bin/*
	/etc/init.d/rpmconfigcheck
	/usr/sbin/rcrpmconfigcheck
	/usr/lib/rpm
	%{_libdir}/librpm.so.*
	%{_libdir}/librpmbuild.so.*
	%{_libdir}/librpmio.so.*
%doc	%{_mandir}/man[18]/*.[18]*
	/usr/share/locale/*/LC_MESSAGES/rpm.mo
%dir 	/var/lib/rpm
%verify(not mode) %dir 	%attr(755,root,root) /usr/src/packages/BUILD
%verify(not mode) %dir 	%attr(755,root,root) /usr/src/packages/SPECS
%verify(not mode) %dir 	%attr(755,root,root) /usr/src/packages/SOURCES
%verify(not mode) %dir 	%attr(755,root,root) /usr/src/packages/SRPMS
%verify(not mode) %dir	%attr(755,root,root)  /usr/src/packages/RPMS
%verify(not mode) %dir	%attr(755,root,root)  /usr/src/packages/BUILDROOT
%verify(not mode) %dir	%attr(755,root,root) /usr/src/packages/RPMS/*
	/var/adm/fillup-templates/sysconfig.services-rpm

%files devel
%defattr(644,root,root,755)
	/usr/include/rpm
        %{_libdir}/librpm.so
        %{_libdir}/librpmbuild.so
        %{_libdir}/librpmio.so
        %{_libdir}/pkgconfig/rpm.pc

%changelog