Merge "Add bgpcep to rpm packaging."
[integration.git] / packaging / rpm / opendaylight-openflowplugin.spec
1 # Spec file only supports RHEL and Fedora now
2 %if 0%{?rhel} || 0%{?fedora}
3
4 Name: opendaylight-openflowplugin
5 Version: 0.1.0
6 Release: 0.2.0%{?dist}
7 Summary: OpenDaylight Openflow Plugin
8 Group: Applications/Communications
9 License: EPL
10 URL: http://www.opendaylight.org
11
12 # todo: Temporary method for generating tarball
13 # git clone https://git.opendaylight.org/gerrit/p/openflowplugin.git
14 # cd openflowplugin
15 # git archive --prefix=opendaylight-openflowplugin-0.1.0/ HEAD | xz > opendaylight-openflowplugin-0.1.0.tar.xz
16 Source0: %{name}-%{version}.tar.xz
17
18 BuildArch: noarch
19
20 BuildRequires: java-devel
21 BuildRequires: maven
22 Requires: java >= 1:1.7.0
23
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
27
28 # This is the directory that has all the JAVA dependencies.
29 %global deps_dir %{_javadir}/opendaylight-controller-dependencies
30
31
32 %description
33 The Openflow Protocol Library will be an implementation of Openflow
34 Protocol as defined in Openflow Switch Specification v1.3 and later
35 versions.
36
37 The library is designed to be extensible from third-party bundles in
38 order to support vendor extensions and should serve as a basis for
39 Openflow Southbound Plugin for Controller.
40
41
42 %prep
43
44 %setup -q
45
46
47 %build
48
49 # This regular maven build will need to be replaced by the distribution
50 # specific maven build command, but this is ok for now:
51 # todo: eventually move to using mvn-build or mvn-rpmbuild so dependencies are
52 # not downloaded.
53 # Don't do the tests since those are already covered by the normal merge and
54 # verify process and this build does not need to verify them.
55 # maven.compile.fork is used to reduce the build time.
56 #export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && \
57 #  mvn clean install -Dmaven.test.skip=true -DskipIT -Dmaven.compile.fork=true
58 export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && mvn clean install -Dmaven.test.skip=true
59
60
61 %install
62
63 # Extract the contents of the distribution to a temporary directory so that we
64 # can take things from there and move them to the correct locations:
65 # todo: Need spec and pom file versions to be consistent so we don't have to
66 # hardcode the version here.
67 mkdir -p tmp
68 unzip -o -d tmp distribution/base/target/distributions-openflowplugin-base-*-osgipackage.zip
69
70 # Create the directories:
71 mkdir -p %{buildroot}%{resources_dir}/plugins
72
73 # Only install the extra jars needed by openflowplugin
74 # opendaylight jars will be moved to the plugins dir and external jars will be
75 # symlinked to the opendaylight dependencies directory.
76 # rm some test files that are not distributed
77 rm tmp/org.opendaylight.openflowplugin.drop-test-*
78 rm tmp/org.opendaylight.openflowplugin.test-provider-*
79
80 for src in $( ls tmp/opendaylight/plugins/*.jar);
81 do
82     tgt=$(basename ${src})
83     if [ ! -f %{_builddir}/%{buildsubdir}/distribution/base/target/generated-resources/opendaylight/plugins/${tgt} ]; then
84         if [ "${tgt}" != "${tgt/org.opendaylight/}" ]; then
85             if [ "${tgt}" == "${tgt/org.opendaylight.openflowjava/}" ]; then
86                 mv ${src} %{buildroot}%{resources_dir}/plugins
87             fi
88         else
89             ln -s %{deps_dir}/${tgt} %{buildroot}%{resources_dir}/plugins/${tgt}
90         fi
91     fi
92 done
93
94
95 # Fix the permissions as they come with all the permissions (mode 777)
96 # from the .zip file:
97 find %{buildroot}%{resources_dir} -type d -exec chmod 755 {} \;
98 find %{buildroot}%{resources_dir} -type f -exec chmod 644 {} \;
99
100 # Remove the temporary directory:
101 rm -rf tmp
102
103
104 %clean
105 %if "%{noclean}" == "1"
106     exit 0
107 %endif
108
109
110 %files
111
112 %{resources_dir}
113
114
115 %endif
116
117 %changelog
118 * Sat Feb 08 2014 Sam Hague <shague@redhat.com> - 0.1.0-0.2.0
119 - Remove test artifacts.
120 - Update description.
121
122 * Wed Jan 08 2014 Hsin-Yi Shen <hshen@redhat.com> - 0.1.0-0.1.0
123 - Initial package.