Пакет slony1: Specfile

%def_enable	sisyphus
%def_disable	alt4
%define		__xargs	/bin/xargs
%define 	sl_runtimedir	/var/run/%name
%define 	sl_configdir	%_sysconfdir/%name.d
%define		PGSQL	pgsql
%define 	ROOT 	%_localstatedir/%PGSQL-root

Name:		slony1 
Version:	2.0.1
%{?_enable_sisyphus:Release:	alt1}
%{?_enable_alt4:Release:	alt0.M40.1}

Summary:	Slony-I is a "master to multiple slaves" replication system with cascading and failover.
License: 	BSD
Group: 		Databases

Url:		http://gborg.postgresql.org/project/slony1

Source:		%name-%version.tar.bz2
Source1:	slon.init
Source2:	slon.conf

Patch0:		%name-alt-default-config.patch
#Patch1:		slonik-init-cluster-alt-path-fix.patch

#Requires:	postgresql-server
Requires:	%name-common = %version-%release

BuildRequires:  flex libecpg-devel-static postgresql-devel postgresql-server

%package	common
Summary:	common files for using with %name server and client packages.
Group:		Databases

%package	server
Summary:	server side package for %name.
Group:		Databases
Requires:	%name-common = %version-%release

%description
Slony-I is a "master to multiple slaves" replication system 
with cascading and failover.

The big picture for the development of Slony-I is a master-slave 
system that includes all features and capabilities needed to 
replicate large databases to a reasonably limited number of 
slave systems.

Slony-I is a system for data centers and backup sites, where 
the normal mode of operation is that all nodes are available.

%description	common
common libraries for using with %name client and server

%description	server
server side package for %name.

%prep
%setup -q
%patch0 -p1
%__grep -rl "@@PGLIBDIR@@/slon-tools.pm" . | %__xargs %__subst "s,@@PGLIBDIR@@/slon-tools.pm,slon-tools.pm,"

#typo fix in slon_watchdog
#__subst "s,node.err\",node.err\";," tools/altperl/slon_watchdog.pl

%build
%configure	--with-perltools \
			--with-pgsharedir=%_datadir/pgsql
%make_build

%install
%make DESTDIR=%buildroot install

# prepare

%__install -d -m 700 %buildroot%_initdir
%__install -d -m 700 %buildroot%sl_configdir
%__install -d -m 1770 %buildroot%sl_runtimedir
%__install -d -m 770 %buildroot%_logdir/%name

# install initscript for slon

%__install -p -m755 -D %SOURCE1 %buildroot%_initdir/slon

# install config files.

%__install -p -m 640 share/slon.conf-sample %buildroot%sl_configdir/slon.conf
%__install -p -m 640 tools/altperl/slon_tools.conf-sample %buildroot%_sysconfdir/slon_tools.conf

# move slon-tools perl module to the right place.

%__mkdir_p %buildroot%perl_vendor_privlib
%__mv %buildroot%_libdir/slon-tools.pm %buildroot%perl_vendor_privlib/

# make postgresql-server and slony1 daemon home directory.
%__mkdir_p  %buildroot%ROOT/%_localstatedir/%PGSQL
%__ln_s %ROOT%_localstatedir/%PGSQL %buildroot%_localstatedir/%PGSQL

%pre server

/usr/sbin/groupadd -g 46 postgres || :
/usr/sbin/useradd -M -o -r -d %_localstatedir/%PGSQL -s /dev/null \
	-c "PostgreSQL Server and slony1 daemon" -u 46 postgres -g postgres || :

%post server

%post_service slon
/sbin/update_chrooted lib

%files
%doc README* COPYRIGHT HISTORY-1.1 doc/*
%_bindir/slonik_build_env
%_bindir/slonik_create_set
%_bindir/slonik_drop_node
%_bindir/slonik_drop_set
%_bindir/slonik_drop_sequence
%_bindir/slonik_drop_table
%_bindir/slonik_execute_script
%_bindir/slonik_failover
%_bindir/slonik_init_cluster
%_bindir/slonik_merge_sets
%_bindir/slonik_move_set
%_bindir/slonik_print_preamble
%_bindir/slonik_restart_node
%_bindir/slonik_store_node
%_bindir/slonik_subscribe_set
%_bindir/slonik_uninstall_nodes
%_bindir/slonik_unsubscribe_set
%_bindir/slonik_update_nodes
%_bindir/slon_kill
%_bindir/slon_start
%_bindir/slon_watchdog
%_bindir/slon_watchdog2
%_bindir/slony_show_configuration
%_bindir/slony_logshipper
%perl_vendor_privlib/slon-tools.pm
%attr(640,root,postgres) %config(noreplace) %_sysconfdir/slon_tools.conf

%files common
%_libdir/pgsql/*
%_datadir/pgsql/*

%files server
%attr(751,root,root) %dir %ROOT%_localstatedir
%attr(700,postgres,postgres)  %dir %ROOT%_localstatedir/%PGSQL
%attr(1770,root,postgres) %sl_runtimedir
%attr(770,root,postgres) %_logdir/%name
%attr(640,root,postgres) %config(noreplace) %sl_configdir/slon.conf
%_localstatedir/%PGSQL
%_initdir/slon
%_bindir/slon
%_bindir/slonik

%changelog
* Thu Mar 26 2009 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 2.0.1-alt1
-  2.0.1.

* Wed Dec 03 2008 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 2.0.0-alt1
-  2.0.0.

* Tue Jun 24 2008 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.2.14-alt0.M40.1
-  1.2.14-alt0.M40.1.

* Tue Jun 24 2008 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.2.14-alt1
-  1.2.14.

* Mon Jan 28 2008 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.2.12-alt1
-  1.2.12.

* Wed Oct 10 2007 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.2.11-alt1
-  1.2.11;
-  fix in initscript.

* Thu Apr 19 2007 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.2.9-alt1.1
-  buildrequires fix.

* Tue Apr 17 2007 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.2.9-alt1
-  build for ALTLinux Sisyphus.

* Mon Apr 16 2007 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.2.9-alt0.M24.1
-  1.2.9.

* Tue Nov 21 2006 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.2.1-alt0.M24.2
-  fix missing path bug in cluster creation script.

* Mon Nov 20 2006 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.2.1-alt0.M24.1
-  1.2.1.

* Wed Feb 01 2006 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.5-alt0.M24.1
-  1.1.5 release.

* Wed Jan 25 2006 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.5.rc3-alt0.M24.1
- 1.1.5 rc3.
- slon-tools.pm moved from 'common' to main package.

* Thu Dec 08 2005 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.2-alt0.M24.4
-  fixes in initscript (requirements for /bin/sed and /bin/grep removed).
-  update_chrooted added to '%post' section (needed for migration between version).

* Wed Dec 07 2005 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.2-alt0.M24.3
-  fixes in initscript.
-  configs in /etc/slony1.d
-  update for patch0 (lock_file parameter not needed).

* Fri Dec 02 2005 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.2-alt0.M24.2
-  1.1.2;
-  fixes in initscript;
-  changes in default config;
-  all configs moved to /etc/slon.d
-  remove requirements to postgresql-server.

* Fri Oct 07 2005 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.0-alt0.5
-  initial build for sisyphus.
-  split to common, server and tools packages.

* Wed Aug 17 2005 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.0-alt0.M24.4
-  fix 'require' in the all perl scripts.
-  resolve trouble with pid-file creation.
-  fixes in initscript.

* Wed Aug 17 2005 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.0-alt0.M24.3
-  right config files for slon and slon tools.
-  requirement to postgresql-server added.
-  access rights to config files added. 
-  cosmetic spec changes.

* Tue Aug 16 2005 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.0-alt0.M24.2
-  right slon.conf
-  '%post' section added.
-  documentation added.

* Fri Aug 12 2005 Alex Gorbachenko (agent_007) <algor@altlinux.ru> 1.1.0-alt0.M24.1
-  1.1.0