Patch-patch adaptation
el7 source code:
cloud-init-19.4-7.el7.src.rpm
Adaptation object:
cloud-init-19.4-7.el7.src.rpm
Background reproduction:
Update cloud-init, failed to execute rpmbuild -bp, and encountered a problem during patch adaptation
Background reproduction:
pushd /root/rpmbuild/SPECS/
rpmbuild -bp cloud-init.spec
popd
Find the problem:
First: check the source patch information:
Second: Find the corresponding file:
A) ls <your_path>/rpmbuild/BUILD (显然最新的版本信息和报错patch的不匹配)
[user@kvm230102:/your_path/rpmbuild/BUILD]
$ls /your_path/rpmbuild/BUILD
cloud-init-19.4
B) Check cloud.cfg (name: cloud_user information lines in the latest cloud.cfg do not match)
The corresponding information of the old patch is as follows:
the name of the latest cloud.cfg: cloud_user is line 57
Re-adaptation:
First: Back up the cloud-init-19.4 directory:
cd $your_path/rpmbuild/BUILD
cp -rfa cloud-init-19.4 cloud-init-19.4.orig
Second: Modify the cloud.cfg information in cloud-init-19.4:
vim cloud-init-19.4/rhel/cloud.cfg
Third: Re-play the patch and replace the old patch in the cloud-init local warehouse
diff -Nuar cloud-init-19.4.orig/ cloud-init-19.4/> cloud-init-alinux-user.patch
$cat cloud-init-huaweilinux-user.patch
diff -Nuar cloud-init-19.4.orig/rhel/cloud.cfg cloud-init-19.4/rhel/cloud.cfg
--- cloud-init-19.4.orig/rhel/cloud.cfg 2020-11-02 13:46:51.140147587 +0800
+++ cloud-init-19.4/rhel/cloud.cfg 2020-11-02 14:27:46.832423249 +0800
@@ -54,7 +54,7 @@
system_info:
default_user:
- name: cloud-user
+ name: huaweilinux
lock_passwd: true
gecos: Cloud User
groups: [adm, systemd-journal]
Finally: After the patch is completed, adapt and verify again <pass>: