Building RPMS

From FedoraJunkies

Jump to: navigation, search

rpmbuild

  • rpmbuild - your best friend
  • Setting up fakeroot so that you as a normal user can install source rpms and build with a pre-created tree. Note yum of course must be done with super user privileges here.
yum install rpmdevtools
Dependencies Resolved
Downloading Packages:
(1/2): rpmdevtools-6.4-1. 100% |=========================|  64 kB    00:00
(2/2): fakeroot-1.6.4-15. 100% |=========================|  75 kB    00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing: fakeroot                     ######################### [1/2]
 Installing: rpmdevtools                  ######################### [2/2]
Installed: rpmdevtools.noarch 0:6.4-1.fc8
Dependency Installed: fakeroot.x86_64 0:1.6.4-15.fc7
Complete!
  • Drop SU and go back to your normal user to create your build tree:
[root@techsup1 x86_64]# logout
[scotth@techsup1 ~]$ rpmdev-setuptree
[scotth@techsup1 ~]$ ls -alh
drwxrwxr-x  7 scotth scotth 4.0K 2008-01-22 09:20 rpmbuild

Now we have a working build tree as a normal user, you can install src rpms as the normal user now and the spec and source files will go into this tree :)

[scotth@techsup1 ~]$ ls -alh rpmbuild
total 32K
drwxrwxr-x  7 scotth scotth 4.0K 2008-01-22 09:20 .
drwx------ 60 scotth scotth 4.0K 2008-01-22 09:20 ..
drwxrwxr-x  2 scotth scotth 4.0K 2008-01-22 09:20 BUILD
drwxrwxr-x  2 scotth scotth 4.0K 2008-01-22 09:20 RPMS
drwxrwxr-x  2 scotth scotth 4.0K 2008-01-22 09:20 SOURCES
drwxrwxr-x  2 scotth scotth 4.0K 2008-01-22 09:20 SPECS
drwxrwxr-x  2 scotth scotth 4.0K 2008-01-22 09:20 SRPMS
  • Below is an example of a install of a source rpm as a normal user and how it is placed into the rpmbuild tree within the home directory of that user.
[scotth@techsup1 ~]$ rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/releases/8/Fedora/source/SRPMS/grub-0.97-19.src.rpm
Retrieving http://download.fedora.redhat.com/pub/fedora/linux/releases/8/Fedora/source/SRPMS/grub-0.97-19.src.rpm
  1:grub                   ########################################### [100%]
[scotth@techsup1 ~]$ cd rpmbuild/SPECS/
[scotth@techsup1 SPECS]$ ls
grub.spec
Personal tools