RPM builder quick steps

Step 1, install rpm tools
[sourcecode]yum install rpmdevtools rpmlint[/sourcecode]

Step 2, set up working directory
[sourcecode]rpmdev-setuptree[/sourcecode]

Step 3, create and edit the spec file
[sourcecode]
cd rpmbuild/SPECS
rpmdev-newspec
[/sourcecode]

Miscellaneous commands:

show environment variables
[sourcecode]rpm –showrc[/sourcecode]
show specific variable
[sourcecode]rpm –eval %_usr[/sourcecode]

Procedures to simulate RPM building with Mock
– Build source rpm
[sourcecode]
rpmbuild -bs SPECS/myproject.spec
[/sourcecode]

– Mock the build, i.e., testing the build in an isolated building environment simulating a specific platform (Redhat or Fedora etc.)
[sourcecode]
mock -r platform_name SRPMS/myproject.src.rpm
[/sourcecode]

– If it’s a multiple-project task, mock install the first project first, and then mock build the 2nd, i.e.,
[sourcecode]
mock -r platform_name –install /mock_path/myproject.rpm
mock -r platform_name SRPMS/myproject2.src.rpm
[/sourcecode]

Leave a Reply