How to realize ceph-deploy source code to make rpm package
This article mainly introduces how to achieve ceph-deploy source code to make rpm package, the article introduces in great detail, has a certain reference value, interested friends must read it!
Making rpm package with ceph-deploy Source Code
To compile and package rpm:
Modify the version number in the setup.cfg file in the code
Add the PKG-INFO file in the code setup.cfg sibling directory, and modify the version number to keep the same as in setup.cfg (the PKG-INFO file can be obtained from the. egg-info folder of the project, or from the rpm source reference of centsos)
Rename the code with the version number and type it into a .tar.gz package
Copy .tar.gz files, files under the spec script project (except .spec files) to the user's rpmbuild/SOURCES directory
Copy the .spec file to the user's rpmbuild/SPECS
Execute rpmbuild-ba [spec file] to package the binary package and the source package
Environmental preparation
CentOS Linux release 7.2.1511 (Core)
Ceph-deploy-1.5.36-0.src.rpm
Create a user
Create a separate user ceph to create rpm for security
one
[root@node ~] # useradd ceph
Set the password of the user ceph
one
two
three
four
five
six
[root@node ~] # passwd ceph
Changing password for user ceph.
New password:
BAD PASSWORD: The password fails the dictionary check-it is too simplistic/systematic
Retype new password:
Passwd: all authentication tokens updated successfully.
Create a rpmbuild directory
Switch accounts
one
[root@node ~] # su ceph
Add a configuration file and set the compiled root directory to ~ / rpmbuild
one
[root@node root] $vi ~ / .rpmmacros
Add content
% _ topdir / home/ceph/rpmbuild/
Wq save exit
Create the directory we need under the compiled root
one
two
three
four
five
six
seven
eight
nine
ten
[root@node root] $cd ~
[root@node ~] $mkdir rpmbuild
[root@node] $cd ~ / rpmbuild
[root@node rpmbuild] $mkdir-pv {BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
Mkdir: created directory 'BUILD'
Mkdir: created directory 'BUILDROOT'
Mkdir: created directory 'RPMS'
Mkdir: created directory 'SOURCES'
Mkdir: created directory 'SPECS'
Mkdir: created directory 'SRPMS'
The six file directories under rpmbuild are
BUILD source code decompressed storage directory BUILDROOT compilation temporary directory RPMS completed RPM package storage directory, which contains the platform-related subdirectories SOURCES collected source materials, patch storage location SPECS SPEC file storage directory SRMPS stores the directory generated by SRMPS compiled rpm package
Type the modified code directory ceph-deploy-1.5.36 into a .tar.bz2 file
one
two
[root@node ~] # cd / opt
[root@node ~] # tar jcf ceph-deploy-1.5.36.tar.bz2 ceph-deploy-1.5.36
Copy ceph-deploy-1.5.36.tar.bz2 to the / home/ceph/rpmbuild/SOURCES directory
one
[root@node ~] # cp / opt/ceph-deploy-1.5.36/ceph-deploy-1.5.36.tar.bz2 / home/ceph/rpmbuild/SOURCES
Copy ceph-deploy.spec to the / home/ceph/rpmbuild/SPECS directory
one
[root@node ~] # cp / opt/ceph-deploy-1.5.36/ceph-deploy.spec / home/ceph/rpmbuild/SPECS
Compilation and packaging
one
two
three
[root@node ~] # su ceph
[root@node root] $cd / home/ceph/rpmbuild/SPECS
[root@node SPECS] $rpmbuild-ba ceph-deploy.spec
After the execution is completed
Generate source code package in / home/ceph/rpmbuild/SRPMS/
Generate binary package ceph-deploy-1.5.36-0.noarch.rpm in / home/ceph/rpmbuild/RPMS/noarch/
The above is all the content of this article "how to achieve ceph-deploy source code to make rpm package". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!