Add opendaylight-release packaging sources
[integration.git] / packaging / rpm / opendaylight-opendove.spec
1 # Spec file only supports RHEL and Fedora now
2 %if 0%{?rhel} || 0%{?fedora}
3
4 Name: opendaylight-opendove
5 Version: 0.1.0
6 Release: 0.1.0%{?dist}
7 Summary: OpenDaylight Open DOVE
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/opendove.git
14 # cd opendove
15 # git archive --prefix=opendaylight-opendove-0.1.0/ HEAD | xz > opendaylight-opendove-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 OpenDaylight Open DOVE
34
35
36 %prep
37
38 %setup -q
39
40
41 %build
42
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
46 # not downloaded.
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
53
54
55 %install
56
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.
61 #mkdir -p tmp
62 #unzip -o -d tmp distribution/opendaylight/target/distribution.opendove-1.0.0-SNAPSHOT-osgipackage.zip
63
64 # Create the directories:
65 mkdir -p %{buildroot}%{resources_dir}/plugins
66
67 # Only install the extra jars needed by ovsdb.
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 %{_builddir}/%{buildsubdir}/odmc/target/*.jar);
71 do
72     tgt=org.opendaylight.opendove.$(basename ${src})
73 #    if [ ! -f %{_builddir}/%{buildsubdir}/distribution/opendaylight/target/generated-resources/opendaylight/plugins/${tgt} ]; then
74 #        if [ "${tgt}" != "${tgt/org.opendaylight/}" ]; then
75             mv ${src} %{buildroot}%{resources_dir}/plugins/${tgt}
76 #        else
77 #            ln -s %{deps_dir}/${tgt} %{buildroot}%{resources_dir}/plugins/${tgt}
78 #        fi
79 #    fi
80 done
81
82 for src in $( ls %{_builddir}/%{buildsubdir}/odmc/implementation/target/*.jar);
83 do
84     tgt=org.opendaylight.opendove.$(basename ${src})
85             mv ${src} %{buildroot}%{resources_dir}/plugins/${tgt}
86 done
87
88 for src in $( ls %{_builddir}/%{buildsubdir}/odmc/rest/target/*.jar);
89 do
90     tgt=org.opendaylight.opendove.$(basename ${src})
91             mv ${src} %{buildroot}%{resources_dir}/plugins/${tgt}
92 done
93
94 for src in $( ls %{_builddir}/%{buildsubdir}/odmc/rest/northbound/target/*.jar);
95 do
96     tgt=org.opendaylight.opendove.$(basename ${src})
97             mv ${src} %{buildroot}%{resources_dir}/plugins/${tgt}
98 done
99
100 for src in $( ls %{_builddir}/%{buildsubdir}/odmc/rest/southbound/target/*.jar);
101 do
102     tgt=org.opendaylight.opendove.$(basename ${src})
103             mv ${src} %{buildroot}%{resources_dir}/plugins/${tgt}
104 done
105
106 # Fix the permissions as they come with all the permissions (mode 777)
107 # from the .zip file:
108 find %{buildroot}%{resources_dir} -type d -exec chmod 755 {} \;
109 find %{buildroot}%{resources_dir} -type f -exec chmod 644 {} \;
110
111 # Remove the temporary directory:
112 #rm -rf tmp
113
114
115 %clean
116 %if "%{noclean}" == "1"
117     exit 0
118 %endif
119
120
121 %files
122
123 %{resources_dir}
124
125
126 %endif
127
128 %changelog
129 * Tue Jan 07 2014 Hsin-Yi Shen <hshen@redhat.com> - 0.1.0-0.1.0
130 - Initial package.