changeset 108:be32a2c5e1fd

pull changes from Holgi's portage overlay
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 04 Mar 2009 02:58:24 +0100
parents 54d7a26e3b70 (current diff) 72f3700549ac (diff)
children 3ba6723f8197
files dev-util/hgsvn/Manifest dev-util/hgsvn/hgsvn-0.1.5.ebuild dev-util/svk/Manifest dev-util/svk/svk-2.0.2.ebuild mail-client/alpine/alpine-1.10.ebuild net-misc/e1000/Manifest net-misc/e1000/e1000-8.0.3.1.ebuild net-misc/e1000e/Manifest net-misc/e1000e/e1000e-0.4.1.7.ebuild net-misc/rabbitmq-server/Manifest net-misc/rabbitmq-server/rabbitmq-server-1.4.0.ebuild sys-block/noflushd/Manifest sys-block/noflushd/files/noflushd-2.7.4-SCSI.patch sys-block/noflushd/files/noflushd.confd sys-block/noflushd/files/noflushd.rc6 sys-block/noflushd/noflushd-2.7.4.ebuild sys-libs/libstatgrab/Manifest sys-libs/libstatgrab/libstatgrab-0.16.ebuild
diffstat 70 files changed, 6324 insertions(+), 532 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-base/Manifest	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,5 @@
+AUX postgresql-8.3-base.patch 4130 RMD160 53cf20e4161ac9a9abd14c1a834f2e4508c5b44a SHA1 f58dbfde59f1543c8bd87527a1dfc3356c06db90 SHA256 a3bb8eca2d472a22d744a23d47d829b9931cd5bae2206e90d7e0fac4399927a5
+AUX postgresql-8.3-common.patch 2641 RMD160 0822bf1512457e91d5f32f9d192de6f197db9c55 SHA1 e4bdbd5eee1023e8f0b42ef408b34b57495d1e2b SHA256 e416c26d9c3d266b306ddbc0a2b648054739b7ace35e2b4e449fbdaf094bc197
+AUX postgresql-8.x-relax_ssl_perms.patch 764 RMD160 d1ce5164779c0b0c9229dc13d2eebe6b8c960616 SHA1 f28af41e549bbe3a0b4b8669a2762f71bf3e8a9e SHA256 98bc99954521db083320bd9a6b3a0a5d6eb960af3699527c16e53c567e22394a
+DIST postgresql-8.3.6.tar.bz2 14081040 RMD160 fa30a5e426ffd4800bd918012e0094c56ad1bae1 SHA1 6ef6d564988209e5c85b061c71af58bebac522bd SHA256 fd0239849839227649e2f472a1ffeab87f9eedc75a1d11c803dde65b109d7479
+EBUILD postgresql-base-8.3.6.ebuild 4664 RMD160 e131ef0e13d31fd982a739c8fe9c83f199852b56 SHA1 a5e1e81459439d9d683a58aa453209e35c747e48 SHA256 6978b378a20196ffb4851dac809653c6ad7c026fbbd8bc1847824c1e38d3764a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-base/files/postgresql-8.3-base.patch	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,143 @@
+=== contrib/Makefile
+==================================================================
+--- contrib/Makefile	(revision 2)
++++ contrib/Makefile	(local)
+@@ -5,41 +5,10 @@
+ include $(top_builddir)/src/Makefile.global
+ 
+ WANTED_DIRS = \
+-		adminpack	\
+-		btree_gist	\
+-		chkpass		\
+-		cube		\
+-		dblink		\
+-		dict_int	\
+-		dict_xsyn	\
+-		earthdistance	\
+-		fuzzystrmatch	\
+-		hstore		\
+-		intagg		\
+-		intarray	\
+-		isn		\
+-		lo		\
+-		ltree		\
+ 		oid2name	\
+-		pageinspect	\
+-		pg_buffercache	\
+-		pg_freespacemap \
+-		pg_standby	\
+-		pg_trgm		\
+ 		pgbench		\
+-		pgcrypto	\
+-		pgrowlocks	\
+-		pgstattuple	\
+-		seg		\
+-		spi		\
+-		tablefunc	\
+-		test_parser	\
+-		tsearch2	\
+ 		vacuumlo
+ 
+-ifeq ($(with_openssl),yes)
+-WANTED_DIRS += sslinfo
+-endif
+ 
+ ifeq ($(with_ossp_uuid),yes)
+ WANTED_DIRS += uuid-ossp
+=== src/Makefile
+==================================================================
+--- src/Makefile	(revision 2)
++++ src/Makefile	(local)
+@@ -15,16 +15,11 @@
+ 
+ all install installdirs uninstall distprep:
+ 	$(MAKE) -C port $@
+-	$(MAKE) -C timezone $@
+ 	$(MAKE) -C backend $@
+-	$(MAKE) -C backend/utils/mb/conversion_procs $@
+-	$(MAKE) -C backend/snowball $@
+ 	$(MAKE) -C include $@
+ 	$(MAKE) -C interfaces $@
+ 	$(MAKE) -C bin $@
+-	$(MAKE) -C pl $@
+ 	$(MAKE) -C makefiles $@
+-	$(MAKE) -C test/regress $@
+ 
+ install: install-local
+ 
+=== src/backend/Makefile
+==================================================================
+--- src/backend/Makefile	(revision 2)
++++ src/backend/Makefile	(local)
+@@ -34,7 +34,7 @@
+ 
+ ##########################################################################
+ 
+-all: submake-libpgport postgres $(POSTGRES_IMP)
++all: someheaders
+ 
+ ifneq ($(PORTNAME), cygwin)
+ ifneq ($(PORTNAME), win32)
+@@ -107,8 +107,7 @@
+ 
+ .PHONY: $(DIRS:%=%-recursive)
+ # Update the commonly used headers before building the subdirectories
+-$(DIRS:%=%-recursive): $(top_builddir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
+-	$(MAKE) -C $(subst -recursive,,$@) all
++someheaders $(DIRS:%=%-recursive): $(top_builddir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
+ 
+ 
+ # The postgres.o target is needed by the rule in Makefile.global that
+@@ -155,23 +154,7 @@
+ 
+ ##########################################################################
+ 
+-install: all installdirs install-bin
+-ifeq ($(PORTNAME), cygwin)
+-ifeq ($(MAKE_DLL), true)
+-	$(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a'
+-endif
+-endif
+-ifeq ($(PORTNAME), win32)
+-ifeq ($(MAKE_DLL), true)
+-	$(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a'
+-endif
+-endif
+-	$(MAKE) -C catalog install-data
+-	$(MAKE) -C tsearch install-data
+-	$(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample'
+-	$(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample'
+-	$(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample'
+-	$(INSTALL_DATA) $(srcdir)/access/transam/recovery.conf.sample '$(DESTDIR)$(datadir)/recovery.conf.sample'
++install:
+ 
+ install-bin: postgres $(POSTGRES_IMP) installdirs
+ 	$(INSTALL_PROGRAM) postgres$(X) '$(DESTDIR)$(bindir)/postgres$(X)'
+=== src/bin/Makefile
+==================================================================
+--- src/bin/Makefile	(revision 2)
++++ src/bin/Makefile	(local)
+@@ -13,8 +13,8 @@
+ top_builddir = ../..
+ include $(top_builddir)/src/Makefile.global
+ 
+-DIRS = initdb ipcclean pg_ctl pg_dump \
+-	psql scripts pg_config pg_controldata pg_resetxlog
++DIRS = pg_dump \
++	psql scripts pg_config
+ ifeq ($(PORTNAME), win32)
+ DIRS+=pgevent
+ endif
+=== src/include/pg_config_manual.h
+==================================================================
+--- src/include/pg_config_manual.h	(revision 2)
++++ src/include/pg_config_manual.h	(local)
+@@ -184,7 +184,7 @@
+  * here's where to twiddle it.  You can also override this at runtime
+  * with the postmaster's -k switch.
+  */
+-#define DEFAULT_PGSOCKET_DIR  "/tmp"
++#define DEFAULT_PGSOCKET_DIR  "/var/run/postgresql"
+ 
+ /*
+  * The random() function is expected to yield values between 0 and
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-base/files/postgresql-8.3-common.patch	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,88 @@
+diff --git a/config/programs.m4 b/config/programs.m4
+index 9434113..d72b35c 100644
+--- a/config/programs.m4
++++ b/config/programs.m4
+@@ -202,8 +202,12 @@ AC_DEFUN([PGAC_CHECK_GETTEXT],
+ dnl FIXME: We should probably check for version >=0.10.36.
+   AC_CHECK_PROGS(XGETTEXT, xgettext)
+ 
+-  # Note: share/locale is always the default, independent of $datadir
+-  localedir='${prefix}/share/locale'
++  # Note: share/locale *WAS* always the default, independent of $datadir
++  AC_ARG_WITH([locale-dir],
++   AC_HELP_STRING([--with-locale-dir],[Set path to locale files]),
++   [ localedir="${withval}" ],
++   [ localedir='${prefix}/share/locale' ]
++  )
+   AC_SUBST(localedir)
+ ])# PGAC_CHECK_GETTEXT
+ 
+diff --git a/configure.in b/configure.in
+index 58cc61c..07ffc38 100644
+--- a/configure.in
++++ b/configure.in
+@@ -19,10 +19,6 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
+ 
+ AC_INIT([PostgreSQL], [8.3RC1], [pgsql-bugs@postgresql.org])
+ 
+-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.59], [], [m4_fatal([Autoconf version 2.59 is required.
+-Untested combinations of 'autoconf' and PostgreSQL versions are not
+-recommended.  You can remove the check from 'configure.in' but it is then
+-your responsibility whether the result works or not.])])
+ AC_COPYRIGHT([Copyright (c) 1996-2008, PostgreSQL Global Development Group])
+ AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
+ AC_CONFIG_AUX_DIR(config)
+diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
+index 7d9448f..07799bc 100644
+--- a/src/include/storage/s_lock.h
++++ b/src/include/storage/s_lock.h
+@@ -298,6 +298,29 @@ tas(volatile slock_t *lock)
+ 
+ #endif	 /* __s390__ || __s390x__ */
+ 
++#if defined(__sh__)
++#define HAS_TEST_AND_SET
++
++typedef unsigned char slock_t;
++
++#define TAS(lock) tas(lock)
++
++static __inline__ int
++tas(volatile slock_t *lock)
++{
++	register int _res = 1;
++
++	__asm__ __volatile__(
++		"tas.b	@%1\n\t"
++		"movt	%0\n\t"
++		"xor	#1,%0"
++:		"=z"(_res)
++:		"r"(lock)
++:		"t","memory");
++	return _res;
++}
++
++#endif	 /* __sh__ */
+ 
+ #if defined(__sparc__)		/* Sparc */
+ #define HAS_TEST_AND_SET
+diff --git a/src/makefiles/Makefile.darwin b/src/makefiles/Makefile.darwin
+index 9f761d4..83b2974 100644
+--- a/src/makefiles/Makefile.darwin
++++ b/src/makefiles/Makefile.darwin
+@@ -5,7 +5,15 @@ DLSUFFIX = .so
+ CFLAGS_SL =
+ 
+ ifdef PGXS
++ifdef PGXS_IN_SERVER
++ifndef PGXS_WITH_SERVER
++BE_DLLLIBS= -bundle_loader $(top_builddir)/src/backend/postgres
++else
++BE_DLLLIBS= -bundle_loader ${PGXS_WITH_SERVER}
++endif
++else
+ BE_DLLLIBS= -bundle_loader $(bindir)/postgres
++endif
+ else
+ BE_DLLLIBS= -bundle_loader $(top_builddir)/src/backend/postgres
+ endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-base/files/postgresql-8.x-relax_ssl_perms.patch	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,14 @@
+diff -ur postgresql-8.0.15.orig/src/backend/libpq/be-secure.c postgresql-8.0.15/src/backend/libpq/be-secure.c
+--- postgresql-8.0.15.orig/src/backend/libpq/be-secure.c	2008-02-21 04:06:04.334289203 +0100
++++ postgresql-8.0.15/src/backend/libpq/be-secure.c	2008-02-21 04:08:47.309426324 +0100
+@@ -737,8 +737,8 @@
+ 		 * data directory permission check in postmaster.c)
+ 		 */
+ #if !defined(WIN32) && !defined(__CYGWIN__)
+-		if (!S_ISREG(buf.st_mode) || (buf.st_mode & (S_IRWXG | S_IRWXO)) ||
+-			buf.st_uid != geteuid())
++		if (!S_ISREG(buf.st_mode) || (buf.st_mode & (S_IWGRP | S_IRWXO)) ||
++			(buf.st_uid != geteuid()) && buf.st_uid != 0)
+ 			ereport(FATAL,
+ 					(errcode(ERRCODE_CONFIG_FILE_ERROR),
+ 				  errmsg("unsafe permissions on private key file \"%s\"",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-base/postgresql-base-8.3.6.ebuild	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,148 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-base/postgresql-base-8.3.5.ebuild,v 1.1 2008/12/03 19:21:50 caleb Exp $
+
+EAPI="1"
+
+WANT_AUTOCONF="latest"
+WANT_AUTOMAKE="none"
+
+inherit eutils multilib toolchain-funcs versionator autotools
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+
+DESCRIPTION="PostgreSQL libraries and clients"
+HOMEPAGE="http://www.postgresql.org/"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
+LICENSE="POSTGRESQL"
+SLOT="$(get_version_component_range 1-2)"
+IUSE_LINGUAS="
+	linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
+	linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
+	linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
+	linguas_tr linguas_zh_CN linguas_zh_TW"
+IUSE="doc kerberos nls pam pg-intdatetime readline ssl threads zlib ldap ${IUSE_LINGUAS}"
+RESTRICT="test"
+
+wanted_languages() {
+	for u in ${IUSE_LINGUAS} ; do
+		use $u && echo -n "${u#linguas_} "
+	done
+}
+
+RDEPEND="kerberos? ( virtual/krb5 )
+	pam? ( virtual/pam )
+	readline? ( >=sys-libs/readline-4.1 )
+	ssl? ( >=dev-libs/openssl-0.9.6-r1 )
+	zlib? ( >=sys-libs/zlib-1.1.3 )
+	>=app-admin/eselect-postgresql-0.3
+	!dev-db/postgresql-libs
+	!dev-db/postgresql-client
+	!dev-db/libpq
+	!dev-db/postgresql
+	ldap? ( net-nds/openldap )"
+DEPEND="${RDEPEND}
+	sys-devel/flex
+	>=sys-devel/bison-1.875
+	nls? ( sys-devel/gettext )"
+PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"
+
+S="${WORKDIR}/postgresql-${PV}"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
+		"${FILESDIR}/postgresql-${SLOT}-base.patch" \
+		"${FILESDIR}/postgresql-8.x-relax_ssl_perms.patch"
+
+	# to avoid collision - it only should be installed by server
+	rm "${S}/src/backend/nls.mk"
+
+	# because psql/help.c includes the file
+	ln -s "${S}/src/include/libpq/pqsignal.h" "${S}/src/bin/psql/"
+
+	eautoconf
+}
+
+src_compile() {
+	econf --prefix=/usr/$(get_libdir)/postgresql-${SLOT} \
+		--datadir=/usr/share/postgresql-${SLOT} \
+		--sysconfdir=/etc/postgresql-${SLOT} \
+		--includedir=/usr/include/postgresql-${SLOT} \
+		--with-locale-dir=/usr/share/postgresql-${SLOT}/locale \
+		--mandir=/usr/share/postgresql-${SLOT}/man \
+		--without-docdir \
+		--enable-depend \
+		--without-tcl \
+		--without-perl \
+		--without-python \
+		$(use_with readline) \
+		$(use_with kerberos krb5) \
+		$(use_with kerberos gssapi) \
+		"$(use_enable nls nls "$(wanted_languages)")" \
+		$(use_with pam) \
+		$(use_enable pg-intdatetime integer-datetimes ) \
+		$(use_with ssl openssl) \
+		$(use_enable threads thread-safety) \
+		$(use_enable threads thread-safety-force) \
+		$(use_with zlib) \
+		$(use_with ldap) \
+		${myconf} \
+		|| die "configure failed"
+
+	emake LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "emake failed"
+
+	cd "${S}/contrib"
+	emake LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+	insinto /usr/include/postgresql-${SLOT}/postmaster
+	doins "${S}"/src/include/postmaster/*.h
+	dodir /usr/share/postgresql-${SLOT}/man/man1
+	tar -zxf "${S}/doc/man.tar.gz" -C "${D}"/usr/share/postgresql-${SLOT}/man man1/{ecpg,pg_config}.1
+
+	rm "${D}/usr/share/postgresql-${SLOT}/man/man1"/{initdb,ipcclean,pg_controldata,pg_ctl,pg_resetxlog,pg_restore,postgres,postmaster}.1
+	dodoc README HISTORY doc/{README.*,TODO,bug.template}
+
+	cd "${S}/contrib"
+	emake DESTDIR="${D}" install || die "emake install failed"
+	cd "${S}"
+
+	dodir /etc/eselect/postgresql/slots/${SLOT}
+
+	IDIR="/usr/include/postgresql-${SLOT}"
+	cat > "${D}/etc/eselect/postgresql/slots/${SLOT}/base" <<-__EOF__
+postgres_ebuilds="\${postgres_ebuilds} ${PF}"
+postgres_prefix=/usr/$(get_libdir)/postgresql-${SLOT}
+postgres_datadir=/usr/share/postgresql-${SLOT}
+postgres_bindir=/usr/$(get_libdir)/postgresql-${SLOT}/bin
+postgres_symlinks=(
+	${IDIR} /usr/include/postgresql
+	${IDIR}/libpq-fe.h /usr/include/libpq-fe.h
+	${IDIR}/libpq /usr/include/libpq
+	${IDIR}/postgres_ext.h /usr/include/postgres_ext.h
+)
+__EOF__
+
+	cat >"${T}/50postgresql-94-${SLOT}" <<-__EOF__
+		LDPATH=/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)
+		MANPATH=/usr/share/postgresql-${SLOT}/man
+	__EOF__
+	doenvd "${T}/50postgresql-94-${SLOT}"
+
+	keepdir /etc/postgresql-${SLOT}
+}
+
+pkg_postinst() {
+	eselect postgresql update
+	[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
+	elog "If you need a global psqlrc-file, you can place it in '${ROOT}/etc/postgresql-${SLOT}/'."
+}
+
+pkg_postrm() {
+	eselect postgresql update
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-server/Manifest	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,6 @@
+AUX postgresql-8.3-common.patch 2641 RMD160 0822bf1512457e91d5f32f9d192de6f197db9c55 SHA1 e4bdbd5eee1023e8f0b42ef408b34b57495d1e2b SHA256 e416c26d9c3d266b306ddbc0a2b648054739b7ace35e2b4e449fbdaf094bc197
+AUX postgresql-8.3-server.patch 66296 RMD160 6acd5dec3b411d0439bab47a344406df25c08b7a SHA1 fca417c169d5de6c2ea036ab80a4ce02665ae881 SHA256 74684e07df2ff15f3c10d4f586cd72fba51c996ab9a97b6aee11f79987fc4de6
+AUX postgresql.conf-8.3 1725 RMD160 5bdd027b82013feddcba5d68c09e4122e219ecd2 SHA1 c1bc9ba72623efa12bfad55a0e12a57350955409 SHA256 15cb0f8052d0ecc1bced449777f76875c06ab088f67c1f7f3148b84e97082233
+AUX postgresql.init-8.3 3036 RMD160 9a6e0eab7413b82ccf4bfaf6494b3eaa1abf3c4c SHA1 8896cd60d669bdbc5b76649ee26bb23e2c5c9654 SHA256 0685e2e5ff9b97ff22cdbf590fed0c76cb13b4c087bb961a751fdb4e03fb3dea
+DIST postgresql-8.3.6.tar.bz2 14081040 RMD160 fa30a5e426ffd4800bd918012e0094c56ad1bae1 SHA1 6ef6d564988209e5c85b061c71af58bebac522bd SHA256 fd0239849839227649e2f472a1ffeab87f9eedc75a1d11c803dde65b109d7479
+EBUILD postgresql-server-8.3.6.ebuild 9662 RMD160 48e9383552053aca0728635ba977412fedbcfc73 SHA1 8a2076011865de5e03e75f80fc64d61bff70ec92 SHA256 8c6e0a3732d8ce8460155d9862fb8e6720fec95a2e62388ed8011eab9113e2e2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-server/files/postgresql-8.3-common.patch	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,88 @@
+diff --git a/config/programs.m4 b/config/programs.m4
+index 9434113..d72b35c 100644
+--- a/config/programs.m4
++++ b/config/programs.m4
+@@ -202,8 +202,12 @@ AC_DEFUN([PGAC_CHECK_GETTEXT],
+ dnl FIXME: We should probably check for version >=0.10.36.
+   AC_CHECK_PROGS(XGETTEXT, xgettext)
+ 
+-  # Note: share/locale is always the default, independent of $datadir
+-  localedir='${prefix}/share/locale'
++  # Note: share/locale *WAS* always the default, independent of $datadir
++  AC_ARG_WITH([locale-dir],
++   AC_HELP_STRING([--with-locale-dir],[Set path to locale files]),
++   [ localedir="${withval}" ],
++   [ localedir='${prefix}/share/locale' ]
++  )
+   AC_SUBST(localedir)
+ ])# PGAC_CHECK_GETTEXT
+ 
+diff --git a/configure.in b/configure.in
+index 58cc61c..07ffc38 100644
+--- a/configure.in
++++ b/configure.in
+@@ -19,10 +19,6 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
+ 
+ AC_INIT([PostgreSQL], [8.3RC1], [pgsql-bugs@postgresql.org])
+ 
+-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.59], [], [m4_fatal([Autoconf version 2.59 is required.
+-Untested combinations of 'autoconf' and PostgreSQL versions are not
+-recommended.  You can remove the check from 'configure.in' but it is then
+-your responsibility whether the result works or not.])])
+ AC_COPYRIGHT([Copyright (c) 1996-2008, PostgreSQL Global Development Group])
+ AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
+ AC_CONFIG_AUX_DIR(config)
+diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
+index 7d9448f..07799bc 100644
+--- a/src/include/storage/s_lock.h
++++ b/src/include/storage/s_lock.h
+@@ -298,6 +298,29 @@ tas(volatile slock_t *lock)
+ 
+ #endif	 /* __s390__ || __s390x__ */
+ 
++#if defined(__sh__)
++#define HAS_TEST_AND_SET
++
++typedef unsigned char slock_t;
++
++#define TAS(lock) tas(lock)
++
++static __inline__ int
++tas(volatile slock_t *lock)
++{
++	register int _res = 1;
++
++	__asm__ __volatile__(
++		"tas.b	@%1\n\t"
++		"movt	%0\n\t"
++		"xor	#1,%0"
++:		"=z"(_res)
++:		"r"(lock)
++:		"t","memory");
++	return _res;
++}
++
++#endif	 /* __sh__ */
+ 
+ #if defined(__sparc__)		/* Sparc */
+ #define HAS_TEST_AND_SET
+diff --git a/src/makefiles/Makefile.darwin b/src/makefiles/Makefile.darwin
+index 9f761d4..83b2974 100644
+--- a/src/makefiles/Makefile.darwin
++++ b/src/makefiles/Makefile.darwin
+@@ -5,7 +5,15 @@ DLSUFFIX = .so
+ CFLAGS_SL =
+ 
+ ifdef PGXS
++ifdef PGXS_IN_SERVER
++ifndef PGXS_WITH_SERVER
++BE_DLLLIBS= -bundle_loader $(top_builddir)/src/backend/postgres
++else
++BE_DLLLIBS= -bundle_loader ${PGXS_WITH_SERVER}
++endif
++else
+ BE_DLLLIBS= -bundle_loader $(bindir)/postgres
++endif
+ else
+ BE_DLLLIBS= -bundle_loader $(top_builddir)/src/backend/postgres
+ endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-server/files/postgresql-8.3-server.patch	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,2449 @@
+diff -Naur postgresql-8.3.3.orig/contrib/adminpack/Makefile postgresql-8.3.3/contrib/adminpack/Makefile
+--- postgresql-8.3.3.orig/contrib/adminpack/Makefile	2008-06-14 12:56:41.000000000 +0200
++++ postgresql-8.3.3/contrib/adminpack/Makefile	2008-06-14 12:57:12.000000000 +0200
+@@ -1,7 +1,7 @@
+ # $PostgreSQL: pgsql/contrib/adminpack/Makefile,v 1.6 2007/11/10 23:59:50 momjian Exp $
+ 
+ MODULE_big = adminpack
+-PG_CPPFLAGS = -I$(libpq_srcdir)
++PG_CPPFLAGS = -I$(libpq_srcdir) -I../../src/include/
+ DATA_built = adminpack.sql
+ DATA = uninstall_adminpack.sql
+ OBJS = adminpack.o
+diff -Naur postgresql-8.3.3.orig/contrib/Makefile postgresql-8.3.3/contrib/Makefile
+--- postgresql-8.3.3.orig/contrib/Makefile	2008-06-14 12:56:41.000000000 +0200
++++ postgresql-8.3.3/contrib/Makefile	2008-06-14 12:57:12.000000000 +0200
+@@ -20,22 +20,19 @@
+ 		isn		\
+ 		lo		\
+ 		ltree		\
+-		oid2name	\
+ 		pageinspect	\
+ 		pg_buffercache	\
+ 		pg_freespacemap \
+ 		pg_standby	\
+ 		pg_trgm		\
+-		pgbench		\
+ 		pgcrypto	\
+ 		pgrowlocks	\
+ 		pgstattuple	\
+ 		seg		\
+ 		spi		\
+ 		tablefunc	\
+-		test_parser	\
+ 		tsearch2	\
+-		vacuumlo
++		test_parser
+ 
+ ifeq ($(with_openssl),yes)
+ WANTED_DIRS += sslinfo
+diff -Naur postgresql-8.3.3.orig/contrib/uuid-ossp/Makefile postgresql-8.3.3/contrib/uuid-ossp/Makefile
+--- postgresql-8.3.3.orig/contrib/uuid-ossp/Makefile	2008-06-14 12:56:41.000000000 +0200
++++ postgresql-8.3.3/contrib/uuid-ossp/Makefile	2008-06-14 12:57:12.000000000 +0200
+@@ -1,11 +1,13 @@
+ # $PostgreSQL: pgsql/contrib/uuid-ossp/Makefile,v 1.4 2007/11/13 00:13:19 tgl Exp $
+ 
++PG_CPPFLAGS += "-DHAVE_OSSP_UUID_H"
++
+ MODULE_big = uuid-ossp
+ OBJS = uuid-ossp.o
+ DATA_built = uuid-ossp.sql
+ DATA = uninstall_uuid-ossp.sql
+ 
+-SHLIB_LINK += $(OSSP_UUID_LIBS)
++SHLIB_LINK += -lossp-uuid
+ 
+ ifdef USE_PGXS
+ PG_CONFIG = pg_config
+diff -Naur postgresql-8.3.3.orig/contrib/xml2/Makefile postgresql-8.3.3/contrib/xml2/Makefile
+--- postgresql-8.3.3.orig/contrib/xml2/Makefile	2008-06-14 12:56:41.000000000 +0200
++++ postgresql-8.3.3/contrib/xml2/Makefile	2008-06-14 13:21:32.000000000 +0200
+@@ -4,7 +4,8 @@
+ 
+ OBJS = $(if $(filter -lxslt, $(LIBS)), xpath.o xslt_proc.o, xpath.o)
+ 
+-SHLIB_LINK += $(filter -lxslt, $(LIBS)) $(filter -lxml2, $(LIBS))
++PG_CPPFLAGS = $(shell xml2-config --cflags)
++SHLIB_LINK += $(shell xml2-config --libs) $(shell xslt-config --libs)
+ 
+ DATA_built = pgxml.sql
+ DATA = uninstall_pgxml.sql
+diff -Naur postgresql-8.3.3.orig/GNUmakefile.in postgresql-8.3.3/GNUmakefile.in
+--- postgresql-8.3.3.orig/GNUmakefile.in	2008-06-14 12:56:41.000000000 +0200
++++ postgresql-8.3.3/GNUmakefile.in	2008-06-14 12:57:12.000000000 +0200
+@@ -11,19 +11,16 @@
+ all:
+ 	$(MAKE) -C doc all
+ 	$(MAKE) -C src all
+-	$(MAKE) -C config all
+ 	@echo "All of PostgreSQL successfully made. Ready to install."
+ 
+ install:
+ 	$(MAKE) -C doc $@
+ 	$(MAKE) -C src $@
+-	$(MAKE) -C config $@
+ 	@echo "PostgreSQL installation complete."
+ 
+ installdirs uninstall:
+ 	$(MAKE) -C doc $@
+ 	$(MAKE) -C src $@
+-	$(MAKE) -C config $@
+ 
+ distprep:
+ 	$(MAKE) -C doc $@
+diff -Naur postgresql-8.3.3.orig/src/bin/initdb/Makefile postgresql-8.3.3/src/bin/initdb/Makefile
+--- postgresql-8.3.3.orig/src/bin/initdb/Makefile	2008-06-14 12:56:40.000000000 +0200
++++ postgresql-8.3.3/src/bin/initdb/Makefile	2008-06-14 12:57:12.000000000 +0200
+@@ -14,7 +14,7 @@
+ top_builddir = ../../..
+ include $(top_builddir)/src/Makefile.global
+ 
+-override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)
++override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/interfaces/libpq $(CPPFLAGS)
+ 
+ OBJS=	initdb.o encnames.o pqsignal.o $(WIN32RES)
+ 
+diff -Naur postgresql-8.3.3.orig/src/bin/Makefile postgresql-8.3.3/src/bin/Makefile
+--- postgresql-8.3.3.orig/src/bin/Makefile	2008-06-14 12:56:40.000000000 +0200
++++ postgresql-8.3.3/src/bin/Makefile	2008-06-14 12:57:12.000000000 +0200
+@@ -13,8 +13,8 @@
+ top_builddir = ../..
+ include $(top_builddir)/src/Makefile.global
+ 
+-DIRS = initdb ipcclean pg_ctl pg_dump \
+-	psql scripts pg_config pg_controldata pg_resetxlog
++DIRS = initdb ipcclean pg_ctl \
++	pg_controldata pg_resetxlog
+ ifeq ($(PORTNAME), win32)
+ DIRS+=pgevent
+ endif
+diff -Naur postgresql-8.3.3.orig/src/include/pg_config_manual.h postgresql-8.3.3/src/include/pg_config_manual.h
+--- postgresql-8.3.3.orig/src/include/pg_config_manual.h	2008-06-14 12:56:41.000000000 +0200
++++ postgresql-8.3.3/src/include/pg_config_manual.h	2008-06-14 12:57:12.000000000 +0200
+@@ -184,7 +184,7 @@
+  * here's where to twiddle it.  You can also override this at runtime
+  * with the postmaster's -k switch.
+  */
+-#define DEFAULT_PGSOCKET_DIR  "/tmp"
++#define DEFAULT_PGSOCKET_DIR  "/var/run/postgresql"
+ 
+ /*
+  * The random() function is expected to yield values between 0 and
+diff -Naur postgresql-8.3.3.orig/src/Makefile postgresql-8.3.3/src/Makefile
+--- postgresql-8.3.3.orig/src/Makefile	2008-06-14 12:56:40.000000000 +0200
++++ postgresql-8.3.3/src/Makefile	2008-06-14 12:57:12.000000000 +0200
+@@ -19,14 +19,11 @@
+ 	$(MAKE) -C backend $@
+ 	$(MAKE) -C backend/utils/mb/conversion_procs $@
+ 	$(MAKE) -C backend/snowball $@
+-	$(MAKE) -C include $@
+-	$(MAKE) -C interfaces $@
+ 	$(MAKE) -C bin $@
+ 	$(MAKE) -C pl $@
+-	$(MAKE) -C makefiles $@
+ 	$(MAKE) -C test/regress $@
+ 
+-install: install-local
++install:
+ 
+ install-local: installdirs-local
+ 	$(INSTALL_DATA) Makefile.global '$(DESTDIR)$(pgxsdir)/$(subdir)/Makefile.global'
+diff -Naur postgresql-8.3.3.orig/src/Makefile.global.in postgresql-8.3.3/src/Makefile.global.in
+--- postgresql-8.3.3.orig/src/Makefile.global.in	2008-06-14 12:56:41.000000000 +0200
++++ postgresql-8.3.3/src/Makefile.global.in	2008-06-14 12:57:12.000000000 +0200
+@@ -373,10 +373,8 @@
+ 
+ 
+ submake-libpq:
+-	$(MAKE) -C $(libpq_builddir) all
+ 
+ submake-libpgport:
+-	$(MAKE) -C $(top_builddir)/src/port all
+ 
+ .PHONY: submake-libpq submake-libpgport
+ 
+@@ -419,6 +417,8 @@
+    LDFLAGS += $(PROFILE)
+ endif
+ 
++CFLAGS += -I${top_srcdir}/src/include
++
+ 
+ ##########################################################################
+ #
+diff -Naur postgresql-8.3.3.orig/src/port/Makefile postgresql-8.3.3/src/port/Makefile
+--- postgresql-8.3.3.orig/src/port/Makefile	2008-06-14 12:56:40.000000000 +0200
++++ postgresql-8.3.3/src/port/Makefile	2008-06-14 12:57:12.000000000 +0200
+@@ -35,11 +35,10 @@
+ # foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
+ OBJS_SRV = $(OBJS:%.o=%_srv.o)
+ 
+-all: libpgport.a libpgport_srv.a
++all: libpgport_srv.a
+ 
+ # libpgport is needed by some contrib
+-install: all installdirs
+-	$(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(libdir)/libpgport.a'
++install:
+ 
+ installdirs:
+ 	$(mkinstalldirs) '$(DESTDIR)$(libdir)'
+diff -Naur postgresql-8.3.3.orig/src/test/regress/GNUmakefile postgresql-8.3.3/src/test/regress/GNUmakefile
+--- postgresql-8.3.3.orig/src/test/regress/GNUmakefile	2008-06-14 12:56:40.000000000 +0200
++++ postgresql-8.3.3/src/test/regress/GNUmakefile	2008-06-14 12:57:12.000000000 +0200
+@@ -141,7 +141,7 @@
+ ##
+ 
+ check: all
+-	./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) $(TEMP_CONF)
++	./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) $(TEMP_CONF) --psqldir=/usr/lib/postgresql-${SLOT}/bin/
+ 
+ installcheck: all
+ 	./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
+diff -Naur postgresql-8.3.3.orig/src/test/regress/pg_regress.c postgresql-8.3.3/src/test/regress/pg_regress.c
+--- postgresql-8.3.3.orig/src/test/regress/pg_regress.c	2008-06-14 12:56:40.000000000 +0200
++++ postgresql-8.3.3/src/test/regress/pg_regress.c	2008-06-14 12:57:12.000000000 +0200
+@@ -781,9 +781,6 @@
+ 		sprintf(tmp, "%s/install/%s", temp_install, datadir);
+ 		datadir = tmp;
+ 
+-		/* psql will be installed into temp-install bindir */
+-		psqldir = bindir;
+-
+ 		/*
+ 		 * Set up shared library paths to include the temp install.
+ 		 *
+@@ -2069,7 +2066,7 @@
+ 		 */
+ 		snprintf(buf, sizeof(buf),
+ 				 SYSTEMQUOTE "\"%s/psql\" -X postgres <%s 2>%s" SYSTEMQUOTE,
+-				 bindir, DEVNULL, DEVNULL);
++				 psqldir, DEVNULL, DEVNULL);
+ 		for (i = 0; i < 60; i++)
+ 		{
+ 			/* Done if psql succeeds */
+diff -Naur postgresql-8.3.3.orig/src/test/regress/pg_regress.c.orig postgresql-8.3.3/src/test/regress/pg_regress.c.orig
+--- postgresql-8.3.3.orig/src/test/regress/pg_regress.c.orig	1970-01-01 01:00:00.000000000 +0100
++++ postgresql-8.3.3/src/test/regress/pg_regress.c.orig	2008-03-31 03:32:01.000000000 +0200
+@@ -0,0 +1,2221 @@
++/*-------------------------------------------------------------------------
++ *
++ * pg_regress --- regression test driver
++ *
++ * This is a C implementation of the previous shell script for running
++ * the regression tests, and should be mostly compatible with it.
++ * Initial author of C translation: Magnus Hagander
++ *
++ * This code is released under the terms of the PostgreSQL License.
++ *
++ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
++ * Portions Copyright (c) 1994, Regents of the University of California
++ *
++ * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.41.2.2 2008/03/31 01:32:01 tgl Exp $
++ *
++ *-------------------------------------------------------------------------
++ */
++
++#include "pg_regress.h"
++
++#include <ctype.h>
++#include <sys/stat.h>
++#include <sys/wait.h>
++#include <signal.h>
++#include <unistd.h>
++
++#ifdef HAVE_SYS_RESOURCE_H
++#include <sys/time.h>
++#include <sys/resource.h>
++#endif
++
++#include "getopt_long.h"
++#include "pg_config_paths.h"
++
++/* for resultmap we need a list of pairs of strings */
++typedef struct _resultmap
++{
++	char	   *test;
++	char	   *type;
++	char	   *resultfile;
++	struct _resultmap *next;
++}	_resultmap;
++
++/*
++ * Values obtained from pg_config_paths.h and Makefile.  The PG installation
++ * paths are only used in temp_install mode: we use these strings to find
++ * out where "make install" will put stuff under the temp_install directory.
++ * In non-temp_install mode, the only thing we need is the location of psql,
++ * which we expect to find in psqldir, or in the PATH if psqldir isn't given.
++ */
++char	   *bindir = PGBINDIR;
++char	   *libdir = LIBDIR;
++char	   *datadir = PGSHAREDIR;
++char	   *host_platform = HOST_TUPLE;
++
++#ifndef WIN32_ONLY_COMPILER
++static char *makeprog = MAKEPROG;
++#endif
++
++#ifndef WIN32					/* not used in WIN32 case */
++static char *shellprog = SHELLPROG;
++#endif
++
++/* currently we can use the same diff switches on all platforms */
++const char *basic_diff_opts = "-w";
++const char *pretty_diff_opts = "-w -C3";
++
++/* options settable from command line */
++_stringlist *dblist = NULL;
++bool		debug = false;
++char	   *inputdir = ".";
++char	   *outputdir = ".";
++char	   *psqldir = NULL;
++static _stringlist *loadlanguage = NULL;
++static int	max_connections = 0;
++static char *encoding = NULL;
++static _stringlist *schedulelist = NULL;
++static _stringlist *extra_tests = NULL;
++static char *temp_install = NULL;
++static char *temp_config = NULL;
++static char *top_builddir = NULL;
++static int	temp_port = 65432;
++static bool nolocale = false;
++static char *hostname = NULL;
++static int	port = -1;
++static char *user = NULL;
++static char *srcdir = NULL;
++static _stringlist *extraroles = NULL;
++
++/* internal variables */
++static const char *progname;
++static char *logfilename;
++static FILE *logfile;
++static char *difffilename;
++
++static _resultmap *resultmap = NULL;
++
++static PID_TYPE postmaster_pid = INVALID_PID;
++static bool postmaster_running = false;
++
++static int	success_count = 0;
++static int	fail_count = 0;
++static int	fail_ignore_count = 0;
++
++static bool directory_exists(const char *dir);
++static void make_directory(const char *dir);
++
++static void
++header(const char *fmt,...)
++/* This extension allows gcc to check the format string for consistency with
++   the supplied arguments. */
++__attribute__((format(printf, 1, 2)));
++static void
++status(const char *fmt,...)
++/* This extension allows gcc to check the format string for consistency with
++   the supplied arguments. */
++__attribute__((format(printf, 1, 2)));
++static void
++psql_command(const char *database, const char *query,...)
++/* This extension allows gcc to check the format string for consistency with
++   the supplied arguments. */
++__attribute__((format(printf, 2, 3)));
++
++#ifdef WIN32
++typedef		BOOL(WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE);
++
++/* Windows API define missing from MingW headers */
++#define DISABLE_MAX_PRIVILEGE	0x1
++#endif
++
++/*
++ * allow core files if possible.
++ */
++#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE)
++static void
++unlimit_core_size(void)
++{
++	struct rlimit lim;
++
++	getrlimit(RLIMIT_CORE, &lim);
++	if (lim.rlim_max == 0)
++	{
++		fprintf(stderr,
++				_("%s: cannot set core size,: disallowed by hard limit.\n"),
++				progname);
++		return;
++	}
++	else if (lim.rlim_max == RLIM_INFINITY || lim.rlim_cur < lim.rlim_max)
++	{
++		lim.rlim_cur = lim.rlim_max;
++		setrlimit(RLIMIT_CORE, &lim);
++	}
++}
++#endif
++
++
++/*
++ * Add an item at the end of a stringlist.
++ */
++void
++add_stringlist_item(_stringlist ** listhead, const char *str)
++{
++	_stringlist *newentry = malloc(sizeof(_stringlist));
++	_stringlist *oldentry;
++
++	newentry->str = strdup(str);
++	newentry->next = NULL;
++	if (*listhead == NULL)
++		*listhead = newentry;
++	else
++	{
++		for (oldentry = *listhead; oldentry->next; oldentry = oldentry->next)
++			 /* skip */ ;
++		oldentry->next = newentry;
++	}
++}
++
++/*
++ * Free a stringlist.
++ */
++static void
++free_stringlist(_stringlist ** listhead)
++{
++	if (listhead == NULL || *listhead == NULL)
++		return;
++	if ((*listhead)->next != NULL)
++		free_stringlist(&((*listhead)->next));
++	free((*listhead)->str);
++	free(*listhead);
++	*listhead = NULL;
++}
++
++/*
++ * Split a delimited string into a stringlist
++ */
++static void
++split_to_stringlist(const char *s, const char *delim, _stringlist ** listhead)
++{
++	char	   *sc = strdup(s);
++	char	   *token = strtok(sc, delim);
++
++	while (token)
++	{
++		add_stringlist_item(listhead, token);
++		token = strtok(NULL, delim);
++	}
++	free(sc);
++}
++
++/*
++ * Print a progress banner on stdout.
++ */
++static void
++header(const char *fmt,...)
++{
++	char		tmp[64];
++	va_list		ap;
++
++	va_start(ap, fmt);
++	vsnprintf(tmp, sizeof(tmp), fmt, ap);
++	va_end(ap);
++
++	fprintf(stdout, "============== %-38s ==============\n", tmp);
++	fflush(stdout);
++}
++
++/*
++ * Print "doing something ..." --- supplied text should not end with newline
++ */
++static void
++status(const char *fmt,...)
++{
++	va_list		ap;
++
++	va_start(ap, fmt);
++	vfprintf(stdout, fmt, ap);
++	fflush(stdout);
++	va_end(ap);
++
++	if (logfile)
++	{
++		va_start(ap, fmt);
++		vfprintf(logfile, fmt, ap);
++		va_end(ap);
++	}
++}
++
++/*
++ * Done "doing something ..."
++ */
++static void
++status_end(void)
++{
++	fprintf(stdout, "\n");
++	fflush(stdout);
++	if (logfile)
++		fprintf(logfile, "\n");
++}
++
++/*
++ * shut down temp postmaster
++ */
++static void
++stop_postmaster(void)
++{
++	if (postmaster_running)
++	{
++		/* We use pg_ctl to issue the kill and wait for stop */
++		char		buf[MAXPGPATH * 2];
++
++		/* On Windows, system() seems not to force fflush, so... */
++		fflush(stdout);
++		fflush(stderr);
++
++		snprintf(buf, sizeof(buf),
++				 SYSTEMQUOTE "\"%s/pg_ctl\" stop -D \"%s/data\" -s -m fast" SYSTEMQUOTE,
++				 bindir, temp_install);
++		system(buf);			/* ignore exit status */
++		postmaster_running = false;
++	}
++}
++
++/*
++ * Always exit through here, not through plain exit(), to ensure we make
++ * an effort to shut down a temp postmaster
++ */
++void
++exit_nicely(int code)
++{
++	stop_postmaster();
++	exit(code);
++}
++
++/*
++ * Check whether string matches pattern
++ *
++ * In the original shell script, this function was implemented using expr(1),
++ * which provides basic regular expressions restricted to match starting at
++ * the string start (in conventional regex terms, there's an implicit "^"
++ * at the start of the pattern --- but no implicit "$" at the end).
++ *
++ * For now, we only support "." and ".*" as non-literal metacharacters,
++ * because that's all that anyone has found use for in resultmap.  This
++ * code could be extended if more functionality is needed.
++ */
++static bool
++string_matches_pattern(const char *str, const char *pattern)
++{
++	while (*str && *pattern)
++	{
++		if (*pattern == '.' && pattern[1] == '*')
++		{
++			pattern += 2;
++			/* Trailing .* matches everything. */
++			if (*pattern == '\0')
++				return true;
++
++			/*
++			 * Otherwise, scan for a text position at which we can match the
++			 * rest of the pattern.
++			 */
++			while (*str)
++			{
++				/*
++				 * Optimization to prevent most recursion: don't recurse
++				 * unless first pattern char might match this text char.
++				 */
++				if (*str == *pattern || *pattern == '.')
++				{
++					if (string_matches_pattern(str, pattern))
++						return true;
++				}
++
++				str++;
++			}
++
++			/*
++			 * End of text with no match.
++			 */
++			return false;
++		}
++		else if (*pattern != '.' && *str != *pattern)
++		{
++			/*
++			 * Not the single-character wildcard and no explicit match? Then
++			 * time to quit...
++			 */
++			return false;
++		}
++
++		str++;
++		pattern++;
++	}
++
++	if (*pattern == '\0')
++		return true;			/* end of pattern, so declare match */
++
++	/* End of input string.  Do we have matching pattern remaining? */
++	while (*pattern == '.' && pattern[1] == '*')
++		pattern += 2;
++	if (*pattern == '\0')
++		return true;			/* end of pattern, so declare match */
++
++	return false;
++}
++
++/*
++ * Replace all occurances of a string in a string with a different string.
++ * NOTE: Assumes there is enough room in the target buffer!
++ */
++void
++replace_string(char *string, char *replace, char *replacement)
++{
++	char	   *ptr;
++
++	while ((ptr = strstr(string, replace)) != NULL)
++	{
++		char	   *dup = strdup(string);
++
++		strlcpy(string, dup, ptr - string + 1);
++		strcat(string, replacement);
++		strcat(string, dup + (ptr - string) + strlen(replace));
++		free(dup);
++	}
++}
++
++/*
++ * Convert *.source found in the "source" directory, replacing certain tokens
++ * in the file contents with their intended values, and put the resulting files
++ * in the "dest" directory, replacing the ".source" prefix in their names with
++ * the given suffix.
++ */
++static void
++convert_sourcefiles_in(char *source, char *dest, char *suffix)
++{
++	char		abs_srcdir[MAXPGPATH];
++	char		abs_builddir[MAXPGPATH];
++	char		testtablespace[MAXPGPATH];
++	char		indir[MAXPGPATH];
++	struct stat	st;
++	int			ret;
++	char	  **name;
++	char	  **names;
++	int			count = 0;
++
++#ifdef WIN32
++	char	   *c;
++#endif
++
++	if (!getcwd(abs_builddir, sizeof(abs_builddir)))
++	{
++		fprintf(stderr, _("%s: could not get current directory: %s\n"),
++				progname, strerror(errno));
++		exit_nicely(2);
++	}
++
++	/*
++	 * in a VPATH build, use the provided source directory; otherwise, use the
++	 * current directory.
++	 */
++	if (srcdir)
++		strlcpy(abs_srcdir, srcdir, MAXPGPATH);
++	else
++		strlcpy(abs_srcdir, abs_builddir, MAXPGPATH);
++
++	snprintf(indir, MAXPGPATH, "%s/%s", abs_srcdir, source);
++
++	/* Check that indir actually exists and is a directory */
++	ret = stat(indir, &st);
++	if (ret != 0 || !S_ISDIR(st.st_mode))
++	{
++		/*
++		 * No warning, to avoid noise in tests that do not have
++		 * these directories; for example, ecpg, contrib and src/pl.
++		 */
++		return;
++	}
++
++	names = pgfnames(indir);
++	if (!names)
++		/* Error logged in pgfnames */
++		exit_nicely(2);
++
++#ifdef WIN32
++	/* in Win32, replace backslashes with forward slashes */
++	for (c = abs_builddir; *c; c++)
++		if (*c == '\\')
++			*c = '/';
++	for (c = abs_srcdir; *c; c++)
++		if (*c == '\\')
++			*c = '/';
++#endif
++
++	snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", abs_builddir);
++
++#ifdef WIN32
++	/*
++	 * On Windows only, clean out the test tablespace dir, or create it if it
++	 * doesn't exist.  On other platforms we expect the Makefile to take
++	 * care of that.  (We don't migrate that functionality in here because
++	 * it'd be harder to cope with platform-specific issues such as SELinux.)
++	 *
++	 * XXX it would be better if pg_regress.c had nothing at all to do with
++	 * testtablespace, and this were handled by a .BAT file or similar on
++	 * Windows.  See pgsql-hackers discussion of 2008-01-18.
++	 */
++	if (directory_exists(testtablespace))
++		rmtree(testtablespace, true);
++	make_directory(testtablespace);
++#endif
++
++	/* finally loop on each file and do the replacement */
++	for (name = names; *name; name++)
++	{
++		char		srcfile[MAXPGPATH];
++		char		destfile[MAXPGPATH];
++		char		prefix[MAXPGPATH];
++		FILE	   *infile,
++				   *outfile;
++		char		line[1024];
++
++		/* reject filenames not finishing in ".source" */
++		if (strlen(*name) < 8)
++			continue;
++		if (strcmp(*name + strlen(*name) - 7, ".source") != 0)
++			continue;
++
++		count++;
++
++		/* build the full actual paths to open */
++		snprintf(prefix, strlen(*name) - 6, "%s", *name);
++		snprintf(srcfile, MAXPGPATH, "%s/%s", indir, *name);
++		snprintf(destfile, MAXPGPATH, "%s/%s.%s", dest, prefix, suffix);
++
++		infile = fopen(srcfile, "r");
++		if (!infile)
++		{
++			fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
++					progname, srcfile, strerror(errno));
++			exit_nicely(2);
++		}
++		outfile = fopen(destfile, "w");
++		if (!outfile)
++		{
++			fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
++					progname, destfile, strerror(errno));
++			exit_nicely(2);
++		}
++		while (fgets(line, sizeof(line), infile))
++		{
++			replace_string(line, "@abs_srcdir@", abs_srcdir);
++			replace_string(line, "@abs_builddir@", abs_builddir);
++			replace_string(line, "@testtablespace@", testtablespace);
++			replace_string(line, "@DLSUFFIX@", DLSUFFIX);
++			fputs(line, outfile);
++		}
++		fclose(infile);
++		fclose(outfile);
++	}
++
++	/*
++	 * If we didn't process any files, complain because it probably means
++	 * somebody neglected to pass the needed --srcdir argument.
++	 */
++	if (count <= 0)
++	{
++		fprintf(stderr, _("%s: no *.source files found in %s\n"),
++				progname, indir);
++		exit_nicely(2);
++	}
++
++	pgfnames_cleanup(names);
++}
++
++/* Create the .sql and .out files from the .source files, if any */
++static void
++convert_sourcefiles(void)
++{
++	convert_sourcefiles_in("input", "sql", "sql");
++	convert_sourcefiles_in("output", "expected", "out");
++}
++
++/*
++ * Scan resultmap file to find which platform-specific expected files to use.
++ *
++ * The format of each line of the file is
++ *		   testname/hostplatformpattern=substitutefile
++ * where the hostplatformpattern is evaluated per the rules of expr(1),
++ * namely, it is a standard regular expression with an implicit ^ at the start.
++ * (We currently support only a very limited subset of regular expressions,
++ * see string_matches_pattern() above.)  What hostplatformpattern will be
++ * matched against is the config.guess output.	(In the shell-script version,
++ * we also provided an indication of whether gcc or another compiler was in
++ * use, but that facility isn't used anymore.)
++ */
++static void
++load_resultmap(void)
++{
++	char		buf[MAXPGPATH];
++	FILE	   *f;
++
++	/* scan the file ... */
++	snprintf(buf, sizeof(buf), "%s/resultmap", inputdir);
++	f = fopen(buf, "r");
++	if (!f)
++	{
++		/* OK if it doesn't exist, else complain */
++		if (errno == ENOENT)
++			return;
++		fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
++				progname, buf, strerror(errno));
++		exit_nicely(2);
++	}
++
++	while (fgets(buf, sizeof(buf), f))
++	{
++		char	   *platform;
++		char	   *file_type;
++		char	   *expected;
++		int			i;
++
++		/* strip trailing whitespace, especially the newline */
++		i = strlen(buf);
++		while (i > 0 && isspace((unsigned char) buf[i - 1]))
++			buf[--i] = '\0';
++
++		/* parse out the line fields */
++		file_type = strchr(buf, ':');
++		if (!file_type)
++		{
++			fprintf(stderr, _("incorrectly formatted resultmap entry: %s\n"),
++					buf);
++			exit_nicely(2);
++		}
++		*file_type++ = '\0';
++
++		platform = strchr(file_type, ':');
++		if (!platform)
++		{
++			fprintf(stderr, _("incorrectly formatted resultmap entry: %s\n"),
++					buf);
++			exit_nicely(2);
++		}
++		*platform++ = '\0';
++		expected = strchr(platform, '=');
++		if (!expected)
++		{
++			fprintf(stderr, _("incorrectly formatted resultmap entry: %s\n"),
++					buf);
++			exit_nicely(2);
++		}
++		*expected++ = '\0';
++
++		/*
++		 * if it's for current platform, save it in resultmap list. Note: by
++		 * adding at the front of the list, we ensure that in ambiguous cases,
++		 * the last match in the resultmap file is used. This mimics the
++		 * behavior of the old shell script.
++		 */
++		if (string_matches_pattern(host_platform, platform))
++		{
++			_resultmap *entry = malloc(sizeof(_resultmap));
++
++			entry->test = strdup(buf);
++			entry->type = strdup(file_type);
++			entry->resultfile = strdup(expected);
++			entry->next = resultmap;
++			resultmap = entry;
++		}
++	}
++	fclose(f);
++}
++
++/*
++ * Check in resultmap if we should be looking at a different file
++ */
++static
++const char *
++get_expectfile(const char *testname, const char *file)
++{
++	char	   *file_type;
++	_resultmap *rm;
++
++	/*
++	 * Determine the file type from the file name. This is just what is
++	 * following the last dot in the file name.
++	 */
++	if (!file || !(file_type = strrchr(file, '.')))
++		return NULL;
++
++	file_type++;
++
++	for (rm = resultmap; rm != NULL; rm = rm->next)
++	{
++		if (strcmp(testname, rm->test) == 0 && strcmp(file_type, rm->type) == 0)
++		{
++			return rm->resultfile;
++		}
++	}
++
++	return NULL;
++}
++
++/*
++ * Handy subroutine for setting an environment variable "var" to "val"
++ */
++static void
++doputenv(const char *var, const char *val)
++{
++	char	   *s = malloc(strlen(var) + strlen(val) + 2);
++
++	sprintf(s, "%s=%s", var, val);
++	putenv(s);
++}
++
++/*
++ * Set the environment variable "pathname", prepending "addval" to its
++ * old value (if any).
++ */
++static void
++add_to_path(const char *pathname, char separator, const char *addval)
++{
++	char	   *oldval = getenv(pathname);
++	char	   *newval;
++
++	if (!oldval || !oldval[0])
++	{
++		/* no previous value */
++		newval = malloc(strlen(pathname) + strlen(addval) + 2);
++		sprintf(newval, "%s=%s", pathname, addval);
++	}
++	else
++	{
++		newval = malloc(strlen(pathname) + strlen(addval) + strlen(oldval) + 3);
++		sprintf(newval, "%s=%s%c%s", pathname, addval, separator, oldval);
++	}
++	putenv(newval);
++}
++
++/*
++ * Prepare environment variables for running regression tests
++ */
++static void
++initialize_environment(void)
++{
++	char	   *tmp;
++
++	/*
++	 * Clear out any non-C locale settings
++	 */
++	unsetenv("LC_COLLATE");
++	unsetenv("LC_CTYPE");
++	unsetenv("LC_MONETARY");
++	unsetenv("LC_MESSAGES");
++	unsetenv("LC_NUMERIC");
++	unsetenv("LC_TIME");
++	unsetenv("LC_ALL");
++	unsetenv("LANG");
++	unsetenv("LANGUAGE");
++	/* On Windows the default locale cannot be English, so force it */
++#if defined(WIN32) || defined(__CYGWIN__)
++	putenv("LANG=en");
++#endif
++
++	/*
++	 * Set multibyte as requested
++	 */
++	if (encoding)
++		doputenv("PGCLIENTENCODING", encoding);
++	else
++		unsetenv("PGCLIENTENCODING");
++
++	/*
++	 * Set timezone and datestyle for datetime-related tests
++	 */
++	putenv("PGTZ=PST8PDT");
++	putenv("PGDATESTYLE=Postgres, MDY");
++
++	if (temp_install)
++	{
++		/*
++		 * Clear out any environment vars that might cause psql to connect to
++		 * the wrong postmaster, or otherwise behave in nondefault ways. (Note
++		 * we also use psql's -X switch consistently, so that ~/.psqlrc files
++		 * won't mess things up.)  Also, set PGPORT to the temp port, and set
++		 * or unset PGHOST depending on whether we are using TCP or Unix
++		 * sockets.
++		 */
++		unsetenv("PGDATABASE");
++		unsetenv("PGUSER");
++		unsetenv("PGSERVICE");
++		unsetenv("PGSSLMODE");
++		unsetenv("PGREQUIRESSL");
++		unsetenv("PGCONNECT_TIMEOUT");
++		unsetenv("PGDATA");
++		if (hostname != NULL)
++			doputenv("PGHOST", hostname);
++		else
++			unsetenv("PGHOST");
++		unsetenv("PGHOSTADDR");
++		if (port != -1)
++		{
++			char		s[16];
++
++			sprintf(s, "%d", port);
++			doputenv("PGPORT", s);
++		}
++
++		/*
++		 * Adjust path variables to point into the temp-install tree
++		 */
++		tmp = malloc(strlen(temp_install) + 32 + strlen(bindir));
++		sprintf(tmp, "%s/install/%s", temp_install, bindir);
++		bindir = tmp;
++
++		tmp = malloc(strlen(temp_install) + 32 + strlen(libdir));
++		sprintf(tmp, "%s/install/%s", temp_install, libdir);
++		libdir = tmp;
++
++		tmp = malloc(strlen(temp_install) + 32 + strlen(datadir));
++		sprintf(tmp, "%s/install/%s", temp_install, datadir);
++		datadir = tmp;
++
++		/* psql will be installed into temp-install bindir */
++		psqldir = bindir;
++
++		/*
++		 * Set up shared library paths to include the temp install.
++		 *
++		 * LD_LIBRARY_PATH covers many platforms.  DYLD_LIBRARY_PATH works on
++		 * Darwin, and maybe other Mach-based systems.	LIBPATH is for AIX.
++		 * Windows needs shared libraries in PATH (only those linked into
++		 * executables, not dlopen'ed ones). Feel free to account for others
++		 * as well.
++		 */
++		add_to_path("LD_LIBRARY_PATH", ':', libdir);
++		add_to_path("DYLD_LIBRARY_PATH", ':', libdir);
++		add_to_path("LIBPATH", ':', libdir);
++#if defined(WIN32) || defined(__CYGWIN__)
++		add_to_path("PATH", ';', libdir);
++#endif
++	}
++	else
++	{
++		const char *pghost;
++		const char *pgport;
++
++		/*
++		 * When testing an existing install, we honor existing environment
++		 * variables, except if they're overridden by command line options.
++		 */
++		if (hostname != NULL)
++		{
++			doputenv("PGHOST", hostname);
++			unsetenv("PGHOSTADDR");
++		}
++		if (port != -1)
++		{
++			char		s[16];
++
++			sprintf(s, "%d", port);
++			doputenv("PGPORT", s);
++		}
++		if (user != NULL)
++			doputenv("PGUSER", user);
++
++		/*
++		 * Report what we're connecting to
++		 */
++		pghost = getenv("PGHOST");
++		pgport = getenv("PGPORT");
++#ifndef HAVE_UNIX_SOCKETS
++		if (!pghost)
++			pghost = "localhost";
++#endif
++
++		if (pghost && pgport)
++			printf(_("(using postmaster on %s, port %s)\n"), pghost, pgport);
++		if (pghost && !pgport)
++			printf(_("(using postmaster on %s, default port)\n"), pghost);
++		if (!pghost && pgport)
++			printf(_("(using postmaster on Unix socket, port %s)\n"), pgport);
++		if (!pghost && !pgport)
++			printf(_("(using postmaster on Unix socket, default port)\n"));
++	}
++
++	convert_sourcefiles();
++	load_resultmap();
++}
++
++/*
++ * Issue a command via psql, connecting to the specified database
++ *
++ * Since we use system(), this doesn't return until the operation finishes
++ */
++static void
++psql_command(const char *database, const char *query,...)
++{
++	char		query_formatted[1024];
++	char		query_escaped[2048];
++	char		psql_cmd[MAXPGPATH + 2048];
++	va_list		args;
++	char	   *s;
++	char	   *d;
++
++	/* Generate the query with insertion of sprintf arguments */
++	va_start(args, query);
++	vsnprintf(query_formatted, sizeof(query_formatted), query, args);
++	va_end(args);
++
++	/* Now escape any shell double-quote metacharacters */
++	d = query_escaped;
++	for (s = query_formatted; *s; s++)
++	{
++		if (strchr("\\\"$`", *s))
++			*d++ = '\\';
++		*d++ = *s;
++	}
++	*d = '\0';
++
++	/* And now we can build and execute the shell command */
++	snprintf(psql_cmd, sizeof(psql_cmd),
++			 SYSTEMQUOTE "\"%s%spsql\" -X -c \"%s\" \"%s\"" SYSTEMQUOTE,
++			 psqldir ? psqldir : "",
++			 psqldir ? "/" : "",
++			 query_escaped,
++			 database);
++
++	if (system(psql_cmd) != 0)
++	{
++		/* psql probably already reported the error */
++		fprintf(stderr, _("command failed: %s\n"), psql_cmd);
++		exit_nicely(2);
++	}
++}
++
++/*
++ * Spawn a process to execute the given shell command; don't wait for it
++ *
++ * Returns the process ID (or HANDLE) so we can wait for it later
++ */
++PID_TYPE
++spawn_process(const char *cmdline)
++{
++#ifndef WIN32
++	pid_t		pid;
++
++	/*
++	 * Must flush I/O buffers before fork.	Ideally we'd use fflush(NULL) here
++	 * ... does anyone still care about systems where that doesn't work?
++	 */
++	fflush(stdout);
++	fflush(stderr);
++	if (logfile)
++		fflush(logfile);
++
++	pid = fork();
++	if (pid == -1)
++	{
++		fprintf(stderr, _("%s: could not fork: %s\n"),
++				progname, strerror(errno));
++		exit_nicely(2);
++	}
++	if (pid == 0)
++	{
++		/*
++		 * In child
++		 *
++		 * Instead of using system(), exec the shell directly, and tell it to
++		 * "exec" the command too.	This saves two useless processes per
++		 * parallel test case.
++		 */
++		char	   *cmdline2 = malloc(strlen(cmdline) + 6);
++
++		sprintf(cmdline2, "exec %s", cmdline);
++		execl(shellprog, shellprog, "-c", cmdline2, (char *) NULL);
++		fprintf(stderr, _("%s: could not exec \"%s\": %s\n"),
++				progname, shellprog, strerror(errno));
++		exit(1);				/* not exit_nicely here... */
++	}
++	/* in parent */
++	return pid;
++#else
++	char	   *cmdline2;
++	BOOL		b;
++	STARTUPINFO si;
++	PROCESS_INFORMATION pi;
++	HANDLE		origToken;
++	HANDLE		restrictedToken;
++	SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
++	SID_AND_ATTRIBUTES dropSids[2];
++	__CreateRestrictedToken _CreateRestrictedToken = NULL;
++	HANDLE		Advapi32Handle;
++
++	ZeroMemory(&si, sizeof(si));
++	si.cb = sizeof(si);
++
++	Advapi32Handle = LoadLibrary("ADVAPI32.DLL");
++	if (Advapi32Handle != NULL)
++	{
++		_CreateRestrictedToken = (__CreateRestrictedToken) GetProcAddress(Advapi32Handle, "CreateRestrictedToken");
++	}
++
++	if (_CreateRestrictedToken == NULL)
++	{
++		if (Advapi32Handle != NULL)
++			FreeLibrary(Advapi32Handle);
++		fprintf(stderr, "ERROR: cannot create restricted tokens on this platform\n");
++		exit_nicely(2);
++	}
++
++	/* Open the current token to use as base for the restricted one */
++	if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &origToken))
++	{
++		fprintf(stderr, "could not open process token: %lu\n", GetLastError());
++		exit_nicely(2);
++	}
++
++	/* Allocate list of SIDs to remove */
++	ZeroMemory(&dropSids, sizeof(dropSids));
++	if (!AllocateAndInitializeSid(&NtAuthority, 2,
++								  SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &dropSids[0].Sid) ||
++		!AllocateAndInitializeSid(&NtAuthority, 2,
++								  SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0, 0, &dropSids[1].Sid))
++	{
++		fprintf(stderr, "could not allocate SIDs: %lu\n", GetLastError());
++		exit_nicely(2);
++	}
++
++	b = _CreateRestrictedToken(origToken,
++							   DISABLE_MAX_PRIVILEGE,
++							   sizeof(dropSids) / sizeof(dropSids[0]),
++							   dropSids,
++							   0, NULL,
++							   0, NULL,
++							   &restrictedToken);
++
++	FreeSid(dropSids[1].Sid);
++	FreeSid(dropSids[0].Sid);
++	CloseHandle(origToken);
++	FreeLibrary(Advapi32Handle);
++
++	if (!b)
++	{
++		fprintf(stderr, "could not create restricted token: %lu\n", GetLastError());
++		exit_nicely(2);
++	}
++
++	cmdline2 = malloc(strlen(cmdline) + 8);
++	sprintf(cmdline2, "cmd /c %s", cmdline);
++
++	if (!CreateProcessAsUser(restrictedToken,
++						NULL,
++						cmdline2,
++						NULL,
++						NULL,
++						TRUE,
++						CREATE_SUSPENDED,
++						NULL,
++						NULL,
++						&si,
++						&pi))
++	{
++		fprintf(stderr, _("could not start process for \"%s\": %lu\n"),
++				cmdline2, GetLastError());
++		exit_nicely(2);
++	}
++
++#ifndef __CYGWIN__
++	AddUserToDacl(pi.hProcess);
++#endif
++
++	free(cmdline2);
++
++    ResumeThread(pi.hThread);
++	CloseHandle(pi.hThread);
++	return pi.hProcess;
++#endif
++}
++
++/*
++ * Count bytes in file
++ */
++static long
++file_size(const char *file)
++{
++	long		r;
++	FILE	   *f = fopen(file, "r");
++
++	if (!f)
++	{
++		fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
++				progname, file, strerror(errno));
++		return -1;
++	}
++	fseek(f, 0, SEEK_END);
++	r = ftell(f);
++	fclose(f);
++	return r;
++}
++
++/*
++ * Count lines in file
++ */
++static int
++file_line_count(const char *file)
++{
++	int			c;
++	int			l = 0;
++	FILE	   *f = fopen(file, "r");
++
++	if (!f)
++	{
++		fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
++				progname, file, strerror(errno));
++		return -1;
++	}
++	while ((c = fgetc(f)) != EOF)
++	{
++		if (c == '\n')
++			l++;
++	}
++	fclose(f);
++	return l;
++}
++
++static bool
++file_exists(const char *file)
++{
++	FILE	   *f = fopen(file, "r");
++
++	if (!f)
++		return false;
++	fclose(f);
++	return true;
++}
++
++static bool
++directory_exists(const char *dir)
++{
++	struct stat st;
++
++	if (stat(dir, &st) != 0)
++		return false;
++	if (S_ISDIR(st.st_mode))
++		return true;
++	return false;
++}
++
++/* Create a directory */
++static void
++make_directory(const char *dir)
++{
++	if (mkdir(dir, S_IRWXU | S_IRWXG | S_IRWXO) < 0)
++	{
++		fprintf(stderr, _("%s: could not create directory \"%s\": %s\n"),
++				progname, dir, strerror(errno));
++		exit_nicely(2);
++	}
++}
++
++/*
++ * In: filename.ext, Return: filename_i.ext, where 0 < i <= 9
++ */
++static char *
++get_alternative_expectfile(const char *expectfile, int i)
++{
++	char	   *last_dot;
++	int			ssize = strlen(expectfile) + 2 + 1;
++	char	   *tmp = (char *) malloc(ssize);
++	char	   *s = (char *) malloc(ssize);
++
++	strcpy(tmp, expectfile);
++	last_dot = strrchr(tmp, '.');
++	if (!last_dot)
++		return NULL;
++	*last_dot = '\0';
++	snprintf(s, ssize, "%s_%d.%s", tmp, i, last_dot + 1);
++	free(tmp);
++	return s;
++}
++
++/*
++ * Run a "diff" command and also check that it didn't crash
++ */
++static int
++run_diff(const char *cmd, const char *filename)
++{
++	int			r;
++
++	r = system(cmd);
++	if (!WIFEXITED(r) || WEXITSTATUS(r) > 1)
++	{
++		fprintf(stderr, _("diff command failed with status %d: %s\n"), r, cmd);
++		exit_nicely(2);
++	}
++#ifdef WIN32
++
++	/*
++	 * On WIN32, if the 'diff' command cannot be found, system() returns 1,
++	 * but produces nothing to stdout, so we check for that here.
++	 */
++	if (WEXITSTATUS(r) == 1 && file_size(filename) <= 0)
++	{
++		fprintf(stderr, _("diff command not found: %s\n"), cmd);
++		exit_nicely(2);
++	}
++#endif
++
++	return WEXITSTATUS(r);
++}
++
++/*
++ * Check the actual result file for the given test against expected results
++ *
++ * Returns true if different (failure), false if correct match found.
++ * In the true case, the diff is appended to the diffs file.
++ */
++static bool
++results_differ(const char *testname, const char *resultsfile, const char *default_expectfile)
++{
++	char		expectfile[MAXPGPATH];
++	char		diff[MAXPGPATH];
++	char		cmd[MAXPGPATH * 3];
++	char		best_expect_file[MAXPGPATH];
++	FILE	   *difffile;
++	int			best_line_count;
++	int			i;
++	int			l;
++	const char *platform_expectfile;
++
++	/*
++	 * We can pass either the resultsfile or the expectfile, they should have
++	 * the same type (filename.type) anyway.
++	 */
++	platform_expectfile = get_expectfile(testname, resultsfile);
++
++	strcpy(expectfile, default_expectfile);
++	if (platform_expectfile)
++	{
++		/*
++		 * Replace everything afer the last slash in expectfile with what the
++		 * platform_expectfile contains.
++		 */
++		char	   *p = strrchr(expectfile, '/');
++
++		if (p)
++			strcpy(++p, platform_expectfile);
++	}
++
++	/* Name to use for temporary diff file */
++	snprintf(diff, sizeof(diff), "%s.diff", resultsfile);
++
++	/* OK, run the diff */
++	snprintf(cmd, sizeof(cmd),
++			 SYSTEMQUOTE "diff %s \"%s\" \"%s\" > \"%s\"" SYSTEMQUOTE,
++			 basic_diff_opts, expectfile, resultsfile, diff);
++
++	/* Is the diff file empty? */
++	if (run_diff(cmd, diff) == 0)
++	{
++		unlink(diff);
++		return false;
++	}
++
++	/* There may be secondary comparison files that match better */
++	best_line_count = file_line_count(diff);
++	strcpy(best_expect_file, expectfile);
++
++	for (i = 0; i <= 9; i++)
++	{
++		char	   *alt_expectfile;
++
++		alt_expectfile = get_alternative_expectfile(expectfile, i);
++		if (!file_exists(alt_expectfile))
++			continue;
++
++		snprintf(cmd, sizeof(cmd),
++				 SYSTEMQUOTE "diff %s \"%s\" \"%s\" > \"%s\"" SYSTEMQUOTE,
++				 basic_diff_opts, alt_expectfile, resultsfile, diff);
++
++		if (run_diff(cmd, diff) == 0)
++		{
++			unlink(diff);
++			return false;
++		}
++
++		l = file_line_count(diff);
++		if (l < best_line_count)
++		{
++			/* This diff was a better match than the last one */
++			best_line_count = l;
++			strcpy(best_expect_file, alt_expectfile);
++		}
++		free(alt_expectfile);
++	}
++
++	/*
++	 * fall back on the canonical results file if we haven't tried it yet and
++	 * haven't found a complete match yet.
++	 */
++
++	if (platform_expectfile)
++	{
++		snprintf(cmd, sizeof(cmd),
++				 SYSTEMQUOTE "diff %s \"%s\" \"%s\" > \"%s\"" SYSTEMQUOTE,
++				 basic_diff_opts, default_expectfile, resultsfile, diff);
++
++		if (run_diff(cmd, diff) == 0)
++		{
++			/* No diff = no changes = good */
++			unlink(diff);
++			return false;
++		}
++
++		l = file_line_count(diff);
++		if (l < best_line_count)
++		{
++			/* This diff was a better match than the last one */
++			best_line_count = l;
++			strcpy(best_expect_file, default_expectfile);
++		}
++	}
++
++	/*
++	 * Use the best comparison file to generate the "pretty" diff, which we
++	 * append to the diffs summary file.
++	 */
++	snprintf(cmd, sizeof(cmd),
++			 SYSTEMQUOTE "diff %s \"%s\" \"%s\" >> \"%s\"" SYSTEMQUOTE,
++			 pretty_diff_opts, best_expect_file, resultsfile, difffilename);
++	run_diff(cmd, difffilename);
++
++	/* And append a separator */
++	difffile = fopen(difffilename, "a");
++	if (difffile)
++	{
++		fprintf(difffile,
++				"\n======================================================================\n\n");
++		fclose(difffile);
++	}
++
++	unlink(diff);
++	return true;
++}
++
++/*
++ * Wait for specified subprocesses to finish
++ *
++ * If names isn't NULL, report each subprocess as it finishes
++ *
++ * Note: it's OK to scribble on the pids array, but not on the names array
++ */
++static void
++wait_for_tests(PID_TYPE * pids, char **names, int num_tests)
++{
++	int			tests_left;
++	int			i;
++
++#ifdef WIN32
++	PID_TYPE   *active_pids = malloc(num_tests * sizeof(PID_TYPE));
++
++	memcpy(active_pids, pids, num_tests * sizeof(PID_TYPE));
++#endif
++
++	tests_left = num_tests;
++	while (tests_left > 0)
++	{
++		PID_TYPE	p;
++
++#ifndef WIN32
++		p = wait(NULL);
++
++		if (p == INVALID_PID)
++		{
++			fprintf(stderr, _("failed to wait for subprocesses: %s\n"),
++					strerror(errno));
++			exit_nicely(2);
++		}
++#else
++		int			r;
++
++		r = WaitForMultipleObjects(tests_left, active_pids, FALSE, INFINITE);
++		if (r < WAIT_OBJECT_0 || r >= WAIT_OBJECT_0 + tests_left)
++		{
++			fprintf(stderr, _("failed to wait for subprocesses: %lu\n"),
++					GetLastError());
++			exit_nicely(2);
++		}
++		p = active_pids[r - WAIT_OBJECT_0];
++		/* compact the active_pids array */
++		active_pids[r - WAIT_OBJECT_0] = active_pids[tests_left - 1];
++#endif   /* WIN32 */
++
++		for (i = 0; i < num_tests; i++)
++		{
++			if (p == pids[i])
++			{
++#ifdef WIN32
++				CloseHandle(pids[i]);
++#endif
++				pids[i] = INVALID_PID;
++				if (names)
++					status(" %s", names[i]);
++				tests_left--;
++				break;
++			}
++		}
++	}
++
++#ifdef WIN32
++	free(active_pids);
++#endif
++}
++
++/*
++ * Run all the tests specified in one schedule file
++ */
++static void
++run_schedule(const char *schedule, test_function tfunc)
++{
++#define MAX_PARALLEL_TESTS 100
++	char	   *tests[MAX_PARALLEL_TESTS];
++	_stringlist *resultfiles[MAX_PARALLEL_TESTS];
++	_stringlist *expectfiles[MAX_PARALLEL_TESTS];
++	_stringlist *tags[MAX_PARALLEL_TESTS];
++	PID_TYPE	pids[MAX_PARALLEL_TESTS];
++	_stringlist *ignorelist = NULL;
++	char		scbuf[1024];
++	FILE	   *scf;
++	int			line_num = 0;
++
++	memset(resultfiles, 0, sizeof(_stringlist *) * MAX_PARALLEL_TESTS);
++	memset(expectfiles, 0, sizeof(_stringlist *) * MAX_PARALLEL_TESTS);
++	memset(tags, 0, sizeof(_stringlist *) * MAX_PARALLEL_TESTS);
++
++	scf = fopen(schedule, "r");
++	if (!scf)
++	{
++		fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
++				progname, schedule, strerror(errno));
++		exit_nicely(2);
++	}
++
++	while (fgets(scbuf, sizeof(scbuf), scf))
++	{
++		char	   *test = NULL;
++		char	   *c;
++		int			num_tests;
++		bool		inword;
++		int			i;
++
++		line_num++;
++
++		for (i = 0; i < MAX_PARALLEL_TESTS; i++)
++		{
++			if (resultfiles[i] == NULL)
++				break;
++			free_stringlist(&resultfiles[i]);
++			free_stringlist(&expectfiles[i]);
++			free_stringlist(&tags[i]);
++		}
++
++		/* strip trailing whitespace, especially the newline */
++		i = strlen(scbuf);
++		while (i > 0 && isspace((unsigned char) scbuf[i - 1]))
++			scbuf[--i] = '\0';
++
++		if (scbuf[0] == '\0' || scbuf[0] == '#')
++			continue;
++		if (strncmp(scbuf, "test: ", 6) == 0)
++			test = scbuf + 6;
++		else if (strncmp(scbuf, "ignore: ", 8) == 0)
++		{
++			c = scbuf + 8;
++			while (*c && isspace((unsigned char) *c))
++				c++;
++			add_stringlist_item(&ignorelist, c);
++
++			/*
++			 * Note: ignore: lines do not run the test, they just say that
++			 * failure of this test when run later on is to be ignored. A bit
++			 * odd but that's how the shell-script version did it.
++			 */
++			continue;
++		}
++		else
++		{
++			fprintf(stderr, _("syntax error in schedule file \"%s\" line %d: %s\n"),
++					schedule, line_num, scbuf);
++			exit_nicely(2);
++		}
++
++		num_tests = 0;
++		inword = false;
++		for (c = test; *c; c++)
++		{
++			if (isspace((unsigned char) *c))
++			{
++				*c = '\0';
++				inword = false;
++			}
++			else if (!inword)
++			{
++				if (num_tests >= MAX_PARALLEL_TESTS)
++				{
++					/* can't print scbuf here, it's already been trashed */
++					fprintf(stderr, _("too many parallel tests in schedule file \"%s\", line %d\n"),
++							schedule, line_num);
++					exit_nicely(2);
++				}
++				tests[num_tests] = c;
++				num_tests++;
++				inword = true;
++			}
++		}
++
++		if (num_tests == 0)
++		{
++			fprintf(stderr, _("syntax error in schedule file \"%s\" line %d: %s\n"),
++					schedule, line_num, scbuf);
++			exit_nicely(2);
++		}
++
++		if (num_tests == 1)
++		{
++			status(_("test %-20s ... "), tests[0]);
++			pids[0] = (tfunc) (tests[0], &resultfiles[0], &expectfiles[0], &tags[0]);
++			wait_for_tests(pids, NULL, 1);
++			/* status line is finished below */
++		}
++		else if (max_connections > 0 && max_connections < num_tests)
++		{
++			int			oldest = 0;
++
++			status(_("parallel group (%d tests, in groups of %d): "),
++				   num_tests, max_connections);
++			for (i = 0; i < num_tests; i++)
++			{
++				if (i - oldest >= max_connections)
++				{
++					wait_for_tests(pids + oldest, tests + oldest, i - oldest);
++					oldest = i;
++				}
++				pids[i] = (tfunc) (tests[i], &resultfiles[i], &expectfiles[i], &tags[i]);
++			}
++			wait_for_tests(pids + oldest, tests + oldest, i - oldest);
++			status_end();
++		}
++		else
++		{
++			status(_("parallel group (%d tests): "), num_tests);
++			for (i = 0; i < num_tests; i++)
++			{
++				pids[i] = (tfunc) (tests[i], &resultfiles[i], &expectfiles[i], &tags[i]);
++			}
++			wait_for_tests(pids, tests, num_tests);
++			status_end();
++		}
++
++		/* Check results for all tests */
++		for (i = 0; i < num_tests; i++)
++		{
++			_stringlist *rl,
++					   *el,
++					   *tl;
++			bool		differ = false;
++
++			if (num_tests > 1)
++				status(_("     %-20s ... "), tests[i]);
++
++			/*
++			 * Advance over all three lists simultaneously.
++			 *
++			 * Compare resultfiles[j] with expectfiles[j] always. Tags are
++			 * optional but if there are tags, the tag list has the same
++			 * length as the other two lists.
++			 */
++			for (rl = resultfiles[i], el = expectfiles[i], tl = tags[i];
++				 rl != NULL;	/* rl and el have the same length */
++				 rl = rl->next, el = el->next)
++			{
++				bool		newdiff;
++
++				if (tl)
++					tl = tl->next;		/* tl has the same lengt has rl and el
++										 * if it exists */
++
++				newdiff = results_differ(tests[i], rl->str, el->str);
++				if (newdiff && tl)
++				{
++					printf("%s ", tl->str);
++				}
++				differ |= newdiff;
++			}
++
++			if (differ)
++			{
++				bool		ignore = false;
++				_stringlist *sl;
++
++				for (sl = ignorelist; sl != NULL; sl = sl->next)
++				{
++					if (strcmp(tests[i], sl->str) == 0)
++					{
++						ignore = true;
++						break;
++					}
++				}
++				if (ignore)
++				{
++					status(_("failed (ignored)"));
++					fail_ignore_count++;
++				}
++				else
++				{
++					status(_("FAILED"));
++					fail_count++;
++				}
++			}
++			else
++			{
++				status(_("ok"));
++				success_count++;
++			}
++
++			status_end();
++		}
++	}
++
++	fclose(scf);
++}
++
++/*
++ * Run a single test
++ */
++static void
++run_single_test(const char *test, test_function tfunc)
++{
++	PID_TYPE	pid;
++	_stringlist *resultfiles = NULL;
++	_stringlist *expectfiles = NULL;
++	_stringlist *tags = NULL;
++	_stringlist *rl,
++			   *el,
++			   *tl;
++	bool		differ = false;
++
++	status(_("test %-20s ... "), test);
++	pid = (tfunc) (test, &resultfiles, &expectfiles, &tags);
++	wait_for_tests(&pid, NULL, 1);
++
++	/*
++	 * Advance over all three lists simultaneously.
++	 *
++	 * Compare resultfiles[j] with expectfiles[j] always. Tags are optional
++	 * but if there are tags, the tag list has the same length as the other
++	 * two lists.
++	 */
++	for (rl = resultfiles, el = expectfiles, tl = tags;
++		 rl != NULL;			/* rl and el have the same length */
++		 rl = rl->next, el = el->next)
++	{
++		bool		newdiff;
++
++		if (tl)
++			tl = tl->next;		/* tl has the same lengt has rl and el if it
++								 * exists */
++
++		newdiff = results_differ(test, rl->str, el->str);
++		if (newdiff && tl)
++		{
++			printf("%s ", tl->str);
++		}
++		differ |= newdiff;
++	}
++
++	if (differ)
++	{
++		status(_("FAILED"));
++		fail_count++;
++	}
++	else
++	{
++		status(_("ok"));
++		success_count++;
++	}
++	status_end();
++}
++
++/*
++ * Create the summary-output files (making them empty if already existing)
++ */
++static void
++open_result_files(void)
++{
++	char		file[MAXPGPATH];
++	FILE	   *difffile;
++
++	/* create the log file (copy of running status output) */
++	snprintf(file, sizeof(file), "%s/regression.out", outputdir);
++	logfilename = strdup(file);
++	logfile = fopen(logfilename, "w");
++	if (!logfile)
++	{
++		fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
++				progname, logfilename, strerror(errno));
++		exit_nicely(2);
++	}
++
++	/* create the diffs file as empty */
++	snprintf(file, sizeof(file), "%s/regression.diffs", outputdir);
++	difffilename = strdup(file);
++	difffile = fopen(difffilename, "w");
++	if (!difffile)
++	{
++		fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
++				progname, difffilename, strerror(errno));
++		exit_nicely(2);
++	}
++	/* we don't keep the diffs file open continuously */
++	fclose(difffile);
++
++	/* also create the output directory if not present */
++	snprintf(file, sizeof(file), "%s/results", outputdir);
++	if (!directory_exists(file))
++		make_directory(file);
++}
++
++static void
++drop_database_if_exists(const char *dbname)
++{
++	header(_("dropping database \"%s\""), dbname);
++	psql_command("postgres", "DROP DATABASE IF EXISTS \"%s\"", dbname);
++}
++
++static void
++create_database(const char *dbname)
++{
++	_stringlist *sl;
++
++	/*
++	 * We use template0 so that any installation-local cruft in template1 will
++	 * not mess up the tests.
++	 */
++	header(_("creating database \"%s\""), dbname);
++	if (encoding)
++		psql_command("postgres", "CREATE DATABASE \"%s\" TEMPLATE=template0 ENCODING='%s'", dbname, encoding);
++	else
++		psql_command("postgres", "CREATE DATABASE \"%s\" TEMPLATE=template0", dbname);
++	psql_command(dbname,
++				 "ALTER DATABASE \"%s\" SET lc_messages TO 'C';"
++				 "ALTER DATABASE \"%s\" SET lc_monetary TO 'C';"
++				 "ALTER DATABASE \"%s\" SET lc_numeric TO 'C';"
++				 "ALTER DATABASE \"%s\" SET lc_time TO 'C';"
++			"ALTER DATABASE \"%s\" SET timezone_abbreviations TO 'Default';",
++				 dbname, dbname, dbname, dbname, dbname);
++
++	/*
++	 * Install any requested procedural languages
++	 */
++	for (sl = loadlanguage; sl != NULL; sl = sl->next)
++	{
++		header(_("installing %s"), sl->str);
++		psql_command(dbname, "CREATE LANGUAGE \"%s\"", sl->str);
++	}
++}
++
++static void
++drop_role_if_exists(const char *rolename)
++{
++	header(_("dropping role \"%s\""), rolename);
++	psql_command("postgres", "DROP ROLE IF EXISTS \"%s\"", rolename);
++}
++
++static void
++create_role(const char *rolename, const _stringlist * granted_dbs)
++{
++	header(_("creating role \"%s\""), rolename);
++	psql_command("postgres", "CREATE ROLE \"%s\" WITH LOGIN", rolename);
++	for (; granted_dbs != NULL; granted_dbs = granted_dbs->next)
++	{
++		psql_command("postgres", "GRANT ALL ON DATABASE \"%s\" TO \"%s\"",
++					 granted_dbs->str, rolename);
++	}
++}
++
++static void
++help(void)
++{
++	printf(_("PostgreSQL regression test driver\n"));
++	printf(_("\n"));
++	printf(_("Usage: %s [options...] [extra tests...]\n"), progname);
++	printf(_("\n"));
++	printf(_("Options:\n"));
++	printf(_("  --dbname=DB               use database DB (default \"regression\")\n"));
++	printf(_("  --debug                   turn on debug mode in programs that are run\n"));
++	printf(_("  --inputdir=DIR            take input files from DIR (default \".\")\n"));
++	printf(_("  --load-language=lang      load the named language before running the\n"));
++	printf(_("                            tests; can appear multiple times\n"));
++	printf(_("  --create-role=ROLE        create the specified role before testing\n"));
++	printf(_("  --max-connections=N       maximum number of concurrent connections\n"));
++	printf(_("                            (default is 0 meaning unlimited)\n"));
++	printf(_("  --multibyte=ENCODING      use ENCODING as the multibyte encoding\n"));
++	printf(_("  --outputdir=DIR           place output files in DIR (default \".\")\n"));
++	printf(_("  --schedule=FILE           use test ordering schedule from FILE\n"));
++	printf(_("                            (can be used multiple times to concatenate)\n"));
++	printf(_("  --srcdir=DIR              absolute path to source directory (for VPATH builds)\n"));
++	printf(_("  --temp-install=DIR        create a temporary installation in DIR\n"));
++	printf(_("\n"));
++	printf(_("Options for \"temp-install\" mode:\n"));
++	printf(_("  --no-locale               use C locale\n"));
++	printf(_("  --top-builddir=DIR        (relative) path to top level build directory\n"));
++	printf(_("  --temp-port=PORT          port number to start temp postmaster on\n"));
++	printf(_("  --temp-config=PATH        append contents of PATH to temporary config\n"));
++	printf(_("\n"));
++	printf(_("Options for using an existing installation:\n"));
++	printf(_("  --host=HOST               use postmaster running on HOST\n"));
++	printf(_("  --port=PORT               use postmaster running at PORT\n"));
++	printf(_("  --user=USER               connect as USER\n"));
++	printf(_("  --psqldir=DIR             use psql in DIR (default: find in PATH)\n"));
++	printf(_("\n"));
++	printf(_("The exit status is 0 if all tests passed, 1 if some tests failed, and 2\n"));
++	printf(_("if the tests could not be run for some reason.\n"));
++	printf(_("\n"));
++	printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
++}
++
++int
++regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc)
++{
++	_stringlist *sl;
++	int			c;
++	int			i;
++	int			option_index;
++	char		buf[MAXPGPATH * 4];
++
++	static struct option long_options[] = {
++		{"help", no_argument, NULL, 'h'},
++		{"version", no_argument, NULL, 'V'},
++		{"dbname", required_argument, NULL, 1},
++		{"debug", no_argument, NULL, 2},
++		{"inputdir", required_argument, NULL, 3},
++		{"load-language", required_argument, NULL, 4},
++		{"max-connections", required_argument, NULL, 5},
++		{"multibyte", required_argument, NULL, 6},
++		{"outputdir", required_argument, NULL, 7},
++		{"schedule", required_argument, NULL, 8},
++		{"temp-install", required_argument, NULL, 9},
++		{"no-locale", no_argument, NULL, 10},
++		{"top-builddir", required_argument, NULL, 11},
++		{"temp-port", required_argument, NULL, 12},
++		{"host", required_argument, NULL, 13},
++		{"port", required_argument, NULL, 14},
++		{"user", required_argument, NULL, 15},
++		{"psqldir", required_argument, NULL, 16},
++		{"srcdir", required_argument, NULL, 17},
++		{"create-role", required_argument, NULL, 18},
++		{"temp-config", required_argument, NULL, 19},
++		{NULL, 0, NULL, 0}
++	};
++
++	progname = get_progname(argv[0]);
++	set_pglocale_pgservice(argv[0], "pg_regress");
++
++#ifndef HAVE_UNIX_SOCKETS
++	/* no unix domain sockets available, so change default */
++	hostname = "localhost";
++#endif
++
++	/*
++	 * We call the initialization function here because that way we can set
++	 * default parameters and let them be overwritten by the commandline.
++	 */
++	ifunc();
++
++	while ((c = getopt_long(argc, argv, "hV", long_options, &option_index)) != -1)
++	{
++		switch (c)
++		{
++			case 'h':
++				help();
++				exit_nicely(0);
++			case 'V':
++				printf("pg_regress (PostgreSQL %s)\n", PG_VERSION);
++				exit_nicely(0);
++			case 1:
++
++				/*
++				 * If a default database was specified, we need to remove it
++				 * before we add the specified one.
++				 */
++				free_stringlist(&dblist);
++				split_to_stringlist(strdup(optarg), ", ", &dblist);
++				break;
++			case 2:
++				debug = true;
++				break;
++			case 3:
++				inputdir = strdup(optarg);
++				break;
++			case 4:
++				add_stringlist_item(&loadlanguage, optarg);
++				break;
++			case 5:
++				max_connections = atoi(optarg);
++				break;
++			case 6:
++				encoding = strdup(optarg);
++				break;
++			case 7:
++				outputdir = strdup(optarg);
++				break;
++			case 8:
++				add_stringlist_item(&schedulelist, optarg);
++				break;
++			case 9:
++				/* temp_install must be absolute path */
++				if (is_absolute_path(optarg))
++					temp_install = strdup(optarg);
++				else
++				{
++					char		cwdbuf[MAXPGPATH];
++
++					if (!getcwd(cwdbuf, sizeof(cwdbuf)))
++					{
++						fprintf(stderr, _("could not get current working directory: %s\n"), strerror(errno));
++						exit_nicely(2);
++					}
++					temp_install = malloc(strlen(cwdbuf) + strlen(optarg) + 2);
++					sprintf(temp_install, "%s/%s", cwdbuf, optarg);
++				}
++				canonicalize_path(temp_install);
++				break;
++			case 10:
++				nolocale = true;
++				break;
++			case 11:
++				top_builddir = strdup(optarg);
++				break;
++			case 12:
++				{
++					int			p = atoi(optarg);
++
++					/* Since Makefile isn't very bright, check port range */
++					if (p >= 1024 && p <= 65535)
++						temp_port = p;
++				}
++				break;
++			case 13:
++				hostname = strdup(optarg);
++				break;
++			case 14:
++				port = atoi(optarg);
++				break;
++			case 15:
++				user = strdup(optarg);
++				break;
++			case 16:
++				/* "--psqldir=" should mean to use PATH */
++				if (strlen(optarg))
++					psqldir = strdup(optarg);
++				break;
++			case 17:
++				srcdir = strdup(optarg);
++				break;
++			case 18:
++				split_to_stringlist(strdup(optarg), ", ", &extraroles);
++				break;
++			case 19:
++				temp_config = strdup(optarg);
++				break;
++			default:
++				/* getopt_long already emitted a complaint */
++				fprintf(stderr, _("\nTry \"%s -h\" for more information.\n"),
++						progname);
++				exit_nicely(2);
++		}
++	}
++
++	/*
++	 * if we still have arguments, they are extra tests to run
++	 */
++	while (argc - optind >= 1)
++	{
++		add_stringlist_item(&extra_tests, argv[optind]);
++		optind++;
++	}
++
++	if (temp_install)
++		port = temp_port;
++
++	/*
++	 * Initialization
++	 */
++	open_result_files();
++
++	initialize_environment();
++
++#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE)
++	unlimit_core_size();
++#endif
++
++	if (temp_install)
++	{
++		/*
++		 * Prepare the temp installation
++		 */
++		if (!top_builddir)
++		{
++			fprintf(stderr, _("--top-builddir must be specified when using --temp-install\n"));
++			exit_nicely(2);
++		}
++
++		if (directory_exists(temp_install))
++		{
++			header(_("removing existing temp installation"));
++			rmtree(temp_install, true);
++		}
++
++		header(_("creating temporary installation"));
++
++		/* make the temp install top directory */
++		make_directory(temp_install);
++
++		/* and a directory for log files */
++		snprintf(buf, sizeof(buf), "%s/log", outputdir);
++		if (!directory_exists(buf))
++			make_directory(buf);
++
++		/* "make install" */
++#ifndef WIN32_ONLY_COMPILER
++		snprintf(buf, sizeof(buf),
++				 SYSTEMQUOTE "\"%s\" -C \"%s\" DESTDIR=\"%s/install\" install with_perl=no with_python=no > \"%s/log/install.log\" 2>&1" SYSTEMQUOTE,
++				 makeprog, top_builddir, temp_install, outputdir);
++#else
++		snprintf(buf, sizeof(buf),
++				 SYSTEMQUOTE "perl \"%s/src/tools/msvc/install.pl\" \"%s/install\" >\"%s/log/install.log\" 2>&1" SYSTEMQUOTE,
++				 top_builddir, temp_install, outputdir);
++#endif
++		if (system(buf))
++		{
++			fprintf(stderr, _("\n%s: installation failed\nExamine %s/log/install.log for the reason.\nCommand was: %s\n"), progname, outputdir, buf);
++			exit_nicely(2);
++		}
++
++		/* initdb */
++		header(_("initializing database system"));
++		snprintf(buf, sizeof(buf),
++				 SYSTEMQUOTE "\"%s/initdb\" -D \"%s/data\" -L \"%s\" --noclean%s%s > \"%s/log/initdb.log\" 2>&1" SYSTEMQUOTE,
++				 bindir, temp_install, datadir,
++				 debug ? " --debug" : "",
++				 nolocale ? " --no-locale" : "",
++				 outputdir);
++		if (system(buf))
++		{
++			fprintf(stderr, _("\n%s: initdb failed\nExamine %s/log/initdb.log for the reason.\nCommand was: %s\n"), progname, outputdir, buf);
++			exit_nicely(2);
++		}
++
++		/* add any extra config specified to the postgresql.conf */
++		if (temp_config != NULL)
++		{
++			FILE	   *extra_conf;
++			FILE	   *pg_conf;
++			char		line_buf[1024];
++
++			snprintf(buf, sizeof(buf), "%s/data/postgresql.conf", temp_install);
++			pg_conf = fopen(buf, "a");
++			if (pg_conf == NULL)
++			{
++				fprintf(stderr, _("\n%s: could not open %s for adding extra config:\nError was %s\n"), progname, buf, strerror(errno));
++				exit_nicely(2);
++			}
++			extra_conf = fopen(temp_config, "r");
++			if (extra_conf == NULL)
++			{
++				fprintf(stderr, _("\n%s: could not open %s to read extra config:\nError was %s\n"), progname, buf, strerror(errno));
++				exit_nicely(2);
++			}
++			while (fgets(line_buf, sizeof(line_buf), extra_conf) != NULL)
++				fputs(line_buf, pg_conf);
++			fclose(extra_conf);
++			fclose(pg_conf);
++		}
++
++		/*
++		 * Start the temp postmaster
++		 */
++		header(_("starting postmaster"));
++		snprintf(buf, sizeof(buf),
++				 SYSTEMQUOTE "\"%s/postgres\" -D \"%s/data\" -F%s -c \"listen_addresses=%s\" > \"%s/log/postmaster.log\" 2>&1" SYSTEMQUOTE,
++				 bindir, temp_install,
++				 debug ? " -d 5" : "",
++				 hostname ? hostname : "",
++				 outputdir);
++		postmaster_pid = spawn_process(buf);
++		if (postmaster_pid == INVALID_PID)
++		{
++			fprintf(stderr, _("\n%s: could not spawn postmaster: %s\n"),
++					progname, strerror(errno));
++			exit_nicely(2);
++		}
++
++		/*
++		 * Wait till postmaster is able to accept connections (normally only a
++		 * second or so, but Cygwin is reportedly *much* slower).  Don't wait
++		 * forever, however.
++		 */
++		snprintf(buf, sizeof(buf),
++				 SYSTEMQUOTE "\"%s/psql\" -X postgres <%s 2>%s" SYSTEMQUOTE,
++				 bindir, DEVNULL, DEVNULL);
++		for (i = 0; i < 60; i++)
++		{
++			/* Done if psql succeeds */
++			if (system(buf) == 0)
++				break;
++
++			/*
++			 * Fail immediately if postmaster has exited
++			 */
++#ifndef WIN32
++			if (kill(postmaster_pid, 0) != 0)
++#else
++			if (WaitForSingleObject(postmaster_pid, 0) == WAIT_OBJECT_0)
++#endif
++			{
++				fprintf(stderr, _("\n%s: postmaster failed\nExamine %s/log/postmaster.log for the reason\n"), progname, outputdir);
++				exit_nicely(2);
++			}
++
++			pg_usleep(1000000L);
++		}
++		if (i >= 60)
++		{
++			fprintf(stderr, _("\n%s: postmaster did not respond within 60 seconds\nExamine %s/log/postmaster.log for the reason\n"), progname, outputdir);
++
++			/*
++			 * If we get here, the postmaster is probably wedged somewhere in
++			 * startup.  Try to kill it ungracefully rather than leaving a
++			 * stuck postmaster that might interfere with subsequent test
++			 * attempts.
++			 */
++#ifndef WIN32
++			if (kill(postmaster_pid, SIGKILL) != 0 &&
++				errno != ESRCH)
++				fprintf(stderr, _("\n%s: could not kill failed postmaster: %s\n"),
++						progname, strerror(errno));
++#else
++			if (TerminateProcess(postmaster_pid, 255) == 0)
++				fprintf(stderr, _("\n%s: could not kill failed postmaster: %lu\n"),
++						progname, GetLastError());
++#endif
++
++			exit_nicely(2);
++		}
++
++		postmaster_running = true;
++
++		printf(_("running on port %d with pid %lu\n"),
++			   temp_port, (unsigned long) postmaster_pid);
++	}
++	else
++	{
++		/*
++		 * Using an existing installation, so may need to get rid of
++		 * pre-existing database(s) and role(s)
++		 */
++		for (sl = dblist; sl; sl = sl->next)
++			drop_database_if_exists(sl->str);
++		for (sl = extraroles; sl; sl = sl->next)
++			drop_role_if_exists(sl->str);
++	}
++
++	/*
++	 * Create the test database(s) and role(s)
++	 */
++	for (sl = dblist; sl; sl = sl->next)
++		create_database(sl->str);
++	for (sl = extraroles; sl; sl = sl->next)
++		create_role(sl->str, dblist);
++
++	/*
++	 * Ready to run the tests
++	 */
++	header(_("running regression test queries"));
++
++	for (sl = schedulelist; sl != NULL; sl = sl->next)
++	{
++		run_schedule(sl->str, tfunc);
++	}
++
++	for (sl = extra_tests; sl != NULL; sl = sl->next)
++	{
++		run_single_test(sl->str, tfunc);
++	}
++
++	/*
++	 * Shut down temp installation's postmaster
++	 */
++	if (temp_install)
++	{
++		header(_("shutting down postmaster"));
++		stop_postmaster();
++	}
++
++	fclose(logfile);
++
++	/*
++	 * Emit nice-looking summary message
++	 */
++	if (fail_count == 0 && fail_ignore_count == 0)
++		snprintf(buf, sizeof(buf),
++				 _(" All %d tests passed. "),
++				 success_count);
++	else if (fail_count == 0)	/* fail_count=0, fail_ignore_count>0 */
++		snprintf(buf, sizeof(buf),
++				 _(" %d of %d tests passed, %d failed test(s) ignored. "),
++				 success_count,
++				 success_count + fail_ignore_count,
++				 fail_ignore_count);
++	else if (fail_ignore_count == 0)	/* fail_count>0 && fail_ignore_count=0 */
++		snprintf(buf, sizeof(buf),
++				 _(" %d of %d tests failed. "),
++				 fail_count,
++				 success_count + fail_count);
++	else
++		/* fail_count>0 && fail_ignore_count>0 */
++		snprintf(buf, sizeof(buf),
++				 _(" %d of %d tests failed, %d of these failures ignored. "),
++				 fail_count + fail_ignore_count,
++				 success_count + fail_count + fail_ignore_count,
++				 fail_ignore_count);
++
++	putchar('\n');
++	for (i = strlen(buf); i > 0; i--)
++		putchar('=');
++	printf("\n%s\n", buf);
++	for (i = strlen(buf); i > 0; i--)
++		putchar('=');
++	putchar('\n');
++	putchar('\n');
++
++	if (file_size(difffilename) > 0)
++	{
++		printf(_("The differences that caused some tests to fail can be viewed in the\n"
++				 "file \"%s\".  A copy of the test summary that you see\n"
++				 "above is saved in the file \"%s\".\n\n"),
++			   difffilename, logfilename);
++	}
++	else
++	{
++		unlink(difffilename);
++		unlink(logfilename);
++	}
++
++	if (fail_count != 0)
++		exit_nicely(1);
++
++	return 0;
++}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-server/files/postgresql.conf-8.3	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,52 @@
+# PostgreSQL's Database Directory
+PGDATA="/var/lib/postgresql/8.3/data"
+
+# PostgreSQL User
+PGUSER="postgres"
+
+# PostgreSQL Group
+PGGROUP="postgres"
+
+# Extra options to run postmaster with, e.g.:
+# -N is the maximal number of client connections
+# -B is the number of shared buffers and has to be at least 2x the value for -N
+# Please read the man-page to postmaster for more options. Many of these options
+# can be set directly in the configuration-file.
+#PGOPTS="-N 512 -B 1024"
+
+
+# SERVER SHUTDOWN:
+# The server will receive 3 signals in the worst case:
+# 1. SIGTERM
+#  This signals the server to ignore new connections and to
+#  wait for all clients to end their transactions before shutting down.
+#  Use WAIT_FOR_DISCONNECT to control how much time the clients
+#  should have until the next signal is being sent.
+# 2. SIGINT
+#  Tell the server to forcefully disconnect all clients.
+#  Terminating a client results in a rollback of the open transactions for this client.
+#  Use WAIT_FOR_CLEANUP to determine how much time the server has
+#  for cleanup.
+# 3. SIGQUIT
+#  This will terminate the server immediately and results in a recovery run for the next start.
+
+# Wait for clients to disconnect
+WAIT_FOR_DISCONNECT=30
+
+# Time the server has to clean up
+WAIT_FOR_CLEANUP=60
+
+# Time the server has to quit (with a recover-run on next startup)
+# Set to 0 to deactivate it
+WAIT_FOR_QUIT=60
+
+# Comment this out if you don't want to wait for the server to
+# startup before continuing.  For example, if this server is a 
+# PITR log shipping based replication standby
+WAIT_FOR_START="-w"
+
+# If you have to export environment variables for the database process,
+# this can be done here.
+#
+# Example:
+#   export R_HOME="/usr/lib/R"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-server/files/postgresql.init-8.3	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,100 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/files/postgresql.init-8.3,v 1.4 2008/09/28 22:53:02 caleb Exp $
+
+opts="${opts} reload"
+
+depend() {
+	use net
+	if [ -L /etc/eselect/postgresql/service ] ; then 
+		local p_service="$(for f in /etc/eselect/postgresql/service/* ; do source $f ; done ; echo $postgres_service )"
+		test "${p_service}" = "${SVCNAME}" && provide postgresql
+	fi
+}
+
+checkconfig() {
+	if [ ! -d "$PGDATA" ] ; then
+		eerror "Directory not found: $PGDATA"
+		eerror "Please make sure that PGDATA points to the right path."
+		eerror "You can run 'emerge postgresql-server --config' to setup a new database cluster."
+		return 1
+	fi
+}
+
+start() {
+	checkconfig || return 1
+
+	ebegin "Starting PostgreSQL"
+
+	if [ -f "$PGDATA/postmaster.pid" ] ; then
+		rm -f "$PGDATA/postmaster.pid"
+	fi
+
+	local retval
+
+	su -l ${PGUSER} \
+		-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.3/bin/pg_ctl start ${WAIT_FOR_START} -o '--silent-mode=true ${PGOPTS}'"
+	retval=$?
+	[ $retval -ne 0 ] && eend $retval && return $retval
+
+	# The following is to catch the case of an already running server
+	# in which pg_ctl doesn't know to which server it connected to and false reports the server as 'up'
+	sleep 2
+	if [ ! -f "$PGDATA/postmaster.pid" ] ; then
+		eerror "The pid-file doesn't exist but pg_ctl reported a running server."
+		eerror "Please check whether there is another server running on the same port or read the log-file."
+		eend 1
+		return 1
+	fi
+
+	local pid=$(grep "^[0-9]\+" "$PGDATA/postmaster.pid")
+	ps -p "${pid}" &> /dev/null
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping PostgreSQL (this can take up to $(( ${WAIT_FOR_DISCONNECT} + ${WAIT_FOR_CLEANUP} )) seconds)"
+
+	local retval
+
+	su -l ${PGUSER} \
+		-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.3/bin/pg_ctl stop -t ${WAIT_FOR_DISCONNECT} -m smart"
+
+	retval=$?
+	[ $retval -eq 0 ] && eend $retval && return $retval
+
+	ewarn "Some clients did not disconnect within ${WAIT_FOR_DISCONNECT} seconds."
+	ewarn "Going to shutdown the server anyway."
+
+	su -l ${PGUSER} \
+		-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.3/bin/pg_ctl stop -m fast"
+
+	retval=$?
+	[ $retval -eq 0 ] && eend $retval && return $retval
+
+	if [ ${WAIT_FOR_QUIT} -eq 0 ] ; then
+		eerror "Server did not shut down and sending the SIGQUIT has been disabled."
+		eend $retval
+		return $retval
+	fi
+
+	ewarn "Shutting down the server gracefully failed."
+	ewarn "Forcing it to shutdown which leads to a recover-run on next startup."
+
+	su -l ${PGUSER} \
+		-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.3/bin/pg_ctl stop -m immediate"
+
+	retval=$?
+	[ $retval -eq 0 ] && eend $retval && return $retval
+
+	eerror "Forced shutdown failed!!! Something is wrong with your system, please take care of it manually."
+	eend $?
+}
+
+reload() {
+	ebegin "Reloading PostgreSQL configuration"
+	su -l ${PGUSER} \
+		-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.3/bin/pg_ctl reload"	
+	eend $?
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-db/postgresql-server/postgresql-server-8.3.6.ebuild	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,249 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.5.ebuild,v 1.1 2008/12/03 19:27:06 caleb Exp $
+
+EAPI="1"
+
+WANT_AUTOCONF="latest"
+WANT_AUTOMAKE="none"
+inherit eutils multilib toolchain-funcs versionator autotools
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+
+DESCRIPTION="PostgreSQL server"
+HOMEPAGE="http://www.postgresql.org/"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
+LICENSE="POSTGRESQL"
+SLOT="$(get_version_component_range 1-2)"
+IUSE_LINGUAS="
+	linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
+	linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
+	linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
+	linguas_tr linguas_zh_CN linguas_zh_TW"
+IUSE="doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}"
+
+wanted_languages() {
+	for u in ${IUSE_LINGUAS} ; do
+		use $u && echo -n "${u#linguas_} "
+	done
+}
+
+RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
+	perl? ( >=dev-lang/perl-5.6.1-r2 )
+	python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
+	selinux? ( sec-policy/selinux-postgresql )
+	tcl? ( >=dev-lang/tcl-8 )
+	uuid? ( dev-libs/ossp-uuid )
+	xml? ( dev-libs/libxml2 dev-libs/libxslt )"
+DEPEND="${RDEPEND}
+	sys-devel/flex
+	xml? ( dev-util/pkgconfig )"
+PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"
+
+S="${WORKDIR}/postgresql-${PV}"
+
+pkg_setup() {
+	enewgroup postgres 70
+	enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
+		"${FILESDIR}/postgresql-${SLOT}-server.patch"
+
+	if hasq test ${FEATURES}; then
+		sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
+	else
+		echo "all install:" > "${S}/src/test/regress/GNUmakefile"
+	fi
+
+	eautoconf
+}
+
+src_compile() {
+	# TODO: test if PPC really cannot work with other CFLAGS settings
+	# use ppc && CFLAGS="-pipe -fsigned-char"
+
+	# eval is needed to get along with pg_config quotation of space-rich entities.
+	eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
+		--disable-thread-safety \
+		$(use_with perl) \
+		$(use_with python) \
+		$(use_with tcl) \
+		$(use_with xml libxml) \
+		$(use_with xml libxslt) \
+		$(use_with uuid ossp-uuid) \
+		--with-system-tzdata="/usr/share/zoneinfo" \
+		--with-includes="/usr/include/postgresql-${SLOT}/" \
+		"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
+		|| die "configure failed"
+
+	for bd in . contrib $(use xml && echo contrib/xml2); do
+		PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+			emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
+				PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
+				PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
+				NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
+	done
+}
+
+src_install() {
+	if use perl ; then
+		mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
+		sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
+			"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
+	fi
+
+	for bd in . contrib $(use xml && echo contrib/xml2) ; do
+		PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+			emake install -C $bd -j1 DESTDIR="${D}" \
+				PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
+				PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
+				NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
+	done
+
+	rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
+	rm "${D}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,reindexdb,vacuumdb}.1
+
+	dodoc README HISTORY doc/{README.*,TODO,bug.template}
+
+	dodir /etc/eselect/postgresql/slots/${SLOT}
+	cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
+		postgres_ebuilds="\${postgres_ebuilds} ${PF}"
+		postgres_service="postgresql-${SLOT}"
+	__EOF__
+
+	newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
+	newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"
+
+	keepdir /var/run/postgresql
+	fperms 0770 /var/run/postgresql
+	fowners postgres:postgres /var/run/postgresql
+}
+
+pkg_postinst() {
+	eselect postgresql update
+	[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
+	[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
+
+	ewarn "Please note that the standard location of the socket has changed from /tmp"
+	ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
+	ewarn "the socket."
+	ewarn "This can break applications which have the standard location hard-coded."
+	ewarn "If such an application links against the libpq, please re-emerge it,"
+	ewarn "if that doesn't help or the application accesses the socket without using libpq,"
+	ewarn "please file a bug-report."
+	ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."
+
+	elog "Execute the following command to setup the initial database environment:"
+	elog
+	elog "emerge --config =${CATEGORY}/${PF}"
+	elog
+	elog "The autovacuum function, which was in contrib, has been moved to the main"
+	elog "PostgreSQL functions starting with 8.1."
+	elog "You can enable it in the clusters postgresql.conf."
+}
+
+pkg_postrm() {
+	eselect postgresql update
+}
+
+pkg_config() {
+	[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
+
+	einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
+	einfo "More information can be found here:"
+	einfo "    http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
+	einfo "    http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
+	einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
+	einfo
+	einfo "You can change the directory where the database cluster is being created by setting"
+	einfo "the PGDATA variable."
+	einfo
+	einfo "PG_INITDB_OPTS is currently set to:"
+	einfo "    \"${PG_INITDB_OPTS}\""
+	einfo "and the database cluster will be created in:"
+	einfo "    \"${PGDATA}\""
+	einfo "Are you ready to continue? (Y/n)"
+	read answer
+	[ -z $answer ] && answer=Y
+	[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
+
+	if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
+		eerror "The given directory \"${PGDATA}\" already contains a database cluster."
+		die "cluster already exists"
+	fi
+
+	[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
+	einfo "Checking system parameters..."
+
+	if ! use kernel_linux ; then
+		SKIP_SYSTEM_TESTS=yes
+		einfo "  Tests not supported on this OS (yet)"
+	fi
+
+	if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
+		einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
+
+		local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
+		local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
+		local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
+		local SHMMAX=$(sysctl -n kernel.shmmax)
+
+		local SEMMSL_MIN=17
+		local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
+		local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
+		local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
+
+		for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
+			if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
+				eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
+				eerror "You have now several options:"
+				eerror "  - Change the mentioned system parameter"
+				eerror "  - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
+				eerror "  - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
+				eerror "More information can be found here:"
+				eerror "  http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
+				die "system test failed"
+			fi
+		done
+		einfo "Passed."
+	else
+		einfo "Skipped."
+	fi
+
+	einfo "Creating the data directory ..."
+	mkdir -p "${PGDATA}"
+	chown -Rf postgres:postgres "${PGDATA}"
+	chmod 0700 "${PGDATA}"
+
+	einfo "Initializing the database ..."
+
+	su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
+
+	einfo
+	einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
+	einfo
+
+	if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
+		ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
+		ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
+	fi
+}
+
+src_test() {
+	einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
+	PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+		emake -j1 check \
+			PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
+			NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
+
+	einfo "Yes, there are other tests which could be run."
+	einfo "... and no, we don't plan to add/support them."
+	einfo "For now, the main regressions tests will suffice."
+	einfo "If you think other tests are necessary, please submit a"
+	einfo "bug including a patch for this ebuild to enable them."
+}
--- a/dev-util/hgsvn/Manifest	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-DIST hgsvn-0.1.5.tar.gz 38621 RMD160 bcb6e40522e2e1cf5dd18b416b45d1f4f1fefb77 SHA1 7a4bb4651875025082633e7b39a707ed2c938ac5 SHA256 a56f5cce308e455fc6ec913355c3d5dd82c1f87b68b62828962b371469db9376
-EBUILD hgsvn-0.1.5.ebuild 639 RMD160 a2e08eb61b3bdf6a324dd6768ca10fec3eada7fd SHA1 fa94c0ed00f0ef353d1d8fd45061ab7c346d7054 SHA256 247e420151129379cd09a832be3f4206c0d63e2e34a57f123a3c56e2bbf493bf
--- a/dev-util/hgsvn/hgsvn-0.1.5.ebuild	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-util/hgsvn/hgsvn-0.1.4.ebuild,v 1.1 2008/01/19 18:21:08 cedk Exp $
-
-NEED_PYTHON=2.4
-
-inherit distutils
-
-DESCRIPTION="A set of scripts to work locally on Subversion checkouts using Mercurial"
-HOMEPAGE="http://cheeseshop.python.org/pypi/hgsvn"
-SRC_URI="http://cheeseshop.python.org/packages/source/h/hgsvn/${P}.tar.gz"
-
-LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="~x86"
-IUSE=""
-
-DEPEND="dev-python/setuptools"
-RDEPEND="${DEPEND}
-	dev-util/subversion
-	|| ( >=dev-lang/python-2.5 dev-python/elementtree )"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/mercurial/Manifest	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,4 @@
+AUX 70mercurial-gentoo.el 76 RMD160 1891ab510adb464211b4cc35c5b6e4b149da79fa SHA1 72eb35d2bf86fa8f806acfbc823b88fc5188741b SHA256 c215746e4a5375569808c6aa6ddabe08e82d33d744128179be3142d9cd53a5ab
+DIST mercurial-1.1.2.tar.gz 952241 RMD160 9dd2505ca8f378804ee64f1367473dcba1d568cb SHA1 b0f77198a96474fc72d38904ce60b007e4c7cc1a SHA256 dd18a3c3821d1638f202b4212a02b9349acac9333785e96e9a8119f6c21d5e44
+EBUILD mercurial-1.1.2.ebuild 3226 RMD160 743d444c471c607972c0cedb0da2599574b6672a SHA1 a29c432f1335a05cdf26aba60ccbb62e17540f5f SHA256 0f1b83d61da1f559d97d934c7c21601015cb8a622ece49344af3bc0294cca507
+MISC metadata.xml 645 RMD160 2a33b3987960796da78558e671c4e5e0c6f10241 SHA1 6cd04e19dc7796b53afe98a9831e128c4c96f3ca SHA256 e0b05e42345698eda32c513e3a8f14d8bf42d5344dcd804b1f2234da327524e2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/mercurial/files/70mercurial-gentoo.el	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,3 @@
+;;; mercurial site-lisp configuration
+
+(add-to-list 'load-path "@SITELISP@")
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/mercurial/mercurial-1.1.2.ebuild	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,118 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-util/mercurial/mercurial-1.0.2.ebuild,v 1.7 2008/10/17 08:04:41 aballier Exp $
+
+inherit bash-completion elisp-common flag-o-matic eutils distutils
+
+DESCRIPTION="Scalable distributed SCM"
+HOMEPAGE="http://www.selenic.com/mercurial/"
+SRC_URI="http://www.selenic.com/mercurial/release/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 ~hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE="bugzilla emacs gpg test zsh-completion"
+
+CDEPEND=">=dev-lang/python-2.3"
+RDEPEND="${CDEPEND}
+	bugzilla? ( dev-python/mysql-python )
+	gpg? ( app-crypt/gnupg )
+	zsh-completion? ( app-shells/zsh )"
+DEPEND="${CDEPEND}
+	emacs? ( virtual/emacs )
+	test? ( app-arch/unzip
+		dev-python/pygments )"
+
+PYTHON_MODNAME="${PN} hgext"
+SITEFILE="70${PN}-gentoo.el"
+
+src_compile() {
+	filter-flags -ftracer -ftree-vectorize
+
+	distutils_src_compile
+
+	if use emacs; then
+		cd "${S}"/contrib
+		elisp-compile mercurial.el || die "elisp-compile failed!"
+	fi
+
+	rm -rf contrib/{win32,macosx}
+}
+
+src_install() {
+	distutils_src_install
+
+	dobashcompletion contrib/bash_completion ${PN}
+
+	if use zsh-completion ; then
+		insinto /usr/share/zsh/site-functions
+		newins contrib/zsh_completion _hg
+	fi
+
+	rm -f doc/*.?.txt
+	dodoc CONTRIBUTORS PKG-INFO README doc/*.txt
+	cp hgweb*.cgi "${D}"/usr/share/doc/${PF}/
+
+	dobin contrib/hgk
+	dobin contrib/hg-relink
+	dobin contrib/hg-ssh
+
+	rm -f contrib/hgk contrib/hg-relink contrib/hg-ssh
+
+	rm -f contrib/bash_completion
+	cp -r contrib "${D}"/usr/share/doc/${PF}/
+	doman doc/*.?
+
+	cat > "${T}/80mercurial" <<-EOF
+HG=/usr/bin/hg
+EOF
+	doenvd "${T}/80mercurial"
+
+	if use emacs; then
+		elisp-install ${PN} contrib/mercurial.el* || die "elisp-install failed!"
+		elisp-site-file-install "${FILESDIR}"/${SITEFILE}
+	fi
+}
+
+src_test() {
+	local testdir="${T}/tests"
+	mkdir -p -m1777 "${testdir}" || die
+	cd "${S}/tests/"
+	rm -f *svn*		# Subversion tests fail with 1.5
+	rm -f test-convert-baz*		# GNU Arch baz
+	rm -f test-convert-cvs*		# CVS
+	rm -f test-convert-darcs*	# Darcs
+	rm -f test-convert-git*		# git
+	rm -f test-convert-mtn*		# monotone
+	rm -f test-convert-tla*		# GNU Arch tla
+	rm -f test-doctest*		# doctest always fails with python 2.5.x
+	if ! has userpriv ${FEATURES}; then
+		einfo "Removing tests which require user privileges to succeed"
+		rm -f test-command-template	# Test is broken when run as root
+		rm -f test-convert			# Test is broken when run as root
+		rm -f test-lock-badness		# Test is broken when run as root
+		rm -f test-permissions		# Test is broken when run as root
+		rm -f test-pull-permission	# Test is broken when run as root
+	fi
+	einfo "Running Mercurial tests ..."
+	python run-tests.py --tmpdir="${testdir}" || die "test failed"
+}
+
+pkg_postinst() {
+	distutils_pkg_postinst
+	use emacs && elisp-site-regen
+	bash-completion_pkg_postinst
+
+	elog "If you want to convert repositories from other tools using convert"
+	elog "extension please install correct tool:"
+	elog "  dev-util/cvs"
+	elog "  dev-util/darcs"
+	elog "  dev-util/git"
+	elog "  dev-util/monotone"
+	elog "  dev-util/subversion"
+}
+
+pkg_postrm() {
+	distutils_pkg_postrm
+	use emacs && elisp-site-regen
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/mercurial/metadata.xml	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>no-herd</herd>
+  <maintainer>
+    <email>nelchael@gentoo.org</email>
+    <name>Krzysiek Pawlik</name>
+  </maintainer>
+  <use>
+    <flag name="bugzilla">Support bugzilla integration.</flag>
+    <flag name="darcs">Support conversion of Darcs repositories to Mercurial.</flag>
+    <flag name="git">Support conversion of Git repositories to Mercurial.</flag>
+    <flag name="gpg">Support signing with GnuPG.</flag>
+    <flag name="zsh-completion">Install zsh command completion for hg.</flag>
+  </use>
+</pkgmetadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/Manifest	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,12 @@
+AUX 1.5.0/70svn-gentoo.el 435 RMD160 e9f4b2e5511523c124f9ba3781249db2860fe5a7 SHA1 c3a3081f79a579b848369cfae76662a98e97687e SHA256 a39bea9a821aa91c7990dd07e1c2d0cec79f1efaac04e2d61882b7c8d5346a34
+AUX 1.5.0/80subversion-extras 62 RMD160 c334b15a86eaf19129afa5b62558dd47504a4e3d SHA1 ba05e978e7ff7b047ec99225e4d932036c340d26 SHA256 758d07cf161fff5e0afef5791dca641d3af58192ad1e4874c5f5c2c285c1149d
+AUX 1.5.0/disable-unneeded-linking.patch 2409 RMD160 0d7c34cc83eff7d08369128762ed714fabcd1dde SHA1 92b80f6cb30fe569f79368aea66027a6da022c53 SHA256 2ef8fcd9fabfd1a71bdd50e1156cb9d421a7008fccd73b7ae3536e9a30886231
+AUX 70svn-gentoo.el 331 RMD160 1de1310ae7e4bdbecef3c685ef8d7ff95b9aab87 SHA1 48eb99e9d494a4a674de32e599914df234b627cd SHA256 c0d733bd3f7c75c47acaea4fd0c816d45ee2cd765da70dc494666f38c91e3d87
+AUX svnserve.confd 323 RMD160 cbf4d810d9f41bac1611004741170d1047cbeef0 SHA1 39e922bc777ba847eb85d421d92f560f84b895b5 SHA256 90d3e2532715a6230ebf65023566a6591eed4b3fc12abbca0d2fb7949e146006
+AUX svnserve.confd2 320 RMD160 dc1e74d06d9bd3eeb1a8dfd20aacebecd8378abb SHA1 557191219c3afa90126b8a2bfe7dd62b8a09eb82 SHA256 c70655c073dc06f538c5acdbcd49e216f4be2c859ce395bdf78757a1eeccab00
+AUX svnserve.initd 817 RMD160 59f4e8e983d4595b7c27615889a9c0809d015a18 SHA1 483b47512fb444c0f752ad4eb6c3252f659a967e SHA256 6b483e211b5c311079605e246fca9228c7e5762d27a023fa4c4529fdaa766b08
+AUX svnserve.xinetd 332 RMD160 c2fc4eb02da7e7405756fce650b8897f0a9da7f7 SHA1 d7d478fc257a40626888f9b12ee218df55dac570 SHA256 267f30c78ef6428aeeb97d3c64c06b9acfba4bc624766fc3c6a6d2c4133799a2
+AUX vc-svn.el 16847 RMD160 8665b9a34c8fd9acae40e18aac33026aff3a39d7 SHA1 4d1a5a9331ff96e943244a6d5538e4f0abeac9e7 SHA256 b4979d5df9fba02dbc8ad71d813229222e95ee1e8e89dec3060611d2d6be87aa
+DIST subversion-1.5.6.tar.bz2 4946600 RMD160 5883f925e19e719c8656b5488ed9b00c0f7c3a79 SHA1 774b6dbd4245c36e86289393e651e36dedf17018 SHA256 f701fe75fecc43d9aecf717260ca18661469128a2f28a57c7e6672f3f64f46c2
+EBUILD subversion-1.5.6.ebuild 13393 RMD160 0ef259d6fc6440536d9fb74c1fc24ad08b8c1997 SHA1 13bb283d304eedc5e1e9937be804e41e4db48015 SHA256 17e47cc89d09b11c79a924b8765a90d2bb0944506e54ab434c4a2016aca95a66
+MISC metadata.xml 958 RMD160 9e4aa5a4dfeef1a81c20121e8e75baf45d0962ca SHA1 c8844225273473a569cefae106533215961c287f SHA256 396a72dd2fddb8fb146ce87fa05692ab9f7d183057c0940d9365f88602a03dc7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/files/1.5.0/70svn-gentoo.el	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,12 @@
+;;; svn site-lisp configuration
+
+(add-to-list 'load-path "@SITELISP@")
+(and (< emacs-major-version 22)
+     (add-to-list 'load-path "@SITELISP@/compat"))
+(add-to-list 'vc-handled-backends 'SVN)
+
+(defalias 'svn-examine 'svn-status)
+(autoload 'svn-status "dsvn" "Run `svn status'." t)
+(autoload 'svn-update "dsvn" "Run `svn update'." t)
+(autoload 'svn-status "psvn"
+  "Examine the status of Subversion working copy in directory DIR." t)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/files/1.5.0/80subversion-extras	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,2 @@
+ROOTPATH=/usr/lib/subversion/bin
+PATH=/usr/lib/subversion/bin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/files/1.5.0/disable-unneeded-linking.patch	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,81 @@
+--- configure.ac
++++ configure.ac
+@@ -234,6 +234,8 @@
+ AC_DEFINE_UNQUOTED(SVN_FS_WANT_DB_PATCH, $SVN_FS_WANT_DB_PATCH,
+                    [The desired patch version for the Berkeley DB])
+ 
++AC_SUBST(SVN_DB_LIBS)
++
+ SVN_LIB_SASL
+ 
+ if test "$svn_lib_sasl" = "yes"; then
+--- Makefile.in
++++ Makefile.in
+@@ -40,9 +40,10 @@
+ NEON_LIBS = @NEON_LIBS@
+ SVN_APR_LIBS = @SVN_APR_LIBS@
+ SVN_APRUTIL_LIBS = @SVN_APRUTIL_LIBS@
+-SVN_DB_LIBS =
+-SVN_SERF_LIBS = @SVN_SERF_LIBS@
++SVN_DB_LIBS = @SVN_DB_LIBS@
+ SVN_SASL_LIBS = @SVN_SASL_LIBS@
++SVN_SERF_LIBS = @SVN_SERF_LIBS@
++SVN_XML_LIBS = -lexpat
+ SVN_ZLIB_LIBS = @SVN_ZLIB_LIBS@
+ 
+ LIBS = @LIBS@
+--- build/ac-macros/aprutil.m4
++++ build/ac-macros/aprutil.m4
+@@ -72,16 +72,14 @@
+     AC_MSG_ERROR([apu-config --includes failed])
+   fi
+ 
+-  dnl When APR stores the dependent libs in the .la file, we don't need
+-  dnl --libs.
+-  SVN_APRUTIL_LIBS="`$apu_config --link-libtool --libs`"
++  SVN_APRUTIL_LIBS="`$apu_config --link-libtool`"
+   if test $? -ne 0; then
+-    AC_MSG_ERROR([apu-config --link-libtool --libs failed])
++    AC_MSG_ERROR([apu-config --link-libtool failed])
+   fi
+ 
+-  SVN_APRUTIL_EXPORT_LIBS="`$apu_config --link-ld --libs`"
++  SVN_APRUTIL_EXPORT_LIBS="`$apu_config --link-ld`"
+   if test $? -ne 0; then
+-    AC_MSG_ERROR([apu-config --link-ld --libs failed])
++    AC_MSG_ERROR([apu-config --link-ld failed])
+   fi
+ 
+   AC_SUBST(SVN_APRUTIL_INCLUDES)
+--- build/ac-macros/apr.m4
++++ build/ac-macros/apr.m4
+@@ -74,16 +74,14 @@
+     AC_MSG_ERROR([apr-config --prefix failed])
+   fi
+ 
+-  dnl When APR stores the dependent libs in the .la file, we don't need 
+-  dnl --libs.
+-  SVN_APR_LIBS="`$apr_config --link-libtool --libs`"
++  SVN_APR_LIBS="`$apr_config --link-libtool`"
+   if test $? -ne 0; then
+-    AC_MSG_ERROR([apr-config --link-libtool --libs failed])
++    AC_MSG_ERROR([apr-config --link-libtool failed])
+   fi
+ 
+-  SVN_APR_EXPORT_LIBS="`$apr_config --link-ld --libs`"
++  SVN_APR_EXPORT_LIBS="`$apr_config --link-ld`"
+   if test $? -ne 0; then
+-    AC_MSG_ERROR([apr-config --link-ld --libs failed])
++    AC_MSG_ERROR([apr-config --link-ld failed])
+   fi
+ 
+   SVN_APR_SHLIB_PATH_VAR="`$apr_config --shlib-path-var`"
+--- build/ac-macros/berkeley-db.m4
++++ build/ac-macros/berkeley-db.m4
+@@ -218,5 +218,6 @@
+ 
+   CPPFLAGS="$svn_lib_berkeley_db_try_save_cppflags"
+   LIBS="$svn_lib_berkeley_db_try_save_libs"
++  SVN_DB_LIBS="$svn_apu_bdb_lib"
+   ]
+ )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/files/70svn-gentoo.el	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,10 @@
+;;; svn site-lisp configuration
+
+(add-to-list 'load-path "@SITELISP@")
+(and (< emacs-major-version 22)
+     (add-to-list 'load-path "@SITELISP@/compat"))
+(add-to-list 'vc-handled-backends 'SVN)
+
+(defalias 'svn-examine 'svn-status)
+(autoload 'svn-status "psvn"
+  "Examine the status of Subversion working copy in directory DIR." t)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/files/svnserve.confd	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,10 @@
+# The commented variables in this file are the defaults that are used
+# in the init-script.  You don't need to uncomment them except to
+# customize them to different values.
+
+# Options for svnserve
+#SVNSERVE_OPTS="--root=/var/svn"
+
+# User and group as which to run svnserve
+#SVNSERVE_USER="apache"
+#SVNSERVE_GROUP="apache"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/files/svnserve.confd2	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,10 @@
+# The commented variables in this file are the defaults that are used
+# in the init-script.  You don't need to uncomment them except to
+# customize them to different values.
+
+# Options for svnserve
+#SVNSERVE_OPTS="--root=/var/svn"
+
+# User and group as which to run svnserve
+SVNSERVE_USER="svn"
+SVNSERVE_GROUP="svnusers"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/files/svnserve.initd	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,26 @@
+#!/sbin/runscript
+# Copyright 2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/dev-util/subversion/files/svnserve.initd,v 1.2 2005/08/25 13:59:48 pauldv Exp $
+
+depend() {
+	need net
+}
+
+start() {
+	ebegin "Starting svnserve"
+	# Ensure that we run from a readable working dir, and that we do not
+	# lock filesystems when being run from such a location.
+	cd /
+	start-stop-daemon --start --quiet --background --make-pidfile \
+		--pidfile /var/run/svnserve.pid --exec /usr/bin/svnserve \
+		--chuid ${SVNSERVE_USER:-apache}:${SVNSERVE_GROUP:-apache} -- \
+		--foreground --daemon ${SVNSERVE_OPTS:---root=/var/svn}
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping svnserve"
+	start-stop-daemon --stop --quiet --pidfile /var/run/svnserve.pid
+	eend $?
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/files/svnserve.xinetd	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,14 @@
+service svn
+{
+    socket_type     = stream
+    wait            = no
+    user            = apache
+    group           = apache
+    umask           = 002
+    protocol        = tcp
+    log_on_failure += USERID HOST
+    port            = 3690
+    server          = /usr/bin/svnserve
+    server_args     = -i
+    disable         = yes
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/files/vc-svn.el	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,414 @@
+;;;; vc-svn.el --- a VC backend for Subversion
+;;;; Jim Blandy <jimb@red-bean.com> --- July 2002
+
+;;; Writing this back end has shown up some problems in VC: bugs,
+;;; shortcomings in the back end interface, and so on.  But I want to
+;;; first produce code that Subversion users can use with an already
+;;; released Emacs distribution.
+;;;
+;;; So for now we're working within the limitations of the released
+;;; VC; once we've got something functional, then we can start writing
+;;; VC patches.
+
+
+;;; To make this file load on demand, put this file into a directory
+;;; in `load-path', and add this line to a startup file:
+;;;
+;;;     (add-to-list 'vc-handled-backends 'SVN)
+
+
+;;; To do here:
+;;; Provide more of the optional VC backend functions: 
+;;; - dir-state
+;;; - merge across arbitrary revisions
+;;;
+;;; Maybe we want more info in mode-line-string.  Status of props?  Status 
+;;; compared to what's in the repository (svn st -u) ? 
+;;;
+;;; VC passes the vc-svn-register function a COMMENT argument, which
+;;; is like the file description in CVS and RCS.  Could we store the
+;;; COMMENT as a Subversion property?  Would that show up in fancy DAV
+;;; web folder displays, or would it just languish in obscurity, the
+;;; way CVS and RCS descriptions do?
+;;;
+;;; After manual merging, need some way to run `svn resolved'.  Perhaps
+;;; we should just prompt for approval when somebody tries to commit a
+;;; conflicted file?
+;;;
+;;; vc-svn ought to handle more gracefully an attempted commit that
+;;; fails with "Transaction is out of date".  Probably the best
+;;; approach is to ask "file is not up-to-date; do you want to merge
+;;; now?"  I think vc-cvs does this.
+;;;
+;;; Perhaps show the "conflicted" marker in the modeline?
+;;;
+;;; If conflicted, before committing or merging, ask the user if they
+;;; want to mark the file as resolved.
+;;;
+;;; Won't searching for strings in svn output cause trouble if the
+;;; locale language is not English?
+;;;
+;;; After merging news, need to recheck our idea of which workfile
+;;; version we have.  Reverting the file does this but we need to
+;;; force it.  Note that this can be necessary even if the file has
+;;; not changed.
+;;;
+;;; Does everything work properly if we're rolled back to an old
+;;; revision?
+;;;
+;;; Perhaps need to implement vc-svn-latest-on-branch-p?
+
+
+;;; To do in VC:
+;;;
+;;; Make sure vc's documentation for `workfile-unchanged-p' default
+;;; function mentions that it must not run asynchronously, and the
+;;; symptoms if it does.
+;;; 
+;;; Fix logic for finding log entries.
+;;;
+;;; Allow historical diff to choose an appropriate default previous
+;;; revision number.  I think this entails moving vc-previous-revision
+;;; et al into the back end.
+;;;
+;;; Should vc-BACKEND-checkout really have to set the workfile version
+;;; itself?
+;;;
+;;; Fix smerge for svn conflict markers.
+;;;
+;;; We can have files which are not editable for reasons other than
+;;; needing to be checked out.  For example, they might be a read-only
+;;; view of an old revision opened with [C-x v ~].  (See vc-merge)
+;;;
+;;; Would be nice if there was a way to mark a file as
+;;; just-checked-out, aside from updating the checkout-time property
+;;; which in theory is not to be changed by backends.
+
+
+(add-to-list 'vc-handled-backends 'SVN)
+
+(defcustom vc-svn-program-name "svn"
+  "*Name of Subversion client program, for use by Emacs's VC package."
+  :type 'string
+  :group 'vc
+  :version "21.2.90.2")
+
+(defcustom vc-svn-diff-switches nil
+  "*A string or list of strings specifying extra switches for `svn diff' under VC."
+  :type '(repeat string)
+  :group 'vc
+  :version "21.2.90.2")
+
+(defun vc-svn-registered (file)
+  "Return true if FILE is registered under Subversion."
+  ;; First, a quick false positive test: is there a `.svn/entries' file?
+  (and (file-exists-p (expand-file-name ".svn/entries"
+                                        (file-name-directory file)))
+       (not (null (vc-svn-run-status file)))))
+
+
+(put 'vc-svn-with-output-buffer 'lisp-indent-function 0)
+(defmacro vc-svn-with-output-buffer (&rest body)
+  "Save excursion, switch to buffer ` *Subversion Output*', and erase it."
+  `(save-excursion
+     ;; Let's not delete this buffer when we're done --- leave
+     ;; it around for debugging.
+     (set-buffer (get-buffer-create " *Subversion Output*"))
+     (erase-buffer)
+     ,@body))
+
+
+(defun vc-svn-pop-up-error (&rest args)
+  "Pop up the Subversion output buffer, and raise an error with ARGS."
+  (pop-to-buffer " *Subversion Output*")
+  (goto-char (point-min))
+  (shrink-window-if-larger-than-buffer)
+  (apply 'error args))
+
+
+(defun vc-svn-run-status (file &optional update)
+  "Run `svn status -v' on FILE, and return the result.
+If optional arg UPDATE is true, pass the `-u' flag to check against
+the repository, across the network.
+See `vc-svn-parse-status' for a description of the result."
+  (vc-svn-with-output-buffer
+
+    ;; We should call vc-do-command here, but Subversion exits with an
+    ;; error status if FILE isn't under its control, and we want to
+    ;; return that as nil, not display it to the user.  We can tell
+    ;; vc-do-command to
+    
+    (let ((status (apply 'call-process vc-svn-program-name nil t nil
+                         (append '("status" "-v")
+                                 (if update '("-u") '())
+                                 (list file)))))
+      (goto-char (point-min))
+      (if (not (equal 0 status)) ; not zerop; status can be a string
+          ;; If you ask for the status of a file that isn't even in a
+          ;; Subversion-controlled directory, then Subversion exits with
+          ;; this error.
+          (if (or (looking-at "\\(.*\n\\)*.*is not a working copy")
+                  (looking-at "\\(.*\n\\)*.*is not a versioned resource")
+                  (looking-at "\\(.*\n\\)*.*: No such file or directory"))
+              nil
+            ;; Other errors we should actually report to the user.
+            (vc-svn-pop-up-error
+             "Error running Subversion to check status of `%s'"
+             (file-name-nondirectory file)))
+
+        ;; Otherwise, we've got valid status output in the buffer, so
+        ;; just parse that.
+        (vc-svn-parse-status)))))
+
+
+(defun vc-svn-parse-status ()
+  "Parse the output from `svn status -v' at point.
+We return nil for a file not under Subversion's control,
+or (STATE LOCAL CHANGED) for files that are, where:
+STATE is the file's VC state (see the documentation for `vc-state'),
+LOCAL is the base revision in the working copy, and
+CHANGED is the last revision in which it was changed.
+Both LOCAL and CHANGED are strings, not numbers.
+If we passed `svn status' the `-u' flag, then CHANGED could be a later
+revision than LOCAL.
+If the file is newly added, LOCAL is \"0\" and CHANGED is nil."
+  (let ((state (vc-svn-parse-state-only)))
+    (cond
+     ((not state) nil)
+     ;; A newly added file has no revision.
+     ((looking-at "....\\s-+\\(\\*\\s-+\\)?[-0]\\s-+\\?")
+      (list state "0" nil))
+     ((looking-at "....\\s-+\\(\\*\\s-+\\)?\\([0-9]+\\)\\s-+\\([0-9]+\\)")
+      (list state
+            (match-string 2)
+            (match-string 3)))
+     ((looking-at "^I +") nil)       ;; An ignored file
+     ((looking-at " \\{40\\}") nil)  ;; A file that is not in the wc nor svn?
+     (t (error "Couldn't parse output from `svn status -v'")))))
+
+
+(defun vc-svn-parse-state-only ()
+  "Parse the output from `svn status -v' at point, and return a state.
+The documentation for the function `vc-state' describes the possible values."
+  (cond
+   ;; Be careful --- some of the later clauses here could yield false
+   ;; positives, if the clauses preceding them didn't screen those
+   ;; out.  Making a pattern more selective could break something.
+
+   ;; nil                 The given file is not under version control,
+   ;;                     or does not exist.
+   ((looking-at "\\?\\|^$") nil)
+
+   ;; 'needs-patch        The file has not been edited by the
+   ;;                     user, but there is a more recent version
+   ;;                     on the current branch stored in the
+   ;;                     master file.
+   ((looking-at "  ..\\s-+\\*") 'needs-patch)
+
+   ;; 'up-to-date         The working file is unmodified with
+   ;;                     respect to the latest version on the
+   ;;                     current branch, and not locked.
+   ;;
+   ;;                     This is also returned for files which do not
+   ;;                     exist, as will be the case when finding a
+   ;;                     new file in a svn-controlled directory.  That
+   ;;                     case is handled in vc-svn-parse-status.
+   ((looking-at "  ") 'up-to-date)
+
+   ;; 'needs-merge        The file has been edited by the user,
+   ;;                     and there is also a more recent version
+   ;;                     on the current branch stored in the
+   ;;                     master file.  This state can only occur
+   ;;                     if locking is not used for the file.
+   ((looking-at "\\S-+\\s-+\\*") 'needs-merge)
+
+   ;; 'edited             The working file has been edited by the
+   ;;                     user.  If locking is used for the file,
+   ;;                     this state means that the current
+   ;;                     version is locked by the calling user.
+   (t 'edited)))
+
+
+;;; Is it really safe not to check for updates?  I haven't seen any
+;;; cases where failing to check causes a problem that is not caught
+;;; in some other way.  However, there *are* cases where checking
+;;; needlessly causes network delay, such as C-x v v.  The common case
+;;; is for the commit to be OK; we can handle errors if they occur. -- mbp
+(defun vc-svn-state (file)
+  "Return the current version control state of FILE.
+For a list of possible return values, see `vc-state'.
+
+This function should do a full and reliable state computation; it is
+usually called immediately after `C-x v v'.  `vc-svn-state-heuristic'
+provides a faster heuristic when visiting a file.
+
+For svn this does *not* check for updates in the repository, because
+that needlessly slows down vc when the repository is remote.  Instead,
+we rely on Subversion to trap situations such as needing a merge
+before commit."
+  (car (vc-svn-run-status file)))
+
+
+(defun vc-svn-state-heuristic (file)
+  "Estimate the version control state of FILE at visiting time.
+For a list of possible values, see the doc string of `vc-state'.
+This is supposed to be considerably faster than `vc-svn-state'.  It
+just runs `svn status -v', without the `-u' flag, so it's a strictly
+local operation."
+  (car (vc-svn-run-status file)))
+
+
+
+(defun vc-svn-workfile-version (file)
+  "Return the current workfile version of FILE."
+  (cadr (vc-svn-run-status file)))
+
+
+(defun vc-svn-checkout-model (file)
+  'implicit)
+
+
+(defun vc-svn-register (file &optional rev comment)
+  "Register FILE with Subversion.
+REV is an initial revision; Subversion ignores it.
+COMMENT is an initial description of the file; currently this is ignored."
+  (vc-svn-with-output-buffer
+    (let ((status (call-process vc-svn-program-name nil t nil "add" file)))
+      (or (equal 0 status) ; not zerop; status can be a string
+          (vc-svn-pop-up-error "Error running Subversion to add `%s'"
+                               (file-name-nondirectory file))))))
+
+
+(defun vc-svn-checkin (file rev comment)
+  (apply 'vc-do-command nil 0 vc-svn-program-name file 
+         "commit" (if comment (list "-m" comment) '())))
+
+
+(defun vc-svn-checkout (file &optional editable rev destfile)
+  "Check out revision REV of FILE into the working area.
+The EDITABLE argument must be non-nil, since Subversion doesn't
+support locking.
+If REV is non-nil, that is the revision to check out (default is
+current workfile version).  If REV is the empty string, that means to
+check out the head of the trunk.  For Subversion, that's equivalent to
+passing nil.
+If optional arg DESTFILE is given, it is an alternate filename to
+write the contents to; we raise an error."
+  (unless editable
+    (error "VC asked Subversion to check out a read-only copy of file"))
+  (when destfile
+    (error "VC asked Subversion to check out a file under another name"))
+  (when (equal rev "")
+    (setq rev nil))
+  (apply 'vc-do-command nil 0 vc-svn-program-name file
+         "update" (if rev (list "-r" rev) '()))
+  (vc-file-setprop file 'vc-workfile-version nil))
+
+
+(defun vc-svn-revert (file &optional contents-done)
+  "Revert FILE back to the current workfile version.
+If optional arg CONTENTS-DONE is non-nil, then the contents of FILE
+have already been reverted from a version backup, and this function
+only needs to update the status of FILE within the backend.  This
+function ignores the CONTENTS-DONE argument."
+  (vc-do-command nil 0 vc-svn-program-name file "revert"))
+
+
+(defun vc-svn-merge-news (file)
+  "Merge recent changes into FILE.
+
+This calls `svn update'.  In the case of conflicts, Subversion puts
+conflict markers into the file and leaves additional temporary files
+containing the `ancestor', `mine', and `other' files.
+
+You may need to run `svn resolved' by hand once these conflicts have
+been resolved.  
+
+Returns a vc status, which is used to determine whether conflicts need
+to be merged."
+  (prog1
+      (vc-do-command nil 0 vc-svn-program-name file "update")
+    
+    ;; This file may not have changed in the revisions which were
+    ;; merged, which means that its mtime on disk will not have been
+    ;; updated.  However, the workfile version may still have been
+    ;; updated, and we want that to be shown correctly in the
+    ;; modeline.
+
+    ;; vc-cvs does something like this
+    (vc-file-setprop file 'vc-checkout-time 0)
+    (vc-file-setprop file 'vc-workfile-version
+                     (vc-svn-workfile-version file))))
+
+
+(defun vc-svn-print-log (file)
+  "Insert the revision log of FILE into the *vc* buffer."
+  (vc-do-command nil 'async vc-svn-program-name file "log"))
+
+
+(defun vc-svn-show-log-entry (version)
+  "Search the log entry for VERSION in the current buffer.
+Make sure it is displayed in the buffer's window."
+  (when (re-search-forward (concat "^-+\n\\(rev\\) "
+                                   (regexp-quote version)
+                                   ":[^|]+|[^|]+| [0-9]+ lines?"))
+    (goto-char (match-beginning 1))
+    (recenter 1)))
+
+
+(defun vc-svn-diff (file &optional rev1 rev2)
+  "Insert the diff for FILE into the *vc-diff* buffer.
+If REV1 and REV2 are non-nil, report differences from REV1 to REV2.
+If REV1 is nil, use the current workfile version (as found in the
+repository) as the older version; if REV2 is nil, use the current
+workfile contents as the newer version.
+This function returns a status of either 0 (no differences found), or
+1 (either non-empty diff or the diff is run asynchronously)."
+  (let* ((diff-switches-list
+          ;; In Emacs 21.3.50 or so, the `vc-diff-switches-list' macro
+          ;; started requiring its symbol argument to be quoted.
+          (condition-case nil
+              (vc-diff-switches-list svn)
+            (void-variable (vc-diff-switches-list 'SVN))))
+         (status (vc-svn-run-status file))
+         (local (elt status 1))
+         (changed (elt status 2))
+         
+         ;; If rev1 is the default (the base revision) set it to nil.
+         ;; This is nice because it lets us recognize when the diff
+         ;; will run locally, and thus when we shouldn't bother to run
+         ;; it asynchronously.  But it's also necessary, since a diff
+         ;; for vc-default-workfile-unchanged-p *must* run
+         ;; synchronously, or else you'll end up with two diffs in the
+         ;; *vc-diff* buffer.  `vc-diff-workfile-unchanged-p' passes
+         ;; the base revision explicitly, but this kludge lets us
+         ;; recognize that we can run the diff synchronously anyway.
+         ;; Fragile, no?
+         (rev1 (if (and rev1 (not (equal rev1 local))) rev1))
+
+         (rev-switches-list
+          (cond
+           ;; Given base rev against given rev.
+           ((and rev1 rev2) (list "-r" (format "%s:%s" rev1 rev2)))
+           ;; Given base rev against working copy.
+           (rev1 (list "-r" rev1))
+           ;; Working copy base against given rev.
+           (rev2 (list "-r" (format "%s:%s" local rev2)))
+           ;; Working copy base against working copy.
+           (t '())))
+
+         ;; Run diff asynchronously if we're going to have to go
+         ;; across the network.
+         (async (or rev1 rev2)))
+
+    (let ((status (apply 'vc-do-command "*vc-diff*" (if async 'async 0)
+                         vc-svn-program-name file
+                         (append '("diff") rev-switches-list))))
+      (if (or async (> (buffer-size (get-buffer "*vc-diff*")) 0))
+          1 0))))
+
+(defun vc-svn-find-version (file rev buffer)
+  (vc-do-command buffer 0 vc-svn-program-name file 
+         "cat" "-r" rev))
+
+(provide 'vc-svn)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/metadata.xml	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer>
+    <email>hollow@gentoo.org</email>
+    <name>Benedikt Böhm</name>
+    <description>Gentoo Subversion maintainer</description>
+  </maintainer>
+  <maintainer>
+    <email>Arfrever.FTA@GMail.Com</email>
+    <name>Arfrever Frehtes Taifersar Arahesis</name>
+    <description>Subversion upstream representative</description>
+  </maintainer>
+  <use>
+    <flag name="dso">Enable runtime module search</flag>
+    <flag name="extras">Install extras scripts (examples, tools, hooks)</flag>
+    <flag name="nowebdav">Disables WebDAV support via neon library</flag>
+    <flag name="svnserve">Install scripts for svnserve</flag>
+    <flag name="webdav-neon">Enable WebDAV support using <pkg>net-misc/neon</pkg></flag>
+    <flag name="webdav-serf">Enable WebDAV support using <pkg>net-libs/serf</pkg></flag>
+  </use>
+</pkgmetadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-util/subversion/subversion-1.5.6.ebuild	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,412 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-util/subversion/subversion-1.5.4.ebuild,v 1.11 2008/12/07 12:13:48 vapier Exp $
+
+EAPI="1"
+WANT_AUTOMAKE="none"
+
+inherit autotools bash-completion confutils depend.apache elisp-common eutils flag-o-matic java-pkg-opt-2 libtool multilib perl-module python
+
+DESCRIPTION="Advanced version control system"
+HOMEPAGE="http://subversion.tigris.org/"
+SRC_URI="http://subversion.tigris.org/downloads/${P/_/-}.tar.bz2"
+
+LICENSE="Subversion"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
+IUSE="apache2 berkdb debug doc +dso emacs extras java nls perl python ruby sasl vim-syntax +webdav-neon webdav-serf"
+RESTRICT="test"
+
+CDEPEND=">=dev-libs/apr-1.2.8
+	>=dev-libs/apr-util-1.2.8
+	dev-libs/expat
+	sys-libs/zlib
+	berkdb? ( =sys-libs/db-4* )
+	emacs? ( virtual/emacs )
+	ruby? ( >=dev-lang/ruby-1.8.2 )
+	sasl? ( dev-libs/cyrus-sasl )
+	webdav-neon? ( >=net-misc/neon-0.28 )
+	webdav-serf? ( net-libs/serf )"
+
+RDEPEND="${CDEPEND}
+	java? ( >=virtual/jre-1.5 )
+	nls? ( virtual/libintl )
+	perl? ( dev-perl/URI )"
+
+DEPEND="${CDEPEND}
+	doc? ( app-doc/doxygen )
+	java? ( >=virtual/jdk-1.5 )
+	nls? ( sys-devel/gettext )"
+
+want_apache
+
+S="${WORKDIR}"/${P/_/-}
+
+# Allow for custom repository locations.
+# This can't be in pkg_setup because the variable needs to be available to
+# pkg_config.
+: ${SVN_REPOS_LOC:=/var/svn}
+
+pkg_setup() {
+	confutils_use_depend_built_with_all berkdb dev-libs/apr-util berkdb
+	java-pkg-opt-2_pkg_setup
+
+	if ! use webdav-neon && ! use webdav-serf; then
+		ewarn
+		ewarn "WebDAV support is disabled. You need WebDAV to"
+		ewarn "access repositories through the HTTP protocol."
+		ewarn
+		ewarn "WebDAV support needs one of the following USE flags enabled:"
+		ewarn "  webdav-neon webdav-serf"
+		ewarn
+		ewarn "You can do this by enabling one of these flags in /etc/portage/package.use:"
+		ewarn "    =${CATEGORY}/${PF} webdav-neon webdav-serf"
+		ewarn
+		ebeep
+	fi
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	epatch "${FILESDIR}"/1.5.0/disable-unneeded-linking.patch
+
+	sed -i \
+		-e "s/\(BUILD_RULES=.*\) bdb-test\(.*\)/\1\2/g" \
+		-e "s/\(BUILD_RULES=.*\) test\(.*\)/\1\2/g" configure.ac
+
+	sed -e 's:@bindir@/svn-contrib:@libdir@/subversion/bin:' \
+		-e 's:@bindir@/svn-tools:@libdir@/subversion/bin:' \
+		-i Makefile.in
+
+	eautoconf
+	elibtoolize
+}
+
+src_compile() {
+	local myconf
+
+	if use python || use perl || use ruby; then
+		myconf="${myconf} --with-swig"
+	else
+		myconf="${myconf} --without-swig"
+	fi
+
+	if use debug; then
+		append-cppflags -DSVN_DEBUG -DAP_DEBUG
+	fi
+
+	append-flags -fno-strict-aliasing
+
+	econf ${myconf} \
+		$(use_with apache2 apxs "${APXS}") \
+		$(use_with berkdb berkeley-db) \
+		$(use_enable dso runtime-module-search) \
+		$(use_enable java javahl) \
+		$(use_with java jdk "${JAVA_HOME}") \
+		$(use_enable nls) \
+		$(use_with sasl) \
+		$(use_with webdav-neon neon /usr) \
+		$(use_with webdav-serf serf /usr) \
+		--with-apr=/usr/bin/apr-1-config \
+		--with-apr-util=/usr/bin/apu-1-config \
+		--disable-experimental-libtool \
+		--without-jikes \
+		--without-junit \
+		--disable-mod-activation
+
+	emake local-all || die "Building of core Subversion failed"
+
+	if use python; then
+		emake swig-py || die "Building of Subversion Python bindings failed"
+	fi
+
+	if use perl; then
+		emake -j1 swig-pl || die "Building of Subversion Perl bindings failed"
+	fi
+
+	if use ruby; then
+		emake swig-rb || die "Building of Subversion Ruby bindings failed"
+	fi
+
+	if use java; then
+		make JAVAC_FLAGS="$(java-pkg_javac-args) -encoding iso8859-1" javahl \
+			|| die "Building of Subversion JavaHL library failed"
+	fi
+
+	if use emacs; then
+		elisp-compile contrib/client-side/emacs/{dsvn,psvn,vc-svn}.el \
+			doc/svn-doc.el doc/tools/svnbook.el \
+			|| die "Compilation of Emacs modules failed"
+	fi
+
+	if use extras; then
+		emake contrib || die "Building of contrib failed"
+		emake tools || die "Building of tools failed"
+	fi
+
+	if use doc; then
+		doxygen doc/doxygen.conf || die "Building of Subversion HTML documentation failed"
+
+		if use java; then
+			emake doc-javahl || die "Building of Subversion JavaHL library HTML documentation failed"
+		fi
+	fi
+}
+
+src_install() {
+	python_version
+	PYTHON_DIR=/usr/$(get_libdir)/python${PYVER}
+
+	emake -j1 DESTDIR="${D}" local-install || die "Installation of core of Subversion failed"
+
+	if use python; then
+		emake -j1 DESTDIR="${D}" DISTUTIL_PARAM="--prefix=${D}" LD_LIBRARY_PATH="-L${D}/usr/$(get_libdir)" install-swig-py \
+			|| die "Installation of Subversion Python bindings failed"
+
+		# Move Python bindings.
+		dodir "${PYTHON_DIR}/site-packages"
+		mv "${D}"/usr/$(get_libdir)/svn-python/svn "${D}${PYTHON_DIR}/site-packages"
+		mv "${D}"/usr/$(get_libdir)/svn-python/libsvn "${D}${PYTHON_DIR}/site-packages"
+		rm -Rf "${D}"/usr/$(get_libdir)/svn-python
+	fi
+
+	if use perl; then
+		emake -j1 DESTDIR="${D}" INSTALLDIRS="vendor" install-swig-pl || die "Installation of Subversion Perl bindings failed"
+		fixlocalpod
+	fi
+
+	if use ruby; then
+		emake -j1 DESTDIR="${D}" install-swig-rb || die "Installation of Subversion Ruby bindings failed"
+	fi
+
+	if use java; then
+		emake -j1 DESTDIR="${D}" install-javahl || die "Installation of Subversion JavaHL library failed"
+		java-pkg_regso "${D}"/usr/$(get_libdir)/libsvnjavahl*.so
+		java-pkg_dojar "${D}"/usr/$(get_libdir)/svn-javahl/svn-javahl.jar
+		rm -Rf "${D}"/usr/$(get_libdir)/svn-javahl/*.jar
+	fi
+
+	# Install Apache module configuration.
+	if use apache2; then
+		dodir "${APACHE_MODULES_CONFDIR}"
+		cat <<EOF >"${D}/${APACHE_MODULES_CONFDIR}"/47_mod_dav_svn.conf
+<IfDefine SVN>
+LoadModule dav_svn_module modules/mod_dav_svn.so
+<IfDefine SVN_AUTHZ>
+LoadModule authz_svn_module modules/mod_authz_svn.so
+</IfDefine>
+
+# Example configuration:
+#<Location /svn/repos>
+#	DAV svn
+#	SVNPath ${SVN_REPOS_LOC}/repos
+#	AuthType Basic
+#	AuthName "Subversion repository"
+#	AuthUserFile ${SVN_REPOS_LOC}/conf/svnusers
+#	Require valid-user
+#</Location>
+</IfDefine>
+EOF
+	fi
+
+	# Install Bash Completion, bug 43179.
+	dobashcompletion tools/client-side/bash_completion subversion
+	rm -f tools/client-side/bash_completion
+
+	# Install hot backup script, bug 54304.
+	newbin tools/backup/hot-backup.py svn-hot-backup
+	rm -fr tools/backup
+
+	# Install svn_load_dirs.pl.
+	if use perl; then
+		newbin contrib/client-side/svn_load_dirs/svn_load_dirs.pl svn-load-dirs
+	fi
+	rm -f contrib/client-side/svn_load_dirs/svn_load_dirs.pl
+
+	# Install svnserve init-script and xinet.d snippet, bug 43245.
+	newinitd "${FILESDIR}"/svnserve.initd svnserve
+	if use apache2; then
+		newconfd "${FILESDIR}"/svnserve.confd svnserve
+	else
+		newconfd "${FILESDIR}"/svnserve.confd2 svnserve
+	fi
+	insinto /etc/xinetd.d
+	newins "${FILESDIR}"/svnserve.xinetd svnserve
+
+	# Install documentation.
+	dodoc CHANGES COMMITTERS README
+	dohtml www/hacking.html
+	dodoc tools/xslt/svnindex.{css,xsl}
+	rm -fr tools/xslt
+
+	# Install Vim syntax files.
+	if use vim-syntax; then
+		insinto /usr/share/vim/vimfiles/syntax
+		doins contrib/client-side/vim/svn.vim
+	fi
+	rm -f contrib/client-side/vim/svn.vim
+
+	# Install Emacs Lisps.
+	if use emacs; then
+		elisp-install ${PN} contrib/client-side/emacs/{dsvn,psvn}.{el,elc} \
+			doc/svn-doc.{el,elc} doc/tools/svnbook.{el,elc} \
+			|| die "Installation of Emacs modules failed"
+		elisp-install ${PN}/compat contrib/client-side/emacs/vc-svn.{el,elc} \
+			|| die "Installation of Emacs modules failed"
+		touch "${D}${SITELISP}/${PN}/compat/.nosearch"
+		elisp-site-file-install "${FILESDIR}"/1.5.0/70svn-gentoo.el \
+			|| die "Installation of Emacs site-init file failed"
+	fi
+	rm -fr contrib/client-side/emacs
+
+	# Install extra files.
+	if use extras; then
+		doenvd "${FILESDIR}"/1.5.0/80subversion-extras
+
+		emake DESTDIR="${D}" install-contrib || die "Installation of contrib failed"
+		emake DESTDIR="${D}" install-tools || die "Installation of tools failed"
+
+		find contrib tools '(' -name "*.bat" -o -name "*.in" -o -name ".libs" ')' -print0 | xargs -0 rm -fr
+		rm -fr contrib/client-side/{svn-push,svnmucc}
+		rm -fr tools/server-side/{svn-populate-node-origins-index,svnauthz-validate}*
+		rm -fr tools/{buildbot,dev,diff,po}
+
+		insinto /usr/share/${PN}
+		doins -r contrib tools
+	fi
+
+	if use doc; then
+		dohtml doc/doxygen/html/*
+
+		insinto /usr/share/doc/${PF}
+		doins -r notes
+		ecompressdir /usr/share/doc/${PF}/notes
+
+		if use java; then
+			java-pkg_dojavadoc doc/javadoc
+		fi
+	fi
+}
+
+pkg_preinst() {
+	# Compare versions of Berkeley DB, bug 122877.
+	if use berkdb && [[ -f "${ROOT}usr/bin/svn" ]] ; then
+		OLD_BDB_VERSION="$(scanelf -nq "${ROOT}usr/$(get_libdir)/libsvn_subr-1.so.0" | grep -Eo "libdb-[[:digit:]]+\.[[:digit:]]+" | sed -e "s/libdb-\(.*\)/\1/")"
+		NEW_BDB_VERSION="$(scanelf -nq "${D}usr/$(get_libdir)/libsvn_subr-1.so.0" | grep -Eo "libdb-[[:digit:]]+\.[[:digit:]]+" | sed -e "s/libdb-\(.*\)/\1/")"
+		if [[ "${OLD_BDB_VERSION}" != "${NEW_BDB_VERSION}" ]] ; then
+			CHANGED_BDB_VERSION=1
+		fi
+	fi
+}
+
+pkg_postinst() {
+	use emacs && elisp-site-regen
+	use perl && perl-module_pkg_postinst
+
+	elog "Subversion Server Notes"
+	elog "-----------------------"
+	elog
+	elog "If you intend to run a server, a repository needs to be created using"
+	elog "svnadmin (see man svnadmin) or the following command to create it in"
+	elog "${SVN_REPOS_LOC}:"
+	elog
+	elog "    emerge --config =${CATEGORY}/${PF}"
+	elog
+	elog "Subversion has multiple server types, take your pick:"
+	elog
+	elog " - svnserve daemon: "
+	elog "   1. Edit /etc/conf.d/svnserve"
+	elog "   2. Fix the repository permissions (see \"Fixing the repository permissions\")"
+	elog "   3. Start daemon: /etc/init.d/svnserve start"
+	elog "   4. Make persistent: rc-update add svnserve default"
+	elog
+	elog " - svnserve via xinetd:"
+	elog "   1. Edit /etc/xinetd.d/svnserve (remove disable line)"
+	elog "   2. Fix the repository permissions (see \"Fixing the repository permissions\")"
+	elog "   3. Restart xinetd.d: /etc/init.d/xinetd restart"
+	elog
+	elog " - svn over ssh:"
+	elog "   1. Fix the repository permissions (see \"Fixing the repository permissions\")"
+	elog "      Additionally run:"
+	elog "        groupadd svnusers"
+	elog "        chown -R root:svnusers ${SVN_REPOS_LOC}/repos"
+	elog "   2. Create an svnserve wrapper in /usr/local/bin to set the umask you"
+	elog "      want, for example:"
+	elog "         #!/bin/bash"
+	elog "         . /etc/conf.d/svnserve"
+	elog "         umask 007"
+	elog "         exec /usr/bin/svnserve \${SVNSERVE_OPTS} \"\$@\""
+	elog
+
+	if use apache2; then
+		elog " - http-based server:"
+		elog "   1. Edit /etc/conf.d/apache2 to include both \"-D DAV\" and \"-D SVN\""
+		elog "   2. Create an htpasswd file:"
+		elog "      htpasswd2 -m -c ${SVN_REPOS_LOC}/conf/svnusers USERNAME"
+		elog "   3. Fix the repository permissions (see \"Fixing the repository permissions\")"
+		elog "   4. Restart Apache: /etc/init.d/apache2 restart"
+		elog
+	fi
+
+	elog "   Fixing the repository permissions:"
+	elog "        chmod -Rf go-rwx ${SVN_REPOS_LOC}/conf"
+	elog "        chmod -Rf g-w,o-rwx ${SVN_REPOS_LOC}/repos"
+	elog "        chmod -Rf g+rw ${SVN_REPOS_LOC}/repos/db"
+	elog "        chmod -Rf g+rw ${SVN_REPOS_LOC}/repos/locks"
+	elog
+
+	elog "If you intend to use svn-hot-backup, you can specify the number of"
+	elog "backups to keep per repository by specifying an environment variable."
+	elog "If you want to keep e.g. 2 backups, do the following:"
+	elog "echo '# hot-backup: Keep that many repository backups around' > /etc/env.d/80subversion"
+	elog "echo 'SVN_HOTBACKUP_BACKUPS_NUMBER=2' >> /etc/env.d/80subversion"
+	elog
+
+	if [[ -n "${CHANGED_BDB_VERSION}" ]] ; then
+		ewarn "You upgraded from an older version of Berkeley DB and may experience"
+		ewarn "problems with your repository. Run the following commands as root to fix it:"
+		ewarn "    db4_recover -h ${SVN_REPOS_LOC}/repos"
+		ewarn "    chown -Rf apache:apache ${SVN_REPOS_LOC}/repos"
+	fi
+}
+
+pkg_postrm() {
+	use emacs && elisp-site-regen
+	use perl && perl-module_pkg_postrm
+}
+
+pkg_config() {
+	if [[ ! -x "${ROOT}usr/bin/svnadmin" ]] ; then
+		die "You seem to only have built the Subversion client"
+	fi
+
+	einfo ">>> Initializing the database in ${ROOT}${SVN_REPOS_LOC} ..."
+	if [[ -e "${ROOT}${SVN_REPOS_LOC}/repos" ]] ; then
+		echo "A Subversion repository already exists and I will not overwrite it."
+		echo "Delete \"${ROOT}${SVN_REPOS_LOC}/repos\" first if you're sure you want to have a clean version."
+	else
+		mkdir -p "${ROOT}${SVN_REPOS_LOC}/conf"
+
+		einfo ">>> Populating repository directory ..."
+		# Create initial repository.
+		"${ROOT}usr/bin/svnadmin" create "${ROOT}${SVN_REPOS_LOC}/repos"
+
+		einfo ">>> Setting repository permissions ..."
+		SVNSERVE_USER="$(. "${ROOT}etc/conf.d/svnserve" ; echo "${SVNSERVE_USER}")"
+		SVNSERVE_GROUP="$(. "${ROOT}etc/conf.d/svnserve" ; echo "${SVNSERVE_GROUP}")"
+		if use apache2 ; then
+			[[ -z "${SVNSERVE_USER}" ]] && SVNSERVE_USER="apache"
+			[[ -z "${SVNSERVE_GROUP}" ]] && SVNSERVE_GROUP="apache"
+		else
+			[[ -z "${SVNSERVE_USER}" ]] && SVNSERVE_USER="svn"
+			[[ -z "${SVNSERVE_GROUP}" ]] && SVNSERVE_GROUP="svnusers"
+			enewgroup "${SVNSERVE_GROUP}"
+			enewuser "${SVNSERVE_USER}" -1 -1 "${SVN_REPOS_LOC}" "${SVNSERVE_GROUP}"
+		fi
+		chown -Rf "${SVNSERVE_USER}:${SVNSERVE_GROUP}" "${ROOT}${SVN_REPOS_LOC}/repos"
+		chmod -Rf go-rwx "${ROOT}${SVN_REPOS_LOC}/conf"
+		chmod -Rf o-rwx "${ROOT}${SVN_REPOS_LOC}/repos"
+	fi
+}
--- a/dev-util/svk/Manifest	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-DIST SVK-v2.0.2.tar.gz 445041 RMD160 5eeaa465355cd3026f7230b120d83051705fc86d SHA1 8d691c6e6b914e5b8e71ba75dee60b61fe90e54f SHA256 405b59c6398c50356f036292668bd653f43e296a3b301be64c90ffcd0e169530
-EBUILD svk-2.0.2.ebuild 2198 RMD160 de6b1c40f9f44020df10527f7be04b5ef82bd472 SHA1 65be4722f252a2046c38c09ad908da57953210ff SHA256 b22a6c83a9ae43c3b020bf185c1ead0606bf924cddf9bf6c219562ee98a67689
--- a/dev-util/svk/svk-2.0.2.ebuild	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header$
-
-inherit eutils perl-module bash-completion
-
-MY_PV="v${PV}"
-MY_P="${PN/svk/SVK}-${MY_PV}"
-S="${WORKDIR}/${MY_P}"
-
-DESCRIPTION="A decentralized version control system"
-SRC_URI="mirror://cpan/authors/id/C/CL/CLKAO/${MY_P}.tar.gz"
-HOMEPAGE="http://svk.elixus.org/"
-
-SLOT="0"
-LICENSE="|| ( Artistic GPL-2 )"
-KEYWORDS="~amd64 ~ia64 ~ppc ~sparc ~x86"
-IUSE="crypt nls pager patch log4p bash-completion"
-
-DEPEND="
-	>=dev-lang/perl-5.8.7
-	>=dev-util/subversion-1.3.0
-        >=dev-perl/version-0.68
-        dev-perl/Algorithm-Annotate
-        >=dev-perl/Algorithm-Diff-1.1901
-        >=dev-perl/YAML-Syck-0.60
-        >=dev-perl/Data-Hierarchy-0.30
-        >=dev-perl/PerlIO-via-dynamic-0.11
-        >=dev-perl/PerlIO-via-symlink-0.02
-        dev-perl/IO-Digest
-        >=dev-perl/SVN-Simple-0.27
-        dev-perl/URI
-        >=dev-perl/PerlIO-eol-0.13
-        >=dev-perl/Class-Autouse-1.15
-        dev-perl/App-CLI
-        dev-perl/List-MoreUtils
-        dev-perl/Class-Accessor
-        dev-perl/Class-Data-Inheritable
-        >=dev-perl/Path-Class-0.16
-        dev-perl/UNIVERSAL-require
-        dev-perl/TermReadKey
-        >=virtual/perl-File-Temp-0.17
-        >=virtual/perl-Getopt-Long-2.35
-        dev-perl/Pod-Escapes
-        dev-perl/Pod-Simple
-        >=virtual/perl-File-Spec-3.19
-	nls? (
-		>=dev-perl/locale-maketext-lexicon-0.62
-		>=dev-perl/Locale-Maketext-Simple-0.16
-	)
-	pager? ( dev-perl/IO-Pager )
-        log4p? ( dev-perl/Log-Log4perl )
-	>=dev-perl/SVN-Mirror-0.71
-	patch? (
-		dev-perl/Compress-Zlib
-		dev-perl/FreezeThaw
-	)
-	crypt? ( app-crypt/gnupg )
-        dev-perl/TimeDate"
-RDEPEND="${DEPEND}"
-
-
-pkg_setup() {
-	if ! perl -MSVN::Core < /dev/null 2> /dev/null; then
-		eerror "SVN::Core missing or outdated. Please emerge \
-		dev-util/subversion ith the perl USE flag."
-		die "Need Subversion compiled with Perl bindings"
-	fi
-}
-
-src_install() {
-	perl-module_src_install
-	if use bash-completion; then
-		dobin contrib/svk-completion.pl
-		echo "complete -C ${DESTTREE}/bin/svk-completion.pl -o default svk" \
-			> svk-completion
-		dobashcompletion svk-completion
-	fi
-}
--- a/mail-client/alpine/Manifest	Tue Feb 10 03:49:43 2009 +0100
+++ b/mail-client/alpine/Manifest	Wed Mar 04 02:58:24 2009 +0100
@@ -1,3 +1,3 @@
 DIST all.patch.gz 170342 RMD160 81647cc792f26da49ef6c5263ff0a5bc55e89d07 SHA1 c8a0daa6b98020f8fc21a68f99e87cc90711aee6 SHA256 d6908fcb25f18f42906c1793b741390f88b48adf5764ba33848f9b4a5018ead0
-DIST alpine-1.10.tar.bz2 4861929 RMD160 03f216b57517f377b7995d913f7d333242f70ab3 SHA1 fe8f83ad9f5b8e528ee61960877443d518af9eed SHA256 8c642829d19b776c153cc8e1d93992dc7986d44f687100823dbb51fe78116765
-EBUILD alpine-1.10.ebuild 3322 RMD160 04b6a9ac17309984df37944c3f61a7134c886891 SHA1 82f5ff5964b6f56083ceb0998365a04ed3caafe9 SHA256 b81e68f03562d44f5de0391fa0a2695be0bb9b7b5b835e69119a3137f6b8cdbd
+DIST alpine-2.00.tar.bz2 5222673 RMD160 9e67704b23b3973d8b878e65ad9e6f5026c10d13 SHA1 dcbd3c5419954f484ccf706feaba31ce48cdebc4 SHA256 c85db8405af90375ba2440c85b7952d80996154e9916b83acca558dc82e0a2a6
+EBUILD alpine-2.00.ebuild 4053 RMD160 bc7833df191592dc23323336b91cb14608b91861 SHA1 5a86fcd5cde05c2cca15b7a2f4b0c166282f67eb SHA256 51e88fb32ac03764852fe1d2183c2efacc210b704346bcdf65f72cb1877f8021
--- a/mail-client/alpine/alpine-1.10.ebuild	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-inherit eutils 
-
-DESCRIPTION="alternativly licensed pine with full UTF-8 support"
-HOMEPAGE="http://www.washington.edu/alpine/
-	  http://staff.washington.edu/chappa/alpine/"
-SRC_URI="ftp://ftp.cac.washington.edu/alpine/${P}.tar.bz2
-	 chappa? ( http://staff.washington.edu/chappa/alpine/patches/${P}/all.patch.gz )"
-
-LICENSE="Apache-2.0"
-SLOT="0"
-KEYWORDS="~x86 ~amd64 ~x86-fbsd"
-IUSE="chappa doc kerberos ldap nls spell ssl threads userland_BSD onlyalpine passfile"
-
-DEPEND="virtual/pam
-	>=sys-libs/ncurses-5.1
-	ssl? ( dev-libs/openssl )
-	ldap? ( net-nds/openldap )
-	kerberos? ( app-crypt/mit-krb5 )
-	spell? ( app-text/aspell )"
-RDEPEND="${DEPEND}
-	app-misc/mime-types
-	!onlyalpine? ( !app-editors/pico )
-	!onlyalpine? ( !mail-client/pine )
-	!<=net-mail/uw-imap-2004g"
-
-maildir_warn() {
-		einfo
-		einfo "This build of alpine has Maildir support built in as"
-		einfo "part of the chappa-all patch."
-		einfo
-		einfo "If you have a maildir at ~/Maildir it will be your"
-		einfo "default INBOX. The path may be changed with the"
-		einfo "\"maildir-location\" setting in alpine."
-		einfo
-		einfo "To use /var/spool/mail INBOX again, set"
-		einfo "\"disable-these-drivers=md\" in your .pinerc file."
-		einfo
-		einfo "Alternately, you might want to read following webpage, which explains how to"
-		einfo "use multiple mailboxes simultaneously:"
-		einfo
-		einfo "http://www.math.washington.edu/~chappa/pine/pine-info/collections/incoming-folders/"
-		einfo
-}
-
-pkg_setup() {
-	if use chappa; then
-		maildir_warn
-	fi
-}
-
-src_unpack() {
-	unpack ${A}
-	if use chappa; then
-		epatch ${WORKDIR}/all.patch
-	fi
-}
-
-src_compile() {
-	local myconf="--without-tcl --with-system-pinerc=/etc/pine.conf --with-system-fixed-pinerc=/etc/pine.conf.fixed"
-	if use ssl; then
-		myconf="${myconf} --with-ssl-certs-dir=/etc/ssl/certs"
-	else
-		myconf="${myconf} --without-ssl"
-	fi
-	if use ldap; then
-		myconf="${myconf}"
-	else
-		myconf="${myconf} --without-ldap"
-	fi
-	if user passfile; then
-		myconf="${myconf} --with-passfile=.pinepwd"
-	fi
-	if use kerberos; then
-		myconf="${myconf}"
-	else
-		myconf="${myconf} --without-krb5"
-	fi
-	if use threads; then
-		myconf="${myconf}"
-	else
-		myconf="${myconf} --without-pthread"
-	fi
-	if use spell; then
-		myconf="${myconf} --with-interactive-spellcheck=/usr/bin/aspell"
-	fi
-	if ! use nls; then
-		myconf="${myconf} --disable-nls"
-	fi
-	econf ${myconf} || die "configure problem"
-	if use userland_BSD; then
-		make
-	else
-		emake
-	fi
-}
-
-src_install() {
-	if use onlyalpine; then
-		dobin alpine/alpine
-		doman doc/alpine.1
-	else
-		if use userland_BSD; then
-			make DESTDIR=${D} install
-		else	
-			emake DESTDIR=${D} install
-		fi
-
-		doman doc/rpdump.1 doc/rpload.1 
-	fi
-
-	dodoc NOTICE
-	if use chappa; then
-		dodoc README.maildir
-	fi
-	
-	if use doc; then
-		dodoc README doc/brochure.txt doc/tech-notes.txt
-		docinto imap
-		dodoc imap/docs/*.txt imap/docs/CONFIG imap/docs/RELNOTES
-
-		docinto imap/rfc
-		dodoc imap/docs/rfc/*.txt
-
-		docinto html/tech-notes
-		dohtml -r doc/tech-notes/
-	fi
-}
-
-pkg_postinst() {
-	elog
-	if use spell; then
-		elog "In order to use spell checking"
-		elog "  emerge app-dicts/aspell-\<your_langs\>"
-		elog "and setup alpine with:"
-		elog "  Speller = /usr/bin/aspell -c"
-		elog
-	fi
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mail-client/alpine/alpine-2.00.ebuild	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,143 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="alpine is the successor of the famous mail and news reader pine"
+HOMEPAGE="http://www.washington.edu/alpine/ http://staff.washington.edu/chappa/alpine/"
+SRC_URI="ftp://ftp.cac.washington.edu/alpine/${P}.tar.bz2
+	     chappa? ( http://staff.washington.edu/chappa/alpine/patches/${P}/all.patch.gz )"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~x86 ~amd64 ~x86-fbsd"
+IUSE="chappa doc ipv6 kerberos ldap nls onlyalpine passfile smime spell ssl threads topal userland_BSD"
+
+DEPEND="virtual/pam
+	    >=sys-libs/ncurses-5.1
+	    ssl? ( dev-libs/openssl )
+	    ldap? ( net-nds/openldap )
+	    kerberos? ( app-crypt/mit-krb5 )
+	    spell? ( app-text/aspell )
+	    topal? ( >=mail-client/topal-62 )"
+RDEPEND="${DEPEND}
+	app-misc/mime-types
+	!onlyalpine? ( !app-editors/pico )
+	!onlyalpine? ( !mail-client/pine )
+	!<=net-mail/uw-imap-2004g"
+
+maildir_warn() {
+		elog
+		elog "This build of ${PN} has Maildir support built in as"
+		elog "part of the chappa-all patch."
+		elog
+		elog "If you have a maildir at ~/Maildir it will be your"
+		elog "default INBOX. The path may be changed with the"
+		elog "\"maildir-location\" setting in alpine."
+		elog
+		elog "To use /var/spool/mail INBOX again, set"
+		elog "\"disable-these-drivers=md\" in your .pinerc file."
+		elog
+		elog "Alternately, you might want to read following webpage, which explains how to"
+		elog "use multiple mailboxes simultaneously:"
+		elog
+		elog "http://www.math.washington.edu/~chappa/pine/pine-info/collections/incoming-folders/"
+		elog
+}
+
+src_unpack() {
+	unpack ${A}
+	use chappa && epatch "${WORKDIR}"/all.patch
+	# topal needs updating for alpine 2.00
+	#use topal && epatch /usr/share/topal/patches/${P}.patch
+	use topal && die "topal needs updating for ${P}. Please disable it for now."
+}
+
+src_compile() {
+	local myconf="--without-tcl
+				  --with-system-pinerc=/etc/pine.conf
+				  --with-system-fixed-pinerc=/etc/pine.conf.fixed
+				  --with-ssl-certs-dir=/etc/ssl/certs"
+
+	use ssl || myconf="${myconf} --without-ssl"
+	use ldap || myconf="${myconf} --without-ldap"
+	use passfile && myconf="${myconf} --with-passfile=.pinepwd"
+	use kerberos || myconf="${myconf} --without-krb5"
+	use threads || myconf="${myconf} --without-pthread"
+	use spell && myconf="${myconf} --with-interactive-spellcheck=/usr/bin/aspell"
+	use nls || myconf="${myconf} --disable-nls"
+	use ipv6 || myconf="${myconf} --without-ipv6"
+	use smime || myconf="${myconf} --without-smime"
+
+	# fixme
+	# --with-system-mail-directory=DIR?
+
+	# fixme
+	# --as-needed breaks linking of c-client for executables
+	# filter-ldflags --as-needed does not work for "-Wl,-O1,--as-needed,-z,now" ??
+	LDFLAGS=`echo $LDFLAGS | sed s/--as-needed//g | sed s/,,/,/g`
+	econf ${myconf} LDFLAGS="$LDFLAGS" || die "configure problem"
+
+	if use userland_BSD; then
+		make || die "make failed"
+	else
+		emake || die "emake failed"
+	fi
+}
+
+src_install() {
+	if use onlyalpine; then
+		dobin alpine/alpine
+		doman doc/alpine.1
+	else
+		if use userland_BSD; then
+			make DESTDIR="${D}" install
+		else
+			emake DESTDIR="${D}" install
+		fi
+
+		doman doc/rpdump.1 doc/rpload.1
+	fi
+
+	dodoc NOTICE
+	if use chappa; then
+		dodoc README.maildir
+	fi
+
+	if use doc; then
+		dodoc README doc/brochure.txt doc/tech-notes.txt
+		docinto imap
+		dodoc imap/docs/*.txt imap/docs/CONFIG imap/docs/RELNOTES
+
+		docinto imap/rfc
+		dodoc imap/docs/rfc/*.txt
+
+		docinto html/tech-notes
+		dohtml -r doc/tech-notes/
+	fi
+}
+
+pkg_postinst() {
+	use chappa && maildir_warn
+	if use spell; then
+		elog
+		elog "In order to use spell checking"
+		elog "  emerge app-dicts/aspell-\<your_langs\>"
+		elog "and setup alpine with:"
+		elog "  Speller = /usr/bin/aspell -c"
+		elog
+	fi
+	if use topal; then
+		elog
+		elog "In order to use gpg with topal"
+		elog "  read /usr/doc/topal/README.txt"
+		elog
+	fi
+	if use passfile ; then
+		elog
+		elog "${PN} will cache passwords between connections."
+		elog "File ~/.pinepw will be used for this."
+		elog
+	fi
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/Manifest	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,16 @@
+AUX README.gentoo 3208 RMD160 858aee78e07bdc0ebee7bc6c2212d4c528325633 SHA1 819ae809566e967cdc03024adae4443c5833dfc5 SHA256 9e87efa3fcea73becdfad4adb0fe677e1969c2951f03c47d1b0f4aeb00999578
+AUX config-3.3/lmhosts 134 RMD160 7c99b13a2f273ee190c7df9392b1678b00ec461a SHA1 d63d8d846c3cecfc706d28d916ea323f2eae4ef1 SHA256 b891ca7448db3fadefd9f5ddaeb28ea19bad63c3ee21ea8f74cdc2dfecd6ab6b
+AUX config-3.3/nsswitch.conf-winbind 414 RMD160 71491dd98acc39aea8f18f5cc382f6a56d80259f SHA1 fa5c1e24437d4ffc0150a2b202f5ba6df5d40463 SHA256 5466dc681036731046f53e4ef59fb7c2110783e77a38d0887432d94776c3dafa
+AUX config-3.3/nsswitch.conf-wins 400 RMD160 1e005e46b161edf12a9118018eb2676e3531dd7f SHA1 ccd9903e26ada045428f1ec16678c29e21c35ef3 SHA256 e028691f7144932404ec154fdb72defb4f127e1f6c330c8864ede2f369a0d05d
+AUX config-3.3/samba.pam 397 RMD160 8f64b09e17e0c458a8156db3cc92a0413513e4fc SHA1 f39d48e07be8069885b51253c5b891a856b7b41e SHA256 86634f2d541370518d0958a73c04776ed5df2a3716ef128ff384459acce9cd38
+AUX config-3.3/samba.schema 16044 RMD160 b28408c64524ea44a9b0ea877d614603456a18fa SHA1 523d8bcf6313fe8ce03a3fbe762ba90b88ca5643 SHA256 c011a2f2f4fcc2839e3609cf5477507d938083f48f15a05787337b352f3afec3
+AUX config-3.3/smb.conf.example-samba3 19701 RMD160 1ce92cbedb15cf5ee4d66ee50fd7c996231facea SHA1 5c60002f23ac2a60fc27b58ea03659acb0db876a SHA256 83fd9407e71db606bb50677f9d8a557688b6eafacb32d30c7a0a6d1c666b694d
+AUX config-3.3/smbusers 212 RMD160 9734e79880e91fb5a9efbd723819413da5746923 SHA1 0c93dcf9d8c854a446b8f1442a7fd9d6b5623314 SHA256 35ebdad3dcad3819996ac63909a3aa5cff72f5953e4060f48c861e399c3ea208
+AUX config-3.3/swat.xinetd 535 RMD160 de492774e24a45eeb378209aa14b212225f3229a SHA1 5d5113ce77807d972bc0d62993cd6a7c2d30705c SHA256 4de179a10806a2e3af2392c0b9002671e567bb94601cfc0a542c607e6cc9dbc9
+AUX config-3.3/system-auth-winbind 709 RMD160 0af9b97a1e35e6e1c5db484bd80ccb95fa8fecf9 SHA1 e36df120cbd51483c22cf324582034c9ff4cee2b SHA256 944f7fbc2d4d5a3da739e1dc37864efa08ee8a39cbd9a36b2ecfeefc47ed3a98
+AUX samba-conf 1291 RMD160 326fb4beee8105d839d23e37f4989d7e332c996b SHA1 af7cd695f212d7ec022df05ba2f821a8f9878ab2 SHA256 dfaf474c3cbfa3d3b26d1531c6f5913739d5815c4b8083063934ee4fd6b38861
+AUX samba-init 1133 RMD160 77a084e8f78665af0233f19dc9c4a49693360da1 SHA1 09d7f1d676856289b61e890396a9976e2ccc794a SHA256 3b41d16daf02f9a1ab12e62c4c915f58e7801c07be48e2a94086eb288bb86aad
+AUX samba-xinetd 286 RMD160 c90bd8518082eb4c182d5f7bd223a76f8e3c7fab SHA1 b250c5ca539187d8b481bcfb6ea3a915d7e8b26b SHA256 964d06dc33beff38978a8f03cd12b05c33d8258ed73aa9ffbf137fe226de25b8
+DIST samba-3.3.1.tar.gz 26057285 RMD160 3b75ef91440b79b649aef66670e5b23a94428590 SHA1 add05aad5bff976d3d25fc455e91c5f8539107a1 SHA256 d2bd8fdd72026d26481827baa35b8311d7531753b87b6086b4d7a3dcdb42e170
+EBUILD samba-3.3.1.ebuild 7736 RMD160 7872a31da441d4a93363bfc3a4f7cf2ec2a69379 SHA1 9e825a80db3989bf09d2bdbb177f7b5eae51c415 SHA256 9f3a573f1f6ea84d4d21276bd3631cfe04e635467cbc98a5dc9acc2e3a503328
+MISC metadata.xml 950 RMD160 4947143536f9776d7dd7f7d6552d624e1f2ac14d SHA1 ef8a8c0c5cd229c88b1f93042ebfbdafaf45deb2 SHA256 b040a13821dbd3f1214b96ed5a808188ef0996161b0ce0cc11de8d8397de960f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/README.gentoo	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,79 @@
+#-------------------------------------------------------------------------
+# WHATSNEW
+#-------------------------------------------------------------------------
+3.0.2:
+    If you are upgrading from a Samba version prior to 3.0.2, and you
+    use Samba's password database, you must run the following command:
+        pdbedit --force-initialized-passwords
+  
+3.0.10:
+    LIBs flags changes for suid bins: LDFLAGS+='-Wl,-z,now'
+
+3.0.12:
+    libsmbclient shared library retrocompatibility is not assured: please
+        rebuild all samba-linked third part packages
+    /etc/samba/private moved to ${PRIVATE_DST}
+        for better File System Hierarchy adeherence
+    
+3.0.20:
+    --with-idmap configure option removed
+        (historical: it is already included if dynamic id/gid mapping is used)
+    New USE flags:
+	async: async input/output
+        automount: automount support (previously default)
+        syslog: log to syslog daemon (previously default)
+
+3.0.22:
+	*sql backend: they were experimental, and now are marked as "deprecated"
+		upstream
+	CVE-2006-1059 security fix: 3.0.21* shipped with a bug in the debug
+		functions of winbind (debug>=5 reveals secret ids in logs)
+
+3.0.23:
+    *sql and xml backends have been removed by upstream devs. SQL is
+        temporarily continued on SourceForge (http://pdbsql.sourceforge.net),
+        but it will be removed with samba 4.x (and maybe 3.2.x)
+    see also ldap changes below
+    CAN-2006-1059: memory exaustion DoS against smbd in all samba versions
+        between 3.0.x and 3.0.23
+
+General:
+    If you experience client locks in file transfers _only_, try the parameter
+             use sendfile = no (man smb.conf(5), man sendfile(2))
+    There also seem some problems with the smbfs implementation of the recent
+        2.6.x kernels. If you experience problems (lockups) with smbfs, try
+        'mount -t cifs' as an alternative
+
+#-------------------------------------------------------------------------
+# WINBIND
+#-------------------------------------------------------------------------
+3.0.7: param: 'winbind enable local accounts' is now disabled by default
+
+#-------------------------------------------------------------------------
+# LDAP
+#-------------------------------------------------------------------------
+3.0.2:
+    If you are upgrading from prior to 3.0.2, and you are using LDAP for Samba
+    authentication, you must check the sambaPwdLastSet attribute on all
+    accounts, and ensure it is not 0.
+    
+3.0.12:
+    smbldap-tools is now a separate package for ease of upgrade
+
+3.0.23:
+    a new index is required: 'index sambaSID sub' (run slapindex afterwards)
+       use an updated samba.schema containing the correct 'sambaSID' definition
+
+#-------------------------------------------------------------------------
+# DOCS
+#-------------------------------------------------------------------------
+General:
+    Beside [1], there is a good HOWTO about setting up samba3 with cups and 
+        clamav at [2]
+Ldap:
+    Beside the Samba Guide ad [1], try to look at smbldap-tools docs [3]
+
+[1] http://www.samba.org
+[2] http://www.gentoo.org/doc/en/quick-samba-howto.xml
+[3] http://www.idealx.org/prj/samba/smbldap-howto.fr.html
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/config-3.3/lmhosts	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,2 @@
+# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/config-3.2/lmhosts,v 1.1 2008/03/08 12:24:12 dev-zero Exp $
+127.0.0.1 localhost
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/config-3.3/nsswitch.conf-winbind	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,17 @@
+# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/config-3.2/nsswitch.conf-winbind,v 1.1 2008/03/08 12:24:12 dev-zero Exp $
+passwd:      files winbind
+group:       files winbind
+
+hosts:       files dns
+networks:    files dns
+
+services:    db files
+protocols:   db files
+rpc:         db files
+ethers:      db files
+netmasks:    files
+netgroup:    files
+bootparams:  files
+
+automount:   files
+aliases:     files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/config-3.3/nsswitch.conf-wins	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,17 @@
+# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/config-3.2/nsswitch.conf-wins,v 1.1 2008/03/08 12:24:12 dev-zero Exp $
+passwd:      files
+group:       files
+
+hosts:       files dns wins
+networks:    files dns
+
+services:    db files
+protocols:   db files
+rpc:         db files
+ethers:      db files
+netmasks:    files
+netgroup:    files
+bootparams:  files
+
+automount:   files
+aliases:     files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/config-3.3/samba.pam	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,8 @@
+#%PAM-1.0
+# * pam_smbpass.so authenticates against the smbpasswd file
+# * changed Redhat's 'pam_stack' with 'include' for *BSD compatibility
+#    (Diego "Flameeyes" Petteno'): enable with pam>=0.78 only
+auth       required     pam_smbpass.so nodelay
+account    include      system-auth
+session    include      system-auth
+password   required     pam_smbpass.so nodelay smbconf=/etc/samba/smb.conf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/config-3.3/samba.schema	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,471 @@
+##
+## schema file for OpenLDAP 2.x
+## Schema for storing Samba user accounts and group maps in LDAP
+## OIDs are owned by the Samba Team
+##
+## Prerequisite schemas - uid         (cosine.schema)
+##                      - displayName (inetorgperson.schema)
+##                      - gidNumber   (nis.schema)
+##
+## 1.3.6.1.4.1.7165.2.1.x - attributetypes
+## 1.3.6.1.4.1.7165.2.2.x - objectclasses
+##
+## ----- READ THIS WHEN ADDING A NEW ATTRIBUTE OR OBJECT CLASS ------
+##
+## Run the 'get_next_oid' bash script in this directory to find the 
+## next available OID for attribute type and object classes.
+##
+##   $ ./get_next_oid
+##   attributetype ( 1.3.6.1.4.1.7165.2.1.XX NAME ....
+##   objectclass ( 1.3.6.1.4.1.7165.2.2.XX NAME ....
+##
+## Also ensure that new entries adhere to the declaration style
+## used throughout this file
+##
+##    <attributetype|objectclass> ( 1.3.6.1.4.1.7165.2.XX.XX NAME ....
+##                               ^ ^                        ^
+##
+## The spaces are required for the get_next_oid script (and for 
+## readability).
+##
+## ------------------------------------------------------------------
+
+########################################################################
+##                            HISTORICAL                              ##
+########################################################################
+
+##
+## Password hashes
+##
+#attributetype ( 1.3.6.1.4.1.7165.2.1.1 NAME 'lmPassword'
+#	DESC 'LanManager Passwd'
+#	EQUALITY caseIgnoreIA5Match
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.2 NAME 'ntPassword'
+#	DESC 'NT Passwd'
+#	EQUALITY caseIgnoreIA5Match
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE )
+
+##
+## Account flags in string format ([UWDX     ])
+##
+#attributetype ( 1.3.6.1.4.1.7165.2.1.4 NAME 'acctFlags'
+#	DESC 'Account Flags'
+#	EQUALITY caseIgnoreIA5Match
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{16} SINGLE-VALUE )
+
+##
+## Password timestamps & policies
+##
+#attributetype ( 1.3.6.1.4.1.7165.2.1.3 NAME 'pwdLastSet'
+#	DESC 'NT pwdLastSet'
+#	EQUALITY integerMatch
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.5 NAME 'logonTime'
+#	DESC 'NT logonTime'
+#	EQUALITY integerMatch
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.6 NAME 'logoffTime'
+#	DESC 'NT logoffTime'
+#	EQUALITY integerMatch
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.7 NAME 'kickoffTime'
+#	DESC 'NT kickoffTime'
+#	EQUALITY integerMatch
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.8 NAME 'pwdCanChange'
+#	DESC 'NT pwdCanChange'
+#	EQUALITY integerMatch
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.9 NAME 'pwdMustChange'
+#	DESC 'NT pwdMustChange'
+#	EQUALITY integerMatch
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+##
+## string settings
+##
+#attributetype ( 1.3.6.1.4.1.7165.2.1.10 NAME 'homeDrive'
+#	DESC 'NT homeDrive'
+#	EQUALITY caseIgnoreIA5Match
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{4} SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.11 NAME 'scriptPath'
+#	DESC 'NT scriptPath'
+#	EQUALITY caseIgnoreIA5Match
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.12 NAME 'profilePath'
+#	DESC 'NT profilePath'
+#	EQUALITY caseIgnoreIA5Match
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.13 NAME 'userWorkstations'
+#	DESC 'userWorkstations'
+#	EQUALITY caseIgnoreIA5Match
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.17 NAME 'smbHome'
+#	DESC 'smbHome'
+#	EQUALITY caseIgnoreIA5Match
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128} )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.18 NAME 'domain'
+#	DESC 'Windows NT domain to which the user belongs'
+#	EQUALITY caseIgnoreIA5Match
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128} )
+
+##
+## user and group RID
+##
+#attributetype ( 1.3.6.1.4.1.7165.2.1.14 NAME 'rid'
+#	DESC 'NT rid'
+#	EQUALITY integerMatch
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+#attributetype ( 1.3.6.1.4.1.7165.2.1.15 NAME 'primaryGroupID'
+#	DESC 'NT Group RID'
+#	EQUALITY integerMatch
+#	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+##
+## The smbPasswordEntry objectclass has been depreciated in favor of the
+## sambaAccount objectclass
+##
+#objectclass ( 1.3.6.1.4.1.7165.2.2.1 NAME 'smbPasswordEntry' SUP top AUXILIARY
+#        DESC 'Samba smbpasswd entry'
+#        MUST ( uid $ uidNumber )
+#        MAY  ( lmPassword $ ntPassword $ pwdLastSet $ acctFlags ))
+
+#objectclass ( 1.3.6.1.4.1.7165.2.2.2 NAME 'sambaAccount' SUP top STRUCTURAL
+#	DESC 'Samba Account'
+#	MUST ( uid $ rid )
+#	MAY  ( cn $ lmPassword $ ntPassword $ pwdLastSet $ logonTime $
+#               logoffTime $ kickoffTime $ pwdCanChange $ pwdMustChange $ acctFlags $
+#               displayName $ smbHome $ homeDrive $ scriptPath $ profilePath $
+#               description $ userWorkstations $ primaryGroupID $ domain ))
+
+#objectclass ( 1.3.6.1.4.1.7165.2.2.3 NAME 'sambaAccount' SUP top AUXILIARY
+#	DESC 'Samba Auxiliary Account'
+#	MUST ( uid $ rid )
+#	MAY  ( cn $ lmPassword $ ntPassword $ pwdLastSet $ logonTime $
+#              logoffTime $ kickoffTime $ pwdCanChange $ pwdMustChange $ acctFlags $
+#              displayName $ smbHome $ homeDrive $ scriptPath $ profilePath $
+#              description $ userWorkstations $ primaryGroupID $ domain ))
+
+########################################################################
+##                        END OF HISTORICAL                           ##
+########################################################################
+
+#######################################################################
+##                Attributes used by Samba 3.0 schema                ##
+#######################################################################
+
+##
+## Password hashes
+##
+attributetype ( 1.3.6.1.4.1.7165.2.1.24 NAME 'sambaLMPassword'
+	DESC 'LanManager Password'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.25 NAME 'sambaNTPassword'
+	DESC 'MD4 hash of the unicode password'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE )
+
+##
+## Account flags in string format ([UWDX     ])
+##
+attributetype ( 1.3.6.1.4.1.7165.2.1.26 NAME 'sambaAcctFlags'
+	DESC 'Account Flags'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{16} SINGLE-VALUE )
+
+##
+## Password timestamps & policies
+##
+attributetype ( 1.3.6.1.4.1.7165.2.1.27 NAME 'sambaPwdLastSet'
+	DESC 'Timestamp of the last password update'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.28 NAME 'sambaPwdCanChange'
+	DESC 'Timestamp of when the user is allowed to update the password'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.29 NAME 'sambaPwdMustChange'
+	DESC 'Timestamp of when the password will expire'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.30 NAME 'sambaLogonTime'
+	DESC 'Timestamp of last logon'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.31 NAME 'sambaLogoffTime'
+	DESC 'Timestamp of last logoff'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.32 NAME 'sambaKickoffTime'
+	DESC 'Timestamp of when the user will be logged off automatically'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.48 NAME 'sambaBadPasswordCount'
+	DESC 'Bad password attempt count'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.49 NAME 'sambaBadPasswordTime'
+	DESC 'Time of the last bad password attempt'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.55 NAME 'sambaLogonHours'
+	DESC 'Logon Hours'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{42} SINGLE-VALUE )
+
+##
+## string settings
+##
+attributetype ( 1.3.6.1.4.1.7165.2.1.33 NAME 'sambaHomeDrive'
+	DESC 'Driver letter of home directory mapping'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{4} SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.34 NAME 'sambaLogonScript'
+	DESC 'Logon script path'
+	EQUALITY caseIgnoreMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.35 NAME 'sambaProfilePath'
+	DESC 'Roaming profile path'
+	EQUALITY caseIgnoreMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.36 NAME 'sambaUserWorkstations'
+	DESC 'List of user workstations the user is allowed to logon to'
+	EQUALITY caseIgnoreMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.37 NAME 'sambaHomePath'
+	DESC 'Home directory UNC path'
+	EQUALITY caseIgnoreMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.38 NAME 'sambaDomainName'
+	DESC 'Windows NT domain to which the user belongs'
+	EQUALITY caseIgnoreMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.47 NAME 'sambaMungedDial'
+	DESC ''
+	EQUALITY caseExactMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1050} )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.54 NAME 'sambaPasswordHistory'
+	DESC 'Concatenated MD4 hashes of the unicode passwords used on this account'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} )
+
+##
+## SID, of any type
+##
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.20 NAME 'sambaSID'
+	DESC 'Security ID'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} SINGLE-VALUE )
+
+
+##
+## Primary group SID, compatible with ntSid
+##
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.23 NAME 'sambaPrimaryGroupSID'
+	DESC 'Primary Group Security ID'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.51 NAME 'sambaSIDList'
+	DESC 'Security ID List'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} )
+
+##
+## group mapping attributes
+##
+attributetype ( 1.3.6.1.4.1.7165.2.1.19 NAME 'sambaGroupType'
+	DESC 'NT Group Type'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+##
+## Store info on the domain
+##
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.21 NAME 'sambaNextUserRid'
+	DESC 'Next NT rid to give our for users'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.22 NAME 'sambaNextGroupRid'
+	DESC 'Next NT rid to give out for groups'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.39 NAME 'sambaNextRid'
+	DESC 'Next NT rid to give out for anything'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.40 NAME 'sambaAlgorithmicRidBase'
+	DESC 'Base at which the samba RID generation algorithm should operate'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.41 NAME 'sambaShareName'
+	DESC 'Share Name'
+	EQUALITY caseIgnoreMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.42 NAME 'sambaOptionName'
+	DESC 'Option Name'
+	EQUALITY caseIgnoreMatch
+	SUBSTR caseIgnoreSubstringsMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.43 NAME 'sambaBoolOption'
+	DESC 'A boolean option'
+	EQUALITY booleanMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.44 NAME 'sambaIntegerOption'
+	DESC 'An integer option'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.45 NAME 'sambaStringOption'
+	DESC 'A string option'
+	EQUALITY caseExactIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.46 NAME 'sambaStringListOption'
+	DESC 'A string list option'
+	EQUALITY caseIgnoreMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
+
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.50 NAME 'sambaPrivName' 
+	SUP name )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.52 NAME 'sambaPrivilegeList'
+	DESC 'Privileges List'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} )
+
+attributetype ( 1.3.6.1.4.1.7165.2.1.53 NAME 'sambaTrustFlags'
+	DESC 'Trust Password Flags'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+
+#######################################################################
+##              objectClasses used by Samba 3.0 schema               ##
+#######################################################################
+
+## The X.500 data model (and therefore LDAPv3) says that each entry can
+## only have one structural objectclass.  OpenLDAP 2.0 does not enforce
+## this currently but will in v2.1
+
+##
+## added new objectclass (and OID) for 3.0 to help us deal with backwards
+## compatibility with 2.2 installations (e.g. ldapsam_compat)  --jerry
+##
+objectclass ( 1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' SUP top AUXILIARY
+	DESC 'Samba 3.0 Auxilary SAM Account'
+	MUST ( uid $ sambaSID )
+	MAY  ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $
+	       sambaLogonTime $ sambaLogoffTime $ sambaKickoffTime $
+	       sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $
+               displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $
+	       sambaProfilePath $ description $ sambaUserWorkstations $
+	       sambaPrimaryGroupSID $ sambaDomainName $ sambaMungedDial $
+	       sambaBadPasswordCount $ sambaBadPasswordTime $
+	       sambaPasswordHistory $ sambaLogonHours))
+
+##
+## Group mapping info
+##
+objectclass ( 1.3.6.1.4.1.7165.2.2.4 NAME 'sambaGroupMapping' SUP top AUXILIARY
+	DESC 'Samba Group Mapping'
+	MUST ( gidNumber $ sambaSID $ sambaGroupType )
+	MAY  ( displayName $ description $ sambaSIDList ))
+
+##
+## Trust password for trust relationships (any kind)
+##
+objectclass ( 1.3.6.1.4.1.7165.2.2.14 NAME 'sambaTrustPassword' SUP top STRUCTURAL
+	DESC 'Samba Trust Password'
+	MUST ( sambaDomainName $ sambaNTPassword $ sambaTrustFlags )
+	MAY ( sambaSID $ sambaPwdLastSet ))
+
+##
+## Whole-of-domain info
+##
+objectclass ( 1.3.6.1.4.1.7165.2.2.5 NAME 'sambaDomain' SUP top STRUCTURAL
+	DESC 'Samba Domain Information'
+	MUST ( sambaDomainName $ 
+	       sambaSID ) 
+	MAY ( sambaNextRid $ sambaNextGroupRid $ sambaNextUserRid $
+	      sambaAlgorithmicRidBase ) )
+
+##
+## used for idmap_ldap module
+##
+objectclass ( 1.3.6.1.4.1.7165.2.2.7 NAME 'sambaUnixIdPool' SUP top AUXILIARY
+        DESC 'Pool for allocating UNIX uids/gids'
+        MUST ( uidNumber $ gidNumber ) )
+
+
+objectclass ( 1.3.6.1.4.1.7165.2.2.8 NAME 'sambaIdmapEntry' SUP top AUXILIARY
+        DESC 'Mapping from a SID to an ID'
+        MUST ( sambaSID )
+	MAY ( uidNumber $ gidNumber ) )
+
+objectclass ( 1.3.6.1.4.1.7165.2.2.9 NAME 'sambaSidEntry' SUP top STRUCTURAL
+	DESC 'Structural Class for a SID'
+	MUST ( sambaSID ) )
+
+objectclass ( 1.3.6.1.4.1.7165.1.2.2.10 NAME 'sambaConfig' SUP top AUXILIARY
+	DESC 'Samba Configuration Section'
+	MAY ( description ) )
+
+objectclass ( 1.3.6.1.4.1.7165.2.2.11 NAME 'sambaShare' SUP top STRUCTURAL
+	DESC 'Samba Share Section'
+	MUST ( sambaShareName )
+	MAY ( description ) )
+
+objectclass ( 1.3.6.1.4.1.7165.2.2.12 NAME 'sambaConfigOption' SUP top STRUCTURAL
+	DESC 'Samba Configuration Option'
+	MUST ( sambaOptionName )
+	MAY ( sambaBoolOption $ sambaIntegerOption $ sambaStringOption $ 
+	      sambaStringListoption $ description ) )
+
+
+objectclass ( 1.3.6.1.4.1.7165.2.2.13 NAME 'sambaPrivilege' SUP top AUXILIARY
+	DESC 'Samba Privilege'
+	MUST ( sambaSID )
+	MAY ( sambaPrivilegeList ) )
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/config-3.3/smb.conf.example-samba3	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,478 @@
+# This is the main Samba configuration file. You should read the
+# smb.conf(5) manual page in order to understand the options listed
+# here. Samba has a huge number of configurable options (perhaps too
+# many!) most of which are not shown in this example
+#
+# For a step to step guide on installing, configuring and using samba,
+# read the Samba-HOWTO-Collection. This may be obtained from:
+#  http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
+#
+# Many working examples of smb.conf files can be found in the
+# Samba-Guide which is generated daily and can be downloaded from:
+#  http://www.samba.org/samba/docs/Samba-Guide.pdf
+#
+# Any line which starts with a ; (semi-colon) or a # (hash) 
+# is a comment and is ignored. In this example we will use a #
+# for commentry and a ; for parts of the config file that you
+# may wish to enable
+#
+# NOTE: Whenever you modify this file you should run the command "testparm"
+# to check that you have not made any basic syntactic errors. 
+#
+#======================= Global Settings =====================================
+[global]
+
+# 1. Server Naming Options:
+# workgroup = NT-Domain-Name or Workgroup-Name
+   workgroup = MYGROUP
+
+# netbios name is the name you will see in "Network Neighbourhood",
+# but defaults to your hostname
+;  netbios name = <name_of_this_server>
+
+# server string is the equivalent of the NT Description field
+   server string = Samba Server %v
+
+# 2. Printing Options:
+# CHANGES TO ENABLE PRINTING ON ALL CUPS PRINTERS IN THE NETWORK
+# if you want to automatically load your printer list rather
+# than setting them up individually then you'll need this
+   printcap name = cups
+   load printers = yes
+
+# It should not be necessary to spell out the print system type unless
+# yours is non-standard. Currently supported print systems include:
+# bsd, sysv, plp, lprng, aix, hpux, qnx, cups
+   printing = cups
+
+# 3. Logging Options:
+# this tells Samba to use a separate log file for each machine
+# that connects
+   log file = /var/log/samba/log.%m
+
+# Put a capping on the size of the log files (in Kb).
+   max log size = 50
+
+# Set the log (verbosity) level (0 <= log level <= 10)
+; log level = 3
+
+# 4. Security and Domain Membership Options:
+# This option is important for security. It allows you to restrict
+# connections to machines which are on your local network. The
+# following example restricts access to two C class networks and
+# the "loopback" interface. For more examples of the syntax see
+# the smb.conf man page. Do not enable this if (tcp/ip) name resolution does
+# not work for all the hosts in your network.
+;   hosts allow = 192.168.1. 192.168.2. 127.
+
+# Uncomment this if you want a guest account, you must add this to /etc/passwd
+# otherwise the user "nobody" is used
+;  guest account = pcguest
+# Allow users to map to guest:
+  map to guest = bad user
+
+# Security mode. Most people will want user level security. See
+# security_level.txt for details.
+   security = user
+# Use password server option only with security = server or security = domain
+# When using security = domain, you should use password server = *
+;   password server = <NT-Server-Name>
+;   password server = *
+
+# Password Level allows matching of _n_ characters of the password for
+# all combinations of upper and lower case.
+;  password level = 8
+;  username level = 8
+
+# You may wish to use password encryption. Please read
+# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
+# Do not enable this option unless you have read those documents
+# Encrypted passwords are required for any use of samba in a Windows NT domain
+# The smbpasswd file is only required by a server doing authentication, thus
+# members of a domain do not need one.
+  encrypt passwords = yes
+
+# The following are needed to allow password changing from Windows to
+# also update the Linux system password.
+# NOTE: Use these with 'encrypt passwords' and 'smb passwd file' above.
+# NOTE2: You do NOT need these to allow workstations to change only
+#        the encrypted SMB passwords. They allow the Unix password
+#        to be kept in sync with the SMB password.
+;  unix password sync = Yes
+# You either need to setup a passwd program and passwd chat, or
+# enable pam password change
+;  pam password change = yes
+;  passwd program = /usr/bin/passwd %u
+;  passwd chat = *New*UNIX*password* %n\n *Re*ype*new*UNIX*password* %n\n \
+;*passwd:*all*authentication*tokens*updated*successfully*
+
+# Unix users can map to different SMB User names
+;  username map = /etc/samba/smbusers
+
+# Using the following line enables you to customise your configuration
+# on a per machine basis. The %m gets replaced with the netbios name
+# of the machine that is connecting
+;   include = /etc/samba/smb.conf.%m
+
+# Options for using winbind. Winbind allows you to do all account and
+# authentication from a Windows or samba domain controller, creating
+# accounts on the fly, and maintaining a mapping of Windows RIDs to unix uid's 
+# and gid's. idmap uid and idmap gid are the only required parameters.
+#
+# winbind separator is the character a user must use between their domain
+# name and username, defaults to "\"
+;  winbind separator = +
+#
+# winbind use default domain allows you to have winbind return usernames
+# in the form user instead of DOMAIN+user for the domain listed in the
+# workgroup parameter.
+;  winbind use default domain = yes
+#
+# template homedir determines the home directory for winbind users, with 
+# %D expanding to their domain name and %U expanding to their username:
+;  template homedir = /home/%D/%U
+
+# When using winbind, you may want to have samba create home directories
+# on the fly for authenticated users. Ensure that /etc/pam.d/samba is
+# using 'service=system-auth-winbind' in pam_stack modules, and then
+# enable obedience of pam restrictions below:
+;  obey pam restrictions = yes
+
+#
+# template shell determines the shell users authenticated by winbind get
+;  template shell = /bin/bash
+
+# 5. Browser Control and Networking Options:
+# Most people will find that this option gives better performance.
+# See speed.txt and the manual pages for details
+   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
+
+# Configure Samba to use multiple interfaces
+# If you have multiple network interfaces then you must list them
+# here. See the man page for details.
+;   interfaces = 192.168.12.2/24 192.168.13.2/24 
+
+# Configure remote browse list synchronisation here
+#  request announcement to, or browse list sync from:
+#       a specific host or from / to a whole subnet (see below)
+;   remote browse sync = 192.168.3.25 192.168.5.255
+# Cause this host to announce itself to local subnets here
+;   remote announce = 192.168.1.255 192.168.2.44
+
+# set local master to no if you don't want Samba to become a master
+# browser on your network. Otherwise the normal election rules apply
+;   local master = no
+
+# OS Level determines the precedence of this server in master browser
+# elections. The default value should be reasonable
+;   os level = 33
+
+# Domain Master specifies Samba to be the Domain Master Browser. This
+# allows Samba to collate browse lists between subnets. Don't use this
+# if you already have a Windows NT domain controller doing this job
+;   domain master = yes 
+
+# Preferred Master causes Samba to force a local browser election on startup
+# and gives it a slightly higher chance of winning the election
+;   preferred master = yes
+
+# 6. Domain Control Options:
+# Enable this if you want Samba to be a domain logon server for 
+# Windows95 workstations or Primary Domain Controller for WinNT and Win2k
+;   domain logons = yes
+
+# if you enable domain logons then you may want a per-machine or
+# per user logon script
+# run a specific logon batch file per workstation (machine)
+;   logon script = %m.bat
+# run a specific logon batch file per username
+;   logon script = %U.bat
+
+# Where to store roaming profiles for WinNT and Win2k
+#        %L substitutes for this servers netbios name, %U is username
+#        You must uncomment the [Profiles] share below
+;   logon path = \\%L\Profiles\%U
+
+# Where to store roaming profiles for Win9x. Be careful with this as it also
+# impacts where Win2k finds it's /HOME share
+; logon home = \\%L\%U\.profile
+
+
+# The add user script is used by a domain member to add local user accounts
+# that have been authenticated by the domain controller, or when adding
+# users via the Windows NT Tools (ie User Manager for Domains).
+
+# Scripts for file (passwd, smbpasswd) backend:
+; add user script = /usr/sbin/useradd -s /bin/false '%u'
+; delete user script = /usr/sbin/userdel '%s'
+; add user to group script = /usr/bin/gpasswd -a '%u' '%g'
+; delete user from group script = /usr/bin/gpasswd -d '%u' '%g'
+; set primary group script = /usr/sbin/usermod -g '%g' '%u'
+; add group script = /usr/sbin/groupadd %g && getent group '%g'|awk -F: '{print $3}'
+; delete group script = /usr/sbin/groupdel '%g'
+
+# Scripts for LDAP backend (assumes nss_ldap is in use on the domain controller.
+# Needs IDEALX scripts, and configuration in smbldap_conf.pm.
+# This assumes you've installed the IDEALX scripts into /usr/share/samba/scripts...
+; add user script = /usr/share/samba/scripts/smbldap-useradd.pl '%u'
+; delete user script = /usr/share/samba/scripts/smbldap-userdel.pl '%u'
+; add user to group script = /usr/share/samba/scripts/smbldap-groupmod.pl -m '%u' '%g'
+; delete user from group script = /usr/share/samba/scripts/smbldap-groupmod.pl -x '%u' '%g'
+; set primary group script = /usr/share/samba/scripts/smbldap-usermod.pl -g '%g' '%u'
+; add group script = /usr/share/samba/scripts/smbldap-groupadd.pl '%g' && /usr/share/samba/scripts/smbldap-groupshow.pl %g|awk '/^gidNumber:/ {print $2}'
+; delete group script = /usr/share/samba/scripts/smbldap-userdel.pl '%g'
+
+
+# The add machine script is use by a samba server configured as a domain
+# controller to add local machine accounts when adding machines to the domain.
+# The script must work from the command line when replacing the macros,
+# or the operation will fail. Check that groups exist if forcing a group.
+# Script for domain controller for adding machines:
+; add machine script = /usr/sbin/useradd -d /dev/null -g machines -c 'Machine Account' -s /bin/false '%u'
+# Script for domain controller with LDAP backend for adding machines (You need
+# the IDEALX scripts, and to configure the smbldap_conf.pm first):
+; add machine script = /usr/share/samba/scripts/smbldap-useradd.pl -w -d /dev/null -g machines -c 'Machine Account' -s /bin/false '%u'
+
+# Domain groups:
+# Domain groups are now configured by using the 'net groupmap' tool
+
+# Samba Password Database configuration:
+# Samba now has runtime-configurable password database backends.
+# smbpasswd is for backwards compatibility only Default (not recommended),
+# new installations should use tdbsam or ldap.
+; passdb backend = smbpasswd
+# TDB backend 
+; passdb backend = tdbsam
+# LDAP with fallback to smbpasswd guest
+# Enable SSL by using an ldaps url, or enable tls with 'ldap ssl' below.
+; passdb backend = ldapsam:ldaps://ldap.mydomain.com
+# Use the samba2 LDAP schema:
+; passdb backend = ldapsam_compat:ldaps://ldap.mydomain.com
+
+# idmap uid account range:
+# This is a range of unix user-id's that samba will map non-unix RIDs to,
+# such as when using Winbind
+; idmap uid = 10000-20000
+; idmap gid = 10000-20000
+  
+# LDAP configuration for Domain Controlling:
+# The account (dn) that samba uses to access the LDAP server
+# This account needs to have write access to the LDAP tree
+# You will need to give samba the password for this dn, by 
+# running 'smbpasswd -w mypassword'
+; ldap admin dn = cn=root,dc=mydomain,dc=com
+; ldap ssl = start_tls
+# start_tls should run on 389, but samba defaults incorrectly to 636
+; ldap port = 389
+; ldap suffix = dc=mydomain,dc=com
+; ldap server = ldap.mydomain.com
+# Seperate suffixes are available for machines, users, groups, and idmap, if 
+# ldap suffix appears first, it is appended to the specific suffix.
+# Example for a unix-ish directory layout:
+; ldap machine suffix = ou=Hosts
+; ldap user suffix = ou=People
+; ldap group suffix = ou=Group
+; ldap idmap suffix = ou=Idmap
+# Example for AD-ish layout:
+; ldap machine suffix = cn=Computers
+; ldap user suffix = cn=Users
+; ldap group suffix = cn=Groups
+; ldap idmap suffix = cn=Idmap
+
+
+# 7. Name Resolution Options:
+# All NetBIOS names must be resolved to IP Addresses
+# 'Name Resolve Order' allows the named resolution mechanism to be specified
+# the default order is "host lmhosts wins bcast". "host" means use the unix
+# system gethostbyname() function call that will use either /etc/hosts OR
+# DNS or NIS depending on the settings of /etc/host.config, /etc/nsswitch.conf
+# and the /etc/resolv.conf file. "host" therefore is system configuration
+# dependant. This parameter is most often of use to prevent DNS lookups
+# in order to resolve NetBIOS names to IP Addresses. Use with care!
+# The example below excludes use of name resolution for machines that are NOT
+# on the local network segment
+# - OR - are not deliberately to be known via lmhosts or via WINS.
+; name resolve order = wins host lmhosts bcast
+
+# Windows Internet Name Serving Support Section:
+# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
+;   wins support = yes
+
+# WINS Server - Tells the NMBD components of Samba to be a WINS Client
+#       Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
+;   wins server = w.x.y.z
+
+# WINS Proxy - Tells Samba to answer name resolution queries on
+# behalf of a non WINS capable client, for this to work there must be
+# at least one  WINS Server on the network. The default is NO.
+;   wins proxy = yes
+
+# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
+# via DNS nslookups. The built-in default for versions 1.9.17 is yes,
+# this has been changed in version 1.9.18 to no.
+   dns proxy = no 
+
+# 8. File Naming Options:
+# Case Preservation can be handy - system default is _no_
+# NOTE: These can be set on a per share basis
+;  preserve case = no
+;  short preserve case = no
+# Default case is normally upper case for all DOS files
+;  default case = lower
+# Be very careful with case sensitivity - it can break things!
+;  case sensitive = no
+
+# Enabling internationalization:
+# you can match a Windows code page with a UNIX character set.
+# Windows: 437 (US), 737 (GREEK), 850 (Latin1 - Western European),
+# 852 (Czech), 861 (???), 932 (Japanese),
+# 936 (Simplified Chin.), 949 (Korean Hangul),
+# 950 (Trad. Chin.).
+# More detail about code page is in
+# "http://www.microsoft.com/globaldev/reference/oslocversion.mspx"
+# UNIX: ISO8859-1 (Western European), ISO8859-2 (Eastern Eu.),
+# ISO8859-5 (Russian Cyrillic), KOI8-R (Alt-Russ. Cyril.)
+# This is an example for french users:
+;   dos charset = 850
+;   unix charset = ISO8859-1
+
+
+#============================ Share Definitions ==============================
+[homes]
+   comment = Home Directories
+   browseable = no
+   writable = yes
+# You can enable VFS recycle bin on a per share basis:
+# Uncomment the next 2 lines (make sure you create a
+# .recycle folder in the base of the share and ensure
+# all users will have write access to it. See
+# examples/VFS/recycle/REAME in the samba docs for details
+;   vfs object = /usr/lib/samba/vfs/recycle.so
+
+# Un-comment the following and create the netlogon directory for Domain Logons
+; [netlogon]
+;   comment = Network Logon Service
+;   path = /var/lib/samba/netlogon
+;   guest ok = yes
+;   writable = no
+
+# Un-comment the following to provide a specific roving profile share
+# the default is to use the user's home directory
+;[Profiles]
+;    path = /var/lib/samba/profiles
+;    browseable = no
+;    guest ok = yes
+# This script can be enabled to create profile directories on the fly
+# You may want to turn off guest acces if you enable this, as it
+# hasn't been thoroughly tested.
+;root preexec = PROFILE=/var/lib/samba/profiles/%u; if [ ! -e $PROFILE ]; \
+;                then mkdir -pm700 $PROFILE; chown %u:%g $PROFILE;fi
+
+# NOTE: If you have a CUPS print system there is no need to 
+# specifically define each individual printer.
+# You must configure the samba printers with the appropriate Windows
+# drivers on your Windows clients. On the Samba server no filtering is
+# done. If you wish that the server provides the driver and the clients
+# send PostScript ("Generic PostScript Printer" under Windows), you have
+# to swap the 'print command' line below with the commented one.
+[printers]
+   comment = All Printers
+   path = /var/spool/samba
+   browseable = no
+# set to yes to allow user 'guest account' to print.
+   guest ok = no
+   writable = no
+   printable = yes
+
+# This share is used for Windows NT-style point-and-print support.
+# To be able to install drivers, you need to be either root, or listed
+# in the printer admin parameter above. Note that you also need write access
+# to the directory and share definition to be able to upload the drivers.
+# For more information on this, please see the Printing Support Section of
+# /usr/share/doc/samba-<version>/Samba-HOWTO-Collection.pdf 
+[print$]
+   path = /var/lib/samba/printers
+   browseable = yes
+   read only = yes
+   write list = @adm root
+   guest ok = yes
+
+# This one is useful for people to share files
+;[tmp]
+;   comment = Temporary file space
+;   path = /tmp
+;   read only = no
+;   public = yes
+
+# A publicly accessible directory, but read only, except for people in
+# the "staff" group
+;[public]
+;   comment = Public Stuff
+;   path = /home/samba/public
+;   public = yes
+;   writable = no
+;   write list = @staff
+# Audited directory through experimental VFS audit.so module:
+# Uncomment next line.
+;   vfs object = /usr/lib/samba/vfs/audit.so
+
+# Other examples. 
+#
+# A private printer, usable only by Fred. Spool data will be placed in Fred's
+# home directory. Note that fred must have write access to the spool directory,
+# wherever it is.
+;[fredsprn]
+;   comment = Fred's Printer
+;   valid users = fred
+;   path = /homes/fred
+;   printer = freds_printer
+;   public = no
+;   writable = no
+;   printable = yes
+
+# A private directory, usable only by Fred. Note that Fred requires write
+# access to the directory.
+;[fredsdir]
+;   comment = Fred's Service
+;   path = /usr/somewhere/private
+;   valid users = fred
+;   public = no
+;   writable = yes
+;   printable = no
+
+# a service which has a different directory for each machine that connects
+# this allows you to tailor configurations to incoming machines. You could
+# also use the %u option to tailor it by user name.
+# The %m gets replaced with the machine name that is connecting.
+;[pchome]
+;  comment = PC Directories
+;  path = /usr/pc/%m
+;  public = no
+;  writable = yes
+
+# A publicly accessible directory, read/write to all users. Note that all files
+# created in the directory by users will be owned by the default user, so
+# any user with access can delete any other user's files. Obviously this
+# directory must be writable by the default user. Another user could of course
+# be specified, in which case all files would be owned by that user instead.
+;[public]
+;   path = /usr/somewhere/else/public
+;   public = yes
+;   only guest = yes
+;   writable = yes
+;   printable = no
+
+# The following two entries demonstrate how to share a directory so that two
+# users can place files there that will be owned by the specific users. In this
+# setup, the directory should be writable by both users and should have the
+# sticky bit set on it to prevent abuse. Obviously this could be extended to
+# as many users as required.
+;[myshare]
+;   comment = Mary's and Fred's stuff
+;   path = /usr/somewhere/shared
+;   valid users = mary fred
+;   public = no
+;   writable = yes
+;   printable = no
+;   create mask = 0765
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/config-3.3/smbusers	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,4 @@
+# Unix_name = SMB_name1 SMB_name2 ...
+# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/config-3.2/smbusers,v 1.1 2008/03/08 12:24:12 dev-zero Exp $
+root = administrator admin
+nobody = guest pcguest smbguest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/config-3.3/swat.xinetd	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,17 @@
+# default: off
+# description: SWAT is the Samba Web Admin Tool. Use swat \
+#	       to configure your Samba server. To use SWAT, \
+#	       connect to port 901 with your favorite web browser.
+# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/config-3.2/swat.xinetd,v 1.1 2008/03/08 12:24:12 dev-zero Exp $
+
+service swat
+{
+	port            = 901
+	socket_type     = stream
+	wait            = no
+	only_from       = localhost
+	user            = root
+	server          = /usr/sbin/swat
+	log_on_failure += USERID
+	disable         = yes
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/config-3.3/system-auth-winbind	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,18 @@
+#%PAM-1.0
+# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/config-3.2/system-auth-winbind,v 1.1 2008/03/08 12:24:12 dev-zero Exp $
+
+auth        required      pam_env.so
+auth        sufficient    pam_winbind.so
+auth        sufficient    pam_unix.so likeauth nullok use_first_pass
+auth        required      pam_deny.so
+
+account     sufficient    pam_winbind.so
+account     required      pam_unix.so
+
+password    required      pam_cracklib.so retry=3
+password    sufficient    pam_unix.so nullok use_authtok md5 shadow
+password    required      pam_deny.so
+
+session     required      pam_mkhomedir.so skel=/etc/skel/ umask=0022 
+session     required      pam_limits.so
+session     required      pam_unix.so
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/samba-conf	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,28 @@
+#add "winbind" to the daemon_list if you also want winbind to start
+daemon_list="smbd nmbd"
+
+#----------------------------------------------------------------------------
+# Daemons calls: <daemon_name>_<command_option>
+#----------------------------------------------------------------------------
+my_service_name="samba"
+my_service_PRE="unset TMP TMPDIR"
+my_service_POST=""
+
+#----------------------------------------------------------------------------
+# Daemons calls: <daemon_name>_<command_option>
+#----------------------------------------------------------------------------
+smbd_start_options="-D"
+smbd_start="start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- ${smbd_start_options}"
+smbd_stop="start-stop-daemon --stop --quiet --pidfile /var/run/samba/smbd.pid"
+smbd_reload="killall -HUP smbd"
+
+nmbd_start_options="-D"
+nmbd_start="start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- ${nmbd_start_options}"
+nmbd_stop="start-stop-daemon --stop --quiet --pidfile /var/run/samba/nmbd.pid"
+nmbd_reload="killall -HUP nmbd"
+
+winbind_start_options=""
+winbind_start="start-stop-daemon --start --quiet --exec /usr/sbin/winbindd -- ${winbind_start_options}"
+winbind_stop="start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/winbindd"
+winbind_reload="killall -HUP winbindd"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/samba-init	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,53 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/samba-init,v 1.17 2007/09/11 22:55:08 uberlord Exp $
+
+opts="reload"
+
+depend() {
+	after slapd
+	need net
+	use cupsd
+}
+
+DAEMONNAME="${SVCNAME##samba.}"
+[ "${DAEMONNAME}" != "samba" ] && daemon_list=${DAEMONNAME}
+
+signal_do() {
+	local signal="$1"
+	[ -z "${signal}" ] && return 0
+
+	local result=0 last_result=0 daemon= cmd_exec=
+	for daemon in ${daemon_list} ; do
+		eval cmd_exec=\$${daemon}_${signal}
+		if [ -n "${cmd_exec}" ]; then
+			ebegin "${my_service_name} -> ${signal}: ${daemon}"
+			#echo ${cmd} '->' ${!cmd}
+			${cmd_exec} > /dev/null
+			last_result=$?
+			eend ${last_result}
+		fi
+		result=$(( ${result} + ${last_result} ))
+	done
+	return ${result}
+}
+start() {
+	${my_service_PRE}
+	signal_do start && return 0
+	
+	eerror "Error: starting services (see system logs)"
+	signal_do stop
+	return 1
+}
+stop() {
+	${my_service_PRE}
+	if signal_do stop ; then
+	    ${my_service_POST}
+	    return 0
+	fi
+}
+reload() {
+	${my_service_PRE}
+	signal_do reload
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/files/samba-xinetd	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,12 @@
+# Samba smb service with ipv6 support (for samba3)
+# Remember to stop samba service starting smbd before you activate this.
+service microsoft-ds
+{
+	flags		= REUSE IPV6
+	socket_type	= stream
+	wait		= no
+	user		= root
+	server		= /usr/sbin/smbd
+	log_on_failure	+= USERID
+	disable		= yes
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/metadata.xml	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>samba</herd>
+<maintainer>
+	<email>samba@gentoo.org</email>
+	<name>Samba Team</name>
+</maintainer>
+<longdescription>
+Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients. Integration with various accounting and antivirus backends. License: GNU General Public License.
+</longdescription>
+<use>
+	<flag name="ads">Enable Active Directory support</flag>
+	<flag name="async">Enables asynchronous input/output</flag>
+	<flag name="automount">Enables automount support</flag>
+	<flag name="oav">Enables support for the OpenAntiVirus plugins</flag>
+	<flag name="quotas">Enables support for user quotas</flag>
+	<flag name="swat">Enables support for swat configuration gui</flag>
+	<flag name="winbind">Enables support for the winbind auth daemon</flag>
+</use>
+</pkgmetadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-fs/samba/samba-3.3.1.ebuild	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,270 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/samba-3.2.0_rc2.ebuild,v 1.1 2008/06/12 12:10:25 dev-zero Exp $
+
+inherit eutils pam multilib versionator confutils
+
+MY_P=${PN}-${PV/_/}
+
+DESCRIPTION="A suite of SMB and CIFS client/server programs for UNIX"
+HOMEPAGE="http://www.samba.org/"
+SRC_URI="mirror://samba/${MY_P}.tar.gz"
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE_LINGUAS="linguas_ja linguas_pl"
+IUSE="${IUSE_LINGUAS} acl ads async automount caps cups doc examples ipv6 kernel_linux ldap fam
+	pam quotas readline selinux swat syslog winbind"
+
+RDEPEND="dev-libs/popt
+	dev-libs/iniparser
+	virtual/libiconv
+	acl? ( kernel_linux? ( sys-apps/acl ) )
+	cups? ( net-print/cups )
+	ipv6? ( sys-apps/xinetd )
+	ads? ( virtual/krb5 sys-fs/e2fsprogs )
+	ldap? ( net-nds/openldap )
+	pam? ( virtual/pam )
+	readline? ( sys-libs/readline )
+	selinux? ( sec-policy/selinux-samba )
+	swat? ( sys-apps/xinetd )
+	syslog? ( virtual/logger )
+	fam? ( virtual/fam )
+	caps? ( sys-libs/libcap )"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+CONFDIR="${FILESDIR}/config-3.3"
+PRIVATE_DST=/var/lib/samba/private
+
+# Tests are currently broken due to hardcoded paths (due to --with-fhs)
+# The problem is that --without-fhs lets samba use lockdir (which can be changed in smb.conf)
+# which is wrong as well.
+RESTRICT="test"
+
+pkg_setup() {
+	confutils_use_depend_all ads ldap
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}/source"
+
+	# Ok, agreed, this is ugly. But it avoids a patch we
+	# need for every samba version and we don't need autotools
+	sed -i \
+		-e 's|"lib32" ||' \
+		-e 's|if test -d "$i/$l" ;|if test -d "$i/$l" -o -L "$i/$l";|' \
+		configure || die "sed failed"
+
+	rm "${S}/docs/manpages"/{mount,umount}.cifs.8
+
+	sed -i \
+		-e 's|tdbsam|tdbsam:${PRIVATEDIR}/passdb.tdb|' \
+		"${S}/source/script/tests/selftest.sh" || die "sed failed"
+}
+
+src_compile() {
+	cd "${S}/source"
+
+	local myconf
+	local mylangs
+	local mymod_shared
+
+	mylangs="--with-manpages-langs=en"
+	use linguas_ja && mylangs="${mylangs},ja"
+	use linguas_pl && mylangs="${mylangs},pl"
+
+	use winbind && mymod_shared="--with-shared-modules=idmap_rid"
+	if use ldap ; then
+		myconf="${myconf} $(use_with ads)"
+		use winbind && mymod_shared="${mymod_shared},idmap_ad"
+	fi
+
+	[[ ${CHOST} == *-*bsd* ]] && myconf="${myconf} --disable-pie"
+	use hppa && myconf="${myconf} --disable-pie"
+
+	use caps && export ac_cv_header_sys_capability_h=yes || export ac_cv_header_sys_capability_h=no
+
+	# Otherwise we get the whole swat stuff installed
+	if ! use swat ; then
+		sed -i \
+			-e 's/^\(install:.*\)installswat \(.*\)/\1\2/' \
+			Makefile.in || die "sed failed"
+	fi
+
+	econf \
+		--with-fhs \
+		--sysconfdir=/etc/samba \
+		--localstatedir=/var \
+		--with-configdir=/etc/samba \
+		--with-libdir=/usr/$(get_libdir)/samba \
+		--with-pammodulesdir=$(getpam_mod_dir) \
+		--with-swatdir=/usr/share/doc/${PF}/swat \
+		--with-piddir=/var/run/samba \
+		--with-lockdir=/var/cache/samba \
+		--with-logfilebase=/var/log/samba \
+		--with-privatedir=${PRIVATE_DST} \
+		--with-libsmbclient \
+		--without-spinlocks \
+		--enable-socket-wrapper \
+		--enable-nss-wrapper \
+		--with-cifsmount=no \
+		$(use_with acl acl-support) \
+		$(use_with async aio-support) \
+		$(use_with automount) \
+		$(use_enable cups) \
+		$(use_enable fam) \
+		$(use_with ads krb5) \
+		$(use_with ads dnsupdate) \
+		$(use_with ldap) \
+		$(use_with pam) $(use_with pam pam_smbpass) \
+		$(use_with quotas) $(use_with quotas sys-quotas) \
+		$(use_with readline) \
+		$(use_with syslog) \
+		$(use_with winbind) \
+		${myconf} ${mylangs} ${mymod_shared} || die "econf failed"
+
+	emake proto || die "emake proto failed"
+	emake everything || die "emake everything failed"
+
+}
+
+src_test() {
+	cd "${S}/source"
+	emake test || die "tests failed"
+}
+
+src_install() {
+	cd "${S}/source"
+
+	emake DESTDIR="${D}" install-everything || die "emake install-everything failed"
+
+	# Extra rpctorture progs
+	local extra_bins="rpctorture"
+	for i in ${extra_bins} ; do
+		[[ -x "${S}/bin/${i}" ]] && dobin "${S}/bin/${i}"
+	done
+
+	# remove .old stuff from /usr/bin:
+	rm -f "${D}"/usr/bin/*.old
+
+	# Removing executable bits from header-files
+	fperms 644 /usr/include/libsmbclient.h
+
+	# Nsswitch extensions. Make link for wins and winbind resolvers
+	if use winbind ; then
+		dolib.so nsswitch/libnss_wins.so
+		dosym libnss_wins.so /usr/$(get_libdir)/libnss_wins.so.2
+		dolib.so nsswitch/libnss_winbind.so
+		dosym libnss_winbind.so /usr/$(get_libdir)/libnss_winbind.so.2
+	fi
+
+	# make the smb backend symlink for cups printing support (bug #133133)
+	if use cups ; then
+		dodir $(cups-config --serverbin)/backend
+		dosym /usr/bin/smbspool $(cups-config --serverbin)/backend/smb
+	fi
+
+	cd "${S}/source"
+
+	# General config files
+	insinto /etc/samba
+	doins "${CONFDIR}"/{smbusers,lmhosts}
+	newins "${CONFDIR}/smb.conf.example-samba3" smb.conf.example
+
+	newpamd "${CONFDIR}/samba.pam" samba
+	use winbind && dopamd "${CONFDIR}/system-auth-winbind"
+	if use swat ; then
+		insinto /etc/xinetd.d
+		newins "${CONFDIR}/swat.xinetd" swat
+	else
+		rm -f "${D}/usr/sbin/swat"
+		rm -f "${D}/usr/share/man/man8/swat.8"
+	fi
+
+	newinitd "${FILESDIR}/samba-init" samba
+	newconfd "${FILESDIR}/samba-conf" samba
+
+	if use ldap ; then
+		insinto /etc/openldap/schema
+		doins "${S}/examples/LDAP/samba.schema"
+	fi
+
+	if use ipv6 ; then
+		insinto /etc/xinetd.d
+		newins "${FILESDIR}/samba-xinetd" smb
+	fi
+
+	# dirs
+	diropts -m0700 ; keepdir "${PRIVATE_DST}"
+	diropts -m1777 ; keepdir /var/spool/samba
+
+	diropts -m0755
+	keepdir /var/{log,run,cache}/samba
+	keepdir /var/lib/samba/{netlogon,profiles}
+	keepdir /var/lib/samba/printers/{W32X86,WIN40,W32ALPHA,W32MIPS,W32PPC,X64,IA64,COLOR}
+	keepdir /usr/$(get_libdir)/samba/{rpc,idmap,auth}
+
+	# docs
+	dodoc "${FILESDIR}/README.gentoo"
+	dodoc "${S}"/{MAINTAINERS,README,Roadmap,WHATSNEW.txt}
+	dodoc "${CONFDIR}/nsswitch.conf-wins"
+	use winbind && dodoc "${CONFDIR}/nsswitch.conf-winbind"
+
+	if use examples ; then
+		insinto /usr/share/doc/${PF}
+		doins -r "${S}/examples/"
+		find "${D}/usr/share/doc/${PF}" -type d -print0 | xargs -0 chmod 755
+		find "${D}/usr/share/doc/${PF}/examples" ! -type d -print0 | xargs -0 chmod 644
+	fi
+
+	if ! use doc ; then
+		if ! use swat ; then
+			rm -rf "${D}/usr/share/doc/${PF}/swat"
+		else
+			rm -rf "${D}/usr/share/doc/${PF}/swat/help"/{guide,howto,devel}
+			rm -rf "${D}/usr/share/doc/${PF}/swat/using_samba"
+		fi
+	fi
+
+}
+
+pkg_preinst() {
+	local PRIVATE_SRC=/etc/samba/private
+	if [[ ! -r "${ROOT}/${PRIVATE_DST}/secrets.tdb" \
+		&& -r "${ROOT}/${PRIVATE_SRC}/secrets.tdb" ]] ; then
+		ebegin "Copying ${ROOT}/${PRIVATE_SRC}/* to ${ROOT}/${PRIVATE_DST}/"
+			mkdir -p "${D}/${PRIVATE_DST}"
+			cp -pPRf "${ROOT}/${PRIVATE_SRC}"/* "${D}/${PRIVATE_DST}/"
+		eend $?
+	fi
+
+	if [[ ! -f "${ROOT}/etc/samba/smb.conf" ]] ; then
+		touch "${D}/etc/samba/smb.conf"
+	fi
+}
+
+pkg_postinst() {
+	if use swat ; then
+		einfo "swat must be enabled by xinetd:"
+		einfo "  change the /etc/xinetd.d/swat configuration"
+	fi
+
+	if use ipv6 ; then
+		einfo "ipv6 support must be enabled by xinetd:"
+		einfo "  change the /etc/xinetd.d/smb configuration"
+	fi
+
+	elog "It is possible to start/stop daemons separately:"
+	elog "  Create a symlink from /etc/init.d/samba.{smbd,nmbd,winbind} to"
+	elog "  /etc/init.d/samba. Calling /etc/init.d/samba directly will start"
+	elog "  the daemons configured in /etc/conf.d/samba"
+
+	elog "The mount/umount.cifs helper applications are not included anymore."
+	elog "Please install net-fs/mount-cifs instead."
+
+	ewarn "If you're upgrading from 3.0.24 or earlier, please make sure to"
+	ewarn "restart your clients to clear any cached information about the server."
+	ewarn "Otherwise they might not be able to connect to the volumes."
+}
--- a/net-misc/e1000/Manifest	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-DIST e1000-8.0.3.1.tar.gz 199029 RMD160 a07d3b52f80c8f7c6e3a0e8a20db38431822397f SHA1 6fef2b7f9636c70d003789593f8e211217264416 SHA256 0751afb6d5191eef568f44c0b57b6d39271df28b3f8ff1eecbc5d35373c00a59
-EBUILD e1000-8.0.3.1.ebuild 1378 RMD160 d36ce4380b793c12c5e15b1b994e53c3aca38fb4 SHA1 0a1df1551fca9cccff44672524b012dfa472cce6 SHA256 9c8e7d27e571b2ef41b840803c46a2e3f9068874054809fee2ff3795032c1ecd
--- a/net-misc/e1000/e1000-8.0.3.1.ebuild	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-# Copyright 1999-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-DESCRIPTION="Kernel driver for Intel Pro/1000 ethernet adapters."
-HOMEPAGE="http://support.intel.com/support/network/adapter/1000/index.htm"
-LICENSE="GPL-2"
-DEPEND="virtual/linux-sources"
-
-SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
-SLOT="0"
-KEYWORDS="x86"
-IUSE=""
-
-
-src_unpack() {
-    unpack ${A}
-    cd ${S}/src
-    # rem out the DEPVER line, since it would cause a sandbox violation and
-    # since it is only needed by RPM ;-)
-    sed -i "/^DEPVER :=/ d" Makefile
-}
-
-
-src_compile() {
-    check_KV
-    cd "${S}/src"
-
-    # workaround needed for some ethernet controllers to work with low end switches
-    if [[ ${USE_INCOMPATIBLE_SWITCH} ]]
-        then CFLAGS_EXTRA="CFLAGS_EXTRA=-DE_1000_MASTER_SLAVE=1"
-        else CFLAGS_EXTRA=""
-    fi
-
-    make ${CFLAGS_EXTRA} KSRC=/usr/src/linux
-}
-
-
-src_install() {
-    insinto "/lib/modules/${KV}/kernel/drivers/net/e1000"
-    doins "${S}/src/e1000.ko"
-    doman e1000.7
-    dodoc LICENSE README SUMS e1000.spec ldistrib.txt ${FILESDIR}/README.Gentoo
-    einfo ""
-    einfo "In case you have problems when loading the module, try to run depmod -A"
-    einfo ""
-    einfo "If you experience problems with low-end switches, read"
-    einfo "/usr/share/doc/${PF}/README.Gentoo.gz for a possible workaround"
-    einfo ""
-}
--- a/net-misc/e1000e/Manifest	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-DIST e1000e-0.4.1.7.tar.gz 200496 RMD160 e03441ffaa7bac2d0b7b0f1b0d8c8434641af935 SHA1 b919215aa566ff00e52425447a7ec43af6170ba8 SHA256 95bd9b275166ead953ebc828597433044ea708093ede6864ed2aac4b64a62175
-EBUILD e1000e-0.4.1.7.ebuild 1187 RMD160 39892b555fbfae0f5a921640b9f7a6672a5d269a SHA1 6c992484bb31def68606054e69fb9978f27cd220 SHA256 319fb813eef746f8263ff84df28529b67733afecfd97c5fbcac8fcf4eb713c14
--- a/net-misc/e1000e/e1000e-0.4.1.7.ebuild	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-# Copyright 1999-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-DESCRIPTION="Kernel driver for Intel Pro/1000 ethernet adapters."
-HOMEPAGE="http://support.intel.com/support/network/adapter/1000/index.htm"
-LICENSE="GPL-2"
-DEPEND="virtual/linux-sources"
-
-SRC_URI="mirror://sourceforge/e1000/${P}.tar.gz"
-SLOT="0"
-KEYWORDS="x86"
-IUSE=""
-
-
-src_unpack() {
-    unpack ${A}
-    cd ${S}/src
-    # rem out the DEPVER line, since it would cause a sandbox violation and
-    # since it is only needed by RPM ;-)
-    sed -i "/^DEPVER :=/ d" Makefile
-}
-
-
-src_compile() {
-    check_KV
-    cd "${S}/src"
-
-    # workaround needed for some ethernet controllers to work with low end switches
-    if [[ ${USE_INCOMPATIBLE_SWITCH} ]]
-        then CFLAGS_EXTRA="CFLAGS_EXTRA=-DE_1000_MASTER_SLAVE=1"
-        else CFLAGS_EXTRA=""
-    fi
-
-    make ${CFLAGS_EXTRA} KSRC=/usr/src/linux
-}
-
-
-src_install() {
-    insinto "/lib/modules/${KV}/kernel/drivers/net/e1000e"
-    doins "${S}/src/e1000e.ko"
-    doman e1000e.7
-    dodoc COPYING README SUMS e1000e.spec
-    einfo ""
-    einfo "In case you have problems when loading the module, try to run depmod -A"
-    einfo ""
-}
--- a/net-misc/rabbitmq-server/Manifest	Tue Feb 10 03:49:43 2009 +0100
+++ b/net-misc/rabbitmq-server/Manifest	Wed Mar 04 02:58:24 2009 +0100
@@ -1,2 +1,2 @@
-DIST rabbitmq-server-generic-unix-1.4.0.tar.gz 394991 RMD160 f3ced06ec6f8ced09a9e0f5c60f0b73954ea8634 SHA1 bea27fa2255324f13e343ed82c50e69c6983628a SHA256 642ffe9cdca8ac5bd030647d24d60cca388df20f1d6a5913c3a2ae036f75018e
-EBUILD rabbitmq-server-1.4.0.ebuild 1066 RMD160 98d1bc0fa46375677176adcd9bcc58c6eb032b60 SHA1 b4f135e52539a267c105cda6199207850ce9ed7c SHA256 15693e4118e305c5e0c8437db3dd1bdd0a427fe5e917e9f3e0a18606931561e4
+DIST rabbitmq-server-generic-unix-1.5.3.tar.gz 356427 RMD160 e1d200d55beccbd543378b3ed85f5bfd0d0791b1 SHA1 3b9819af6c689a31b114f36df2ce8ab51e9fb64a SHA256 08980363a52eccb3f4515ad0afd0b0ae3e3f64b28e3df0a0f7702c2979470ea4
+EBUILD rabbitmq-server-1.5.3.ebuild 1051 RMD160 35f9549863af11a127f096783a57dbc0ff3421eb SHA1 166b02e0a531303ce68d7c7b761374c27b831d8f SHA256 794bca4f2c1926e3913e69326e914a783d914816cd21f531b9c870b7ccfdd89f
--- a/net-misc/rabbitmq-server/rabbitmq-server-1.4.0.ebuild	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-inherit eutils
-
-DESCRIPTION="RabbitMQ is a high-performance AMQP-compliant message broker written in Erlang."
-HOMEPAGE="http://www.rabbitmq.com/" 
-SRC_URI="http://www.rabbitmq.com/releases/rabbitmq-server/v${PV}/rabbitmq-server-generic-unix-${PV}.tar.gz"
-LICENSE="MPL"
-SLOT="0" 
-KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
-IUSE=""
- 
-# Q: is RDEPEND-only sufficient for a binary package, since we don't compile?
-DEPEND="dev-lang/erlang"
-RDEPEND="${DEPEND}"
-
-# grr: the packaged directory contains an underscore
-S="${WORKDIR}/rabbitmq_server-${PV}"
-
-src_install() {
-	# the local erlang module directory
-	local targetdir="/usr/$(get_libdir)/erlang/lib/${P}"
-
-	# scripts
-	dosbin sbin/*
-
-	# erlang module
-	dodir "${targetdir}"
-	cp -dpR ebin include src "${D}/${targetdir}"
-
-	# docs
-	dodoc INSTALL LICENSE LICENSE-MPL-RabbitMQ
-
-	# TODO:
-	# config to set env vars as per INSTALL?
-	# set LOGDIR to /var/log/rabbitmq.log
-	# run as different user?
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-misc/rabbitmq-server/rabbitmq-server-1.5.3.ebuild	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,39 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="RabbitMQ is a high-performance AMQP-compliant message broker written in Erlang."
+HOMEPAGE="http://www.rabbitmq.com/" 
+SRC_URI="http://www.rabbitmq.com/releases/rabbitmq-server/v${PV}/rabbitmq-server-generic-unix-${PV}.tar.gz"
+LICENSE="MPL"
+SLOT="0" 
+KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
+ 
+# Q: is RDEPEND-only sufficient for a binary package, since we don't compile?
+DEPEND="dev-lang/erlang"
+RDEPEND="${DEPEND}"
+
+# grr: the packaged directory contains an underscore
+MODNAME="rabbitmq_server-${PV}"
+S="${WORKDIR}/${MODNAME}"
+
+src_install() {
+	# erlang module
+	local targetdir="/usr/$(get_libdir)/erlang/lib/${MODNAME}"
+	dodir "${targetdir}"
+	cp -dpR ebin include "${D}/${targetdir}"
+
+	# scripts
+	dosbin sbin/*
+
+	# docs
+	dodoc INSTALL LICENSE LICENSE-MPL-RabbitMQ
+
+	# TODO:
+	# config to set env vars as per INSTALL?
+	# set LOGDIR to /var/log/rabbitmq.log
+	# run as different user?
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-misc/zmq/Manifest	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,2 @@
+DIST zmq-0.4.tar.gz 482494 RMD160 7760d330fb8244b5bce80210dd284d10844ca44f SHA1 ddf97fe85dfc040a3e4ec751f0ce5a29b3f4aea1 SHA256 ca74a6779cd3fd9f3ee84f48e69e680588ee7dacf2bd65273a16952c78228c0d
+EBUILD zmq-0.4.ebuild 1042 RMD160 f9eae30c1f712baa77a8849fad3069692a33f00b SHA1 ddedbd9c7c2c46c0945ce6d88f6b77f69b9e14ca SHA256 353f16d6e58d6e183ee3b13861636db89b916e4cd7ebb6974542af14878dfdb0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-misc/zmq/zmq-0.4.ebuild	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,34 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="ZeroMQ is a brokerless messaging kernel with extremely high performance."
+HOMEPAGE="http://www.zeromq.org/"
+SRC_URI="http://www.zeromq.org/local--files/area:download/${P}.tar.gz"
+LICENSE="LGPL-3"
+SLOT="0"
+KEYWORDS="~x86"
+#IUSE="c examples java profile python"
+#DEPEND=""
+#RDEPEND="${DEPEND}"
+
+src_compile() {
+
+# TODO:
+#  --with-perf             build performance tests [default=no]
+#  --with-camera           build camera example [default=no]
+#  --with-exchange         build exchange example [default=no]
+#  --with-chat             build chatroom example [default=no]
+#  --with-c                build c language binding [default=no]
+#  --with-python           build Python language binding [default=no]
+#  --with-java             build Java language binding [default=no]
+
+	econf \
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
--- a/sys-block/noflushd/Manifest	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-AUX noflushd-2.7.4-SCSI.patch 420 RMD160 dfa4bda2d4cf83eb9e50d92b2b641a38c2f6b3ca SHA1 49d680916160cc1258531e3bbe3469da49a88d0d SHA256 89a80449b3123874732ec9a0b2f315fe26b98b673882256c76cd0e3d882520ec
-AUX noflushd.confd 356 RMD160 254e729eeef41c07805f145abe1a8f4831928513 SHA1 15ed3819b8ac677e9fa637d2fd65179b2833ae72 SHA256 373605b32c82970239c694fae3e698a079834090f59b7255b984de4c07671cd7
-AUX noflushd.rc6 776 RMD160 d3012b284160d61b5f446a967b997e65963b279b SHA1 35b4dbd0d46ede89474a25824b9140f17a02dfe9 SHA256 de5c4ca015cb23826742f55d56c1cba4b4a9d019405abec50ff49de95c1a5a18
-DIST noflushd-2.7.4.tar.gz 149686 RMD160 c009cb8d288e482e5b516f135a168315cfc799e7 SHA1 32cbb38def18c68329b5451e53f7e25816b77ca3 SHA256 4118451009808ba18bc773b872ac43f1e4244a09d39126210860f846248e2360
-EBUILD noflushd-2.7.4.ebuild 1399 RMD160 cc7d2ce317d1e2f07a9d7fb81b20bc6b03c35768 SHA1 2281b0a07a489c09f7123b8db5459a7fa45d7904 SHA256 7d82c07a0fe9255d674de7dccad1a2273b768c24aa4f19d3d4d30d1b2dd6a8fb
--- a/sys-block/noflushd/files/noflushd-2.7.4-SCSI.patch	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- noflushd-2.7.4/src/spindown.c	2004-02-27 14:41:05.000000000 +0100
-+++ noflushd-2.7.4+scsi/src/spindown.c	2004-10-23 00:02:33.185395308 +0200
-@@ -39,7 +39,7 @@
- #include <errno.h>
- 
- /* Indicate whether SCSI support was enabled. */
--int nfd_do_scsi = 0;
-+int nfd_do_scsi = 1;
- 
- /* IDE knows two versions of several commands. Some versions work on
-  * old drives, some on new ones. We keep trying until we run out of
--- a/sys-block/noflushd/files/noflushd.confd	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/noflushd/files/noflushd.confd,v 1.3 2004/07/15 00:45:49 agriffis Exp $
-
-# Config file for /etc/init.d/noflushd
-
-#TIMEOUT=60
-#DISKS=/dev/discs/disc0/disc
-#EXTRA=
-#NOFLUSHD_OPTS="-n $TIMEOUT $DISKS $EXTRA"
-
--- a/sys-block/noflushd/files/noflushd.rc6	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/noflushd/files/noflushd.rc6,v 1.6 2004/07/15 00:45:49 agriffis Exp $
-
-# NB: Config is in /etc/conf.d/noflushd
-
-depend() {
-	need localmount
-}
-
-checkconfig() {
-	if [ -z "$NOFLUSHD_OPTS" ] ; then
-		eerror "You need to setup your NOFLUSHD_OPTS first"
-		eerror "Check that you've adjusted /etc/conf.d/noflushd for your needs"
-		return 1
-	fi
-}
-
-start() {
-	checkconfig || return 1
-	ebegin "Starting noflushd"
-	start-stop-daemon --start --quiet --exec /usr/sbin/noflushd -- $NOFLUSHD_OPTS
-	eend $?
-}
-
-stop() {
-	ebegin "Stopping noflushd"
-	start-stop-daemon --stop --quiet --pidfile /var/run/noflushd.pid
-	eend $?
-}
--- a/sys-block/noflushd/noflushd-2.7.4.ebuild	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/noflushd/noflushd-2.7.3.ebuild,v 1.5 2004/09/03 21:03:24 pvdabeel Exp $
-
-inherit flag-o-matic eutils
-
-DESCRIPTION="A daemon to spin down your disks and force accesses to be cached"
-HOMEPAGE="http://noflushd.sourceforge.net"
-SRC_URI="mirror://sourceforge/noflushd/${P}.tar.gz"
-RESTRICT="nomirror"
-LICENSE="GPL-2"
-KEYWORDS="~x86 ~amd64 ppc"
-IUSE="SCSI"
-SLOT="0"
-
-DEPEND="virtual/libc"
-
-src_compile() {
-
-	if use SCSI; then
-		ewarn "Enabling SCSI support - you do this on your own risk!"
-		epatch ${FILESDIR}/${P}-SCSI.patch
-	fi
-
-	# Replace -O[2-9] flags to keep the executable small
-	replace-flags -O[2-9] -Os
-
-	./configure --prefix=/usr \
-		--host=${CHOST} \
-		--mandir=/usr/share/man \
-		--infodir=/usr/share/info \
-		--with-docdir=/usr/share/doc/${PF} || die "configure problem"
-	emake || die "compile problem"
-}
-
-src_install () {
-	dosbin src/noflushd
-	doman man/noflushd.8
-	dodoc README NEWS
-
-	exeinto /etc/init.d ; newexe ${FILESDIR}/noflushd.rc6 noflushd
-	insinto /etc/conf.d ; newins ${FILESDIR}/noflushd.confd noflushd
-}
-
-pkg_postinst() {
-	einfo 'Run "rc-update add noflushd default" to add it to the'
-	einfo "default runlevel."
-
-	ewarn "noflushd works reliably with IDE devices only."
-	ewarn "It has possible problems with reiserfs, too."
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys-fs/ntfs3g/Manifest	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,4 @@
+AUX 10-ntfs3g.fdi 397 RMD160 a09440a0d239db40ce7c6cada0008e425a0a5dc7 SHA1 d26af4f1dcdfad6da384b0e706c79a629fa893dd SHA256 bceb8474647e9dd8a1740d3d3af559cbd9f5ad428f335606f44f87b17c712de7
+DIST ntfs-3g-1.5130.tgz 649883 RMD160 173b1c7e3a94d440ecaa19d97980ba6f3228e33e SHA1 02b7a874b02827665c97123c6335e1d856054c42 SHA256 a456973a4b44c8fa1b63214425edfd1a72fd7b26ab40d25a4372e2a4f3ac4057
+EBUILD ntfs3g-1.5130.ebuild 1278 RMD160 cb81bae446250f7f88ee77aa51c6da7201980d95 SHA1 65789307d54ec097e4eab738fb6c757fddb9fb40 SHA256 13e5ad5cc6eb5be95bccc05b4a9747ea9cf38ee854564e5cf8009c7756d5f476
+MISC metadata.xml 641 RMD160 361ae848a3012a236c512a5cfc71cc96026ba072 SHA1 9cc731cc7093ad04c8a3199948f24b2c5ff2cadb SHA256 bb0e59a4fde05b0fbad22547a263d7ef98bb5809fd00bf14c0d4d2c89cab05ed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys-fs/ntfs3g/files/10-ntfs3g.fdi	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deviceinfo version="0.2">
+    <device>
+        <match key="volume.fstype" string="ntfs">
+	    <merge key="volume.fstype" type="string">ntfs-3g</merge>
+    	    <merge key="volume.policy.mount_filesystem" type="string">ntfs-3g</merge>
+	    <append key="volume.mount.valid_options" type="strlist">locale=</append>
+        </match>
+    </device>
+</deviceinfo>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys-fs/ntfs3g/metadata.xml	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>no-herd</herd>
+  <maintainer>
+    <email>chutzpah@gentoo.org</email>
+    <name>Patrick McLean</name>
+  </maintainer>
+  <longdescription lang="en">
+The ntfs-3g driver is an open source, GPL licensed, third generation Linux 
+NTFS driver for 32-bit, little-endian architectures which was implemented 
+by the Linux-NTFS project. It provides full read-write access to NTFS, 
+excluding access to encrypted files, writing compressed files, changing 
+file ownership, access right.
+  </longdescription>
+</pkgmetadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys-fs/ntfs3g/ntfs3g-1.5130.ebuild	Wed Mar 04 02:58:24 2009 +0100
@@ -0,0 +1,53 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/ntfs3g/ntfs3g-1.5012.ebuild,v 1.1 2008/10/23 14:23:59 chutzpah Exp $
+
+MY_PN="${PN/3g/-3g}"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Open source read-write NTFS driver that runs under FUSE"
+HOMEPAGE="http://www.ntfs-3g.org"
+SRC_URI="http://www.ntfs-3g.org/${MY_P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="debug hal suid"
+
+RDEPEND="hal? ( sys-apps/hal )"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+src_compile() {
+	econf \
+		--docdir="/usr/share/doc/${PF}" \
+		--enable-ldscript \
+		--disable-ldconfig \
+		$(use_enable debug)
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "install failed"
+
+	prepalldocs
+	dodoc AUTHORS ChangeLog CREDITS
+
+	use suid && fperms u+s "/bin/${MY_PN}"
+
+	if use hal; then
+		insinto /etc/hal/fdi/policy/
+		doins "${FILESDIR}/10-ntfs3g.fdi"
+	fi
+}
+
+pkg_postinst() {
+	if use suid; then
+		ewarn
+		ewarn "You have chosen to install ${PN} with the binary setuid root. This"
+		ewarn "means that if there any undetected vulnerabilities in the binary,"
+		ewarn "then local users may be able to gain root access on your machine."
+		ewarn
+	fi
+}
--- a/sys-libs/libstatgrab/Manifest	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-DIST libstatgrab-0.16.tar.gz 462691 RMD160 1ded8eb8b213b9c86ad89031e4501e0546181f9a SHA1 233c752dd26e0cc16e88b3da13bcf63d733637c8 SHA256 8a7adb6f3e322c6974d7ca70abd16dd5d5755d108689f6c77f3b42a1ad3aa184
-EBUILD libstatgrab-0.16.ebuild 967 RMD160 70064d425e388a435a6d0ae501a3dfa393f1c8f5 SHA1 59166713f3ff8562d5c439a672e07c224c45f16f SHA256 c82e10ac31686acc095a0a14552dc3cfeefd0f9864da628321e39001ef42e3ba
--- a/sys-libs/libstatgrab/libstatgrab-0.16.ebuild	Tue Feb 10 03:49:43 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/libstatgrab/libstatgrab-0.11.ebuild,v 1.1 2004/12/07 13:55:38 dragonheart Exp $
-
-DESCRIPTION="Provides cross platform access to statistics about the system on which it's run."
-HOMEPAGE="http://www.i-scream.org/libstatgrab/"
-SRC_URI="http://www.mirrorservice.org/sites/ftp.i-scream.org/pub/i-scream/libstatgrab/${P}.tar.gz"
-
-LICENSE="|| ( GPL-2 LGPL-2.1 )"
-SLOT=0
-KEYWORDS="~x86 ~ppc"
-IUSE=""
-RDEPEND=">=sys-libs/ncurses-5.4-r1
-	virtual/libc"
-
-DEPEND="${RDEPEND}
-	sys-apps/gawk
-	sys-apps/grep
-	sys-devel/gcc
-	dev-util/pkgconfig"
-
-src_compile() {
-	econf --disable-setgid-binaries --disable-setuid-binaries \
-		--disable-deprecated --with-ncurses || die "econf failed"
-	emake || die "emake failed"
-}
-
-src_install() {
-	emake DESTDIR=${D} install || die "einstall failed"
-	dodoc ChangeLog PLATFORMS NEWS AUTHORS README
-}