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
linux_wiki:rpm_building [2015/10/23 16:46]
billdozor [Mock to Test Dependencies]
linux_wiki:rpm_building [2019/05/25 23:50] (current)
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 75: Line 79:
  
 Download source files, place a copy in rpmbuild's SOURCES directory. Download source files, place a copy in rpmbuild's SOURCES directory.
-  * Download the Xymon tar file +  * Download the Xymon tar file<code bash>wget http://downloads.sourceforge.net/project/xymon/Xymon/4.3.21/xymon-4.3.21.tar.gz</code> 
-    * <code bash>wget http://downloads.sourceforge.net/project/xymon/Xymon/4.3.21/xymon-4.3.21.tar.gz</code> +  * Extract<code bash>tar -zxvf xymon-4.3.21.tar.gz</code> 
-  * Extract +  * Copy the original tar file into rpmbuild's SOURCES<code bash>cp ~/xymon-4.3.21.tar.gz ~/rpmbuild/SOURCES/</code> 
-    * <code bash>tar -zxvf xymon-4.3.21.tar.gz</code> +  * Copy all files but "xymon.spec" from the xymon-4.3.21/rpm directory into SOURCES<code bash>cp ~/xymon-4.3.21/rpm/xymon-client* ~/rpmbuild/SOURCES/
-  * Copy the original tar file into rpmbuild's SOURCES +
-    * <code bash>cp ~/xymon-4.3.21.tar.gz ~/rpmbuild/SOURCES/</code> +
-  * Copy all files but "xymon.spec" from the xymon-4.3.21/rpm directory into SOURCES +
-    * <code bash>cp ~/xymon-4.3.21/rpm/xymon-client* ~/rpmbuild/SOURCES/+
 cp ~/xymon-4.3.21/rpm/xymon-init.d ~/rpmbuild/SOURCES/ cp ~/xymon-4.3.21/rpm/xymon-init.d ~/rpmbuild/SOURCES/
 cp ~/xymon-4.3.21/rpm/xymon.logrotate ~/rpmbuild/SOURCES/</code> cp ~/xymon-4.3.21/rpm/xymon.logrotate ~/rpmbuild/SOURCES/</code>
Line 125: Line 125:
 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 146:
 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 417:
 ====== 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>
  
 +\\
 Set default mock config of the type of repos you are building for (ie EPEL 6, Fedora 23, etc) Set default mock config of the type of repos you are building for (ie EPEL 6, Fedora 23, etc)
  
Line 431: Line 443:
 </code> </code>
  
 +\\
 Go to where your source RPMs were built and run mock against that package Go to where your source RPMs were built and run mock against that package
 <code bash> <code bash>
Line 437: Line 450:
 </code> </code>
  
 +\\
 Results location is displayed (/var/lib/mock/epel-6-x86_64/result/) in the above example. Results location is displayed (/var/lib/mock/epel-6-x86_64/result/) in the above example.
 <code bash> <code bash>
  • linux_wiki/rpm_building.1445633193.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)