rpm/rpm.spec

362 lines
12 KiB
RPMSpec
Raw Normal View History

#% define program_suffix 4
%define __prefix %{?_prefix}%{!?_prefix:/usr}
%ifarch x86_64
%{?!_lib: %define _lib lib64}
%{?!_libexec: %define _libexec libexec64}
%else
%{?!_lib: %define _lib lib}
%{?!_libexec: %define _libexec libexec}
%endif
%define __bindir %{__prefix}/bin
%define __includedir %{__prefix}/include
%define __libdir %{__prefix}/%{_lib}
%define __mandir %{__prefix}/share/man
%define packager_groupid 65028
%define packager_userid 65028
%define majver %(echo %version | cut -d. -f1-2)
Name: rpm
Epoch: 1
Version: 4.14.3
Release: 2mamba
Summary: The RPM Package Manager (RPM) is a powerful package management system
Group: System/Management
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://rpm.org/index.html
Source: http://ftp.rpm.org/releases/rpm-%{majver}.x/rpm-%{version}.tar.bz2
Source2: rpm4-macros_openmamba
Patch0: rpm-4.14.2.1-fix-rebuilddb-from-rpm-5.2.patch
Patch1: rpm-4.14.2.1-fix-rebuilddb-from-rpm-5.2-better.patch
Patch2: rpm-4.14.2.1-fix-missing-translations-from-rpm4-segfault.patch
Patch3: rpm-4.14.2.1-arm-openmamba-arch-support.patch
Patch4: rpm-4.14.2.1-i586-openmamba-arch-support.patch
Patch5: rpm-4.14.2.1-debuginfo-rename-to-debug.patch
Patch6: rpm-4.14.2.1-add-usrlibrpm-macro.patch
Patch7: rpm-4.14.2.1-remove_macro_expanded_in_comment_warning.patch
Patch8: rpm-4.14.2.1-arm-openamba-force-armv5t.patch
Patch9: rpm-4.14.2.1-increase_default_patch_fuzz.patch
Patch10: rpm-4.14.2.1-openmamba-buildroot.patch
Patch11: rpm-4.14.2.1-target-platform-gnu.patch
Patch12: rpm-4.14.2.1-find-lang-qt-fix.patch
License: LGPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libacl-devel
BuildRequires: libarchive-devel
BuildRequires: libattr-devel
BuildRequires: libbzip2-devel
BuildRequires: libdb53-devel
BuildRequires: libdbus-devel
BuildRequires: libdw-devel
BuildRequires: libelf-devel
BuildRequires: liblmdb-devel
BuildRequires: liblua-devel
BuildRequires: liblz4-devel
BuildRequires: liblzma-devel
BuildRequires: libmagic-devel
BuildRequires: libnettle-devel
BuildRequires: libnss-devel
BuildRequires: libopenssl-devel
BuildRequires: libpopt-devel
BuildRequires: libpython3-devel
BuildRequires: libpython27-devel
BuildRequires: libreadline-devel
BuildRequires: libsystemd-devel
BuildRequires: libxml2-devel
BuildRequires: libz-devel
BuildRequires: libzstd-devel
## AUTOBUILDREQ-END
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Provides: rpm-build
Obsoletes: rpm-build
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
The RPM Package Manager (RPM) is a powerful package management system capable of building computer software from source into easily distributable packages installing, updating and uninstalling packaged software querying detailed information about the packaged software, whether installed or not verifying integrity of packaged software and resulting software installation.
%package build
Summary: The RPM package build tools and environment
Group: Development/Tools
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: elfutils
%description build
The RPM Package Manager (RPM) is a powerful package management system capable of building computer software from source into easily distributable packages installing, updating and uninstalling packaged software querying detailed information about the packaged software, whether installed or not verifying integrity of packaged software and resulting software installation.
This package provides the RPM package build tools and environment.
%package -n lib%{name}
Group: System/Libraries
Summary: Shared libraries for %{name}
%description -n lib%{name}
This package contains shared libraries for %{name}.
%package -n lib%{name}-devel
Group: Development/Libraries
Summary: Development files for %{name}
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: pkg-config
Provides: rpm-devel
Obsoletes: rpm-devel
%description -n lib%{name}-devel
This package contains libraries and header files for developing applications that use %{name}.
%package -n python-rpm
Summary: Python bindings for apps which will manipulate RPM packages
Group: Development/Libraries/Python
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: python27
Provides: python-rpm4
Obsoletes: python-rpm4
%description -n python-rpm
The rpm-python package contains a module which permits applications written in the Python programming language to use the interface supplied by RPM (RPM Package Manager) libraries.
This package should be installed if you want to develop Python programs that will manipulate RPM packages and databases.
%package -n python-rpm-py3
Summary: Python bindings for apps which will manipulate RPM packages
Group: Development/Libraries/Python
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: python3
%description -n python-rpm-py3
The rpm-python package contains a module which permits applications written in the Python programming language to use the interface supplied by RPM (RPM Package Manager) libraries.
This package should be installed if you want to develop Python programs that will manipulate RPM packages and databases.
%debug_package
%prep
%setup -q -n rpm-%{version}
#-D -T
#:<< _EOF
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
#%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
sed -i "s,| arm-\* |,| aarch64-\* | arm-\* |," config.sub
cp -a python python27
%build
#:<< _EOF
./configure \
%{?program_suffix:--program-suffix=%{program_suffix}} \
--build=%{_build} \
--host=%{_target_platform} \
--prefix=%{__prefix} \
--libdir=%{__libdir} \
--mandir=%{__prefix}/share/man \
--infodir=%{__prefix}/share/info \
--localstatedir=/var \
--sysconfdir=/etc \
--with-path-sources=%{__prefix}/src/RPM \
--with-path-lib=%{_prefix}/lib/rpm%{?program_suffix} \
--with-path-cfg=%{_sysconfdir}/rpm%{?program_suffix} \
--enable-python \
--with-external-db \
--with-vendor=openmamba \
PYTHON=%{__python3}
%make
# Build python 2.7 legacy
cd python27
cp ../python/Makefile .
sed -i "s|%{python3_inc}|%{python_inc}|" Makefile
sed -i "s|%{python3_sitearch}|%{python_sitearch}|" Makefile
sed -i "s|%{python3_sitelib}|%{python_sitelib}|" Makefile
sed -i "s|python%{python3_version}[m]*|python%{python_version}|" Makefile
sed -i "s|%{__python3}|%{__python}|" Makefile
%make PYTHON_VERSION=2.7
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall -C python27 PYTHON_VERSION=2.7
%makeinstall
%find_lang rpm --with-man --all-name || touch rpm.lang
# create system-wide build directories
mkdir -p %{buildroot}%{_usr}/src/RPM/{BUILD,RPMS/{arm,i586,noarch,x86_64},SOURCES,SPECS,SRPMS}
# install rpm macros for openmamba
install -D -m 644 %{S:2} %{buildroot}%{_sysconfdir}/rpm%{?program_suffix}/macros.openmamba
%ifarch x86_64
sed -i "s|/libexec$|/%{_libexec}|" %{buildroot}%{_prefix}/lib/rpm/platform/x86_64-linux/macros
%endif
%ifarch aarch64
sed -i "s|/libexec$|/%{_libexec}|" %{buildroot}%{_prefix}/lib/rpm/platform/aarch64-linux/macros
%endif
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pretrans
[ -e /var/lib/rpm/Enhancename ] || {
cp -a /var/lib/rpm /var/lib/rpm.52.pretrans.bak
}
:
%post
# Upgrade db from 5.2.1 (tricky)
[ -e /var/lib/rpm/Enhancename ] || {
cat > /tmp/rpm-upgrade.sh << _EOF
#!/bin/sh
while true; do fuser -s /var/lib/rpm/*; [ $? -eq 1 ] && break; sleep 5; done
echo "** Performing rpmdb upgrade from rpm5 to rpm4..."
rpm --rebuilddb
rpm --rebuilddb && echo "** rpmdb upgrade completed successfully"
_EOF
chmod +x /tmp/rpm-upgrade.sh
/bin/sh /tmp/rpm-upgrade.sh &
}
:
%post -n lib%{name}
/sbin/ldconfig
/usr/sbin/groupadd packager -g %{packager_groupid} 2>/dev/null || :
/usr/sbin/useradd packager -u %{packager_userid} -g packager -d /dev/null -s /bin/false 2>/dev/null || :
:
%postun -n lib%{name}
/sbin/ldconfig
:
%files -f rpm.lang
%defattr(-,root,root)
%dir %{_sysconfdir}/rpm%{?program_suffix}
%config %{_sysconfdir}/rpm%{?program_suffix}/macros.openmamba
%{_bindir}/gendiff%{?program_suffix}
%{_bindir}/rpm%{?program_suffix}
%{_bindir}/rpm2archive%{?program_suffix}
%{_bindir}/rpm2cpio%{?program_suffix}
%{_bindir}/rpmbuild%{?program_suffix}
%{_bindir}/rpmdb%{?program_suffix}
%{_bindir}/rpmgraph%{?program_suffix}
%{_bindir}/rpmkeys%{?program_suffix}
%{_bindir}/rpmquery
%{_bindir}/rpmsign%{?program_suffix}
%{_bindir}/rpmspec%{?program_suffix}
%{_bindir}/rpmverify
%dir %{_prefix}/lib/rpm
%{_prefix}/lib/rpm/*
%dir /usr/src/RPM
%attr(775,root,packager) %dir /usr/src/RPM/BUILD
%attr(775,root,packager) %dir /usr/src/RPM/SOURCES
%attr(775,root,packager) %dir /usr/src/RPM/SRPMS
%attr(775,root,packager) %dir /usr/src/RPM/RPMS
%attr(775,root,packager) %dir /usr/src/RPM/SPECS
%attr(775,root,packager) /usr/src/RPM/RPMS/*
%{_mandir}/man1/gendiff.1*
%{_mandir}/man8/rpm-misc.8*
%{_mandir}/man8/rpm-plugin-systemd-inhibit.8*
%{_mandir}/man8/rpm.8*
%{_mandir}/man8/rpm2cpio.8*
%{_mandir}/man8/rpmbuild.8*
%{_mandir}/man8/rpmdb.8*
%{_mandir}/man8/rpmdeps.8*
%{_mandir}/man8/rpmgraph.8*
%{_mandir}/man8/rpmkeys.8*
%{_mandir}/man8/rpmsign.8*
%{_mandir}/man8/rpmspec.8*
%doc COPYING CREDITS
%files -n lib%{name}
%defattr(-,root,root)
%{_libdir}/librpm.so.*
%{_libdir}/librpmbuild.so.*
%{_libdir}/librpmio.so.*
%{_libdir}/librpmsign.so.*
%dir %{_libdir}/rpm-plugins
%{_libdir}/rpm-plugins/*
%files -n lib%{name}-devel
%defattr(-,root,root)
%dir %{_includedir}/rpm
%{_includedir}/rpm/*.h
%{_libdir}/librpm.la
%{_libdir}/librpm.so
%{_libdir}/librpmbuild.la
%{_libdir}/librpmbuild.so
%{_libdir}/librpmio.la
%{_libdir}/librpmio.so
%{_libdir}/librpmsign.la
%{_libdir}/librpmsign.so
%{_libdir}/pkgconfig/rpm.pc
%doc ChangeLog README
%files -n python-rpm
%defattr(-,root,root)
%dir %{python_sitearch}/rpm
%{python_sitearch}/rpm/*
%files -n python-rpm-py3
%defattr(-,root,root)
%dir %{python3_sitearch}/rpm
%{python3_sitearch}/rpm/*
%changelog
* Fri Aug 14 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.3-2mamba
- preserve legacy python-rpm (python 2.7) and add python-rpm-py3
* Fri Aug 14 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.3-1mamba
- update to 4.14.3
- python-rpm: base on python3
* Tue May 05 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-14mamba
- arm: drop armv5t patch in favor of armv7l
* Sat Aug 31 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-13mamba
- find-lang.sh: patched to fix detection of qt translations
* Thu Aug 01 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-12mamba
- added patch to add %{_gnu} to %_target platform
* Wed Jul 24 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-11mamba
- x86_64: set libexecdir as libexec64; arm: force armv5t; set default_patch_fuzz to 1
* Mon Jul 22 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-10mamba
- added patch to remove 'Macro expanded in commit...' warnings
* Sun Jul 21 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-9mamba
- i586: patch rpmrc to set as default x86 arch; debuginfo: patch macros to rename suffix to debug
* Fri Jul 12 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-8mamba
- readd host and build options to configure
* Sun Jun 30 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-7mamba
- fix rpmdb upgrade by running a background scripts delayed
* Sat Jun 29 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-6mamba
- added patch to fix a segfault in checkInstalledFiles for missing installed translation files
* Tue Jun 25 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-5mamba
- install macros for default build environment with openmamba
* Mon Jun 24 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-4mamba
- better patch for rebuilddb from 5.2
* Sat Jun 22 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-3mamba
- rebuilt against external libdb53
* Fri Jun 21 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-2mamba
- patch to fix rebuilddb from rpm 5.2, --enable-python, create packager user and group
* Wed Jun 05 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.14.2.1-1mamba
- package created using the webbuild interface