Adding sleep to l2switch suite
[integration.git] / packaging / rpm / opendaylight-yangtools.spec
1 # Spec file only supports RHEL and Fedora now
2 %if 0%{?rhel} || 0%{?fedora}
3
4 Name: opendaylight-yangtools
5 Version: 0.1.0
6 Release: 0.1.0%{?dist}
7 Summary: OpenDaylight yangtools
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/yangtools.git
14 # cd yangtools
15 # git archive --prefix=opendaylight-yangtools-0.1.0/ HEAD | xz > opendaylight-yangtools-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 YANG Tools is a infrastructure project aiming to develop necessary
34 tooling and libraries providing support of NETCONF and YANG for Java
35 (JVM-language based) projects and applications, such as Model Driven
36 SAL for Controller (which uses YANG as it's modeling language) and
37 Netconf / OFConfig plugins.
38
39
40 %prep
41
42 %setup -q
43
44
45 %build
46
47 # This regular maven build will need to be replaced by the distribution
48 # specific maven build command, but this is ok for now:
49 # todo: eventually move to using mvn-build or mvn-rpmbuild so dependencies are
50 # not downloaded.
51 # Don't do the tests since those are already covered by the normal merge and
52 # verify process and this build does not need to verify them.
53 # maven.compile.fork is used to reduce the build time.
54 #export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && \
55 #  mvn clean install -Dmaven.test.skip=true -DskipIT -Dmaven.compile.fork=true
56 export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && mvn clean install -Dmaven.test.skip=true
57
58
59 %install
60
61 # Create the directories:
62 install -d -m 755 %{buildroot}%{resources_dir}/plugins
63
64 while read artifact; do
65     src=$(find . -name "*${artifact}" -a ! -name "*javadoc.jar" -a ! -name "*sources.jar")
66     if [ -f "${src}" ]; then
67         tgt=$(basename ${src})
68         install -m 644 ${src} %{buildroot}%{resources_dir}/plugins/org.opendaylight.yangtools.${tgt}
69     fi
70 done <<'.'
71 binding-generator-api-*.jar
72 binding-generator-impl-*.jar
73 binding-generator-spi-*.jar
74 binding-generator-util-*.jar
75 binding-model-api-*.jar
76 binding-type-provider-*.jar
77 concepts-*.jar
78 yang-binding-*.jar
79 yang-common-*.jar
80 yang-data-api-*.jar
81 yang-data-impl-*.jar
82 yang-data-util-*.jar
83 yang-model-api-*.jar
84 yang-model-util-*.jar
85 yang-parser-api-*.jar
86 yang-parser-impl-*.jar
87 .
88
89 # These next two loops have chairs that need a model prefix.
90 # But first take care of these topology jars. Notice there is another topology jar
91 # in the loop after this one, but its pattern matches all the topology jars and
92 # causes the -f to fail so break the loops apart. Some master regex god can
93 # probably combine the loops with magic.
94 while read base artifact; do
95     src=$(find . -name "*${artifact}" -a ! -name "*javadoc.jar" -a ! -name "*sources.jar")
96     if [ -f "${src}" ]; then
97         tgt=$(basename ${src})
98         install -m 644 ${src} %{buildroot}%{resources_dir}/plugins/org.opendaylight.yangtools.model.${tgt}
99         rm -f ${src}
100     fi
101 done <<'.'
102 model ietf-topology-isis-*.jar
103 model ietf-topology-l3-unicast-igp-*.jar
104 model ietf-topology-ospf-*.jar
105 .
106
107 while read base artifact; do
108     src=$(find . -name "*${artifact}" -a ! -name "*javadoc.jar" -a ! -name "*sources.jar")
109     if [ -f "${src}" ]; then
110         tgt=$(basename ${src})
111         install -m 644 ${src} %{buildroot}%{resources_dir}/plugins/org.opendaylight.yangtools.model.${tgt}
112     fi
113 done <<'.'
114 model ietf-inet-types-*.jar
115 model ietf-ted-*.jar
116 model ietf-topology-*.jar
117 model ietf-yang-types-*.jar
118 model opendaylight-l2-types-*.jar
119 model yang-ext-*.jar
120 .
121
122 # Remove the temporary directory:
123 rm -rf tmp
124
125
126 %clean
127 %if "%{noclean}" == "1"
128     exit 0
129 %endif
130
131
132 %files
133
134 %{resources_dir}
135
136
137 %endif
138
139 %changelog
140 * Sat Feb 08 2014 Sam Hague <shague@redhat.com> - 0.1.0-0.1.0
141 - Initial package.