Build deb's using common build.py
[integration/packaging.git] / rpm / README.markdown
index e0b6a1eb7884e322c005d992465b48312d8a5f43..457de2b63d08979b5adf19d8c5f9e8e51e49ebb5 100644 (file)
@@ -1,16 +1,5 @@
 Logic for building OpenDaylight's upstream Source RPMs.
 
-SRPM/RPM builds are supported for the following OpenDaylight major releases, as well as various daily builds:
-
-* Helium SR4
-* Lithium
-* Lithium SR1
-* Lithium SR2
-* Lithium SR3
-* Lithium SR4
-* Beryllium
-* Beryllium SR1
-
 ## Overview
 
 OpenDaylight's Source RPMs (SRPMs) are built using the logic provided here.
@@ -19,7 +8,7 @@ When new builds are defined, the new SRPMs are uploaded to the CentOS
 Community Build System's Koji-based RPM build system. From there they are
 built into ready-to-install noarch RPMs and hosted for consumption.
 
-Data that differs per-build is is defined in the `build_vars.yaml` YAML
+Data that differs per-build is defined in the `build_vars.yaml` YAML
 configuration file. The build logic consumes that dynamic data, uses
 JinJa2 templates to generate RPM spec files and builds the RPMs/SRPMs they
 define.
@@ -28,20 +17,42 @@ See the Templates vs Macros section for details about why we use this design.
 
 ## Vagrant Build Environment
 
-All SRPM builds are done in the included Vagrantfile. It provides a
-consistent, known-working and easily shared environment.
+The included Vagrantfile defines a consistent, known-working and easily
+shared environment. It supports both VM and container-based providers.
 
 ```
-[~/packaging/rpm]$ vagrant status
+$ vagrant status
 Current machine states:
 
 default                   not created (virtualbox)
-[~/packaging/rpm]$ vagrant up
-[~/packaging/rpm]$ vagrant ssh
+$ vagrant up
+$ vagrant ssh
 [vagrant@localhost vagrant]$ ls /vagrant/
 build.py  build_vars.yaml  cache  connect.sh  Vagrantfile <snip>
 ```
 
+### Docker provider
+
+The Vagrantfile defines a Docker provider, enabling easy access to build.py
+in a container. The general command format is:
+
+```
+$ vagrant docker-run -- <flags to build.py>
+```
+
+To pass 5.0 (Boron) as the version to build:
+
+```
+$ vagrant docker-run -- -v 5 0
+```
+
+Dockerfile can be also used directly to build container image:
+
+```
+$ docker build -t "odl_rpm" .
+$ docker run -v $(pwd):/build odl_rpm -v 5 0
+```
+
 ## Defining New RPMs
 
 The dynamic aspects of a build, such as ODL and RPM version info, have all
@@ -57,8 +68,8 @@ definition should define all supported variables.
 
 The OpenDaylight major (element) version number of the release to build.
 
-For example, Hydrogen is 1.x.x, Helium is 2.x.x, Lithium is 3.x.x and
-so on down the periodic table.
+For example, Hydrogen is 1.x.x, Helium is 2.x.x, Lithium is 3.x.x and so on
+down the periodic table.
 
 #### `version_minor`
 
@@ -117,6 +128,16 @@ The changelog entry must follow a specific format. It's best to follow the
 examples provided by existing build definitions closely. The `rpmbuild` tool
 will fail and complain fairly clearly if the format isn't correct.
 
+### Testing Build Logic
+
+Some `build.py` logic is covered by Python unit tests.
+
+To execute them:
+
+```
+$ python -m unittest test_build
+```
+
 ## Building SRPMs/RPMs
 
 The `build.py` helper script is used for building OpenDaylight SRPMs/RPMs.
@@ -266,15 +287,15 @@ Additionally, here's an example of connecting manually (password: `karaf`):
 [vagrant@localhost vagrant]$ ssh -p 8101 -o StrictHostKeyChecking=no karaf@localhost
 Authenticated with partial success.
 Password authentication
-Password: 
-                                                                                           
-    ________                       ________                .__  .__       .__     __       
-    \_____  \ ______   ____   ____ \______ \ _____  ___.__.|  | |__| ____ |  |___/  |_     
-     /   |   \\____ \_/ __ \ /    \ |    |  \\__  \<   |  ||  | |  |/ ___\|  |  \   __\    
-    /    |    \  |_> >  ___/|   |  \|    `   \/ __ \\___  ||  |_|  / /_/  >   Y  \  |      
-    \_______  /   __/ \___  >___|  /_______  (____  / ____||____/__\___  /|___|  /__|      
-            \/|__|        \/     \/        \/     \/\/            /_____/      \/          
-                                                                                           
+Password:
+
+    ________                       ________                .__  .__       .__     __
+    \_____  \ ______   ____   ____ \______ \ _____  ___.__.|  | |__| ____ |  |___/  |_
+     /   |   \\____ \_/ __ \ /    \ |    |  \\__  \<   |  ||  | |  |/ ___\|  |  \   __\
+    /    |    \  |_> >  ___/|   |  \|    `   \/ __ \\___  ||  |_|  / /_/  >   Y  \  |
+    \_______  /   __/ \___  >___|  /_______  (____  / ____||____/__\___  /|___|  /__|
+            \/|__|        \/     \/        \/     \/\/            /_____/      \/
+
 
 Hit '<tab>' for a list of available commands
 and '[cmd] --help' for help on a specific command.
@@ -385,8 +406,8 @@ $ sudo yum install -y opendaylight
 
 ## Templates vs Macros
 
-This section documents _why_ we use the YAML+Py+JinJa2 design we do, whereas
-the sections above document _how_.
+This section documents *why* we use the YAML+Py+JinJa2 design we do, whereas
+the sections above document *how*.
 
 Typically, RPM builds use the macro mechanism provided by RPM spec files
 and the `rpmbuild` tool to customize specs for specific builds. This works
@@ -414,20 +435,34 @@ templates to build simi-static (only default macros) RPM spec files emerged.
 The specifics (YAML, Python, JinJa2) were chosen because of their use in
 other tools used by [Int/Pack][15], like Packer, Ansible and Puppet.
 
-
 [1]: http://cbs.centos.org/koji/
+
 [2]: https://trello.com/c/cgQmevT8/209-additional-access-to-centos-cbs
+
 [3]: https://bugs.centos.org/
+
 [4]: https://bugs.centos.org/view.php?id=8879
+
 [5]: https://wiki.centos.org/HowTos/CommunityBuildSystem#head-00dad77f5720f3a984b0fac9f9bacac52047f73f
+
 [6]: https://wiki.opendaylight.org/view/User:Dfarrell07
+
 [7]: https://wiki.centos.org/HowTos/CommunityBuildSystem
+
 [8]: https://bugs.centos.org/view.php?id=9472
+
 [9]: http://cbs.centos.org/repos/
+
 [10]: https://github.com/opendaylight/integration-packaging/tree/master/rpm/example_repo_configs
+
 [11]: https://bugs.centos.org/view.php?id=9098#c23768
+
 [12]: https://wiki.opendaylight.org/view/Simultaneous_Release:Helium_Release_Plan#Schedule
+
 [13]: https://wiki.opendaylight.org/view/Simultaneous_Release:Lithium_Release_Plan#Schedule
+
 [14]: https://wiki.opendaylight.org/view/Simultaneous_Release:Beryllium_Release_Plan#Schedule
+
 [15]: https://wiki.opendaylight.org/view/Integration/Packaging
+
 [16]: https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=tree;h=refs/heads/master;hb=refs/heads/master