Provides changes to the automake.mk file in the rhel/ directory to utilize mock
instead of rpmbuild for the rpm-fedora build target. The usage of mock provides
an isolated environment for building packages, and makes things reproducible in
various environment by relying on the spec file for a list of dependencies to
install.

Documentation has been updated to reflect this change by noting that mock is a
package dependency.

It has also been noted that the existing package list for buil dependencies
remains unchanged for now, as the kmod packages are still utilizing rpmbuild. A
submission in the future will update the rpm-fedora-kmod build target to work
in a similar manner to what is being provided here.

Signed-off-by: Leif Madsen <lmad...@redhat.com>
---
 AUTHORS           |  1 +
 INSTALL.Fedora.md | 19 ++++++++++++++++---
 rhel/automake.mk  | 15 ++++++++++++---
 3 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 9fda4c1..18c1d3a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -133,6 +133,7 @@ Kyle Upton              kup...@baymicrosystems.com
 Lance Richardson        lrich...@redhat.com
 Lars Kellogg-Stedman    l...@redhat.com
 Lei Huang               huang.f....@gmail.com
+Leif Madsen             lmad...@redhat.com
 Leo Alterman            lalter...@nicira.com
 Lilijun                 jerry.lili...@huawei.com
 Linda Sun               l...@vmware.com
diff --git a/INSTALL.Fedora.md b/INSTALL.Fedora.md
index 12d9a72..5fff636 100644
--- a/INSTALL.Fedora.md
+++ b/INSTALL.Fedora.md
@@ -12,8 +12,13 @@ for RHEL 7.x and its derivatives, including CentOS 7.x and 
Scientific Linux
 
 Build Requirements
 ------------------
-The tools and packages that are required for building Open vSwitch are
-documented in [INSTALL.md]. Specific packages (by package name) include:
+The only package required for building Open vSwitch is `mock` as all
+dependencies will be automatically installed from the package list within the
+RPM spec files. The tools and packages that are required for building Open 
vSwitch are
+documented in [INSTALL.md].
+
+However, to build the kmod packages require the following specific packages
+(by package name):
 
   - rpm-build
   - autoconf automake libtool
@@ -57,7 +62,8 @@ cd openvswitch-x.y.z
 ### Building the User-Space RPMs
 To build Open vSwitch user-space RPMs, after having completed the appropriate
 preparation steps described above, execute the following from the directory
-in which `./configure` was executed:
+in which `./configure` was executed. The build will be done within `mock`,
+allowing for reproducible builds in an isolated environment.
 
 ```
 make rpm-fedora
@@ -68,6 +74,13 @@ This will create the RPMs `openvswitch`, 
`python-openvswitch`,
 `openvswitch-ovn-central`, `openvswitch-ovn-host`, `openvswitch-ovn-vtep`,
 `openvswitch-ovn-docker`, and `openvswitch-debuginfo`.
 
+The default build root is Fedora 23 x86_64 (/etc/mock/fedora-23-x86_64.cfg). To
+change the default build root you can pass RPMBUILD_ROOT environment variable:
+
+```
+make rpm-fedora RPMBUILD_ROOT="epel-7-x86_64"
+```
+
 To enable DPDK support in the openvswitch package,
 the `--with dpdk` option can be added:
 
diff --git a/rhel/automake.mk b/rhel/automake.mk
index dc30715..97d2117 100644
--- a/rhel/automake.mk
+++ b/rhel/automake.mk
@@ -52,14 +52,23 @@ $(srcdir)/rhel/openvswitch-fedora.spec: 
rhel/openvswitch-fedora.spec.in $(top_bu
        $(update_rhel_spec)
 
 RPMBUILD_TOP := $(abs_top_builddir)/rpm/rpmbuild
+RPMBUILD_ROOT := fedora-23-x86_64
 
 # Build user-space RPMs
 rpm-fedora: dist $(srcdir)/rhel/openvswitch-fedora.spec
        ${MKDIR_P} ${RPMBUILD_TOP}/SOURCES
        cp ${DIST_ARCHIVES} ${RPMBUILD_TOP}/SOURCES
-       rpmbuild ${RPMBUILD_OPT} \
-                 -D "_topdir ${RPMBUILD_TOP}" \
-                 -bb $(srcdir)/rhel/openvswitch-fedora.spec
+       mock --root ${RPMBUILD_ROOT} \
+                --dnf \
+                --spec $(srcdir)/rhel/openvswitch-fedora.spec \
+                --sources=${RPMBUILD_TOP}/SOURCES  \
+                --resultdir=${RPMBUILD_TOP}/SRPMS \
+                --buildsrpm
+       mock --root ${RPMBUILD_ROOT} ${RPMBUILD_OPT} \
+                --dnf --define "_topdir ${RPMBUILD_TOP}" \
+                --rebuild \
+                --resultdir=${RPMBUILD_TOP}/RPMS \
+                ${RPMBUILD_TOP}/SRPMS/openvswitch-$(VERSION)*.src.rpm
 
 # Build kernel datapath RPM
 rpm-fedora-kmod: dist $(srcdir)/rhel/openvswitch-kmod-fedora.spec
-- 
2.5.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to