# Common paths used in this script
# NB: Name will need to be updated for both ODL and RMP version bumps
-rpm_name="opendaylight-0.2.2-1.fc20.noarch.rpm"
-rpm_out_path="$HOME/rpmbuild/RPMS/noarch/$rpm_name"
+version=4
+rpm_name="opendaylight-0.2.2-$version.noarch.rpm"
+rpm_out_path="$HOME/rpmbuild/RPMS/noarch/opendaylight-0.2.2-$version.fc20.noarch.rpm"
+srpm_name="opendaylight-0.2.2-$version.src.rpm"
+srpm_out_path="$HOME/rpmbuild/SRPMS/opendaylight-0.2.2-$version.fc20.src.rpm"
src_name="distribution-karaf-0.2.2-Helium-SR2.tar.gz"
src_cache_path0="$HOME/$src_name"
src_cache_path1="/vagrant/$src_name"
-sysd_commit=f984005
+sysd_commit=4a87227
# Install required software, add user to mock group for rpmbuild
sudo yum install -y @development-tools fedora-packager
cd $HOME/rpmbuild/SPECS
rpmbuild -ba opendaylight.spec
+# Confirm SRPM found in expected location
+if [ -f $srpm_out_path ]; then
+ echo "SRPM built!"
+ echo "Location: $srpm_out_path"
+ if [ -d /vagrant/ ]; then
+ echo "Assuming you want to move RPM off Vagrant box"
+ echo "Also renaming RPM, not actually tagged as for FC20 target OS"
+ echo "cp $srpm_out_path /vagrant/$srpm_name"
+ cp $srpm_out_path /vagrant/$srpm_name
+ fi
+else
+ echo "SRPM seems to have failed. :(" >&2
+fi
+
# Confirm RPM found in expected location
if [ -f $rpm_out_path ]; then
echo "RPM built!"
- echo "Should be at: $rpm_out_path"
+ echo "Location: $rpm_out_path"
+ if [ -d /vagrant/ ]; then
+ echo "Assuming you want to move RPM off Vagrant box"
+ echo "Also renaming RPM, not actually tagged as for FC20 target OS"
+ echo "cp $rpm_out_path /vagrant/$rpm_name"
+ cp $rpm_out_path /vagrant/$rpm_name
+ fi
else
- echo "RPM seems to have failed. :(" &>2
+ echo "RPM seems to have failed. :(" >&2
fi
%define __jar_repack 0
# Update this commit if systemd unit file is updated
-%global commit f984005039c39596a6cf4e7718b44a48db0ba849
+%global commit 4a872270893f0daeebcbbcc0ff0014978e3c5f68
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: opendaylight
Version: 0.2.2
-Release: 1%{?dist}
+Release: 4%{?dist}
Summary: OpenDaylight SDN Controller
Group: Applications/Communications
URL: http://www.opendaylight.org
BuildArch: noarch
Source0: https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.2-Helium-SR2/distribution-karaf-0.2.2-Helium-SR2.tar.gz
-Source1: https://github.com/dfarrell07/opendaylight-systemd/archive/b080cdc/opendaylight-systemd-%{shortcommit}.tar.gz
+Source1: https://github.com/dfarrell07/opendaylight-systemd/archive/%{shortcommit}/opendaylight-systemd-%{shortcommit}.tar.gz
Buildroot: /tmp
# Required for ODL at run time
# 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-%version
+getent passwd odl > /dev/null || useradd odl -M -d $RPM_BUILD_ROOT/opt/%name
getent group odl > /dev/null || groupadd odl
%description
%install
# Create directory in build root for ODL
-mkdir -p $RPM_BUILD_ROOT/opt/%name-%version
+mkdir -p $RPM_BUILD_ROOT/opt/%name
# Move ODL from archive to its dir in build root
-cp -r ../distribution-karaf-0.2.2-Helium-SR2/* $RPM_BUILD_ROOT/opt/%name-%version
+cp -r ../distribution-karaf-0.2.2-Helium-SR2/* $RPM_BUILD_ROOT/opt/%name
# Create directory in build root for systemd .service file
mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
# Move ODL's systemd .service file to correct dir in build root
# 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 persevered
-rm -rf $RPM_BUILD_ROOT/opt/%name-%version
+rm -rf $RPM_BUILD_ROOT/opt/%name
%files
-# ODL uses systemd to run as user:group odl:odl
-%attr(0775,odl,odl) /opt/%name-%version/
-# Configure systemd
-%attr(0644,-,-) %{_unitdir}/%name.service
+# ODL will run as odl:odl, set as user:group for ODL dir, dont override mode
+%attr(-,odl,odl) /opt/%name
+# Configure systemd unitfile user/group/mode
+%attr(0644,root,root) %{_unitdir}/%name.service
%changelog
+* Sun Mar 15 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.2-4
+- Don't override ODL dir mode, explicitly set unitfile owner:group
+* Fri Mar 13 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.2-3
+- Don't include ODL version in ODL dir name
+* Tue Feb 10 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.2-2
+- Bugfix in URL to download ODL systemd .service file
* Sat Jan 31 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.2-1
- Upgrade from Helium SR1.1 to Helium SR2
* Thu Jan 29 2015 Daniel Farrell <dfarrell@redhat.com> - 0.2.1-6