This commit adds support for building the ODL OVSDB virtualization distribution.
- Added spec for building the ovsdb package
- Added distribution support to the controller spec. Mainly consists of adding
the integration run.sh wrapper script for run.sh.
- Updated dependencies.spec to also package ovsdb dependencies.
- Added spec for building the distribution. The spec simply Requires the
specific packages for the distribution. For example, it Requires the
controller, ovsdb and dependencies packages to support the OVSDB
virtualization package.
Change-Id: Iad931c46fc41bd107926dd9a41b5013638c55084
Signed-off-by: Sam Hague <shague@redhat.com>
artifacts. The plan is to create a dependencies RPM to package up all the
artifacts.
+Release 0.1.0-0.4.0
+1. Build
+Build all the required packages:
+rpmbuild opendaylight-controller.spec
+rpmbuild opendaylight-ovsdb.spec
+rpmbuild opendaylight-dependencies.spec
+rpmbuild opendaylight-distribution.spec
+
+2. Install
+rpm -Uvh opendaylight-distribution
+* This will install all required packages.
+
+3. Start/Stop
+sudo systemctl start opendaylight-controller.service
+sudo systemctl stop opendaylight-controller.service
+* to get the osgi console: telnet 127.0.0.1 2400
+
+4. Distribution
+Edit the sysconfig file to change the type of distribution:
+sudo vi /etc/sysconfig/opendaylight-controller
+Set ODL_DIST to the desired distribution, i.e.
+ODL_DEST="-virt ovsdb" or ODL_DEST="-virt opendove"
+
+Release <0.1.0-0.4.0
+
1. Get a source tarball:
$git clone https://git.opendaylight.org/gerrit/p/controller.git
$cd controller
Name: opendaylight-controller-dependencies
Version: 0.1.0
-Release: 0.2.0%{?dist}
+Release: 0.3.0%{?dist}
Summary: OpenDaylight SDN Controller Dependencies
Group: Applications/Communications
License: EPL
URL: http://www.opendaylight.org
-Source: opendaylight-controller-%{version}.zip
+
+# The sources are built by the other projects so just copy them:
+# cp ~/rpmbuild/BUILD/opendaylight-controller-0.1.0/opendaylight/distribution/opendaylight/target/distribution.opendaylight-osgipackage.zip ~/rpmbuild/SOURCES/opendaylight-controller-%{version}.zip
+# cp ~/rpmbuild/BUILD/opendaylight-ovsdb-0.1.0/distribution/opendaylight/target/distribution.ovsdb-1.0.0-SNAPSHOT-osgipackage.zip ~/rpmbuild/SOURCES/opendaylight-ovsdb-%{version}.zip
+Source0: opendaylight-controller-%{version}.zip
+Source1: opendaylight-ovsdb-%{version}.zip
BuildArch: noarch
Requires: java >= 1:1.7.0
%prep
-%setup -q -c opendaylight-controller-dependencies-%{version}
+%setup -q -c -c -n opendaylight-controller-dependencies-%{version}
+%setup -q -T -a 1 -c -n opendaylight-ovsdb-dependencies-%{version}
-%build
-# Nothing to build, just repackage the jars
+%build
exit 0
%install
+mv -f ../opendaylight-controller-dependencies-%{version}/opendaylight/lib/* opendaylight/lib/
+mv -f ../opendaylight-controller-dependencies-%{version}/opendaylight/plugins/* opendaylight/plugins/
+
# Create the directory for the dependencies:
mkdir -p %{buildroot}%{deps_dir}
for src in $( ls -I "org.opendaylight.*" opendaylight/lib );
do
- tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
- mv opendaylight/lib/${src} %{buildroot}%{deps_dir}/${tgt}
+ #tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
+ #mv opendaylight/lib/${src} %{buildroot}%{deps_dir}/${tgt}
+ mv opendaylight/lib/${src} %{buildroot}%{deps_dir}/${src}
done
for src in $( ls -I "org.opendaylight.*" opendaylight/plugins );
do
- tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
- mv opendaylight/plugins/${src} %{buildroot}%{deps_dir}/${tgt}
+ #tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
+ #mv opendaylight/plugins/${src} %{buildroot}%{deps_dir}/${tgt}
+ mv opendaylight/plugins/${src} %{buildroot}%{deps_dir}/${src}
done
%changelog
+* Thu Jan 02 2014 Sam Hague <shague@redhat.com> - 0.1.0-0.3.0
+- Updates to include building distributions.
+
* Fri Nov 22 2013 Sam Hague <shague@redhat.com> - 0.1.0-0.2.0
- Updates to support building rpm with jenkins.
Name: opendaylight-controller
Version: 0.1.0
-Release: 0.3.0%{?dist}
+Release: 0.4.0%{?dist}
Summary: OpenDaylight SDN Controller
Group: Applications/Communications
License: EPL
# todo: Temporary method for generating tarball
# git clone https://git.opendaylight.org/gerrit/p/controller.git
# cd controller
-# git archive --prefix=opendaylight-controller-0.1.0/ 20dcbd1 | xz > opendaylight-controller-0.1.0.tar.xz
+# git archive --prefix=opendaylight-controller-0.1.0/ HEAD | xz > opendaylight-controller-0.1.0.tar.xz
# git clone https://git.opendaylight.org/gerrit/p/integration.git
-# cd packaging/rpm/fedora
-# git archive 20dcbd1 opendaylight-controller.sysconfig opendaylight-controller.systemd | xz > opendaylight-controller-integration-0.1.0.tar.xz
+# cd packaging/rpm
+# git archive HEAD opendaylight-controller.sysconfig opendaylight-controller.systemd \
+# opendaylight-controller.sysv run.dist.sh | xz > opendaylight-controller-integration-0.1.0.tar.xz
Source0: %{name}-%{version}.tar.xz
Source1: %{name}-integration-%{version}.tar.xz
# mvn clean install -Dmaven.test.skip=true -DskipIT -Dmaven.compile.fork=true
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && mvn clean install -Dmaven.test.skip=true
+
%install
# Extract the contents of the distribution to a temporary directory so that we
install -m 644 -D %{name}.sysv %{buildroot}%{_initddir}/%{name}
%endif
install -m 644 -D %{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
+install -m 755 -D run.dist.sh %{buildroot}%{resources_dir}/run.dist.sh
# Usually one wants to replace the .jar files of the dependencies by symlinks
# to the ones provided to the system. This assumes the dependencies have been
for src in $( ls -I "org.opendaylight.*" );
do
rm -f ${src}
- tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
- ln -s %{deps_dir}/${tgt} ${src}
+ #tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
+ #ln -s %{deps_dir}/${tgt} ${src}
+ ln -s %{deps_dir}/${src} ${src}
done
cd %{buildroot}%{resources_dir}/plugins
for src in $( ls -I "org.opendaylight.*" );
do
rm -f ${src}
- tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
- ln -s %{deps_dir}/${tgt} ${src}
+ #tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
+ #ln -s %{deps_dir}/${tgt} ${src}
+ ln -s %{deps_dir}/${src} ${src}
done
find %{buildroot}%{data_dir} -type d -exec chmod 755 {} \;
find %{buildroot}%{data_dir} -type f -exec chmod 755 {} \;
chmod 755 %{buildroot}%{resources_dir}/run.sh
+chmod 755 %{buildroot}%{resources_dir}/run.dist.sh
%if 0%{?rhel}
chmod 755 %{buildroot}%{_initddir}/%{name}
%endif
%endif
%clean
+# This check is used for mock build so the build files are not deleted.
%if "%{noclean}" == "1"
exit 0
%endif
%endif
%changelog
+* Thu Jan 02 2014 Sam Hague <shague@redhat.com> - 0.1.0-0.4.0
+- Updates to include building distributions.
+
* Mon Dec 23 2013 Hsin-Yi Shen <hshen@redhat.com> - 0.1.0-0.3.0
- Updates to support building rpm for both RHEL and fedora.
# The path to the java jre or jdk:
#JAVA_HOME=/usr
+
+# The requested distribution:
+ODL_DIST="-virt ovsdb"
\ No newline at end of file
Group=opendaylight
EnvironmentFile=-/etc/sysconfig/opendaylight-controller
WorkingDirectory=/var/lib/opendaylight-controller
-ExecStart=-/usr/share/opendaylight-controller/run.sh -start
+ExecStart=-/usr/share/opendaylight-controller/run.dist.sh $ODL_DIST -start
ExecStop=-/usr/share/opendaylight-controller/run.sh -stop
[Install]
# Source function library.
. /etc/rc.d/init.d/functions
-exec="/usr/share/opendaylight-controller/run.sh"
+exec="/usr/share/opendaylight-controller/run.dist.sh"
prog="opendaylight-controller"
config="/etc/opendaylight-controller/config.ini"
[ -f $config ] || exit 6
echo -n $"Starting $prog: "
# if not running, start it up here, usually something like "daemon $exec"
- $exec -start
+ $exec $ODL_DIST -start
retval=$?
echo
# [ $retval -eq 0 ] && touch $lockfile
stop() {
echo -n $"Stopping $prog: "
# stop it here, often "killproc $prog"
- $exec -stop
+ /usr/share/opendaylight-controller/run.sh" -stop
retval=$?
echo
# [ $retval -eq 0 ] && rm -f $lockfile
--- /dev/null
+# Spec file only supports RHEL and Fedora now
+%if 0%{?rhel} || 0%{?fedora}
+
+Name: opendaylight-distribution
+Version: 0.1.0
+Release: 0.1.0%{?dist}
+Summary: OpenDaylight SDN Controller Distributions
+Group: Applications/Communications
+License: EPL
+URL: http://www.opendaylight.org
+BuildArch: noarch
+
+Requires: java >= 1:1.7.0
+Requires: opendaylight-controller
+Requires: opendaylight-ovsdb
+Requires: opendaylight-controller-dependencies
+
+%description
+OpenDaylight SDN Controller Distributions
+
+%files
+
+%endif
+
+%changelog
+* Thu Jan 02 2014 Sam Hague <shague@redhat.com> - 0.1.0-0.1.0
+- Initial package.
--- /dev/null
+# Spec file only supports RHEL and Fedora now
+%if 0%{?rhel} || 0%{?fedora}
+
+Name: opendaylight-ovsdb
+Version: 0.1.0
+Release: 0.1.0%{?dist}
+Summary: OpenDaylight OVSDB
+Group: Applications/Communications
+License: EPL
+URL: http://www.opendaylight.org
+
+# todo: Temporary method for generating tarball
+# git clone https://git.opendaylight.org/gerrit/p/ovsdb.git
+# cd ovsdb
+# git archive --prefix=opendaylight-ovsdb-0.1.0/ HEAD | xz > opendaylight-ovsdb-0.1.0.tar.xz
+Source0: %{name}-%{version}.tar.xz
+
+BuildArch: noarch
+
+BuildRequires: java-devel
+BuildRequires: maven
+Requires: java >= 1:1.7.0
+
+# This is the directory where all the application resources (scripts,
+# libraries, etc) will be installed: /usr/share/opendaylight
+%global resources_dir %{_datadir}/opendaylight-controller
+
+# This is the directory that has all the JAVA dependencies.
+%global deps_dir %{_javadir}/opendaylight-controller-dependencies
+
+
+%description
+OpenDaylight OVSDB
+
+
+%prep
+
+%setup -q
+
+
+%build
+
+# This regular maven build will need to be replaced by the distribution
+# specific maven build command, but this is ok for now:
+# todo: eventually move to using mvn-build or mvn-rpmbuild so dependencies are
+# not downloaded.
+# Don't do the tests since those are already covered by the normal merge and
+# verify process and this build does not need to verify them.
+# maven.compile.fork is used to reduce the build time.
+#export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && \
+# mvn clean install -Dmaven.test.skip=true -DskipIT -Dmaven.compile.fork=true
+export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && mvn clean install -Dmaven.test.skip=true
+
+
+%install
+
+# Extract the contents of the distribution to a temporary directory so that we
+# can take things from there and move them to the correct locations:
+# todo: Need spec and pom file versions to be consistent so we don't have to
+# hardcode the version here.
+mkdir -p tmp
+unzip -o -d tmp distribution/opendaylight/target/distribution.ovsdb-1.0.0-SNAPSHOT-osgipackage.zip
+
+# Create the directories:
+mkdir -p %{buildroot}%{resources_dir}/plugins
+
+# Only install the extra jars needed by ovsdb.
+# opendaylight jars will be moved to the plugins dir and external jars will be
+# symlinked to the opendaylight dependencies directory.
+for src in $( ls tmp/opendaylight/plugins/*.jar);
+do
+ tgt=$(basename ${src})
+ if [ ! -f %{_builddir}/%{buildsubdir}/distribution/opendaylight/target/generated-resources/opendaylight/plugins/${tgt} ]; then
+ if [ "${tgt}" != "${tgt/org.opendaylight/}" ]; then
+ mv ${src} %{buildroot}%{resources_dir}/plugins
+ else
+ ln -s %{deps_dir}/${tgt} %{buildroot}%{resources_dir}/plugins/${tgt}
+ fi
+ fi
+done
+
+
+# Fix the permissions as they come with all the permissions (mode 777)
+# from the .zip file:
+find %{buildroot}%{resources_dir} -type d -exec chmod 755 {} \;
+find %{buildroot}%{resources_dir} -type f -exec chmod 644 {} \;
+
+# Remove the temporary directory:
+rm -rf tmp
+
+
+%clean
+%if "%{noclean}" == "1"
+ exit 0
+%endif
+
+
+%files
+
+%{resources_dir}
+
+
+%endif
+
+%changelog
+* Thu Jan 02 2014 Sam Hague <shague@redhat.com> - 0.1.0-0.1.0
+- Initial package.
--- /dev/null
+#!/bin/bash
+
+function usage {
+ echo "Please select one of the 3 supported Virtualization technology : \"$0 -virt [ovsdb | opendove | vtn]\""
+ exit 1
+}
+
+virtIndex=0
+while true ; do
+ (( i += 1 ))
+ case "${@:$i:1}" in
+ -virt) virtIndex=$i ;;
+ "") break ;;
+ esac
+done
+
+# Virtualization edition select
+if [ ${virtIndex} -eq 0 ]; then
+ usage
+fi
+
+virt=${@:$virtIndex+1:1}
+if [ "${virt}" == "" ]; then
+ usage
+else
+ if [ "${virt}" == "ovsdb" ]; then
+ ODL_VIRT_FILTER="opendove|vtn"
+ elif [ "${virt}" == "opendove" ]; then
+ ODL_VIRT_FILTER="ovsdb|vtn"
+ elif [ "${virt}" == "vtn" ]; then
+ ODL_VIRT_FILTER="affinity|opendove|ovsdb|controller.(arphandler|samples)"
+ else
+ usage
+ fi
+fi
+
+/usr/share/opendaylight-controller/run.sh -Dfelix.fileinstall.filter="^(?!org.opendaylight.(${ODL_VIRT_FILTER})).*" "${@:1:$virtIndex-1}" "${@:virtIndex+2}"