packages: xorp/xorp.spec, xorp/xorp-default_paths.patch (NEW), xorp/xorp.in...

alucard alucard at pld-linux.org
Fri Apr 29 14:09:28 CEST 2011


Author: alucard                      Date: Fri Apr 29 12:09:28 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- up to 1.8.3
- tests works, fixed upsteam (TODO)
- fixed template paths (TODO)
- split for xorpsh left (TODO) - I don't see reason for this
- release 1

---- Files affected:
packages/xorp:
   xorp.spec (1.9 -> 1.10) , xorp-default_paths.patch (NONE -> 1.1)  (NEW), xorp.init (NONE -> 1.1)  (NEW), xorp-configure.patch (1.1 -> NONE)  (REMOVED), xorp-curses.patch (1.1 -> NONE)  (REMOVED), xorp-tests.patch (1.1 -> NONE)  (REMOVED)

---- Diffs:

================================================================
Index: packages/xorp/xorp.spec
diff -u packages/xorp/xorp.spec:1.9 packages/xorp/xorp.spec:1.10
--- packages/xorp/xorp.spec:1.9	Fri Mar 30 13:28:31 2007
+++ packages/xorp/xorp.spec	Fri Apr 29 14:09:23 2011
@@ -1,25 +1,21 @@
 # $Revision$, $Date$
 # TODO:
-# - fix putting config templates in datadir (should be /etc/xorp/templates) 
 # - separate packages: xorpsh, maybe some more
-# - if someone know how to run bgp tests without root priviledges 
-#   (probably other too)
 # 
 # Conditional build:
-%bcond_with	tests	# build without performing tests
+%bcond_without	tests	# build without performing tests
 #
 Summary:	eXtensible Open Router Platform
 Summary(pl.UTF-8):	eXtensible Open Router Platform - rozszerzalna otwarta platforma dla routera
 Name:		xorp
-Version:	1.4
-Release:	0.1
+Version:	1.8.3
+Release:	1
 License:	BSD-like
 Group:		Networking/Admin
-Source0:	http://www.xorp.org/releases/%{version}/%{name}-%{version}.tar.gz
-# Source0-md5:	2eeacffc96d9551fdbf6786fcd033e76
-Patch0:		%{name}-curses.patch
-Patch1:		%{name}-tests.patch
-Patch2:		%{name}-configure.patch
+Source0:	https://github.com/downloads/greearb/xorp.ct/%{name}-%{version}-src.tar.gz
+# Source0-md5:	5879bcf398a7040e893bfb0b33329511
+Source1:	%{name}.init
+Patch0:		%{name}-default_paths.patch
 URL:		http://www.xorp.org/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -29,6 +25,8 @@
 BuildRequires:	ncurses-devel
 BuildRequires:	net-snmp-devel
 %{?with_test:BuildRequires:	python}
+Requires(post,preun):	/sbin/chkconfig
+Requires:	traceroute
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -57,29 +55,41 @@
 programowych. Przykładem może być modularny router Click.
 
 %prep
-%setup -q -n %{name}-%{version}
+%setup -q -n %{name}
 %patch0 -p1
-%patch1 -p1
-%patch2 -p1
 
-%build
-%{__libtoolize}
-%{__aclocal}
-%{__autoconf}
-%{__automake}
-%configure
+# in addition to patch0
+%{__sed} -i "s#/lib/xorp#/%{_lib}/xorp#g" rtrmgr/util.cc
 
-%{__make}
+%build
+%{__scons} DESTDIR=$RPM_BUILD_ROOT \
+	prefix=/usr \
+	libexecdir=%{_libdir} \
+	libdir=%{_libdir} \
+	sbindir=%{_sbindir} \
+	sysconfdir=%{_sysconfdir} \
+	localstatedir=%{_localstatedir} \
 
 %if %{with tests}
-%{__make} check
+%{__scons} check
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
-%{__make} install \
-	 DESTDIR=$RPM_BUILD_ROOT datadir=%{_datadir}/xorp bindir=%{_bindir} sbindir=%{_sbindir} sysconfdir=/etc/xorp docdir=%{_docdir}/xorp-1.4
+install -d $RPM_BUILD_ROOT/etc/{xorp,rc.d/init.d,logrotate.d,sysconfig}
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install -p package_files/xorp.conf $RPM_BUILD_ROOT/etc/xorp/ 
+install -p package_files/xorp.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/xorp
+install -p package_files/xorp.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
+
+%{__scons} install DESTDIR=$RPM_BUILD_ROOT \
+	prefix=/usr \
+	libexecdir=%{_libdir} \
+	libdir=%{_libdir} \
+	sbindir=%{_sbindir} \
+	sysconfdir=%{_sysconfdir} \
+	localstatedir=%{_localstatedir} \
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -87,55 +97,46 @@
 %post
 umask 022
 if [ ! -f %{_sysconfdir}/shells ]; then
-	echo "/usr/bin/xorpsh" > %{_sysconfdir}/shells
+	echo "/usr/sbin/xorpsh" > %{_sysconfdir}/shells
 else
-	if ! grep -q '^/usr/bin/xorpsh$' %{_sysconfdir}/shells; then
-		echo "/usr/bin/xorpsh" >> %{_sysconfdir}/shells
+	if ! grep -q '^/usr/sbin/xorpsh$' %{_sysconfdir}/shells; then
+		echo "/usr/sbin/xorpsh" >> %{_sysconfdir}/shells
 	fi
 fi
+/sbin/chkconfig --add %{name}
+if [ -f /var/lock/subsys/%{name} ]; then
+	echo "Run \"/sbin/service %{name} restart\" to restart XORP." >&2
+else
+	echo "Run \"/sbin/service %{name} start\" to start XORP." >&2
+fi
 
 %preun
 umask 022
 if [ "$1" = "0" ]; then
-	grep -v /usr/bin/xorpsh /etc/shells > /etc/shells.new
+	grep -v /usr/sbin/xorpsh /etc/shells > /etc/shells.new
 	mv -f /etc/shells.new /etc/shells
+	%service %{name} stop
+	/sbin/chkconfig --del %{name}
 fi
 
 %files
 %defattr(644,root,root,755)
-%doc ERRATA README RELEASE_NOTES
-#%attr(644,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/rssh.conf
-%attr(755,root,root) %{_bindir}/print_lsas
-%attr(755,root,root) %{_bindir}/print_neighbours
-%attr(755,root,root) %{_bindir}/send_cli_processor_xrl
-%attr(755,root,root) %{_bindir}/show_interfaces
-%attr(755,root,root) %{_bindir}/show_peer_stats
-%attr(755,root,root) %{_bindir}/show_routes
-%attr(755,root,root) %{_bindir}/show_stats
-%attr(755,root,root) %{_bindir}/xorp_profiler
-%attr(755,root,root) %{_bindir}/xorp_rtrmgr
-%attr(755,root,root) %{_bindir}/xorp_bgp
-%attr(755,root,root) %{_bindir}/xorp_fea
-%attr(755,root,root) %{_bindir}/xorp_fea_click_config_generator
-%attr(755,root,root) %{_bindir}/xorp_fea_dummy
-%attr(755,root,root) %{_bindir}/xorp_fib2mrib
-%attr(755,root,root) %{_bindir}/xorp_finder
-%attr(755,root,root) %{_bindir}/xorp_igmp
-%attr(755,root,root) %{_bindir}/xorp_mld
-%attr(755,root,root) %{_bindir}/xorp_ospfv2
-%attr(755,root,root) %{_bindir}/xorp_ospfv3
-%attr(755,root,root) %{_bindir}/xorp_pimsm4
-%attr(755,root,root) %{_bindir}/xorp_pimsm6
-%attr(755,root,root) %{_bindir}/xorp_policy
-%attr(755,root,root) %{_bindir}/xorp_rib
-%attr(755,root,root) %{_bindir}/xorp_rip
-%attr(755,root,root) %{_bindir}/xorp_ripng
-%attr(755,root,root) %{_bindir}/xorp_static_routes
-%attr(755,root,root) %{_bindir}/xorpsh
-%attr(755,root,root) %{_bindir}/xorpsh_print_peers
-%attr(755,root,root) %{_bindir}/xorpsh_print_routes
+%doc ERRATA RELEASE_NOTES
+%attr(755,root,root) /etc/rc.d/init.d/%{name}
+%attr(644,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
+%attr(644,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%dir %{_sysconfdir}/%{name}
+%attr(644,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/%{name}.conf
+%{_sysconfdir}/%{name}/templates
+%attr(755,root,root) %{_sbindir}/bgp_xrl_shell_funcs.sh
 %attr(755,root,root) %{_sbindir}/call_xrl
-%{_datadir}/xorp
+%attr(755,root,root) %{_sbindir}/fea_xrl_shell_funcs.sh
+%attr(755,root,root) %{_sbindir}/rib_xrl_shell_funcs.sh
+%attr(755,root,root) %{_sbindir}/xorp_profiler
+%attr(755,root,root) %{_sbindir}/xorp_rtrmgr
+%attr(755,root,root) %{_sbindir}/xorpsh
+%attr(755,root,root) %{_libdir}/%{name}
+#%{_datadir}/xorp
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
@@ -143,6 +144,13 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.10  2011/04/29 12:09:23  alucard
+- up to 1.8.3
+- tests works, fixed upsteam (TODO)
+- fixed template paths (TODO)
+- split for xorpsh left (TODO) - I don't see reason for this
+- release 1
+
 Revision 1.9  2007/03/30 11:28:31  alucard
 - double BR...
 

================================================================
Index: packages/xorp/xorp-default_paths.patch
diff -u /dev/null packages/xorp/xorp-default_paths.patch:1.1
--- /dev/null	Fri Apr 29 14:09:28 2011
+++ packages/xorp/xorp-default_paths.patch	Fri Apr 29 14:09:23 2011
@@ -0,0 +1,45 @@
+--- xorp/SConstruct.orig	2011-04-28 14:50:29.133202249 +0000
++++ xorp/SConstruct	2011-04-28 14:51:14.113203367 +0000
+@@ -371,11 +371,11 @@ env['mandir'] = ARGUMENTS.get('mandir',
+ # of 3rd party packagers and distributors.
+ #
+ env['xorp_rootdir']     = env['exec_prefix']	# used to determine RPATH
+-env['xorp_confdir']     = env['sysconfdir']		# path to xorp.conf
++env['xorp_confdir']     = env['sysconfdir'] + '/xorp'	# path to xorp.conf
+ env['xorp_libdir']      = env['libdir']  + '/xorp/lib'
+ env['xorp_moduledir']   = env['libdir']  + '/xorp/sbin'	# Protocol modules
+ env['xorp_sbindir']     = env['sbindir']		# End-user binaries
+-env['xorp_templatedir'] = env['datadir'] + '/templates'
++env['xorp_templatedir'] = env['xorp_confdir'] + '/templates'
+ env['xorp_tooldir']     = env['libdir']  + '/xorp/bin'	# tools/*
+ env['xorp_xrlsdir']     = env['datadir'] + '/xorp/xrls'	# *.xrls
+ env['xorp_sourcedir']   = sourcedir	# rtrmgr/util.cc and xif need this
+--- xorp/rtrmgr/util.cc.orig	2011-04-28 14:52:07.343202413 +0000
++++ xorp/rtrmgr/util.cc	2011-04-28 14:54:30.839868926 +0000
+@@ -130,7 +130,7 @@ xorp_path_init(const char* argv0)
+     if (xr != NULL) {
+ 	s_bin_root = xr;
+ 	s_cfg_root = xr;
+-	s_config_file = s_cfg_root + "/etc/xorp.conf";
++	s_config_file = "/etc/xorp/xorp.conf";
+ 	return;
+     }
+ 
+@@ -158,7 +158,7 @@ xorp_path_init(const char* argv0)
+     string install_root = xorp_real_path(XORP_INSTALL_ROOT);
+     s_bin_root = install_root;
+     s_cfg_root = install_root;
+-    s_config_file = s_cfg_root + "/etc/xorp.conf";
++    s_config_file = "/etc/xorp/xorp.conf";
+ 
+     debug_msg("s_bin_root:   %s\n", s_bin_root.c_str());
+     debug_msg("s_cfg_root:   %s\n", s_cfg_root.c_str());
+@@ -192,7 +192,7 @@ xorp_command_dir()
+ string
+ xorp_template_dir()
+ {
+-    return s_cfg_root + string("/share/xorp/templates");
++    return string("/etc/xorp/templates");
+ }
+ 
+ string

================================================================
Index: packages/xorp/xorp.init
diff -u /dev/null packages/xorp/xorp.init:1.1
--- /dev/null	Fri Apr 29 14:09:28 2011
+++ packages/xorp/xorp.init	Fri Apr 29 14:09:23 2011
@@ -0,0 +1,110 @@
+#!/bin/sh
+#
+# xorp		Start/Stop the XORP routing daemon.
+#
+# chkconfig:	345 12 88
+# description:	XORP is the eXtensible Open Router Platform
+#
+# processname:	xorp_rtrmgr
+# config:	/etc/xorp/xorp.conf
+# pidfile:	/var/run/xorp.pid
+
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+BOOT_CONF="/etc/xorp/xorp.conf"
+LOGFILE="/var/log/xorp.log"
+OPTIONS=""
+WAIT_TO_STOP=100
+
+# Get service config
+[ -f /etc/sysconfig/xorp ] && . /etc/sysconfig/xorp
+
+start() {
+	# Check if the service is already running?
+	if [ -f /var/lock/subsys/xorp ]; then
+		msg_already_running "XORP"
+		return
+	fi
+
+	msg_starting "XORP"
+	daemon xorp_rtrmgr -d -P /var/run/xorp.pid -b $BOOT_CONF -l $LOGFILE $OPTIONS
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/xorp
+}
+
+stop() {
+	if [ ! -f /var/lock/subsys/xorp ]; then
+		msg_not_running "XORP"
+		return
+	fi
+
+	msg_stopping "XORP"
+	busy
+	pid=$(pidofproc xorp_rtrmgr /var/run/xorp.pid)
+	if [ -n $pid ]; then
+		kill -TERM $pid
+		while [ "$i" -lt "$WAIT_TO_STOP" ]; do
+			i=$((i + 1))
+			checkpid $pid && sleep 1 || break
+		done
+		ok
+		rm -f /var/lock/subsys/xorp
+	else
+		died
+	fi
+}
+
+reload() {
+	if [ ! -f /var/lock/subsys/xorp ]; then
+		msg_not_running "xorp"
+		RETVAL=7
+		return
+	fi
+
+	msg_reloading "xorp"
+	killproc xorp_rtrmgr -HUP
+	RETVAL=$?
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/xorp ]; then
+		msg_not_running "xorp"
+		RETVAL=$1
+		return
+	fi
+
+	stop
+	start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  reload|force-reload)
+  	reload
+	;;
+  status)
+	status --pidfile /var/run/xorp.pid XORP
+	exit $?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
+	exit 3
+esac
+
+exit $RETVAL
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/xorp/xorp.spec?r1=1.9&r2=1.10&f=u



More information about the pld-cvs-commit mailing list