1 # Spec file only supports RHEL and Fedora now
2 %if 0%{?rhel} || 0%{?fedora}
4 Name: opendaylight-openflowplugin
7 Summary: OpenDaylight Openflow Plugin
8 Group: Applications/Communications
10 URL: http://www.opendaylight.org
12 # todo: Temporary method for generating tarball
13 # git clone https://git.opendaylight.org/gerrit/p/openflowplugin.git
15 # git archive --prefix=opendaylight-openflowplugin-0.1.0/ HEAD | xz > opendaylight-openflowplugin-0.1.0.tar.xz
16 Source0: %{name}-%{version}.tar.xz
20 BuildRequires: java-devel
22 Requires: java >= 1:1.7.0
24 # This is the directory where all the application resources (scripts,
25 # libraries, etc) will be installed: /usr/share/opendaylight
26 %global resources_dir %{_datadir}/opendaylight-controller
28 # This is the directory that has all the JAVA dependencies.
29 %global deps_dir %{_javadir}/opendaylight-controller-dependencies
33 OpenDaylight Openflow Plugin
43 # This regular maven build will need to be replaced by the distribution
44 # specific maven build command, but this is ok for now:
45 # todo: eventually move to using mvn-build or mvn-rpmbuild so dependencies are
47 # Don't do the tests since those are already covered by the normal merge and
48 # verify process and this build does not need to verify them.
49 # maven.compile.fork is used to reduce the build time.
50 #export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && \
51 # mvn clean install -Dmaven.test.skip=true -DskipIT -Dmaven.compile.fork=true
52 export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && mvn clean install -Dmaven.test.skip=true
57 # Extract the contents of the distribution to a temporary directory so that we
58 # can take things from there and move them to the correct locations:
59 # todo: Need spec and pom file versions to be consistent so we don't have to
60 # hardcode the version here.
62 unzip -o -d tmp distribution/base/target/distributions-openflowplugin-base-0.0.1-SNAPSHOT-osgipackage.zip
64 # Create the directories:
65 mkdir -p %{buildroot}%{resources_dir}/plugins
67 # Only install the extra jars needed by openflowplugin
68 # opendaylight jars will be moved to the plugins dir and external jars will be
69 # symlinked to the opendaylight dependencies directory.
70 for src in $( ls tmp/opendaylight/plugins/*.jar);
72 tgt=$(basename ${src})
73 if [ ! -f %{_builddir}/%{buildsubdir}/distribution/base/target/generated-resources/opendaylight/plugins/${tgt} ]; then
74 if [ "${tgt}" != "${tgt/org.opendaylight/}" ]; then
75 if [ "${tgt}" == "${tgt/org.opendaylight.openflowjava/}" ]; then
76 mv ${src} %{buildroot}%{resources_dir}/plugins
79 ln -s %{deps_dir}/${tgt} %{buildroot}%{resources_dir}/plugins/${tgt}
85 # Fix the permissions as they come with all the permissions (mode 777)
87 find %{buildroot}%{resources_dir} -type d -exec chmod 755 {} \;
88 find %{buildroot}%{resources_dir} -type f -exec chmod 644 {} \;
90 # Remove the temporary directory:
95 %if "%{noclean}" == "1"
108 * Wed Jan 08 2014 Hsin-Yi Shen <hshen@redhat.com> - 0.1.0-0.1.0