Add 5.0.0-0.1.20160809snap4240 RPM definition 61/43561/2
authorDaniel Farrell <dfarrell@redhat.com>
Tue, 9 Aug 2016 20:25:19 +0000 (16:25 -0400)
committerDaniel Farrell <dfarrell@redhat.com>
Tue, 9 Aug 2016 20:28:38 +0000 (20:28 +0000)
Moving to 0.n, vs n, for RPM version. Also proper snapshot version
format. Both described here:

http://fedoraproject.org/wiki/Packaging:Naming

Change-Id: I32c16d9911527b6675c3d8428f68eb91811320e5
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
rpm/build_vars.yaml
rpm/specs/opendaylight-5.0.0-0.1.20160809snap4240.spec [new file with mode: 0644]

index 0a8dcd6efb588d6fac236de28067bd00dcfa7f08..c55cb4100b4c95467feb0e54aabc185759623e31 100644 (file)
@@ -144,3 +144,13 @@ builds:
     changelog_date: "Tue Aug 09 2016"
     changelog_name: "Daniel Farrell"
     changelog_email: "dfarrell@redhat.com"
+  - version_major: "5"
+    version_minor: "0"
+    version_patch: "0"
+    rpm_release: "0.1.20160809snap4240"
+    codename: SNAPSHOT
+    download_url: "https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/integration/distribution-karaf/0.5.0-SNAPSHOT/distribution-karaf-0.5.0-20160809.145534-4240.tar.gz"
+    sysd_commit: c6d7ee1f21d62ff8ffb741c7a12c3d8d3aa3d6ed
+    changelog_date: "Tue Aug 09 2016"
+    changelog_name: "Daniel Farrell"
+    changelog_email: "dfarrell@redhat.com"
diff --git a/rpm/specs/opendaylight-5.0.0-0.1.20160809snap4240.spec b/rpm/specs/opendaylight-5.0.0-0.1.20160809snap4240.spec
new file mode 100644 (file)
index 0000000..4f1da99
--- /dev/null
@@ -0,0 +1,69 @@
+# ODL is a noarch package, so this isn't necessary. It's also very slow.
+%define __jar_repack 0
+
+Name:       opendaylight
+Version:    5.0.0
+# The Fedora/CentOS packaging guidelines *require* the use of a disttag. ODL's
+#   RPM build doesn't do anything Fedora/CentOS specific, so the disttag is
+#   unnecessary and unused in our case, but both the docs and the pros (apevec)
+#   agree that we should include it.
+# See: https://fedoraproject.org/wiki/Packaging:DistTag
+Release:    0.1.20160809snap4240.el7
+BuildArch:  noarch
+Summary:    OpenDaylight SDN Controller
+Group:      Applications/Communications
+License:    EPL-1.0
+URL:        http://www.opendaylight.org
+Source0:    %name-5.0.0-0.1.20160809snap4240.tar.gz
+Source1:    %name-c6d7ee1f21d62ff8ffb741c7a12c3d8d3aa3d6ed.service.tar.gz
+Buildroot:  /tmp
+# Required for ODL at run time
+Requires:   java >= 1:1.7.0
+# Required for creating odl group
+Requires(pre): shadow-utils
+# Required for configuring systemd
+BuildRequires: systemd
+
+%pre
+# Create `odl` user/group
+# Short circuits if the user/group already exists
+# Home dir must be a valid path for various files to be created in it
+getent passwd odl > /dev/null || useradd odl -M -d $RPM_BUILD_ROOT/opt/%name
+getent group odl > /dev/null || groupadd odl
+
+%description
+OpenDaylight SNAPSHOT
+
+%prep
+# Extract Source0 (ODL archive)
+%autosetup -n distribution-karaf-0.5.0-SNAPSHOT
+# Extract Source1 (systemd config)
+%autosetup -T -D -b 1 -c -n %name-c6d7ee1f21d62ff8ffb741c7a12c3d8d3aa3d6ed.service
+
+%install
+# Create directory in build root for ODL
+mkdir -p $RPM_BUILD_ROOT/opt/%name
+# Copy ODL from archive to its dir in build root
+cp -r ../distribution-karaf-0.5.0-SNAPSHOT/* $RPM_BUILD_ROOT/opt/%name
+# Create directory in build root for systemd .service file
+mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
+# Copy ODL's systemd .service file to correct dir in build root
+cp ../../BUILD/%name-c6d7ee1f21d62ff8ffb741c7a12c3d8d3aa3d6ed.service/%name-c6d7ee1f21d62ff8ffb741c7a12c3d8d3aa3d6ed.service $RPM_BUILD_ROOT/%{_unitdir}/%name.service
+
+%postun
+# When the RPM is removed, the subdirs containing new files wouldn't normally
+#   be deleted. Manually clean them up.
+#   Warning: This does assume there's no data there that should be preserved
+if [ $1 -eq 0 ]; then
+    rm -rf $RPM_BUILD_ROOT/opt/%name
+fi
+
+%files
+# ODL will run as odl:odl, set as user:group for ODL dir, don't override mode
+%attr(-,odl,odl) /opt/%name
+# Configure systemd unitfile user/group/mode
+%attr(0644,root,root) %{_unitdir}/%name.service
+
+%changelog
+* Tue Aug 09 2016 Daniel Farrell <dfarrell@redhat.com> - 5.0.0-0.1.20160809snap4240
+- Create 5.0.0-0.1.20160809snap4240 RPM
\ No newline at end of file