From 7527e4a9e51530433b2484e3e4c1dbdb96d6a4fc Mon Sep 17 00:00:00 2001 From: Zhongling He Date: Thu, 13 Apr 2023 15:36:49 +0800 Subject: [PATCH] refactor rpm spec --- rpm.spec | 351 +++++++++++++++++++++++++++---------------------------- 1 file changed, 170 insertions(+), 181 deletions(-) diff --git a/rpm.spec b/rpm.spec index aa5c741..8daa893 100644 --- a/rpm.spec +++ b/rpm.spec @@ -1,27 +1,14 @@ -%define anolis_release 6 +%define anolis_release 7 %define rpmhome /usr/lib/rpm - -# run internal testsuite? -# fakechroot is severely broken, disable it %bcond_with check - -# build against xz? %bcond_without xz -# build with plugins? %bcond_without plugins -# build with libarchive? (needed for rpm2archive) %bcond_without libarchive -# build with libimaevm.so %bcond_without libimaevm -# build with fsverity support? %bcond_with fsverity -# build with zstd support? %bcond_without zstd -# build with ndb backend? %bcond_without ndb -# build with sqlite support? %bcond_without sqlite -# build with bdb_ro support? %bcond_without bdb_ro %global rpmver 4.18.0 @@ -43,80 +30,61 @@ Source20: rpmdb-migrate.service Source21: rpmdb_migrate Patch0: rpm-4.17.x-rpm_dbpath.patch - -# Partially GPL/LGPL dual-licensed and some bits with BSD -# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD License: GPLv2+ +BuildRequires: automake libtool system-rpm-config systemd-rpm-macros make gawk +BuildRequires: elfutils-devel >= 0.112 elfutils-libelf-devel +BuildRequires: readline-devel zlib-devel openssl-devel ncurses-devel +BuildRequires: popt-devel >= 1.10.2 file-devel gettext-devel libacl-devel +BuildRequires: bzip2-devel >= 0.9.0c pkgconfig(lua) >= 5.2 libcap-devel + Requires: coreutils Requires: popt >= 1.10.2.1 Requires: curl Obsoletes: python2-rpm < %{version}-%{release} %if %{with check} -BuildRequires: fakechroot gnupg2 -BuildRequires: debugedit >= 0.3 +BuildRequires: fakechroot gnupg2 debugedit >= 0.3 %endif -# XXX generally assumed to be installed but make it explicit as rpm -# is a bit special... -BuildRequires: system-rpm-config -BuildRequires: systemd-rpm-macros -BuildRequires: gcc make -BuildRequires: gawk -BuildRequires: elfutils-devel >= 0.112 -BuildRequires: elfutils-libelf-devel -BuildRequires: readline-devel zlib-devel -BuildRequires: openssl-devel -# The popt version here just documents an older known-good version -BuildRequires: popt-devel >= 1.10.2 -BuildRequires: file-devel -BuildRequires: gettext-devel -BuildRequires: ncurses-devel -BuildRequires: bzip2-devel >= 0.9.0c -BuildRequires: pkgconfig(lua) >= 5.2 -BuildRequires: libcap-devel -BuildRequires: libacl-devel -%if %{with xz} -BuildRequires: xz-devel >= 4.999.8 +%if %{with plugins} +BuildRequires: libselinux-devel dbus-devel audit-libs-devel %endif -%if %{with libarchive} -BuildRequires: libarchive-devel + +%if %{with libimaevm} +BuildRequires: ima-evm-utils-devel >= 1.0 %endif -%if %{with zstd} -BuildRequires: libzstd-devel + +%if %{with fsverity} +BuildRequires: fsverity-utils-devel %endif + %if %{with sqlite} BuildRequires: sqlite-devel %endif -# Couple of patches change makefiles so, require for now... -BuildRequires: automake libtool -%if %{with plugins} -BuildRequires: libselinux-devel -BuildRequires: dbus-devel -BuildRequires: audit-libs-devel +%if %{with zstd} +BuildRequires: libzstd-devel %endif -%if %{with libimaevm} -BuildRequires: ima-evm-utils-devel >= 1.0 +%if %{with libarchive} +BuildRequires: libarchive-devel %endif -%if %{with fsverity} -BuildRequires: fsverity-utils-devel +%if %{with xz} +BuildRequires: xz-devel >= 4.999.8 %endif -# For the rpmdb migration scriptlet (#2055033) -Requires(pre): coreutils -Requires(pre): findutils -Requires(pre): sed +Requires(pre): coreutils findutils sed %description -The RPM Package Manager (RPM) is a powerful command line driven -package management system capable of installing, uninstalling, -verifying, querying, and updating software packages. Each software -package consists of an archive of files along with information about -the package like its version, a description, etc. +RPM Package Manager (RPM) is a free and open-source tool that enables you to +install, remove, update, verify and manage software packages on Linux-based +systems. RPM packages are files that contain the compiled version of a +software project, along with metadata such as its name, version, description +and dependencies. You can also create and distribute source RPM packages +(SRPMs), which contain the source code and instructions for building a binary +RPM package. %package libs Summary: Libraries for manipulating RPM packages @@ -124,7 +92,14 @@ License: GPLv2+ and LGPLv2+ with exceptions Requires: %{name} = %{version}-%{release} %description libs -This package contains the RPM shared libraries. +This package contains the RPM shared libraries. + +The RPM shared libraries are used by dynamic executables +that depend on them at run time. They can be installed in different locations +and configured with ldconfig or rpath . The RPM shared libraries have different +versions and symbols that are tracked by RPM using the soname and unique +identifiers . This package allows you to build packages that are compatible +with the RPM shared libraries on your system. %package build-libs Summary: Libraries for building RPM packages @@ -132,7 +107,8 @@ License: GPLv2+ and LGPLv2+ with exceptions Requires: rpm-libs = %{version}-%{release} %description build-libs -This package contains the RPM shared libraries for building packages. +This package provides the RPM shared libraries that are needed for creating +packages with RPM. %package sign-libs Summary: Libraries for signing RPM packages @@ -141,7 +117,12 @@ Requires: rpm-libs = %{version}-%{release} Requires: %{_bindir}/gpg2 %description sign-libs -This package contains the RPM shared libraries for signing packages. +This package provides the RPM shared libraries for package signing. Package +signing is a process of adding a digital signature to an RPM package to +verify its integrity and authenticity. The rpm utility uses GPG keys to sign +and verify packages. The sign-libs package contains the libraries that +implement the signing and verification algorithms for RPM. This package is +required for building and installing signed RPM packages. %package devel Summary: Development files for manipulating RPM packages @@ -153,12 +134,11 @@ Requires: %{name}-sign-libs = %{version}-%{release} 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 that -manipulate RPM packages and databases. These files are intended to -simplify the process of creating graphical package managers or any -other tools that need an intimate knowledge of RPM packages in order -to function. +This package includes the C library and header files for RPM. These development +files allow you to write programs that can manipulate RPM packages and +databases. These files are designed to make it easier to create graphical +package managers or any other tools that require a deep understanding of +RPM packages to function. This package should be installed if you want to develop programs that will manipulate RPM packages and databases. @@ -179,8 +159,14 @@ Suggests: gdb-minimal Requires: system-rpm-config %description build -The rpm-build package contains the scripts and executable programs -that are used to build packages using the RPM Package Manager. +The rpm-build package enables you to create binary and source packages using +the RPM Package Manager. A package is a collection of files and meta-data that +can be installed and removed from a system. The meta-data contains information +such as scripts, attributes, and descriptions of the package. The rpm-build +package provides the tools and scripts that are required to build packages +from source code or pre-compiled binaries. You can use the rpm-build package +to create custom packages for your own software or modify existing packages +to suit your needs. %package sign Summary: Package signing support @@ -199,20 +185,24 @@ Obsoletes: %{name}-python3 < %{version}-%{release} Obsoletes: platform-python-%{name} < %{version}-%{release} %description -n python3-%{name} -The python3-rpm package contains a module that permits applications -written in the Python programming language to use the interface -supplied by RPM Package Manager libraries. - -This package should be installed if you want to develop Python 3 -programs that will manipulate RPM packages and databases. +python3-rpm provides a module that allows you to use the interface provided by +RPM libraries in your Python 3 code. You can access various functions and +classes related to RPM packages and databases using this module. + +If you are developing Python 3 applications that need to interact with RPM +Package Manager libraries, you should install the python3-rpm package. %package apidocs Summary: API documentation for RPM libraries BuildArch: noarch %description apidocs -This package contains API documentation for developing applications -that will manipulate RPM packages and databases. +This package provides API documentation for RPM libraries that can be used to +create applications that work with RPM packages and databases. The documentation +covers various aspects of RPM development, such as package building, dependency +resolution, signature verification, and transaction management. The documentation +is generated using Doxygen and can be browsed online or offline. The package is +useful for developers who want to learn more about the RPM internals and APIs. %package cron Summary: Create daily logs of installed packages. @@ -220,8 +210,10 @@ BuildArch: noarch Requires: crontabs logrotate rpm = %{version}-%{release} %description cron -This package contains a cron job which creates daily logs of installed -packages on a system. +rpm-cron is a package that contains a cron job for logging the packages +installed on a system on a daily basis. Cron is a service that allows you +to schedule tasks to run at regular intervals. The rpm-cron package is useful +for keeping track of the changes in the system's package inventory. %if %{with plugins} %package plugin-selinux @@ -244,8 +236,16 @@ Summary: Rpm plugin for systemd inhibit functionality Requires: rpm-libs = %{version}-%{release} %description plugin-systemd-inhibit -This plugin blocks systemd from entering idle, sleep or shutdown while an rpm -transaction is running using the systemd-inhibit mechanism. +This plugin for RPM uses the systemd-inhibit mechanism to block the system from +going into idle, sleep or shutdown mode while an rpm transaction is in progress. +This prevents possible system damage that could result from a transaction being +aborted by a reboot. +For more details on how this mechanism works, see systemd-inhibit(1). It is +highly recommended to install this plugin on all systems that use systemd as +the init system and have the DBUS system bus available. If the plugin cannot +access the inhibit interface, it will issue a warning but will not stop the +transaction. There are no specific options for this plugin. See rpm-plugins(8) +for general information on how to control plugins. %package plugin-ima Summary: Rpm plugin ima file signatures @@ -282,24 +282,22 @@ Requires: rpm-libs = %{version}-%{release} Summary: Rpm plugin for fapolicyd support Requires: rpm-libs = %{version}-%{release} Provides: fapolicyd-plugin = %{version}-%{release} -# fapolicyd-dnf-plugin currently at 1.0.4 Obsoletes: fapolicyd-dnf-plugin < 1.0.5 %description plugin-fapolicyd %{summary}. - %package plugin-dbus-announce Summary: Rpm plugin for announcing transactions on the DBUS Requires: rpm-libs = %{version}-%{release} %description plugin-dbus-announce -The plugin announces basic information about rpm transactions to the -system DBUS - like packages installed or removed. Other programs can -subscribe to the signals to get notified when packages on the system -change. +This plugin broadcasts basic information about rpm transactions to the system +DBUS, such as which packages are being installed or removed. This way, other +applications can listen to the signals and get updated on the changes in the +system packages. This plugin is useful for open source software development +and testing on Linux operating systems. -# with plugins %endif %prep @@ -310,7 +308,6 @@ change. autoreconf -i -f -# Hardening hack taken from macro %%configure defined in system-rpm-config for i in $(find . -name ltmain.sh) ; do %{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i done; @@ -320,30 +317,28 @@ done; [ -x /usr/lib/rpm/anolis/fix-libtool-from-moving-options-after-libs ] && /usr/lib/rpm/anolis/fix-libtool-from-moving-options-after-libs . [ -x /usr/lib/rpm/anolis/fix-dlsearch-path-in-libtool ] && /usr/lib/rpm/anolis/fix-dlsearch-path-in-libtool . %{_lib} -# Using configure macro has some unwanted side-effects on rpm platform -# setup, use the old-fashioned way for now only defining minimal paths. ./configure \ - --prefix=%{_usr} \ - --sysconfdir=%{_sysconfdir} \ - --localstatedir=%{_var} \ - --sharedstatedir=%{_var}/lib \ - --libdir=%{_libdir} \ - --build=%{_target_platform} \ - --host=%{_target_platform} \ - --with-vendor=anolis \ - %{!?with_plugins: --disable-plugins} \ - --with-selinux \ - --with-cap \ - --with-acl \ - --with-fapolicyd \ - %{?with_ndb: --enable-ndb} \ - %{?with_libimaevm: --with-imaevm} \ - %{?with_fsverity: --with-fsverity} \ - %{?with_zstd: --enable-zstd} \ - %{?with_sqlite: --enable-sqlite} \ - %{?with_bdb_ro: --enable-bdb-ro} \ + --with-crypto=openssl \ --enable-python \ - --with-crypto=openssl + %{?with_bdb_ro: --enable-bdb-ro} \ + %{?with_sqlite: --enable-sqlite} \ + %{?with_zstd: --enable-zstd} \ + %{?with_fsverity: --with-fsverity} \ + %{?with_libimaevm: --with-imaevm} \ + %{?with_ndb: --enable-ndb} \ + --with-fapolicyd \ + --with-acl \ + --with-cap \ + --with-selinux \ + %{!?with_plugins: --disable-plugins} \ + --with-vendor=anolis \ + --host=%{_target_platform} \ + --build=%{_target_platform} \ + --libdir=%{_libdir} \ + --sharedstatedir=%{_var}/lib \ + --localstatedir=%{_var} \ + --sysconfdir=%{_sysconfdir} \ + --prefix=%{_usr} %make_build @@ -354,8 +349,6 @@ popd %install %make_install -# We need to build with --enable-python for the self-test suite, but we -# actually package the bindings built with setup.py (#531543#c26) pushd python %py3_install popd @@ -367,7 +360,6 @@ install -m 644 %{SOURCE20} $RPM_BUILD_ROOT/%{_unitdir} mkdir -p $RPM_BUILD_ROOT%{rpmhome} install -m 755 %{SOURCE21} $RPM_BUILD_ROOT/%{rpmhome} -# Save list of packages through cron mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily install -m 755 scripts/rpm.daily ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily/rpm @@ -378,20 +370,17 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm mkdir -p $RPM_BUILD_ROOT%{rpmhome}/macros.d mkdir -p $RPM_BUILD_ROOT/usr/lib/sysimage/rpm -# init an empty database for %ghost'ing for all supported backends for be in %{?with_ndb:ndb} %{?with_sqlite:sqlite}; do ./rpmdb --define "_db_backend ${be}" --dbpath=${PWD}/${be} --initdb cp -va ${be}/. $RPM_BUILD_ROOT/usr/lib/sysimage/rpm/ done -# some packages invoke find-debuginfo directly, preserve compat for now ln -s ../../bin/find-debuginfo $RPM_BUILD_ROOT/usr/lib/rpm/find-debuginfo.sh %find_lang rpm find $RPM_BUILD_ROOT -name "*.la"|xargs rm -f -# These live in perl-generators and python-rpm-generators now rm -f $RPM_BUILD_ROOT/%{rpmhome}/{perldeps.pl,perl.*,pythond*} rm -f $RPM_BUILD_ROOT/%{_fileattrsdir}/{perl*,python*} rm -rf $RPM_BUILD_ROOT/var/tmp @@ -401,12 +390,10 @@ rm -rf $RPM_BUILD_ROOT/var/tmp %if %{with check} %check make check TESTSUITEFLAGS=-j%{_smp_build_ncpus} || (cat tests/rpmtests.log; exit 1) -# rpm >= 4.16.0 testsuite leaves a read-only tree behind, clean it up make clean %endif %pre -# Symlink all rpmdb files to the new location if we're still using /var/lib/rpm if [ -d /var/lib/rpm ]; then mkdir -p /usr/lib/sysimage/rpm rpmdb_files=$(find /var/lib/rpm -maxdepth 1 -type f | sed 's|^/var/lib/rpm/||g' | sort) @@ -416,7 +403,6 @@ if [ -d /var/lib/rpm ]; then fi %triggerun -- rpm < 4.17.0 -# Handle rpmdb migrate service on erasure of old to avoid ordering issues if [ -x /usr/bin/systemctl ]; then systemctl --no-reload preset rpmdb-migrate ||: fi @@ -430,6 +416,11 @@ fi %license COPYING %doc CREDITS docs/manual/[a-z]* +%exclude %{abidir}/rpmsign-option.list +%exclude %{abidir}/rpmbuild-option.list +%exclude %{abidir}/rpmspec-option.list +%exclude %{abidir}/rpmlua-option.list + %{_unitdir}/rpmdb-rebuild.service %{_unitdir}/rpmdb-migrate.service @@ -439,53 +430,49 @@ fi %attr(0644, root, root) %ghost %config(missingok,noreplace) /usr/lib/sysimage/rpm/* %attr(0644, root, root) %ghost /usr/lib/sysimage/rpm/.*.lock -%{_bindir}/rpm -%{_bindir}/rpm2archive -%{_bindir}/rpm2cpio -%{_bindir}/rpmdb -%{_bindir}/rpmkeys -%{_bindir}/rpmquery %{_bindir}/rpmverify +%{_bindir}/rpmquery +%{_bindir}/rpmkeys +%{_bindir}/rpmdb +%{_bindir}/rpm2cpio +%{_bindir}/rpm2archive +%{_bindir}/rpm %{abidir}/rpm*-option.list -%exclude %{abidir}/rpmsign-option.list -%exclude %{abidir}/rpmbuild-option.list -%exclude %{abidir}/rpmspec-option.list -%exclude %{abidir}/rpmlua-option.list - -%{_mandir}/man8/rpm.8* -%{_mandir}/man8/rpmdb.8* -%{_mandir}/man8/rpmkeys.8* -%{_mandir}/man8/rpm2archive.8* -%{_mandir}/man8/rpm2cpio.8* -%{_mandir}/man8/rpm-misc.8* -%{_mandir}/man8/rpm-plugins.8* - -# XXX this places translated manuals to wrong package wrt eg rpmbuild -%lang(fr) %{_mandir}/fr/man[18]/*.[18]* -%lang(ko) %{_mandir}/ko/man[18]/*.[18]* -%lang(ja) %{_mandir}/ja/man[18]/*.[18]* -%lang(pl) %{_mandir}/pl/man[18]/*.[18]* -%lang(ru) %{_mandir}/ru/man[18]/*.[18]* -%lang(sk) %{_mandir}/sk/man[18]/*.[18]* %attr(0755, root, root) %dir %{rpmhome} -%{rpmhome}/macros -%{rpmhome}/macros.d -%{rpmhome}/lua -%{rpmhome}/rpmpopt* -%{rpmhome}/rpmrc - -%{rpmhome}/rpmdb_* -%{rpmhome}/rpm.daily -%{rpmhome}/rpm.log -%{rpmhome}/rpm.supp -%{rpmhome}/rpm2cpio.sh %{rpmhome}/tgpg +%{rpmhome}/rpm2cpio.sh +%{rpmhome}/rpm.supp +%{rpmhome}/rpm.log +%{rpmhome}/rpm.daily +%{rpmhome}/rpmdb_* + +%{rpmhome}/rpmrc +%{rpmhome}/rpmpopt* +%{rpmhome}/lua +%{rpmhome}/macros.d +%{rpmhome}/macros %{rpmhome}/platform %dir %{rpmhome}/fileattrs +%{_mandir}/man8/rpm-plugins.8* +%{_mandir}/man8/rpm-misc.8* +%{_mandir}/man8/rpm2cpio.8* +%{_mandir}/man8/rpm2archive.8* +%{_mandir}/man8/rpmkeys.8* +%{_mandir}/man8/rpmdb.8* +%{_mandir}/man8/rpm.8* + +# XXX this places translated manuals to wrong package wrt eg rpmbuild +%lang(sk) %{_mandir}/sk/man[18]/*.[18]* +%lang(ru) %{_mandir}/ru/man[18]/*.[18]* +%lang(pl) %{_mandir}/pl/man[18]/*.[18]* +%lang(ja) %{_mandir}/ja/man[18]/*.[18]* +%lang(ko) %{_mandir}/ko/man[18]/*.[18]* +%lang(fr) %{_mandir}/fr/man[18]/*.[18]* + %{abidir}/_rpm*.dump @@ -539,7 +526,6 @@ fi %{_libdir}/rpm-plugins/audit.so %{abidir}/audit.dump %{_mandir}/man8/rpm-plugin-audit.8* -# with plugins %files plugin-dbus-announce %{_libdir}/rpm-plugins/dbus_announce.so @@ -559,6 +545,19 @@ fi %{abidir}/librpmsign*.dump %files build +%{rpmhome}/rpmuncompress +%{rpmhome}/find-debuginfo.sh +%{rpmhome}/fileattrs/* +%{rpmhome}/mkinstalldirs +%{rpmhome}/*.req +%{rpmhome}/*.prov +%{rpmhome}/*deps* +%{rpmhome}/*requires* +%{rpmhome}/*provides* +%{rpmhome}/find-lang.sh +%{rpmhome}/check-* +%{rpmhome}/brp-* + %{_bindir}/rpmbuild %{_bindir}/gendiff %{_bindir}/rpmspec @@ -573,19 +572,6 @@ fi %{_mandir}/man8/rpmspec.8* %{_mandir}/man8/rpmlua.8* -%{rpmhome}/brp-* -%{rpmhome}/check-* -%{rpmhome}/find-lang.sh -%{rpmhome}/*provides* -%{rpmhome}/*requires* -%{rpmhome}/*deps* -%{rpmhome}/*.prov -%{rpmhome}/*.req -%{rpmhome}/mkinstalldirs -%{rpmhome}/fileattrs/* -%{rpmhome}/find-debuginfo.sh -%{rpmhome}/rpmuncompress - %files sign %{_bindir}/rpmsign %{abidir}/rpmsign-option.list @@ -596,12 +582,12 @@ fi %{python3_sitearch}/rpm-%{rpmver}*.egg-info %files devel -%{_mandir}/man8/rpmgraph.8* -%{_bindir}/rpmgraph -%{abidir}/rpmgraph-option.list -%{_libdir}/librp*[a-z].so -%{_libdir}/pkgconfig/rpm.pc %{_includedir}/rpm/ +%{_libdir}/pkgconfig/rpm.pc +%{_libdir}/librp*[a-z].so +%{abidir}/rpmgraph-option.list +%{_bindir}/rpmgraph +%{_mandir}/man8/rpmgraph.8* %files cron %{_sysconfdir}/cron.daily/rpm @@ -612,6 +598,9 @@ fi %doc docs/librpm/html/* %changelog +* Thu Apr 13 2023 Zhongling - 4.18.0-7 +- Refactor rpm spec + * Thu Mar 30 2023 mgb01105731 - 4.18.0-6 - Del Specific Fields -- Gitee