Force RPM to use Java 1.7, not newer versions
[integration/packaging.git] / packaging / rpm / opendaylight.spec
1 # jar_repack step takes a long time and doesn't seem to be necessary, so skip
2 %define __jar_repack 0
3
4 # Update this commit if systemd unit file is updated
5 %global commit 4a872270893f0daeebcbbcc0ff0014978e3c5f68
6 %global shortcommit %(c=%{commit}; echo ${c:0:7})
7
8 Name:       opendaylight
9 Version:    0.2.3
10 Release:    2%{?dist}
11 Summary:    OpenDaylight SDN Controller
12
13 Group:      Applications/Communications
14 License:    EPL-1.0
15 URL:        http://www.opendaylight.org
16 BuildArch:  noarch
17 Source0:    https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.3-Helium-SR3/distribution-karaf-0.2.3-Helium-SR3.tar.gz
18 Source1:    https://github.com/dfarrell07/opendaylight-systemd/archive/%{shortcommit}/opendaylight-systemd-%{shortcommit}.tar.gz
19 Buildroot:  /tmp
20
21 # Required for ODL at run time
22 Requires:   java = 1:1.7.0
23 # Required for creating odl group
24 Requires(pre): shadow-utils
25 # Required for configuring systemd
26 BuildRequires: systemd
27
28 %pre
29 # Create `odl` user/group
30 # Short circuits if the user/group already exists
31 # Home dir must be a valid path for various files to be created in it
32 getent passwd odl > /dev/null || useradd odl -M -d $RPM_BUILD_ROOT/opt/%name
33 getent group odl > /dev/null || groupadd odl
34
35 %description
36 OpenDaylight Helium SR3 (0.2.3)
37
38 %prep
39 # Extract Source0 (ODL archive)
40 %autosetup -n distribution-karaf-0.2.3-Helium-SR3
41 # Extract Source1 (systemd config)
42 %autosetup -T -D -b 1 -n opendaylight-systemd-%{commit}
43
44 %install
45 # Create directory in build root for ODL
46 mkdir -p $RPM_BUILD_ROOT/opt/%name
47 # Move ODL from archive to its dir in build root
48 cp -r ../distribution-karaf-0.2.3-Helium-SR3/* $RPM_BUILD_ROOT/opt/%name
49 # Create directory in build root for systemd .service file
50 mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
51 # Move ODL's systemd .service file to correct dir in build root
52 cp ../../BUILD/opendaylight-systemd-%{commit}/opendaylight.service $RPM_BUILD_ROOT/%{_unitdir}
53
54 %postun
55 # When the RPM is removed, the subdirs containing new files wouldn't normally
56 #   be deleted. Manually clean them up.
57 #   Warning: This does assume there's no data there that should be persevered
58 rm -rf $RPM_BUILD_ROOT/opt/%name
59
60 %files
61 # ODL will run as odl:odl, set as user:group for ODL dir, dont override mode
62 %attr(-,odl,odl) /opt/%name
63 # Configure systemd unitfile user/group/mode
64 %attr(0644,root,root) %{_unitdir}/%name.service
65
66
67 %changelog
68 * Thu Apr 16 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.3-2
69 - Force Java version 1.7
70 * Mon Mar 23 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.3-1
71 - Upgrade from Helium SR2 to Helium SR3
72 * Sun Mar 15 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.2-4
73 - Don't override ODL dir mode, explicitly set unitfile owner:group
74 * Fri Mar 13 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.2-3
75 - Don't include ODL version in ODL dir name
76 * Tue Feb 10 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.2-2
77 - Bugfix in URL to download ODL systemd .service file
78 * Sat Jan 31 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.2-1
79 - Upgrade from Helium SR1.1 to Helium SR2
80 * Thu Jan 29 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.1-6
81 - Give odl user a valid home dir for automatically created files
82 * Tue Jan 13 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.1-5
83 - Set ODL ownership to odl:odl vs root:odl
84 * Mon Jan 12 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.1-4
85 - Added systemd config as a source
86 * Sat Jan 10 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.1-3
87 - Completely clean up ODL after uninstall
88 * Fri Jan 9 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.1-2
89 - Added systemd configuration
90 * Tue Dec 16 2014 Daniel Farrell <dfarrell@redhat.com> - 0.2.1-1
91 - Initial Karaf-based RPM