Creating An RPM for openSUSE - some notes

Posted on Sun 24 March 2013 in misc

I wanted to create an rpm for SuSE which I had not done before. Here are some notes on the process.

I created a user on my machine for this process called rpmbuilder.

Create a folder for development and create the layout for developing rpms

mkdir rpmdevenv; cd rpmdevenv

mkdir BUILD RPMS SOURCES SPECS SRPMS

Create the file ~/.rpmmacros with

%packager       High Fructose Corn Syrup

%_topdir        /home/rpmbuilder/rpmdevenv

%_rpmtopdir     %{_topdir}
%_builddir      %{_rpmtopdir}/BUILD
%_rpmdir        %{_rpmtopdir}/RPMS
%_sourcedir     %{_rpmtopdir}/SOURCES
%_specdir       %{_rpmtopdir}/SPECS
%_srcrpmdir     %{_rpmtopdir}/SRPMS

Add source code to SOURCES

Add .spec file to SPECS

Build the rpm from the SPEC

rpmbuild -ba SPECS/something.spec

Some good references

http://fedoraproject.org/wiki/How_to_create_an_RPM_package

http://fedoraproject.org/wiki/Packaging:NamingGuidelines

http://en.opensuse.org/openSUSE:Specfile_guidelines

http://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros

http://www.techrepublic.com/article/making-rpms-part-4-finishing-the-spec-file/5033542 (four parts)

rpm