4. uninstall rpm:
#rpm -e opendaylight-controller-0.1.0-0.1.20131007gitd684dd4.fc19.noarch
+
+
+Using yum for testing.
+
+1. Create a local repo:
+yum install createrepo
+yum install vsftpd
+systemctl start vsftpd.service
+
+Add /etc/yum.repos.d/localftp.repo
+[localftp]
+name=Local FTP repo
+baseurl=file://127.0.0.1/pub
+enabled=0
+gpgcheck=0
+metadata_expire=1m
+
+2. Add packages to local repo:
+cp opendaylight-controller.spec /var/ftp/pub
+cp opendaylight-controller-dependencies.spec /var/ftp/pub
+
+3. Update local repo with new packages:
+Change the enabled=0 to enabled=1 in the localftp.repo file.
+createrepo /var/ftp/pub
+yum clean expire-cache
+
+4. Verify the repo is there:
+yum repolist
+
+Yum away...
+
+You could also use a fiel based repo and change the baseurl to:
+file:////var/ftp/pub.
+This failed with a network error for me so I switched to ftp.
+
+
+The file system after install should look like
+
+/etc/opendaylight-controller/config.ini
+/usr/share/java/opendaylight-dependencies/{all the non-opendaylight jars from
+the lib and plugin directories
+/usr/share/opendaylight-controller/run.bat, run.sh, ..
+/usr/share/opendaylight-controller/configuration/...
+/usr/share/opendaylight-controller/lib/*.jar ln's to /usr/share/java/opendaylight-dependencies/*.jar
+/usr/share/opendaylight-controller/plugins/*.jar ln's to /usr/share/java/opendaylight-dependencies/*.jar
+/var/lib/opendaylight-controller
+/var/lib/opendaylight-controller/configuration/ ln's back to /usr/share/opendaylight-controller/configuration
+/var/lib/opendaylight-controller/lib
+/var/lib/opendaylight-controller/plugins
\ No newline at end of file
--- /dev/null
+Name: opendaylight-controller-dependencies
+Version: 0.1.0
+Release: 0.1.20131101git31c8f18%{?dist}
+Summary: OpenDaylight SDN Controller Dependencies
+Group: Applications/Communications
+License: EPL
+URL: http://www.opendaylight.org
+Source: opendaylight-controller-%%{version}.zip
+BuildArch: noarch
+Requires: java >= 1:1.7.0
+
+# Here you should have at least dependencies for the packages containing .jar
+# files that you want to create symlinks to:
+# First pass just use everything from the distribution zip.
+#Requires: slf4j
+
+# This is the directory where all dependencies will go:
+# /usr/share/java/opendaylight-controller-dependencies
+%global deps_dir %{_javadir}/%{name}
+
+%description
+OpenDaylight SDN Controller Dependencies
+
+
+%prep
+%setup -q -c opendaylight-controller-dependencies-%{version}
+
+
+%build
+
+# Nothing to build, just repackage the jars
+exit 0
+
+
+%install
+
+# Create the directory for the dependencies:
+mkdir -p %{buildroot}%{deps_dir}
+
+for src in $( ls -I "org.opendaylight.*" opendaylight/lib );
+do
+ tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
+ mv opendaylight/lib/${src} %{buildroot}%{deps_dir}/${tgt}
+done
+
+for src in $( ls -I "org.opendaylight.*" opendaylight/plugins );
+do
+ tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
+ mv opendaylight/plugins/${src} %{buildroot}%{deps_dir}/${tgt}
+done
+
+
+%files
+
+# Own the directory containing the dependencies and its contents:
+%{deps_dir}
+
+
+%changelog
+* Fri Nov 01 2013 Sam Hague <shague@redhat.com> - 0.1.0-0.1.20131007git31c8f18
+- Initial Fedora package.
# todo: Use the ODL snapshot version? Could also be used for the
# Source property in a proper URL.
Version: 0.1.0
-Release: 0.1.20131007gitd684dd4%{?dist}
+Release: 0.1.20131101git31c8f18%{?dist}
Summary: OpenDaylight SDN Controller
Group: Applications/Communications
License: EPL
# todo: Temporary method for generating tarball
# git clone https://git.opendaylight.org/gerrit/p/controller.git
# cd controller
-# git archive --prefix=opendaylight-controller-0.1.0/ d684dd4 | xz > opendaylight-controller-0.1.0.tar.xz
+# git archive --prefix=opendaylight-controller-0.1.0/ 31c8f18 | xz > opendaylight-controller-0.1.0.tar.xz
Source: opendaylight-controller-%{version}.tar.xz
BuildArch: noarch
# todo: Need to create proper packages for all the dependencies.
# Here you should have at least dependencies for the packages containing .jar
-# files that you want to create symlinks to.
-Requires: slf4j
-
+# files that you want to create symlinks to. For now all the jars in a
+# dependencies package.
+#Requires: slf4j
+Requires: opendaylight-controller-dependencies
# This is the directory where all the application resources (scripts,
# libraries, etc) will be installed: /usr/share/opendaylight
# /etc/opendaylight
%global configuration_dir %{_sysconfdir}/%{name}
+%global deps_dir %{_javadir}/opendaylight-controller-dependencies
+
%description
OpenDaylight SDN Controller
# specific maven build command, but this is ok for now:
# todo: eventually move to using mvn-build or mvn-rpmbuild so dependencies are
# not downloaded.
-MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m"; mvn clean install -DskipTests
+MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" && mvn clean install -DskipTests
+#MAVEN_OPTS="-XX:PermSize=256m -Xmx1024m -XX:MaxPermSize=512m" && mvn -DskipTests clean install
# below is just for testing
# MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m"; mvn package
ln -s %{resources_dir}/configuration/tomcat-server.xml %{buildroot}%{data_dir}/configuration
mv tmp/opendaylight/* %{buildroot}%{resources_dir}
+
ln -s %{resources_dir}/lib %{buildroot}%{data_dir}
ln -s %{resources_dir}/plugins %{buildroot}%{data_dir}
+
# Usually one wants to replace the .jar files of the dependencies by symlinks
# to the ones provided to the system. This assumes the dependencies have been
# installed as separate packages and listed in the Requires header.
-while read resource_path system_path
+#while read resource_path system_path
+#do
+# rm -f %%{buildroot}%%{resources_dir}/${resource_path}
+## ln -s %%{_javadir}/${system_path} %%{buildroot}%%{resources_dir}/${resource_path}
+# ln -s %%{deps_dir}/%%{system_path} %%{buildroot}%%{resources_dir}/${resource_path}
+#done <<.
+#lib/jersey-core.jar jersey-core.jar
+#.
+cd %{buildroot}%{resources_dir}/lib
+for src in $( ls -I "org.opendaylight.*" );
+do
+ rm -f ${src}
+ tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
+ ln -s %{deps_dir}/${tgt} ${src}
+done
+
+cd %{buildroot}%{resources_dir}/plugins
+for src in $( ls -I "org.opendaylight.*" );
do
- rm -f %{buildroot}%{resources_dir}/${resource_path}
- ln -s %{_javadir}/${system_path} %{buildroot}%{resources_dir}/${resource_path}
-done <<.
-lib/slf4j-api-1.7.2.jar slf4j/slf4j-api.jar
-.
+ rm -f ${src}
+ tgt=$(echo ${src} | sed -e "s/-[0-9].*/.jar/")
+ ln -s %{deps_dir}/${tgt} ${src}
+done
+
# Fix the permissions as they come with all the permissions (mode 777)
# from the .zip file:
chmod -R 755 %{buildroot}%{resources_dir}
-#chmod 755 %%{buildroot}%%{resources_dir}/lib
-#chmod 755 %%{buildroot}%%{resources_dir}/plugins
# Remove the temporary directory:
rm -rf tmp
# todo: add checks to ensure controller is stopped
#%%preun
-%postun
-
-if [ $1 = 0 ]; then
- rm -rf %{data_dir}
-fi
-
%changelog
+* Fri Nov 01 2013 Sam Hague <shague@redhat.com> - 0.1.0-0.1.20131007git31c8f18
+- Modify to include opendaylight-controller-dependencies.
+- Do not delete the files in var
+
* Mon Oct 07 2013 Sam Hague <shague@redhat.com> - 0.1.0-0.1.20131007gitd684dd4
- Initial Fedora package.