工具安装
1
2
|
yum install -y rpm-build rpmrebuild
yum install -y rpmdevtools
|
环境初始化
创建目录
提取 SPEC
1
|
rpmrebuild -s ~/rpmbuild/SPECS/aaa.spec -p xxx.rpm
|
RPM 包解压
1
|
rpm2cpio xxx.rpm | cpio -div
|
复制文件到 ~/rpmbuild/BUILDROOT/xxx 目录下
自定义修改 SPEC 文件
rpmdev-newspec -o hello.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
Name: hello
Version: 1.0
Release: 1%{?dist}
Summary: This is my first rpm
License: GPLv3+
Source0: %{name}-%{version}.tar.gz
%description
This is my first rpm.
%prep
echo "prep"
%setup -q
%build
echo "build"
%install
chmod +x hello.py
mkdir -p %{buildroot}%{_bindir}
install -m 755 hello.py %{buildroot}%{_bindir}
%files
%{_bindir}/hello.py
%doc
%changelog
|
重新打包
1
|
rpmbuild -bb hello.spec
|
关闭 python 自动编译为 pyc、pyo 文件
注释文件/usr/lib/rpm/redhat/macros里的/usr/lib/rpm/brp-python-bytecompile