Skip to the content.

RPM

如何不依赖 tarball 来实现

Source1: php.conf
Source2: php.ini
Source3: macros.php

install -m 644 $RPM_SOURCE_DIR/php.conf $RPM_BUILD_ROOT/etc/httpd/conf.d

%setup 修改 tarball 的位置

%post 和 %posttrans

posttrans 和 post 似乎只有这里才有意义 https://stackoverflow.com/questions/22456217/rpm-scriptlet-ordering-for-install-remove-upgrade-using-yum

uninstall 的脚本

rpm

如何创建软链接

https://serverfault.com/questions/82193/creating-symlink-in-usr-bin-when-creating-an-rpm

%{__ln_s} libcursor.so.%{version} %{buildroot}/usr/lib64/libcursor.so.1

文档

http://ftp.rpm.org/max-rpm/

[ ] https://unix.stackexchange.com/questions/330186/where-does-modprobe-load-a-driver-that-udev-requests

modporbe 是如何工作的

查找 changelog

rpm -q –changelog php less

-ba 和 -bb

https://bodhileafy.wordpress.com/2017/09/11/howto-rpmbuild-ba-and-rpmbuild-bb/

rpmbuild -ba and rpmbuild -bb are for spec files. rpmbuild -ba will generate both source and binary – src.rpm and .rpm rpmbuild -bb will generate binary only .rpm

%post 的作用

https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax

yum clean all

使用 aliyun 的源之后,

curl https://mirrors.aliyun.com/repo/Centos-7.repo -o /etc/yum.repos.d/CentOS-Base.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

yum makecache 存在如下报错:

[root@localhost 14:22:59 yum.repos.d]$ yum makecache
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base                                                                                                                                            | 3.6 kB  00:00:00
Not using downloaded base/repomd.xml because it is older than what we have:
  Current   : Wed Jul 10 11:42:30 2024
  Downloaded: Fri Oct 30 04:03:00 2020
extras                                                                                                                                          | 2.9 kB  00:00:00
Not using downloaded extras/repomd.xml because it is older than what we have:
  Current   : Wed Jul 10 11:42:34 2024
  Downloaded: Wed Apr  3 01:41:49 2024
updates                                                                                                                                         | 2.9 kB  00:00:00
Not using downloaded updates/repomd.xml because it is older than what we have:
  Current   : Wed Jul 10 11:42:52 2024
  Downloaded: Sat Jun 22 00:30:50 2024
Loading mirror speeds from cached hostfile
Metadata Cache Created

这个时候 yum clean all 可以解决问题

rpm macros

https://github.com/openeuler-mirror/openEuler-rpm-config/blob/master/macros

依赖关系

rpm -qp mypackage.rpm –provides rpm -qp mypackage.rpm –requires

避免额外依赖

https://stackoverflow.com/questions/16598201/disable-rpmbuild-automatic-requirement-finding 在 spec 中添加

AutoReqProv: no

rpmbuild –showrc

https://www.ichenfu.com/2017/11/20/rpmbuild-not-strip/

rpmbuild –showrc nixos 下,似乎很多环境都不太正常的

rpm uninstll 和 remove 的区别

https://stackoverflow.com/questions/7398834/rpm-upgrade-uninstalls-the-rpm

Install the first time:          1
Upgrade:                         2 or higher
                                 (depending on the number of versions installed)
Remove last version of package:  0

如何让 rpmbuild 不去 strip 一些文件

文件的冲突标准是,两个 pkg 提供的包是不是一模一样的

调试小技巧

真的给我干蒙了

 rpm --eval '%{__spec_install_post}'

–test 来测试而不是真的安装

rpm -ivh –test python3-perf rpm -Uvh –test python3-perf

rpm 常用命令

本站所有文章转发 CSDN 将按侵权追究法律责任,其它情况随意。