added rpm spec for lispflowmapping
[integration.git] / packaging / rpm / opendaylight-lispflowmapping.spec
1 # Spec file only supports RHEL and Fedora now
2 %if 0%{?rhel} || 0%{?fedora}
3
4 Name: opendaylight-lispflowmapping
5 Version: 0.1.0
6 Release: 0.1.0%{?dist}
7 Summary: OpenDaylight LispFlowMapping
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/lispflowmapping.git
14 # cd lispflowmapping
15 # git archive --prefix=opendaylight-lispflowmapping-1.0.0/ HEAD | xz > opendaylight-lispflowmapping-1.0.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 LispFlowMapping
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 cd distribution
53 export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && mvn clean install -Dmaven.test.skip=true
54 cd ..
55
56
57 %install
58
59 # Extract the contents of the distribution to a temporary directory so that we
60 # can take things from there and move them to the correct locations:
61 # todo: Need spec and pom file versions to be consistent so we don't have to
62 # hardcode the version here.
63 mkdir -p tmp
64 unzip -o -d tmp distribution/target/lispflowmapping-distribution-1.0.0-SNAPSHOT-osgipackage.zip
65
66 # Create the directories:
67 mkdir -p %{buildroot}%{resources_dir}/plugins
68
69 # Only install the extra jars needed by lispflowmapping.
70 # opendaylight jars will be moved to the plugins dir and external jars will be
71 # symlinked to the opendaylight dependencies directory.
72 for src in $( ls tmp/opendaylight/plugins/*.jar);
73 do
74     tgt=$(basename ${src})
75     if [ ! -f %{_builddir}/%{buildsubdir}/distribution/opendaylight/target/generated-resources/opendaylight/plugins/${tgt} ]; then
76         if [ "${tgt}" != "${tgt/org.opendaylight/}" ]; then
77             mv ${src} %{buildroot}%{resources_dir}/plugins
78         else
79             ln -s %{deps_dir}/${tgt} %{buildroot}%{resources_dir}/plugins/${tgt}
80         fi
81     fi
82 done
83
84
85 # Fix the permissions as they come with all the permissions (mode 777)
86 # from the .zip file:
87 find %{buildroot}%{resources_dir} -type d -exec chmod 755 {} \;
88 find %{buildroot}%{resources_dir} -type f -exec chmod 644 {} \;
89
90 # Remove the temporary directory:
91 rm -rf tmp
92
93
94 %clean
95 %if "%{noclean}" == "1"
96     exit 0
97 %endif
98
99
100 %files
101
102 %{resources_dir}
103
104
105 %endif
106
107 %changelog
108 * Wed Jan 22 2014 David Goldberg <david.goldberg@contextream.com> - 0.1.0-0.1.0
109 - Initial package.
110