linux_wiki:rpm_building

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
linux_wiki:rpm_building [2015/10/23 16:20]
billdozor [Spec Example: Custom Scripts]
linux_wiki:rpm_building [2016/04/13 21:38]
billdozor [Setup Build Environment]
Line 4: Line 4:
  
 How to create RPM packages from source files. How to create RPM packages from source files.
 +
 +Resources:
 +  * [[https://fedoraproject.org/wiki/How_to_create_an_RPM_package]]
 +  * [[https://fedoraproject.org/wiki/Using_Mock_to_test_package_builds]]
  
 **Checklist** **Checklist**
-  * Distro: Enterprise Linux 6.x+  * Distro(s): Enterprise Linux 6
  
 ---- ----
Line 12: Line 16:
 ====== Setup Build Environment ====== ====== Setup Build Environment ======
  
-  * Add the [[linux_wiki:epel_repo|EPEL Repo]].+  * Add the [[linux_wiki:repos#epel|EPEL repo]].
  
   * Install packages   * Install packages
Line 125: Line 129:
 Summary: My Custom Scripts Summary: My Custom Scripts
 License: GPL+ License: GPL+
-URL: www.mysite.com +Source0: %{name}-%{version}.tar.gz
-SOURCE0: %{name}-%{version}.tar.gz+
  
 %description %description
Line 147: Line 150:
 mkdir -p %{buildroot} mkdir -p %{buildroot}
 cp -a * %{buildroot} cp -a * %{buildroot}
 +
 +# clean => remove files from buildrootdir; redundant in Fedora, EPEL still requires this
 +%clean
 +rm -rf %{buildroot}
  
 # files => set file permissions, owner, group, and what files/dirs to include # files => set file permissions, owner, group, and what files/dirs to include
-# %attr(<mode>, <user>, <group>) file 
 %files %files
 %attr(755, root, root) /opt/myscripts %attr(755, root, root) /opt/myscripts
Line 415: Line 421:
 ====== Mock to Test Dependencies ====== ====== Mock to Test Dependencies ======
  
 +  * **More Details**: [[https://fedoraproject.org/wiki/Using_Mock_to_test_package_builds]]
 +
 +\\
 Mock is used to rebuild binary RPMs from source RPMs in a clean environment to ensure you are not missing any dependencies in your SPEC file. Mock is used to rebuild binary RPMs from source RPMs in a clean environment to ensure you are not missing any dependencies in your SPEC file.
 +\\ 
  
 Install mock Install mock
-<code bash>yum install mock</code>+<code bash> 
 +yum install mock 
 +</code>
  
 +\\
 Add user to the mock group Add user to the mock group
-<code bash>usermod -a -G mock builder</code>+<code bash> 
 +usermod -a -G mock builder 
 +</code>
  
-**TODO**+\\ 
 +Set default mock config of the type of repos you are building for (ie EPEL 6, Fedora 23, etc) 
 + 
 +Example: Set default config to EPEL 6 x86_64 
 +<code bash> 
 +cd /etc/mock 
 +ln -sf epel-6-x86_64.cfg default.cfg 
 +</code> 
 + 
 +\\ 
 +Go to where your source RPMs were built and run mock against that package 
 +<code bash> 
 +cd ~/rpmbuild/SRPMS 
 +mock --rebuild myscripts-1.0.0-1.el6.src.rpm 
 +</code> 
 + 
 +\\ 
 +Results location is displayed (/var/lib/mock/epel-6-x86_64/result/) in the above example. 
 +<code bash> 
 +ls -l /var/lib/mock/epel-6-x86_64/result 
 +total 172 
 +-rw-rw-r-- 1 builder mock   4500 Oct 16 07:32 build.log 
 +-rw-rw-r-- 1 builder mock   2740 Oct 16 07:32 myscripts-1.0.0-1.el6.src.rpm 
 +-rw-rw-r-- 1 builder mock   2524 Oct 16 07:32 myscripts-1.0.0-1.el6.x86_64.rpm 
 +-rw-rw-r-- 1 builder mock 153606 Oct 16 07:32 root.log 
 +-rw-rw-r-- 1 builder mock    782 Oct 16 07:32 state.log 
 +</code>
  
 ---- ----
  • linux_wiki/rpm_building.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)