Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:rpm_building [2015/10/23 16:45] 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:// | ||
+ | * [[https:// | ||
**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: | + | * Add the [[linux_wiki: |
* Install packages | * Install packages | ||
Line 75: | Line 79: | ||
Download source files, place a copy in rpmbuild' | Download source files, place a copy in rpmbuild' | ||
- | * Download the Xymon tar file | + | * Download the Xymon tar file< |
- | * <code bash> | + | * Extract< |
- | * Extract | + | * Copy the original tar file into rpmbuild' |
- | * <code bash>tar -zxvf xymon-4.3.21.tar.gz</ | + | * Copy all files but " |
- | * Copy the original tar file into rpmbuild' | + | |
- | * <code bash>cp ~/ | + | |
- | * Copy all files but " | + | |
- | * <code bash>cp ~/ | + | |
cp ~/ | cp ~/ | ||
cp ~/ | cp ~/ | ||
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; | ||
+ | %clean | ||
+ | rm -rf %{buildroot} | ||
# files => set file permissions, | # files => set file permissions, | ||
- | # %attr(< | ||
%files | %files | ||
%attr(755, root, root) / | %attr(755, root, root) / | ||
Line 415: | Line 417: | ||
====== Mock to Test Dependencies ====== | ====== Mock to Test Dependencies ====== | ||
+ | * **More Details**: [[https:// | ||
+ | |||
+ | \\ | ||
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 bash> |
+ | yum install mock | ||
+ | </ | ||
+ | \\ | ||
Add user to the mock group | Add user to the mock group | ||
- | <code bash> | + | <code bash> |
+ | usermod -a -G mock builder | ||
+ | </ | ||
+ | \\ | ||
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: | ||
</ | </ | ||
+ | \\ | ||
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: | ||
</ | </ | ||
+ | \\ | ||
Results location is displayed (/ | Results location is displayed (/ | ||
<code bash> | <code bash> | ||
- | ls / | + | ls -l / |
- | + | total 172 | |
- | build.log | + | -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 | ||
</ | </ | ||
---- | ---- |