summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorroot <root@rshg047.dnsready.net>2011-05-08 22:33:52 +0000
committerroot <root@rshg047.dnsready.net>2011-05-08 22:33:52 +0000
commit886d3d0994eb8e9f3e797155619619e0ef1353f8 (patch)
treeaecae53a57082f8f3e4b72755149285659c1bee3 /testing
parentfe6dc99352fe2b801d251e55b2b8baa71441908e (diff)
Sun May 8 22:33:51 UTC 2011
Diffstat (limited to 'testing')
-rw-r--r--testing/alpine/2.00-lpam.patch13
-rw-r--r--testing/alpine/CVE-2008-5514.patch20
-rw-r--r--testing/alpine/PKGBUILD44
-rw-r--r--testing/anjuta/PKGBUILD35
-rw-r--r--testing/anjuta/anjuta.install21
-rw-r--r--testing/bash/PKGBUILD87
-rw-r--r--testing/bash/bash.install20
-rw-r--r--testing/bash/dot.bash_logout3
-rw-r--r--testing/bash/dot.bash_profile5
-rw-r--r--testing/bash/dot.bashrc9
-rw-r--r--testing/bash/system.bash_logout3
-rw-r--r--testing/bash/system.bashrc23
-rw-r--r--testing/bind/127.0.0.zone11
-rw-r--r--testing/bind/ChangeLog15
-rw-r--r--testing/bind/PKGBUILD80
-rw-r--r--testing/bind/install21
-rw-r--r--testing/bind/localhost.zone10
-rwxr-xr-xtesting/bind/named48
-rw-r--r--testing/bind/named.conf64
-rw-r--r--testing/bind/named.conf.d4
-rw-r--r--testing/bind/named.logrotate6
-rw-r--r--testing/bind/notools.patch11
-rw-r--r--testing/bind/so_bsdcompat.patch13
-rw-r--r--testing/cifs-utils/PKGBUILD26
-rw-r--r--testing/cups/PKGBUILD110
-rwxr-xr-xtesting/cups/cups38
-rw-r--r--testing/cups/cups-avahi.patch1089
-rw-r--r--testing/cups/cups.install15
-rw-r--r--testing/cups/cups.logrotate8
-rw-r--r--testing/cups/cups.pam3
-rw-r--r--testing/cvs/PKGBUILD39
-rw-r--r--testing/cvs/cvs-1.11.23-cve-2010-3846.patch167
-rw-r--r--testing/cvs/cvs-1.11.23-getline64.patch34
-rw-r--r--testing/cvs/cvs.install20
-rw-r--r--testing/cyrus-sasl-plugins/PKGBUILD52
-rw-r--r--testing/cyrus-sasl-plugins/cyrus-sasl-2.1.22-gcc44.patch24
-rw-r--r--testing/cyrus-sasl-plugins/cyrus-sasl-2.1.23-db5-fix.patch23
-rw-r--r--testing/cyrus-sasl/PKGBUILD53
-rw-r--r--testing/cyrus-sasl/cyrus-sasl-2.1.23+db-5.0.patch24
-rw-r--r--testing/cyrus-sasl/cyrus-sasl-2.1.23-gcc4.patch21
-rw-r--r--testing/cyrus-sasl/saslauthd50
-rw-r--r--testing/cyrus-sasl/saslauthd.conf.d1
-rw-r--r--testing/dnsutils/PKGBUILD39
-rw-r--r--testing/dnsutils/tools-only.patch25
-rw-r--r--testing/dovecot/PKGBUILD74
-rw-r--r--testing/dovecot/dovecot.install57
-rwxr-xr-xtesting/dovecot/dovecot.sh36
-rw-r--r--testing/evolution-data-server/PKGBUILD29
-rw-r--r--testing/evolution-exchange/PKGBUILD33
-rw-r--r--testing/evolution-exchange/evolution-exchange.install17
-rw-r--r--testing/gnome-control-center/PKGBUILD34
-rw-r--r--testing/gnome-control-center/gnome-control-center.install19
-rw-r--r--testing/gnome-settings-daemon/PKGBUILD33
-rw-r--r--testing/gnome-settings-daemon/gnome-settings-daemon.install18
-rw-r--r--testing/gnome-vfs/PKGBUILD45
-rw-r--r--testing/gnome-vfs/gnome-vfs.install17
-rw-r--r--testing/gnome-vfs/gnutls-config.patch25
-rw-r--r--testing/gtk2/PKGBUILD50
-rw-r--r--testing/gtk2/gtk2.install16
-rw-r--r--testing/gtk2/xid-collision-debug.patch15
-rw-r--r--testing/gtk3/PKGBUILD36
-rw-r--r--testing/gtk3/gtk3.install15
-rw-r--r--testing/gtk3/settings.ini2
-rw-r--r--testing/gutenprint/PKGBUILD39
-rw-r--r--testing/gutenprint/gutenprint.install9
-rw-r--r--testing/kdelibs/PKGBUILD62
-rw-r--r--testing/kdelibs/abs-syntax-highlight.patch12
-rw-r--r--testing/kdelibs/archlinux-menu.patch22
-rw-r--r--testing/kdelibs/kde-applications-menu.patch22
-rw-r--r--testing/kdelibs/kdelibs.install12
-rw-r--r--testing/krb5/PKGBUILD64
-rw-r--r--testing/krb5/kadmind.rc40
-rw-r--r--testing/krb5/krb5-kdc.rc40
-rw-r--r--testing/libgnomecups/PKGBUILD31
-rw-r--r--testing/libgnomecups/libgnomecups_0.2.3-ignore-ipp-not-found.patch11
-rw-r--r--testing/libgnomeprint/PKGBUILD28
-rw-r--r--testing/librpcsecgss/PKGBUILD27
-rw-r--r--testing/librpcsecgss/librpcsecgss-0.18-heimdal.patch33
-rw-r--r--testing/libtirpc/PKGBUILD32
-rw-r--r--testing/libtirpc/libtirpc-0.2.1-fortify.patch18
-rw-r--r--testing/mutt/PKGBUILD47
-rw-r--r--testing/mutt/install8
-rw-r--r--testing/neon/PKGBUILD29
-rw-r--r--testing/nfs-utils/PKGBUILD69
-rw-r--r--testing/nfs-utils/exports15
-rw-r--r--testing/nfs-utils/idmapd.conf14
-rw-r--r--testing/nfs-utils/nfs-common319
-rw-r--r--testing/nfs-utils/nfs-common.conf40
-rw-r--r--testing/nfs-utils/nfs-server303
-rw-r--r--testing/nfs-utils/nfs-server.conf29
-rw-r--r--testing/nfs-utils/nfs-utils-1.1.2-kerberos-ac.patch138
-rw-r--r--testing/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch39
-rw-r--r--testing/nfs-utils/nfs-utils-1.1.4-no-exec.patch15
-rw-r--r--testing/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch69
-rw-r--r--testing/nfs-utils/nfs-utils-1.1.6-no_libgssapi.patch57
-rw-r--r--testing/nfs-utils/nfs-utils.install32
-rw-r--r--testing/nfs-utils/start-statd.patch22
-rw-r--r--testing/nss_ldap/PKGBUILD33
-rw-r--r--testing/openssh/PKGBUILD6
-rw-r--r--testing/samba/PKGBUILD139
-rw-r--r--testing/samba/fix-ipv6-mount.patch11
-rwxr-xr-xtesting/samba/samba54
-rw-r--r--testing/samba/samba.conf.d7
-rw-r--r--testing/samba/samba.logrotate9
-rw-r--r--testing/samba/samba.pam3
-rw-r--r--testing/samba/swat.xinetd10
-rw-r--r--testing/subversion/PKGBUILD92
-rw-r--r--testing/subversion/subversion.rpath.fix.patch10
-rw-r--r--testing/subversion/subversion.suppress.deprecation.warnings.patch22
-rw-r--r--testing/subversion/svn11
-rw-r--r--testing/subversion/svnmerge.py2370
-rwxr-xr-xtesting/subversion/svnserve42
-rw-r--r--testing/subversion/svnserve.conf7
-rw-r--r--testing/syslog-ng/PKGBUILD52
-rw-r--r--testing/syslog-ng/cap_syslog.patch101
-rw-r--r--testing/syslog-ng/syslog-ng.conf92
-rw-r--r--testing/syslog-ng/syslog-ng.logrotate7
-rwxr-xr-xtesting/syslog-ng/syslog-ng.rc63
-rw-r--r--testing/wget/PKGBUILD55
-rw-r--r--testing/wget/wget-1.12-CVE-2010-2252.patch155
-rw-r--r--testing/wget/wget-1.12-subjectAltName.patch216
-rw-r--r--testing/wget/wget.install20
-rw-r--r--testing/wireshark/PKGBUILD54
-rw-r--r--testing/wireshark/wireshark-gtk.install11
-rw-r--r--testing/wireshark/wireshark.install18
-rw-r--r--testing/xfprint/PKGBUILD35
-rw-r--r--testing/xfprint/xfprint-manager-fix.diff29
-rw-r--r--testing/xfprint/xfprint.install11
128 files changed, 8487 insertions, 3 deletions
diff --git a/testing/alpine/2.00-lpam.patch b/testing/alpine/2.00-lpam.patch
new file mode 100644
index 000000000..69e66d7ef
--- /dev/null
+++ b/testing/alpine/2.00-lpam.patch
@@ -0,0 +1,13 @@
+--- alpine-2.00.orig/alpine/Makefile.in
++++ alpine-2.00/alpine/Makefile.in
+@@ -169,7 +169,7 @@
+ LIBICONV = @LIBICONV@
+ LIBINTL = @LIBINTL@
+ LIBOBJS = @LIBOBJS@
+-LIBS = @LIBS@
++LIBS = @LIBS@ -lpam
+ LIBTOOL = @LIBTOOL@
+ LN = @LN@
+ LN_S = @LN_S@
+ LTLIBICONV = @LTLIBICONV@
+ LTLIBINTL = @LTLIBINTL@
diff --git a/testing/alpine/CVE-2008-5514.patch b/testing/alpine/CVE-2008-5514.patch
new file mode 100644
index 000000000..594bea0b2
--- /dev/null
+++ b/testing/alpine/CVE-2008-5514.patch
@@ -0,0 +1,20 @@
+--- alpine-2.00/imap/src/c-client/rfc822.c
++++ alpine-2.00/imap/src/c-client/rfc822.c
+@@ -1351,6 +1351,7 @@
+
+ static long rfc822_output_char (RFC822BUFFER *buf,int c)
+ {
++ if ((buf->cur == buf->end) && !rfc822_output_flush (buf)) return NIL;
+ *buf->cur++ = c; /* add character, soutr buffer if full */
+ return (buf->cur == buf->end) ? rfc822_output_flush (buf) : LONGT;
+ }
+@@ -1374,7 +1375,8 @@
+ len -= i;
+ }
+ /* soutr buffer now if full */
+- if (len && !rfc822_output_flush (buf)) return NIL;
++ if ((len || (buf->cur == buf->end)) && !rfc822_output_flush (buf))
++ return NIL;
+ }
+ return LONGT;
+ }
diff --git a/testing/alpine/PKGBUILD b/testing/alpine/PKGBUILD
new file mode 100644
index 000000000..6b2f9ee73
--- /dev/null
+++ b/testing/alpine/PKGBUILD
@@ -0,0 +1,44 @@
+# $Id: PKGBUILD 121113 2011-04-29 02:56:31Z eric $
+# Maintainer: Eric BĂ©langer <eric@archlinux.org>
+
+pkgname=alpine
+pkgver=2.00
+pkgrel=13
+_patchlevel=79
+pkgdesc="The Apache-licensed PINE (a tool for reading, sending, and managing electronic messages)"
+arch=('i686' 'x86_64')
+url="http://www.washington.edu/alpine/"
+license=('APACHE')
+depends=('libldap' 'krb5' 'gettext')
+optdepends=('aspell: for spell-checking support')
+provides=('pine')
+conflicts=('pine')
+replaces=('pine')
+options=('!makeflags')
+source=(ftp://ftp.cac.washington.edu/${pkgname}/${pkgname}.tar.bz2 \
+ http://staff.washington.edu/chappa/alpine/patches/alpine-${pkgver}/all_${_patchlevel}.patch.gz \
+ 2.00-lpam.patch CVE-2008-5514.patch)
+md5sums=('84e44cbf71ed674800a5d57eed9c1c52'
+ 'd7dffd121c9a1cac4c458c0ff71df1ce'
+ 'cd3911c16fc6a072e853c0ccfc35857c'
+ '1b52a54a656979116c09fb1d948a4325')
+sha1sums=('dcbd3c5419954f484ccf706feaba31ce48cdebc4'
+ 'd3acbf0e46c50feb2e822ef3bdc0a0f43c007294'
+ '1b39525f91ebd5a9de5a1e04f5554f6fa5f58ae3'
+ 'bc61d76a237ff42b00b3f60f2e6fc5c45e261dbb')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -p1 < ../all_${_patchlevel}.patch
+ patch -p1 < ../2.00-lpam.patch
+ patch -p1 < ../CVE-2008-5514.patch
+ ./configure --prefix=/usr --without-passfile --without-tcl \
+ --disable-shared --with-system-pinerc=/etc/alpine.d/pine.conf \
+ --with-system-fixed-pinerc=/etc/alpine.d/pine.conf.fixed
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/testing/anjuta/PKGBUILD b/testing/anjuta/PKGBUILD
new file mode 100644
index 000000000..98a1c6730
--- /dev/null
+++ b/testing/anjuta/PKGBUILD
@@ -0,0 +1,35 @@
+# $Id: PKGBUILD 122589 2011-05-04 18:41:26Z ibiru $
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+# Contributor: Harley Laue <losinggeneration@yahoo.com>
+
+pkgname=anjuta
+pkgver=3.0.1.0
+pkgrel=2
+pkgdesc="GNOME Integrated Development Environment (IDE)"
+arch=('i686' 'x86_64')
+license=('GPL')
+depends=('vte3' 'gdl' 'autogen' 'devhelp' 'gtksourceview3' 'glade' 'libgda'
+ 'subversion' 'gnome-icon-theme' 'hicolor-icon-theme' 'vala' 'graphviz'
+ 'python2' 'shared-mime-info' 'desktop-file-utils')
+makedepends=('gnome-doc-utils' 'intltool' 'gobject-introspection')
+url="http://anjuta.sourceforge.net/"
+install=anjuta.install
+source=(ftp://ftp.gnome.org/pub/gnome/sources/${pkgname}/${pkgver%.*.*}/${pkgname}-${pkgver}.tar.bz2)
+options=('!libtool' '!emptydirs')
+sha256sums=('dbda189f453e0f9baecb35e85d59df92613668f7f4be08207d635cff3abb7261')
+
+build() {
+ cd "${srcdir}/anjuta-${pkgver}"
+ PYTHON=/usr/bin/python2 ./configure --prefix=/usr --sysconfdir=/etc \
+ --localstatedir=/var --disable-scrollkeeper
+ make
+}
+
+package(){
+ cd "${srcdir}/anjuta-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ sed -i "1s|#!/usr/bin/python$|&2|" \
+ $pkgdir/usr/share/anjuta/project/{pygtk,python}/src/main.py
+}
diff --git a/testing/anjuta/anjuta.install b/testing/anjuta/anjuta.install
new file mode 100644
index 000000000..c6fcfec11
--- /dev/null
+++ b/testing/anjuta/anjuta.install
@@ -0,0 +1,21 @@
+post_install() {
+ usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas
+ update-desktop-database -q
+ gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+ gtk-update-icon-cache -q -t -f usr/share/icons/gnome
+ update-mime-database usr/share/mime > /dev/null
+}
+
+pre_upgrade() {
+ if (( $(vercmp $2 2.90.0) < 0 )); then
+ usr/sbin/gconfpkg --uninstall anjuta
+ fi
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
diff --git a/testing/bash/PKGBUILD b/testing/bash/PKGBUILD
new file mode 100644
index 000000000..c8d6c0c36
--- /dev/null
+++ b/testing/bash/PKGBUILD
@@ -0,0 +1,87 @@
+# $Id: PKGBUILD 123077 2011-05-08 02:14:26Z allan $
+# Maintainer: Aaron Griffin <aaron@archlinux.org>
+# Maintainer: Allan McRae <allan@archlinux.org>
+
+pkgname=bash
+_basever=4.2
+_patchlevel=010 #prepare for some patches
+pkgver=$_basever.$_patchlevel
+pkgrel=1
+pkgdesc="The GNU Bourne Again shell"
+arch=('i686' 'x86_64')
+license=('GPL')
+url="http://www.gnu.org/software/bash/bash.html"
+groups=('base')
+backup=(etc/bash.bash{rc,_logout} etc/skel/.bash{rc,_profile,_logout})
+depends=('readline>=6.1' 'glibc')
+provides=('sh')
+install=bash.install
+source=(http://ftp.gnu.org/gnu/bash/bash-$_basever.tar.gz
+ dot.bashrc
+ dot.bash_profile
+ dot.bash_logout
+ system.bashrc
+ system.bash_logout)
+if [ $_patchlevel -gt 000 ]; then
+ for (( p=1; p<=$((10#${_patchlevel})); p++ )); do
+ source=(${source[@]} http://ftp.gnu.org/gnu/bash/bash-$_basever-patches/bash${_basever//./}-$(printf "%03d" $p))
+ done
+fi
+
+build() {
+ cd ${srcdir}/${pkgname}-$_basever
+ for p in ../bash${_basever//./}-*; do
+ [[ -e "$p" ]] || continue
+ msg "applying patch ${p}"
+ patch -Np0 -i ${p}
+ done
+
+ _bashconfig=(-DDEFAULT_PATH_VALUE=\'\"/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin\"\'
+ -DSTANDARD_UTILS_PATH=\'\"/usr/bin:/bin:/usr/sbin:/sbin\"\'
+ -DSYS_BASHRC=\'\"/etc/bash.bashrc\"\'
+ -DSYS_BASH_LOGOUT=\'\"/etc/bash.bash_logout\"\')
+ export CFLAGS="${CFLAGS} ${_bashconfig[@]}"
+
+ ./configure --prefix=/usr --with-curses --enable-readline \
+ --without-bash-malloc --with-installed-readline \
+ --bindir=/bin --mandir=/usr/share/man --infodir=/usr/share/info
+ make
+ make check
+}
+
+package() {
+ cd ${srcdir}/${pkgname}-$_basever
+ make DESTDIR=${pkgdir} install
+
+ # for now, bash is our default /bin/sh
+ cd ${pkgdir}/bin
+ ln -s bash sh
+
+ install -dm755 ${pkgdir}/etc/skel/
+
+ # system-wide configuration files
+ install -m644 ${srcdir}/system.bashrc ${pkgdir}/etc/bash.bashrc
+ install -m644 ${srcdir}/system.bash_logout ${pkgdir}/etc/bash.bash_logout
+
+ # user configuration file skeletons
+ install -m644 ${srcdir}/dot.bashrc ${pkgdir}/etc/skel/.bashrc
+ install -m644 ${srcdir}/dot.bash_profile ${pkgdir}/etc/skel/.bash_profile
+ install -m644 ${srcdir}/dot.bash_logout ${pkgdir}/etc/skel/.bash_logout
+}
+
+md5sums=('3fb927c7c33022f1c327f14a81c0d4b0'
+ '027d6bd8f5f6a06b75bb7698cb478089'
+ '2902e0fee7a9168f3a4fd2ccd60ff047'
+ '42f4400ed2314bd7519c020d0187edc5'
+ 'fe5d3a367f7d5f754214dc05e3d958ab'
+ '472f536d7c9e8250dc4568ec4cfaf294'
+ '1100bc1dda2cdc06ac44d7e5d17864a3'
+ '30e7948079921d3261efcc6a40722135'
+ '9ea06decec43a198f3d7cf29acc602f8'
+ 'fb48f6134d7b013135929476aa0c250c'
+ 'e70e45de33426b38153b390be0dbbcd4'
+ 'ce4e5c484993705b27daa151eca242c2'
+ '88d1f96db29461767602e2546803bda7'
+ '24c574bf6d6a581e300823d9c1276af6'
+ '4c5835f2fbab36c4292bb334977e5b6d'
+ '0a51602b535ef661ee707be6c8bdb373')
diff --git a/testing/bash/bash.install b/testing/bash/bash.install
new file mode 100644
index 000000000..bc75e9b6a
--- /dev/null
+++ b/testing/bash/bash.install
@@ -0,0 +1,20 @@
+info_dir=usr/share/info
+info_files=(bash.info)
+
+post_install() {
+ [ -x usr/bin/install-info ] || return 0
+ for f in ${info_files[@]}; do
+ usr/bin/install-info ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ [ -x usr/bin/install-info ] || return 0
+ for f in ${info_files[@]}; do
+ usr/bin/install-info --delete ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
+ done
+}
diff --git a/testing/bash/dot.bash_logout b/testing/bash/dot.bash_logout
new file mode 100644
index 000000000..0e4e4f184
--- /dev/null
+++ b/testing/bash/dot.bash_logout
@@ -0,0 +1,3 @@
+#
+# ~/.bash_logout
+#
diff --git a/testing/bash/dot.bash_profile b/testing/bash/dot.bash_profile
new file mode 100644
index 000000000..5545f007e
--- /dev/null
+++ b/testing/bash/dot.bash_profile
@@ -0,0 +1,5 @@
+#
+# ~/.bash_profile
+#
+
+[[ -f ~/.bashrc ]] && . ~/.bashrc
diff --git a/testing/bash/dot.bashrc b/testing/bash/dot.bashrc
new file mode 100644
index 000000000..a355b0cd3
--- /dev/null
+++ b/testing/bash/dot.bashrc
@@ -0,0 +1,9 @@
+#
+# ~/.bashrc
+#
+
+# If not running interactively, don't do anything
+[[ $- != *i* ]] && return
+
+alias ls='ls --color=auto'
+PS1='[\u@\h \W]\$ '
diff --git a/testing/bash/system.bash_logout b/testing/bash/system.bash_logout
new file mode 100644
index 000000000..a76e48e4a
--- /dev/null
+++ b/testing/bash/system.bash_logout
@@ -0,0 +1,3 @@
+#
+# /etc/bash.bash_logout
+#
diff --git a/testing/bash/system.bashrc b/testing/bash/system.bashrc
new file mode 100644
index 000000000..84de2898c
--- /dev/null
+++ b/testing/bash/system.bashrc
@@ -0,0 +1,23 @@
+#
+# /etc/bash.bashrc
+#
+
+# If not running interactively, don't do anything
+[[ $- != *i* ]] && return
+
+PS1='[\u@\h \W]\$ '
+PS2='> '
+PS3='> '
+PS4='+ '
+
+case ${TERM} in
+ xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
+ PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
+
+ ;;
+ screen)
+ PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
+ ;;
+esac
+
+[ -r /etc/bash_completion ] && . /etc/bash_completion
diff --git a/testing/bind/127.0.0.zone b/testing/bind/127.0.0.zone
new file mode 100644
index 000000000..509c311f6
--- /dev/null
+++ b/testing/bind/127.0.0.zone
@@ -0,0 +1,11 @@
+$ORIGIN 0.0.127.in-addr.arpa.
+
+@ 1D IN SOA localhost. root.localhost. (
+ 42 ; serial (yyyymmdd##)
+ 3H ; refresh
+ 15M ; retry
+ 1W ; expiry
+ 1D ) ; minimum ttl
+
+ 1D IN NS localhost.
+1 1D IN PTR localhost.
diff --git a/testing/bind/ChangeLog b/testing/bind/ChangeLog
new file mode 100644
index 000000000..fac736994
--- /dev/null
+++ b/testing/bind/ChangeLog
@@ -0,0 +1,15 @@
+
+2010-03-27 kevin <kevin@archlinux.org>
+
+ * bind 9.7.0.P1-1
+ - Patch addresses excessive query traffic generated when there is a break
+ in the DNSSEC trust chain as a result of a configuration error
+
+2010-01-22 kevin <kevin@archlinux.org>
+
+ * bind 9.6.1.P3-1
+ - Fix for CVE-2010-0097, VU#360341, BIND 9 DNSSEC validation code could
+ cause bogus NXDOMAIN responses
+ - Updated fix for CVE-2009-4022, VU#418861, BIND 9 Cache Update from
+ Additional Section
+
diff --git a/testing/bind/PKGBUILD b/testing/bind/PKGBUILD
new file mode 100644
index 000000000..b559d2c54
--- /dev/null
+++ b/testing/bind/PKGBUILD
@@ -0,0 +1,80 @@
+# $Id: PKGBUILD 122962 2011-05-07 14:45:29Z bisson $
+# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+# Contributor: judd <jvinet@zeroflux.org>
+# Contributor: Mario Vazquez <mario_vazq@hotmail.com>
+
+pkgname=bind
+
+# Use a period and not a hyphen before the patch level for proper versioning.
+pkgver=9.8.0.P1
+_pkgver=9.8.0-P1
+pkgrel=1
+
+pkgdesc='Berkeley Internet Name Daemon (BIND) is the reference implementation of the Domain Name System (DNS) protocols'
+arch=('i686' 'x86_64')
+url='http://www.isc.org/software/bind/'
+license=('custom:ISC')
+provides=('dns-server')
+backup=('etc/logrotate.d/named'
+ 'etc/conf.d/named'
+ 'etc/named.conf'
+ 'etc/rndc.key')
+depends=('openssl' 'libxml2')
+options=('!makeflags' '!libtool')
+source=("http://ftp.isc.org/isc/bind9/${_pkgver}/${pkgname}-${_pkgver}.tar.gz"
+ 'ftp://ftp.rs.internic.net/domain/db.cache'
+ 'so_bsdcompat.patch'
+ 'notools.patch'
+ 'named'
+ 'named.conf'
+ 'named.conf.d'
+ 'named.logrotate'
+ 'localhost.zone'
+ '127.0.0.zone')
+sha1sums=('aa8f308f218e437ac4bad616e0ae83a9b9c40c29'
+ 'ee52947062c1582858187716b776afa3613608fb'
+ '2f737f4e81186447ac2ef370fa8dcea0b3abec31'
+ '5277cf4d6fbc5728c55b51c77c9347d28393fb7c'
+ '02b0e20a542663d27af4faa4d2e397ae2764276e'
+ '5ca7a5f2a132548a090a045a2df3acea6b35d9eb'
+ '7848edbfb9a848843f57c11c02b0289eefd42d00'
+ '9ffb5c3f72390a517aeae557e32349d5d278cb63'
+ '76a0d4cd1b913db177a5a375bebc47e5956866ec'
+ '53be0f1437ebe595240d8dbdd819939582b97fb9')
+
+install=install
+
+build() {
+ cd "${srcdir}/${pkgname}-${_pkgver}"
+
+ patch -p1 -i "${srcdir}"/so_bsdcompat.patch
+ patch -p1 -i "${srcdir}"/notools.patch
+
+ ./configure \
+ --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --with-libtool --enable-static=no --disable-linux-caps \
+ --with-openssl=yes --with-libxml2=yes
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${_pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+
+ install -d "${pkgdir}"/usr/share/doc/bind
+ install ./doc/arm/*.html "${pkgdir}"/usr/share/doc/bind/
+
+ install -D -m755 ../named "${pkgdir}"/etc/rc.d/named
+ install -D -m644 ../named.conf.d "${pkgdir}"/etc/conf.d/named
+ install -D -m600 ../named.logrotate "${pkgdir}"/etc/logrotate.d/named
+ install -D -m640 -o 0 -g 40 ../named.conf "${pkgdir}"/etc/named.conf
+
+ install -d -m750 -o 0 -g 40 "${pkgdir}"/var/named
+ install -d -m755 -o 40 -g 40 "${pkgdir}"/var/run/named
+ install -m640 -o 0 -g 40 ../db.cache "${pkgdir}"/var/named/root.hint
+ install -m640 -o 0 -g 40 ../127.0.0.zone "${pkgdir}"/var/named/
+ install -m640 -o 0 -g 40 ../localhost.zone "${pkgdir}"/var/named/
+}
diff --git a/testing/bind/install b/testing/bind/install
new file mode 100644
index 000000000..e3a1397cb
--- /dev/null
+++ b/testing/bind/install
@@ -0,0 +1,21 @@
+post_install() {
+ getent group named >/dev/null || groupadd -g 40 named
+ getent passwd named >/dev/null || useradd -u 40 -c "BIND DNS Server" -g named -d /var/named -s /bin/false named
+ passwd -l named &>/dev/null
+
+ touch var/log/named.log
+ chown named:named var/log/named.log
+
+ # create an rndc.key if it doesn't already exist
+ if [ ! -s etc/rndc.key ]; then
+ usr/sbin/rndc-confgen -r /dev/urandom -b 256 | head -n 5 >>etc/rndc.key
+ chown root:named etc/rndc.key
+ chmod 640 etc/rndc.key
+ fi
+}
+
+pre_remove() {
+ getent passwd named &>/dev/null && userdel named >/dev/null
+ getent group named &>/dev/null && groupdel named >/dev/null
+ return 0
+}
diff --git a/testing/bind/localhost.zone b/testing/bind/localhost.zone
new file mode 100644
index 000000000..e3ff9641c
--- /dev/null
+++ b/testing/bind/localhost.zone
@@ -0,0 +1,10 @@
+$ORIGIN localhost.
+@ 1D IN SOA @ root (
+ 42 ; serial (yyyymmdd##)
+ 3H ; refresh
+ 15M ; retry
+ 1W ; expiry
+ 1D ) ; minimum ttl
+
+ 1D IN NS @
+ 1D IN A 127.0.0.1
diff --git a/testing/bind/named b/testing/bind/named
new file mode 100755
index 000000000..3be558f27
--- /dev/null
+++ b/testing/bind/named
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+NAMED_ARGS=
+[ -f /etc/conf.d/named ] && . /etc/conf.d/named
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/named`
+case "$1" in
+ start)
+ stat_busy "Starting BIND"
+ [ -z "$PID" ] && /usr/sbin/named ${NAMED_ARGS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon named
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping BIND"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon named
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload)
+ stat_busy "Reloading BIND"
+ [ ! -z "$PID" ] && rndc reload &>/dev/null || kill -HUP $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ *)
+ echo "usage: $0 {start|stop|reload|restart}"
+esac
+exit 0
diff --git a/testing/bind/named.conf b/testing/bind/named.conf
new file mode 100644
index 000000000..38fb12cbe
--- /dev/null
+++ b/testing/bind/named.conf
@@ -0,0 +1,64 @@
+//
+// /etc/named.conf
+//
+
+options {
+ directory "/var/named";
+ pid-file "/var/run/named/named.pid";
+ auth-nxdomain yes;
+ datasize default;
+// Uncomment these to enable IPv6 connections support
+// IPv4 will still work:
+// listen-on-v6 { any; };
+// Add this for no IPv4:
+// listen-on { none; };
+
+ // Default security settings.
+ allow-recursion { 127.0.0.1; };
+ allow-transfer { none; };
+ allow-update { none; };
+ version none;
+ hostname none;
+ server-id none;
+};
+
+zone "localhost" IN {
+ type master;
+ file "localhost.zone";
+ allow-transfer { any; };
+};
+
+zone "0.0.127.in-addr.arpa" IN {
+ type master;
+ file "127.0.0.zone";
+ allow-transfer { any; };
+};
+
+zone "." IN {
+ type hint;
+ file "root.hint";
+};
+
+//zone "example.org" IN {
+// type slave;
+// file "example.zone";
+// masters {
+// 192.168.1.100;
+// };
+// allow-query { any; };
+// allow-transfer { any; };
+//};
+
+logging {
+ channel xfer-log {
+ file "/var/log/named.log";
+ print-category yes;
+ print-severity yes;
+ print-time yes;
+ severity info;
+ };
+ category xfer-in { xfer-log; };
+ category xfer-out { xfer-log; };
+ category notify { xfer-log; };
+};
+
diff --git a/testing/bind/named.conf.d b/testing/bind/named.conf.d
new file mode 100644
index 000000000..aecbd2307
--- /dev/null
+++ b/testing/bind/named.conf.d
@@ -0,0 +1,4 @@
+#
+# Parameters to be passed to BIND
+#
+NAMED_ARGS="-u named"
diff --git a/testing/bind/named.logrotate b/testing/bind/named.logrotate
new file mode 100644
index 000000000..ef1a2d032
--- /dev/null
+++ b/testing/bind/named.logrotate
@@ -0,0 +1,6 @@
+/var/log/named.log {
+ missingok
+ postrotate
+ /bin/kill -HUP `cat /var/run/named/named.pid 2>/dev/null` 2>/dev/null || true
+ endscript
+}
diff --git a/testing/bind/notools.patch b/testing/bind/notools.patch
new file mode 100644
index 000000000..2d16fdcd5
--- /dev/null
+++ b/testing/bind/notools.patch
@@ -0,0 +1,11 @@
+--- bind-9.7.0/bin/Makefile.in.orig 2010-03-14 21:19:23.000000000 -0400
++++ bind-9.7.0/bin/Makefile.in 2010-03-14 21:19:37.000000000 -0400
+@@ -19,7 +19,7 @@
+ VPATH = @srcdir@
+ top_srcdir = @top_srcdir@
+
+-SUBDIRS = named rndc dig dnssec tests tools nsupdate \
++SUBDIRS = named rndc dnssec tests tools \
+ check confgen @PKCS11_TOOLS@
+ TARGETS =
+
diff --git a/testing/bind/so_bsdcompat.patch b/testing/bind/so_bsdcompat.patch
new file mode 100644
index 000000000..cae2b835c
--- /dev/null
+++ b/testing/bind/so_bsdcompat.patch
@@ -0,0 +1,13 @@
+diff -aur old/lib/isc/unix/socket.c new/lib/isc/unix/socket.c
+--- old/lib/isc/unix/socket.c 2010-03-12 04:25:20.000000000 +0100
++++ new/lib/isc/unix/socket.c 2011-01-22 21:07:52.410000038 +0100
+@@ -681,6 +681,8 @@
+ isc_sockstatscounter_fdwatchrecvfail
+ };
+
++#undef SO_BSDCOMPAT
++
+ static void
+ manager_log(isc__socketmgr_t *sockmgr,
+ isc_logcategory_t *category, isc_logmodule_t *module, int level,
+Only in new/lib/isc/unix: socket.c.orig
diff --git a/testing/cifs-utils/PKGBUILD b/testing/cifs-utils/PKGBUILD
new file mode 100644
index 000000000..9c33cefba
--- /dev/null
+++ b/testing/cifs-utils/PKGBUILD
@@ -0,0 +1,26 @@
+# $Id: PKGBUILD 122574 2011-05-04 17:23:19Z ibiru $
+# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+pkgname=cifs-utils
+pkgver=4.9
+pkgrel=3
+pkgdesc="CIFS filesystem user-space tools"
+arch=(i686 x86_64)
+url="http://wiki.samba.org/index.php/LinuxCIFS_utils"
+license=('GPL')
+depends=('libcap' 'keyutils' 'krb5' 'talloc')
+source=(ftp://ftp.samba.org/pub/linux-cifs/cifs-utils/$pkgname-$pkgver.tar.bz2)
+md5sums=('908d904e6b9e58f09f530de151a88ef8')
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+ rm -r $pkgdir/usr/bin
+ # set mount.cifs uid, to enable none root mounting form fstab
+ chmod +s $pkgdir/sbin/mount.cifs
+}
diff --git a/testing/cups/PKGBUILD b/testing/cups/PKGBUILD
new file mode 100644
index 000000000..64ab5d109
--- /dev/null
+++ b/testing/cups/PKGBUILD
@@ -0,0 +1,110 @@
+# $Id: PKGBUILD 121078 2011-04-29 00:03:07Z stephane $
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+
+pkgbase="cups"
+pkgname=('libcups' 'cups')
+pkgver=1.4.6
+pkgrel=2
+arch=('i686' 'x86_64')
+license=('GPL')
+url="http://www.cups.org/"
+makedepends=('libtiff>=3.9.2-2' 'libpng>=1.4.0' 'acl' 'openslp' 'pam' 'xdg-utils' 'krb5' 'gnutls>=2.8.3' 'poppler>=0.12.3'
+ 'xinetd' 'gzip' 'autoconf' 'php' 'libusb-compat' 'dbus-core' 'avahi' 'hicolor-icon-theme')
+source=(ftp://ftp.easysw.com/pub/cups/${pkgver}/cups-${pkgver}-source.tar.bz2
+ cups-avahi.patch
+ cups cups.logrotate cups.pam)
+#options=('!emptydirs')
+md5sums=('de8fb5a29c36554925c0c6a6e2c0dae1'
+ '8ebd390197501ffd709f0ee546937fd5'
+ '5c85b7d8d2ddd02c2c64955cebbf55ea'
+ 'f861b18f4446c43918c8643dcbbd7f6d'
+ '96f82c38f3f540b53f3e5144900acf17')
+
+# move client.conf man page for next update to the client pkg.
+
+build() {
+ cd ${srcdir}/${pkgbase}-${pkgver}
+ # Avahi support in the dnssd backend. patch from Fedora
+ patch -Np1 -i ${srcdir}/cups-avahi.patch || return 1
+
+ # Rebuild configure script for --enable-avahi.
+ aclocal -I config-scripts
+ autoconf -I config-scripts
+
+ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --with-logdir=/var/log/cups -with-docdir=/usr/share/cups/doc \
+ --with-cups-user=daemon --with-cups-group=lp --enable-pam=yes \
+ --disable-ldap --libdir=/usr/lib --enable-raw-printing \
+ --enable-dbus --with-dbusdir=/etc/dbus-1 --enable-ssl=yes --enable-gnutls --disable-threads --enable-avahi\
+ --with-php=/usr/bin/php-cgi --with-pdftops=pdftops --with-optim="$CFLAGS"
+ make || return 1
+}
+
+package_libcups() {
+pkgdesc="The CUPS Printing System - client libraries and headers"
+depends=('gnutls>=2.8.3' 'libtiff>=3.9.2-2' 'libpng>=1.4.0' 'krb5' 'avahi')
+
+ cd ${srcdir}/${pkgbase}-${pkgver}
+ make BUILDROOT=${pkgdir} install-headers install-libs || return 1
+ # put this into the libs pkg to make other software find the libs(no pkg-config file included)
+ mkdir -p ${pkgdir}/usr/bin
+ install -m755 ${srcdir}/${pkgbase}-${pkgver}/cups-config ${pkgdir}/usr/bin/cups-config
+}
+
+package_cups() {
+pkgdesc="The CUPS Printing System - deamon package"
+install=cups.install
+backup=(etc/cups/cupsd.conf
+ etc/cups/mime.convs
+ etc/cups/mime.types
+ etc/cups/snmp.conf
+ etc/cups/printers.conf
+ etc/cups/classes.conf
+ etc/cups/client.conf
+ etc/cups/subscriptions.conf
+ etc/dbus-1/system.d/cups.conf
+ etc/logrotate.d/cups
+ etc/pam.d/cups
+ etc/xinetd.d/cups-lpd)
+depends=('acl' 'openslp' 'pam' "libcups>=${pkgver}" 'xdg-utils' 'poppler>=0.12.3' 'libusb-compat' 'dbus-core' 'hicolor-icon-theme')
+optdepends=('php: for included phpcups.so module')
+
+ cd ${srcdir}/${pkgbase}-${pkgver}
+ make BUILDROOT=${pkgdir} install-data install-exec || return 1
+
+ # this one we ship in the libcups pkg
+ rm -f ${pkgdir}/usr/bin/cups-config
+
+ # kill the sysv stuff
+ rm -rf ${pkgdir}/etc/rc*.d
+ rm -rf ${pkgdir}/etc/init.d
+ install -D -m755 ../cups ${pkgdir}/etc/rc.d/cups
+ install -D -m644 ../cups.logrotate ${pkgdir}/etc/logrotate.d/cups
+ install -D -m644 ../cups.pam ${pkgdir}/etc/pam.d/cups
+
+ # fix perms on /var/spool and /etc
+ chmod 755 ${pkgdir}/var/spool
+ chmod 755 ${pkgdir}/etc
+
+ # serial backend needs to run as root (http://bugs.archlinux.org/task/20396)
+ chmod 700 ${pkgdir}/usr/lib/cups/backend/serial
+
+ # install ssl directory where to store the certs, solves some samba issues
+ install -dm700 -g lp ${pkgdir}/etc/cups/ssl
+ install -dm511 -g lp ${pkgdir}/var/run/cups/certs
+
+ # install some more configuration files that will get filled by cupsd
+ touch ${pkgdir}/etc/cups/printers.conf
+ touch ${pkgdir}/etc/cups/classes.conf
+ touch ${pkgdir}/etc/cups/client.conf
+ echo "# see 'man client.conf'" >> ${pkgdir}/etc/cups/client.conf
+ echo "ServerName /var/run/cups/cups.sock # alternative: ServerName hostname-or-ip-address[:port] of a remote server" >> ${pkgdir}/etc/cups/client.conf
+ touch ${pkgdir}/etc/cups/subscriptions.conf
+ chgrp lp ${pkgdir}/etc/cups/{printers.conf,classes.conf,client.conf,subscriptions.conf}
+
+ # fix .desktop file
+ sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' ${pkgdir}/usr/share/applications/cups.desktop
+
+ # compress some driver files, adopted from Fedora
+ find ${pkgdir}/usr/share/cups/model -name "*.ppd" | xargs gzip -n9f
+}
diff --git a/testing/cups/cups b/testing/cups/cups
new file mode 100755
index 000000000..4afaf5a7c
--- /dev/null
+++ b/testing/cups/cups
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/cupsd`
+case "$1" in
+ start)
+ stat_busy "Starting CUPS Daemon"
+ [ -z "$PID" ] && /usr/sbin/cupsd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $(pidof -o %PPID -x /usr/sbin/cupsd) > /var/run/cups.pid
+ add_daemon cups
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping CUPS Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/cups.pid
+ rm_daemon cups
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/testing/cups/cups-avahi.patch b/testing/cups/cups-avahi.patch
new file mode 100644
index 000000000..cf1056a75
--- /dev/null
+++ b/testing/cups/cups-avahi.patch
@@ -0,0 +1,1089 @@
+diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+--- cups-1.4.5/backend/dnssd.c.avahi 2009-08-08 00:27:12.000000000 +0200
++++ cups-1.4.5/backend/dnssd.c 2010-11-12 13:13:31.000000000 +0100
+@@ -22,6 +22,7 @@
+ * exec_backend() - Execute the backend that corresponds to the
+ * resolved service name.
+ * get_device() - Create or update a device.
++* find_device()
+ * query_callback() - Process query data.
+ * sigterm_handler() - Handle termination signals...
+ * unquote() - Unquote a name string.
+@@ -33,7 +34,18 @@
+
+ #include "backend-private.h"
+ #include <cups/array.h>
+-#include <dns_sd.h>
++#ifdef HAVE_DNSSD
++# include <dns_sd.h>
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++# include <avahi-client/client.h>
++# include <avahi-client/lookup.h>
++# include <avahi-common/simple-watch.h>
++# include <avahi-common/domain.h>
++# include <avahi-common/error.h>
++# include <avahi-common/malloc.h>
++#define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX
++#endif /* HAVE_AVAHI */
+
+
+ /*
+@@ -52,7 +64,12 @@ typedef enum
+
+ typedef struct
+ {
++#ifdef HAVE_DNSSD
+ DNSServiceRef ref; /* Service reference for resolve */
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ int resolved; /* Did we resolve the device? */
++#endif /* HAVE_AVAHI */
+ char *name, /* Service name */
+ *domain, /* Domain name */
+ *fullName, /* Full name */
+@@ -64,6 +81,20 @@ typedef struct
+ sent; /* Did we list the device? */
+ } cups_device_t;
+
++typedef struct
++{
++ char key[256];
++ char value[256];
++
++#ifdef HAVE_DNSSD
++ const uint8_t *data;
++ const uint8_t *datanext;
++ const uint8_t *dataend;
++#else /* HAVE_AVAHI */
++ AvahiStringList *txt;
++#endif /* HAVE_DNSSD */
++} cups_txt_records_t;
++
+
+ /*
+ * Local globals...
+@@ -77,6 +108,7 @@ static int job_canceled = 0;
+ * Local functions...
+ */
+
++#ifdef HAVE_DNSSD
+ static void browse_callback(DNSServiceRef sdRef,
+ DNSServiceFlags flags,
+ uint32_t interfaceIndex,
+@@ -92,12 +124,6 @@ static void browse_local_callback(DNSSe
+ const char *regtype,
+ const char *replyDomain,
+ void *context);
+-static int compare_devices(cups_device_t *a, cups_device_t *b);
+-static void exec_backend(char **argv);
+-static cups_device_t *get_device(cups_array_t *devices,
+- const char *serviceName,
+- const char *regtype,
+- const char *replyDomain);
+ static void query_callback(DNSServiceRef sdRef,
+ DNSServiceFlags flags,
+ uint32_t interfaceIndex,
+@@ -106,9 +132,111 @@ static void query_callback(DNSServiceRe
+ uint16_t rrclass, uint16_t rdlen,
+ const void *rdata, uint32_t ttl,
+ void *context);
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++static void avahi_client_callback (AvahiClient *client,
++ AvahiClientState state,
++ void *context);
++static void avahi_browse_callback (AvahiServiceBrowser *browser,
++ AvahiIfIndex interface,
++ AvahiProtocol protocol,
++ AvahiBrowserEvent event,
++ const char *serviceName,
++ const char *regtype,
++ const char *replyDomain,
++ AvahiLookupResultFlags flags,
++ void *context);
++#endif /* HAVE_AVAHI */
++
++static cups_device_t * find_device (cups_array_t *devices,
++ cups_txt_records_t *txt,
++ cups_device_t *dkey);
++static int compare_devices(cups_device_t *a, cups_device_t *b);
++static void exec_backend(char **argv);
++static cups_device_t *get_device(cups_array_t *devices,
++ const char *serviceName,
++ const char *regtype,
++ const char *replyDomain);
+ static void sigterm_handler(int sig);
+ static void unquote(char *dst, const char *src, size_t dstsize);
+
++#ifdef HAVE_AVAHI
++static AvahiSimplePoll *simple_poll = NULL;
++static int avahi_got_callback;
++#endif /* HAVE_AVAHI */
++
++
++/*
++ * cups_txt_records_t access functions
++ */
++static cups_txt_records_t *
++next_txt_record (cups_txt_records_t *txt)
++{
++#ifdef HAVE_DNSSD
++ txt->data = txt->datanext;
++#else /* HAVE_AVAHI */
++ txt->txt = avahi_string_list_get_next (txt->txt);
++ if (txt->txt == NULL)
++ return NULL;
++#endif /* HAVE_DNSSD */
++
++ return txt;
++}
++
++static int
++parse_txt_record_pair (cups_txt_records_t *txt)
++{
++#ifdef HAVE_DNSSD
++ uint8_t datalen;
++ uint8_t *data = txt->data;
++ char *ptr;
++
++ /*
++ * Read a key/value pair starting with an 8-bit length. Since the
++ * length is 8 bits and the size of the key/value buffers is 256, we
++ * don't need to check for overflow...
++ */
++
++ datalen = *data++;
++ if (!datalen || (data + datalen) >= txt->dataend)
++ return NULL;
++ txt->datanext = data + datalen;
++
++ for (ptr = txt->key; data < txt->datanext && *data != '='; data ++)
++ *ptr++ = *data;
++ *ptr = '\0';
++
++ if (data < txt->datanext && *data == '=')
++ {
++ data++;
++
++ if (data < datanext)
++ memcpy (txt->value, data, txt->datanext - data);
++ value[txt->datanext - data] = '\0';
++ }
++ else
++ return 1;
++#else /* HAVE_AVAHI */
++ char *key, *value;
++ size_t len;
++ avahi_string_list_get_pair (txt->txt, &key, &value, &len);
++ if (len > sizeof (txt->value) - 1)
++ len = sizeof (txt->value) - 1;
++
++ memcpy (txt->value, value, len);
++ txt->value[len] = '\0';
++ len = strlen (key);
++ if (len > sizeof (txt->key) - 1)
++ len = sizeof (txt->key) - 1;
++
++ memcpy (txt->key, key, len);
++ txt->key[len] = '\0';
++ avahi_free (key);
++ avahi_free (value);
++#endif /* HAVE_AVAHI */
++
++ return 0;
++}
+
+ /*
+ * 'main()' - Browse for printers.
+@@ -119,6 +247,13 @@ main(int argc, /* I - Number of comm
+ char *argv[]) /* I - Command-line arguments */
+ {
+ const char *name; /* Backend name */
++ cups_array_t *devices; /* Device array */
++ cups_device_t *device; /* Current device */
++ char uriName[1024]; /* Unquoted fullName for URI */
++#ifdef HAVE_DNSSD
++ int fd; /* Main file descriptor */
++ fd_set input; /* Input set for select() */
++ struct timeval timeout; /* Timeout for select() */
+ DNSServiceRef main_ref, /* Main service reference */
+ fax_ipp_ref, /* IPP fax service reference */
+ ipp_ref, /* IPP service reference */
+@@ -130,12 +265,11 @@ main(int argc, /* I - Number of comm
+ pdl_datastream_ref, /* AppSocket service reference */
+ printer_ref, /* LPD service reference */
+ riousbprint_ref; /* Remote IO service reference */
+- int fd; /* Main file descriptor */
+- fd_set input; /* Input set for select() */
+- struct timeval timeout; /* Timeout for select() */
+- cups_array_t *devices; /* Device array */
+- cups_device_t *device; /* Current device */
+- char uriName[1024]; /* Unquoted fullName for URI */
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ AvahiClient *client;
++ int error;
++#endif /* HAVE_AVAHI */
+ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+@@ -194,6 +328,49 @@ main(int argc, /* I - Number of comm
+ * Browse for different kinds of printers...
+ */
+
++#ifdef HAVE_AVAHI
++ if ((simple_poll = avahi_simple_poll_new ()) == NULL)
++ {
++ perror ("ERROR: Unable to create avahi simple poll object");
++ return (1);
++ }
++
++ client = avahi_client_new (avahi_simple_poll_get (simple_poll),
++ 0, avahi_client_callback, NULL, &error);
++ if (!client)
++ {
++ perror ("ERROR: Unable to create avahi client");
++ return (1);
++ }
++
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_fax-ipp._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_ipp._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_ipp-tls._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_pdl-datastream._tcp",
++ NULL, 0,
++ avahi_browse_callback,
++ devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_printer._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_riousbprint._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++#endif /* HAVE_AVAHI */
++#ifdef HAVE_DNSSD
+ if (DNSServiceCreateConnection(&main_ref) != kDNSServiceErr_NoError)
+ {
+ perror("ERROR: Unable to create service connection");
+@@ -245,6 +422,7 @@ main(int argc, /* I - Number of comm
+ riousbprint_ref = main_ref;
+ DNSServiceBrowse(&riousbprint_ref, kDNSServiceFlagsShareConnection, 0,
+ "_riousbprint._tcp", NULL, browse_callback, devices);
++#endif /* HAVE_DNSSD */
+
+ /*
+ * Loop until we are killed...
+@@ -252,6 +430,9 @@ main(int argc, /* I - Number of comm
+
+ while (!job_canceled)
+ {
++ int announce = 0;
++
++#ifdef HAVE_DNSSD
+ FD_ZERO(&input);
+ FD_SET(fd, &input);
+
+@@ -271,11 +452,35 @@ main(int argc, /* I - Number of comm
+ }
+ else
+ {
++ announce = 1;
++ }
++#else /* HAVE_AVAHI */
++ int r;
++ avahi_got_callback = 0;
++ r = avahi_simple_poll_iterate (simple_poll, 1);
++ if (r != 0 && r != EINTR)
++ {
++ /*
++ * We've been told to exit the loop. Perhaps the connection to
++ * avahi failed.
++ */
++
++ break;
++ }
++
++ if (avahi_got_callback)
++ announce = 1;
++#endif /* HAVE_DNSSD */
++
++ if (announce)
++ {
+ /*
+ * Announce any devices we've found...
+ */
+
++#ifdef HAVE_DNSSD
+ DNSServiceErrorType status; /* DNS query status */
++#endif /* HAVE_DNSSD */
+ cups_device_t *best; /* Best matching device */
+ char device_uri[1024]; /* Device URI */
+ int count; /* Number of queries */
+@@ -285,6 +490,7 @@ main(int argc, /* I - Number of comm
+ best = NULL, count = 0;
+ device;
+ device = (cups_device_t *)cupsArrayNext(devices))
++#ifdef HAVE_DNSSD
+ if (!device->ref && !device->sent)
+ {
+ /*
+@@ -313,14 +519,23 @@ main(int argc, /* I - Number of comm
+ count ++;
+ }
+ }
+- else if (!device->sent)
++ else
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ if (!device->resolved)
++ continue;
++ else
++#endif /* HAVE_AVAHI */
++ if (!device->sent)
+ {
++#ifdef HAVE_DNSSD
+ /*
+ * Got the TXT records, now report the device...
+ */
+
+ DNSServiceRefDeallocate(device->ref);
+ device->ref = 0;
++#endif /* HAVE_DNSSD */
+
+ if (!best)
+ best = device;
+@@ -372,6 +587,7 @@ main(int argc, /* I - Number of comm
+ * 'browse_callback()' - Browse devices.
+ */
+
++#ifdef HAVE_DNSSD
+ static void
+ browse_callback(
+ DNSServiceRef sdRef, /* I - Service reference */
+@@ -405,12 +621,14 @@ browse_callback(
+
+ get_device((cups_array_t *)context, serviceName, regtype, replyDomain);
+ }
++#endif /* HAVE_DNSSD */
+
+
+ /*
+ * 'browse_local_callback()' - Browse local devices.
+ */
+
++#ifdef HAVE_DNSSD
+ static void
+ browse_local_callback(
+ DNSServiceRef sdRef, /* I - Service reference */
+@@ -456,6 +674,7 @@ browse_local_callback(
+ device->fullName);
+ device->sent = 1;
+ }
++#endif /* HAVE_DNSSD */
+
+
+ /*
+@@ -528,6 +747,32 @@ exec_backend(char **argv) /* I - Comman
+ exit(CUPS_BACKEND_STOP);
+ }
+
++static int
++device_type (const char *regtype)
++{
++#ifdef HAVE_AVAHI
++ if (!strcmp(regtype, "_ipp._tcp") ||
++ !strcmp(regtype, "_ipp-tls._tcp"))
++ return (CUPS_DEVICE_IPP);
++ else if (!strcmp(regtype, "_fax-ipp._tcp"))
++ return (CUPS_DEVICE_FAX_IPP);
++ else if (!strcmp(regtype, "_printer._tcp"))
++ return (CUPS_DEVICE_PDL_DATASTREAM);
++#else
++ if (!strcmp(regtype, "_ipp._tcp.") ||
++ !strcmp(regtype, "_ipp-tls._tcp."))
++ return (CUPS_DEVICE_IPP);
++ else if (!strcmp(regtype, "_fax-ipp._tcp."))
++ return (CUPS_DEVICE_FAX_IPP);
++ else if (!strcmp(regtype, "_printer._tcp."))
++ return (CUPS_DEVICE_PRINTER);
++ else if (!strcmp(regtype, "_pdl-datastream._tcp."))
++ return (CUPS_DEVICE_PDL_DATASTREAM);
++#endif /* HAVE_AVAHI */
++
++ return (CUPS_DEVICE_RIOUSBPRINT);
++}
++
+
+ /*
+ * 'get_device()' - Create or update a device.
+@@ -550,18 +795,7 @@ get_device(cups_array_t *devices, /* I -
+ */
+
+ key.name = (char *)serviceName;
+-
+- if (!strcmp(regtype, "_ipp._tcp.") ||
+- !strcmp(regtype, "_ipp-tls._tcp."))
+- key.type = CUPS_DEVICE_IPP;
+- else if (!strcmp(regtype, "_fax-ipp._tcp."))
+- key.type = CUPS_DEVICE_FAX_IPP;
+- else if (!strcmp(regtype, "_printer._tcp."))
+- key.type = CUPS_DEVICE_PRINTER;
+- else if (!strcmp(regtype, "_pdl-datastream._tcp."))
+- key.type = CUPS_DEVICE_PDL_DATASTREAM;
+- else
+- key.type = CUPS_DEVICE_RIOUSBPRINT;
++ key.type = device_type (regtype);
+
+ for (device = cupsArrayFind(devices, &key);
+ device;
+@@ -581,8 +815,14 @@ get_device(cups_array_t *devices, /* I -
+ free(device->domain);
+ device->domain = strdup(replyDomain);
+
++#ifdef HAVE_DNSSD
+ DNSServiceConstructFullName(fullName, device->name, regtype,
+ replyDomain);
++#else /* HAVE_AVAHI */
++ avahi_service_name_join (fullName, kDNSServiceMaxDomainName,
++ serviceName, regtype, replyDomain);
++#endif /* HAVE_DNSSD */
++
+ free(device->fullName);
+ device->fullName = strdup(fullName);
+ }
+@@ -602,6 +842,9 @@ get_device(cups_array_t *devices, /* I -
+ device->domain = strdup(replyDomain);
+ device->type = key.type;
+ device->priority = 50;
++#ifdef HAVE_AVAHI
++ device->resolved = 0;
++#endif /* HAVE_AVAHI */
+
+ cupsArrayAdd(devices, device);
+
+@@ -609,7 +852,13 @@ get_device(cups_array_t *devices, /* I -
+ * Set the "full name" of this service, which is used for queries...
+ */
+
++#ifdef HAVE_DNSSD
+ DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain);
++#else /* HAVE_AVAHI */
++ avahi_service_name_join (fullName, kDNSServiceMaxDomainName,
++ serviceName, regtype, replyDomain);
++#endif /* HAVE_DNSSD */
++
+ device->fullName = strdup(fullName);
+
+ return (device);
+@@ -620,6 +869,7 @@ get_device(cups_array_t *devices, /* I -
+ * 'query_callback()' - Process query data.
+ */
+
++#ifdef HAVE_DNSSD
+ static void
+ query_callback(
+ DNSServiceRef sdRef, /* I - Service reference */
+@@ -639,7 +889,7 @@ query_callback(
+ *ptr; /* Pointer into string */
+ cups_device_t dkey, /* Search key */
+ *device; /* Device */
+-
++ cups_txt_records_t txt;
+
+ fprintf(stderr, "DEBUG2: query_callback(sdRef=%p, flags=%x, "
+ "interfaceIndex=%d, errorCode=%d, fullName=\"%s\", "
+@@ -673,84 +923,212 @@ query_callback(
+ if ((ptr = strstr(name, "._")) != NULL)
+ *ptr = '\0';
+
+- if (strstr(fullName, "_ipp._tcp.") ||
+- strstr(fullName, "_ipp-tls._tcp."))
+- dkey.type = CUPS_DEVICE_IPP;
+- else if (strstr(fullName, "_fax-ipp._tcp."))
+- dkey.type = CUPS_DEVICE_FAX_IPP;
+- else if (strstr(fullName, "_printer._tcp."))
+- dkey.type = CUPS_DEVICE_PRINTER;
+- else if (strstr(fullName, "_pdl-datastream._tcp."))
+- dkey.type = CUPS_DEVICE_PDL_DATASTREAM;
++ dkey.type = device_type (fullName);
++
++ txt.data = rdata;
++ txt.dataend = rdata + rdlen;
++ device = find_device ((cups_array_t *) context, &txt, &dkey);
++ if (!device)
++ fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
++}
++#endif /* HAVE_DNSSD */
++
++#ifdef HAVE_AVAHI
++static void
++avahi_client_callback(AvahiClient *client,
++ AvahiClientState state,
++ void *context)
++{
++ /*
++ * If the connection drops, quit.
++ */
++
++ if (state == AVAHI_CLIENT_FAILURE)
++ {
++ fprintf (stderr, "ERROR: Avahi connection failed\n");
++ avahi_simple_poll_quit (simple_poll);
++ }
++}
++
++static void
++avahi_query_callback(AvahiServiceResolver *resolver,
++ AvahiIfIndex interface,
++ AvahiProtocol protocol,
++ AvahiResolverEvent event,
++ const char *name,
++ const char *type,
++ const char *domain,
++ const char *host_name,
++ const AvahiAddress *address,
++ uint16_t port,
++ AvahiStringList *txt,
++ AvahiLookupResultFlags flags,
++ void *context)
++{
++ AvahiClient *client;
++ cups_device_t key,
++ *device;
++ char uqname[1024],
++ *ptr;
++ cups_txt_records_t txtr;
++
++ client = avahi_service_resolver_get_client (resolver);
++ if (event != AVAHI_RESOLVER_FOUND)
++ {
++ if (event == AVAHI_RESOLVER_FAILURE)
++ {
++ fprintf (stderr, "ERROR: %s\n",
++ avahi_strerror (avahi_client_errno (client)));
++ }
++
++ avahi_service_resolver_free (resolver);
++ return;
++ }
++
++ /*
++ * Set search key for device.
++ */
++
++ key.name = uqname;
++ unquote (uqname, name, sizeof (uqname));
++ if ((ptr = strstr(name, "._")) != NULL)
++ *ptr = '\0';
++
++ key.domain = (char *) domain;
++ key.type = device_type (type);
++
++ /*
++ * Find the device and the the TXT information.
++ */
++
++ txtr.txt = txt;
++ device = find_device ((cups_array_t *) context, &txtr, &key);
++ if (device)
++ {
++ /*
++ * Let the main loop know to announce the device.
++ */
++
++ device->resolved = 1;
++ avahi_got_callback = 1;
++ }
+ else
+- dkey.type = CUPS_DEVICE_RIOUSBPRINT;
++ fprintf (stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", name);
++
++ avahi_service_resolver_free (resolver);
++}
++
++static void
++avahi_browse_callback(AvahiServiceBrowser *browser,
++ AvahiIfIndex interface,
++ AvahiProtocol protocol,
++ AvahiBrowserEvent event,
++ const char *name,
++ const char *type,
++ const char *domain,
++ AvahiLookupResultFlags flags,
++ void *context)
++{
++ AvahiClient *client = avahi_service_browser_get_client (browser);
++
++ switch (event)
++ {
++ case AVAHI_BROWSER_FAILURE:
++ fprintf (stderr, "ERROR: %s\n",
++ avahi_strerror (avahi_client_errno (client)));
++ avahi_simple_poll_quit (simple_poll);
++ return;
++
++ case AVAHI_BROWSER_NEW:
++ /*
++ * This object is new on the network.
++ */
++
++ if (flags & AVAHI_LOOKUP_RESULT_LOCAL)
++ {
++ /*
++ * This comes from the local machine so ignore it.
++ */
++
++ fprintf (stderr, "DEBUG: ignoring local service %s\n", name);
++ }
++ else
++ {
++ /*
++ * Create a device entry for it if it doesn't yet exist.
++ */
++
++ get_device ((cups_array_t *)context, name, type, domain);
++
++ /*
++ * Now look for a TXT entry.
++ */
++
++ if (avahi_service_resolver_new (client, interface, protocol,
++ name, type, domain,
++ AVAHI_PROTO_UNSPEC, 0,
++ avahi_query_callback, context) == NULL)
++ {
++ fprintf (stderr, "ERROR: failed to resolve service %s: %s\n",
++ name, avahi_strerror (avahi_client_errno (client)));
++ }
++ }
++
++ break;
+
+- for (device = cupsArrayFind(devices, &dkey);
++ case AVAHI_BROWSER_REMOVE:
++ case AVAHI_BROWSER_ALL_FOR_NOW:
++ case AVAHI_BROWSER_CACHE_EXHAUSTED:
++ break;
++ }
++}
++#endif /* HAVE_AVAHI */
++
++static cups_device_t *
++find_device (cups_array_t *devices,
++ cups_txt_records_t *txt,
++ cups_device_t *dkey)
++{
++ cups_device_t *device;
++ char *ptr;
++
++ for (device = cupsArrayFind(devices, dkey);
+ device;
+ device = cupsArrayNext(devices))
+ {
+- if (strcasecmp(device->name, dkey.name) ||
+- strcasecmp(device->domain, dkey.domain))
++ if (strcasecmp(device->name, dkey->name) ||
++ strcasecmp(device->domain, dkey->domain))
+ {
+ device = NULL;
+ break;
+ }
+- else if (device->type == dkey.type)
++ else if (device->type == dkey->type)
+ {
+ /*
+ * Found it, pull out the priority and make and model from the TXT
+ * record and save it...
+ */
+
+- const uint8_t *data, /* Pointer into data */
+- *datanext, /* Next key/value pair */
+- *dataend; /* End of entire TXT record */
+- uint8_t datalen; /* Length of current key/value pair */
+- char key[256], /* Key string */
+- value[256], /* Value string */
+- make_and_model[512],
++ char make_and_model[512],
+ /* Manufacturer and model */
+ model[256], /* Model */
+- device_id[2048];/* 1284 device ID */
+-
++ device_id[2048]; /* 1284 device ID */
+
+ device_id[0] = '\0';
+ make_and_model[0] = '\0';
+
+ strcpy(model, "Unknown");
+
+- for (data = rdata, dataend = data + rdlen;
+- data < dataend;
+- data = datanext)
++ for (;;)
+ {
+- /*
+- * Read a key/value pair starting with an 8-bit length. Since the
+- * length is 8 bits and the size of the key/value buffers is 256, we
+- * don't need to check for overflow...
+- */
+-
+- datalen = *data++;
+-
+- if (!datalen || (data + datalen) >= dataend)
+- break;
+-
+- datanext = data + datalen;
++ char *key;
++ char *value;
+
+- for (ptr = key; data < datanext && *data != '='; data ++)
+- *ptr++ = *data;
+- *ptr = '\0';
+-
+- if (data < datanext && *data == '=')
+- {
+- data ++;
+-
+- if (data < datanext)
+- memcpy(value, data, datanext - data);
+- value[datanext - data] = '\0';
+- }
+- else
+- continue;
++ if (parse_txt_record_pair (txt))
++ goto next;
+
++ key = txt->key;
++ value = txt->value;
+ if (!strncasecmp(key, "usb_", 4))
+ {
+ /*
+@@ -805,6 +1183,10 @@ query_callback(
+ if (device->type == CUPS_DEVICE_PRINTER)
+ device->sent = 1;
+ }
++
++ next:
++ if (next_txt_record (txt) == NULL)
++ break;
+ }
+
+ if (device->device_id)
+@@ -854,11 +1236,9 @@ query_callback(
+ }
+ }
+
+- if (!device)
+- fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
++ return device;
+ }
+
+-
+ /*
+ * 'sigterm_handler()' - Handle termination signals...
+ */
+diff -up cups-1.4.5/config.h.in.avahi cups-1.4.5/config.h.in
+--- cups-1.4.5/config.h.in.avahi 2010-08-13 06:11:46.000000000 +0200
++++ cups-1.4.5/config.h.in 2010-11-12 13:13:31.000000000 +0100
+@@ -344,6 +344,13 @@
+
+
+ /*
++ * Do we have Avahi for DNS Service Discovery?
++ */
++
++#undef HAVE_AVAHI
++
++
++/*
+ * Do we have <sys/ioctl.h>?
+ */
+
+diff -up cups-1.4.5/config-scripts/cups-dnssd.m4.avahi cups-1.4.5/config-scripts/cups-dnssd.m4
+--- cups-1.4.5/config-scripts/cups-dnssd.m4.avahi 2009-08-29 00:54:34.000000000 +0200
++++ cups-1.4.5/config-scripts/cups-dnssd.m4 2010-11-12 13:13:31.000000000 +0100
+@@ -27,6 +27,21 @@ AC_ARG_WITH(dnssd-includes, [ --with-dn
+ DNSSDLIBS=""
+ DNSSD_BACKEND=""
+
++AC_ARG_ENABLE(avahi, [ --enable-avahi turn on DNS Service Discovery support, default=no],
++ [if test x$enable_avahi = xyes; then
++ AC_MSG_CHECKING(for Avahi)
++ if $PKGCONFIG --exists avahi-client; then
++ AC_MSG_RESULT(yes)
++ CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`"
++ DNSSDLIBS="`$PKGCONFIG --libs avahi-client`"
++ DNSSD_BACKEND="dnssd"
++ AC_DEFINE(HAVE_AVAHI)
++ enable_dnssd=no
++ else
++ AC_MSG_RESULT(no)
++ fi
++ fi])
++
+ if test x$enable_dnssd != xno; then
+ AC_CHECK_HEADER(dns_sd.h, [
+ case "$uname" in
+diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
+--- cups-1.4.5/cups/http-support.c.avahi 2010-10-02 00:40:38.000000000 +0200
++++ cups-1.4.5/cups/http-support.c 2010-11-12 13:28:45.000000000 +0100
+@@ -55,6 +55,11 @@
+ # include <dns_sd.h>
+ # include <poll.h>
+ #endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++# include <avahi-client/client.h>
++# include <avahi-client/lookup.h>
++# include <avahi-common/simple-watch.h>
++#endif /* HAVE_AVAHI */
+
+
+ /*
+@@ -121,6 +126,24 @@ static void resolve_callback(DNSService
+ void *context);
+ #endif /* HAVE_DNSSD */
+
++#ifdef HAVE_AVAHI
++static void avahi_resolve_uri_client_cb(AvahiClient *client,
++ AvahiClientState state,
++ void *simple_poll);
++static void avahi_resolve_uri_resolver_cb(AvahiServiceResolver *resolver,
++ AvahiIfIndex interface,
++ AvahiProtocol protocol,
++ AvahiResolverEvent event,
++ const char *name,
++ const char *type,
++ const char *domain,
++ const char *host_name,
++ const AvahiAddress *address,
++ uint16_t port,
++ AvahiStringList *txt,
++ AvahiLookupResultFlags flags,
++ void *context);
++#endif /* HAVE_AVAHI */
+
+ /*
+ * 'httpAssembleURI()' - Assemble a uniform resource identifier from its
+@@ -1351,16 +1374,27 @@ _httpResolveURI(
+
+ if (strstr(hostname, "._tcp"))
+ {
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
++ char *regtype, /* Pointer to type in hostname */
++ *domain; /* Pointer to domain in hostname */
+ #ifdef HAVE_DNSSD
+ DNSServiceRef ref, /* DNS-SD master service reference */
+ domainref, /* DNS-SD service reference for domain */
+ localref; /* DNS-SD service reference for .local */
+ int domainsent = 0, /* Send the domain resolve? */
+ offline = 0; /* offline-report state set? */
+- char *regtype, /* Pointer to type in hostname */
+- *domain; /* Pointer to domain in hostname */
+ _http_uribuf_t uribuf; /* URI buffer */
+ struct pollfd polldata; /* Polling data */
++#else /* HAVE_AVAHI */
++ AvahiSimplePoll *simple_poll;
++ AvahiClient *client;
++ int error;
++ struct
++ {
++ AvahiSimplePoll *poll;
++ _http_uribuf_t uribuf;
++ } user_data;
++#endif /* HAVE_DNSSD */
+
+
+ if (logit)
+@@ -1398,8 +1432,13 @@ _httpResolveURI(
+ if (domain)
+ *domain++ = '\0';
+
++#ifdef HAVE_DNSSD
+ uribuf.buffer = resolved_uri;
+ uribuf.bufsize = resolved_size;
++#else
++ user_data.uribuf.buffer = resolved_uri;
++ user_data.uribuf.bufsize = resolved_size;
++#endif
+
+ resolved_uri[0] = '\0';
+
+@@ -1414,6 +1453,7 @@ _httpResolveURI(
+
+ uri = NULL;
+
++#ifdef HAVE_DNSSD
+ if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
+ {
+ localref = ref;
+@@ -1500,6 +1540,36 @@ _httpResolveURI(
+
+ DNSServiceRefDeallocate(ref);
+ }
++#else /* HAVE_AVAHI */
++ if ((simple_poll = avahi_simple_poll_new ()) != NULL)
++ {
++ if ((client = avahi_client_new (avahi_simple_poll_get (simple_poll),
++ 0, avahi_resolve_uri_client_cb,
++ &simple_poll, &error)) != NULL)
++ {
++ user_data.poll = simple_poll;
++ if (avahi_service_resolver_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC, hostname,
++ regtype, domain, AVAHI_PROTO_UNSPEC, 0,
++ avahi_resolve_uri_resolver_cb,
++ &user_data) != NULL)
++ {
++ avahi_simple_poll_loop (simple_poll);
++
++ /*
++ * Collect the result.
++ */
++
++ if (resolved_uri[0])
++ uri = resolved_uri;
++ }
++
++ avahi_client_free (client);
++ }
++
++ avahi_simple_poll_free (simple_poll);
++ }
++#endif /* HAVE_DNSSD */
+
+ if (logit)
+ {
+@@ -1511,13 +1581,13 @@ _httpResolveURI(
+ fputs("STATE: -connecting-to-device,offline-report\n", stderr);
+ }
+
+-#else
++#else /* HAVE_DNSSD || HAVE_AVAHI */
+ /*
+ * No DNS-SD support...
+ */
+
+ uri = NULL;
+-#endif /* HAVE_DNSSD */
++#endif /* HAVE_DNSSD || HAVE_AVAHI */
+
+ if (logit && !uri)
+ _cupsLangPuts(stderr, _("Unable to find printer!\n"));
+@@ -1722,6 +1792,105 @@ resolve_callback(
+ }
+ #endif /* HAVE_DNSSD */
+
++#ifdef HAVE_AVAHI
++static void
++avahi_resolve_uri_client_cb (AvahiClient *client,
++ AvahiClientState state,
++ void *simple_poll)
++{
++ DEBUG_printf(("avahi_resolve_uri_client_callback(client=%p, state=%d, "
++ "simple_poll=%p)\n", client, state, simple_poll));
++
++ /*
++ * If the connection drops, quit.
++ */
++
++ if (state == AVAHI_CLIENT_FAILURE)
++ avahi_simple_poll_quit (simple_poll);
++}
++
++static void
++avahi_resolve_uri_resolver_cb (AvahiServiceResolver *resolver,
++ AvahiIfIndex interface,
++ AvahiProtocol protocol,
++ AvahiResolverEvent event,
++ const char *name,
++ const char *type,
++ const char *domain,
++ const char *host_name,
++ const AvahiAddress *address,
++ uint16_t port,
++ AvahiStringList *txt,
++ AvahiLookupResultFlags flags,
++ void *context)
++{
++ const char *scheme; /* URI scheme */
++ char rp[256]; /* Remote printer */
++ AvahiStringList *pair;
++ char *value;
++ size_t valueLen = 0;
++ char addr[AVAHI_ADDRESS_STR_MAX];
++ struct
++ {
++ AvahiSimplePoll *poll;
++ _http_uribuf_t uribuf;
++ } *poll_uribuf = context;
++
++ DEBUG_printf(("avahi_resolve_uri_resolver_callback(resolver=%p, "
++ "interface=%d, protocol=%d, event=%d, name=\"%s\", "
++ "type=\"%s\", domain=\"%s\", host_name=\"%s\", address=%p, "
++ "port=%d, txt=%p, flags=%d, context=%p)\n",
++ resolver, interface, protocol, event, name, type, domain,
++ host_name, address, port, txt, flags, context));
++
++ if (event != AVAHI_RESOLVER_FOUND)
++ {
++ avahi_service_resolver_free (resolver);
++ avahi_simple_poll_quit (poll_uribuf->poll);
++ return;
++ }
++
++ /*
++ * Figure out the scheme from the full name...
++ */
++
++ if (strstr(type, "_ipp."))
++ scheme = "ipp";
++ else if (strstr(type, "_printer."))
++ scheme = "lpd";
++ else if (strstr(type, "_pdl-datastream."))
++ scheme = "socket";
++ else
++ scheme = "riousbprint";
++
++ /*
++ * Extract the "remote printer key from the TXT record...
++ */
++
++ if ((pair = avahi_string_list_find (txt, "rp")) != NULL)
++ {
++ avahi_string_list_get_pair (pair, NULL, &value, &valueLen);
++ rp[0] = '/';
++ memcpy (rp + 1, value, valueLen);
++ rp[valueLen + 1] = '\0';
++ }
++ else
++ rp[0] = '\0';
++
++ /*
++ * Assemble the final device URI...
++ */
++
++ avahi_address_snprint (addr, AVAHI_ADDRESS_STR_MAX, address);
++ httpAssembleURI(HTTP_URI_CODING_ALL, poll_uribuf->uribuf.buffer,
++ poll_uribuf->uribuf.bufsize, scheme, NULL,
++ addr, port, rp);
++ DEBUG_printf(("avahi_resolve_uri_resolver_callback: Resolved URI is \"%s\"\n",
++ poll_uribuf->uribuf.buffer));
++ avahi_simple_poll_quit (poll_uribuf->poll);
++}
++#endif /* HAVE_AVAHI */
++
+
+ /*
+ * End of "$Id: http-support.c 9322 2010-10-01 22:40:38Z mike $".
diff --git a/testing/cups/cups.install b/testing/cups/cups.install
new file mode 100644
index 000000000..e92e17ed3
--- /dev/null
+++ b/testing/cups/cups.install
@@ -0,0 +1,15 @@
+post_install() {
+ xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+ echo ">> If you use an HTTPS connection to CUPS, the first time you access"
+ echo ">> the interface it may take a very long time before the site comes up."
+ echo ">> This is because the first request triggers the generation of the CUPS"
+ echo ">> SSL certificates which can be a very time-consuming job."
+}
+
+post_upgrade() {
+ xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+}
+
+post_remove() {
+ xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+}
diff --git a/testing/cups/cups.logrotate b/testing/cups/cups.logrotate
new file mode 100644
index 000000000..9c49bbdaf
--- /dev/null
+++ b/testing/cups/cups.logrotate
@@ -0,0 +1,8 @@
+/var/log/cups/*log {
+ missingok
+ notifempty
+ delaycompress
+ postrotate
+ /bin/kill -HUP `cat /var/run/cups.pid 2>/dev/null` 2>/dev/null || true
+ endscript
+}
diff --git a/testing/cups/cups.pam b/testing/cups/cups.pam
new file mode 100644
index 000000000..53724d1f8
--- /dev/null
+++ b/testing/cups/cups.pam
@@ -0,0 +1,3 @@
+auth required pam_unix.so
+account required pam_unix.so
+session required pam_unix.so
diff --git a/testing/cvs/PKGBUILD b/testing/cvs/PKGBUILD
new file mode 100644
index 000000000..76f71a2a1
--- /dev/null
+++ b/testing/cvs/PKGBUILD
@@ -0,0 +1,39 @@
+# $Id: PKGBUILD 121072 2011-04-28 22:54:58Z stephane $
+# Contributor: dorphell <dorphell@archlinux.org>
+
+pkgname=cvs
+pkgver=1.11.23
+pkgrel=7
+pkgdesc="Concurrent Versions System - a source control system"
+arch=(i686 x86_64)
+url="http://cvs.nongnu.org"
+license=('GPL')
+depends=('krb5')
+optdepends=('openssh: for using cvs over ssh' 'inetutils: for using cvs over rsh')
+install=cvs.install
+source=(ftp://ftp.gnu.org/non-gnu/cvs/source/stable/${pkgver}/${pkgname}-${pkgver}.tar.bz2
+ cvs-1.11.23-getline64.patch
+ cvs-1.11.23-cve-2010-3846.patch)
+sha256sums=('400f51b59d85116e79b844f2d5dbbad4759442a789b401a94aa5052c3d7a4aa9'
+ '9126d7992ace943980ad8a10d5a09aeb6f1eeeb9b921fc796fe31de7b1c220cf'
+ 'c6506d0a5efc7b0cab6415f26e070ec214fb9781fac8d295506f4d0825431a8f')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ unset EDITOR VISUAL
+
+ patch -Np1 -i ../cvs-1.11.23-getline64.patch
+
+ # CVE-2010-3864, see https://www.redhat.com/security/data/cve/CVE-2010-3846.html
+ patch -Np1 -i ../cvs-1.11.23-cve-2010-3846.patch
+
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+ rm "${pkgdir}"/usr/share/info/dir
+}
diff --git a/testing/cvs/cvs-1.11.23-cve-2010-3846.patch b/testing/cvs/cvs-1.11.23-cve-2010-3846.patch
new file mode 100644
index 000000000..e1560cef8
--- /dev/null
+++ b/testing/cvs/cvs-1.11.23-cve-2010-3846.patch
@@ -0,0 +1,167 @@
+From b122edcb68ff05bb6eb22f6e50423e7f1050841b Mon Sep 17 00:00:00 2001
+From: Larry Jones <lawrence.jones@siemens.com>
+Date: Thu, 21 Oct 2010 10:08:16 +0200
+Subject: [PATCH] Fix for CVE-2010-3846
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Mallformed RCS revision (delete after the end of input file, or overlayed
+deleted regions) screws output file image size computation. This leads to
+write attempt after the allocated memory opening hiden memory corruption
+driven by CVS server.
+
+Signed-off-by: Petr PĂ­saĹ™ <ppisar@redhat.com>
+---
+ src/rcs.c | 52 +++++++++++++++++++++++++++++-----------------------
+ 1 files changed, 29 insertions(+), 23 deletions(-)
+
+diff --git a/src/rcs.c b/src/rcs.c
+index 7d0d078..2f88f85 100644
+--- a/src/rcs.c
++++ b/src/rcs.c
+@@ -7128,7 +7128,7 @@ apply_rcs_changes (orig_lines, diffbuf, difflen, name, addvers, delvers)
+ struct deltafrag *dfhead;
+ struct deltafrag **dftail;
+ struct deltafrag *df;
+- unsigned long numlines, lastmodline, offset;
++ unsigned long numlines, offset;
+ struct linevector lines;
+ int err;
+
+@@ -7202,12 +7202,12 @@ apply_rcs_changes (orig_lines, diffbuf, difflen, name, addvers, delvers)
+
+ /* New temp data structure to hold new org before
+ copy back into original structure. */
+- lines.nlines = lines.lines_alloced = numlines;
++ lines.lines_alloced = numlines;
+ lines.vector = xmalloc (numlines * sizeof *lines.vector);
+
+ /* We changed the list order to first to last -- so the
+ list never gets larger than the size numlines. */
+- lastmodline = 0;
++ lines.nlines = 0;
+
+ /* offset created when adding/removing lines
+ between new and original structure */
+@@ -7216,25 +7216,24 @@ apply_rcs_changes (orig_lines, diffbuf, difflen, name, addvers, delvers)
+ for (df = dfhead; df != NULL; )
+ {
+ unsigned int ln;
+- unsigned long deltaend;
++ unsigned long newpos = df->pos - offset;
+
+- if (df->pos > orig_lines->nlines)
++ if (newpos < lines.nlines || newpos > numlines)
+ err = 1;
+
+ /* On error, just free the rest of the list. */
+ if (!err)
+ {
+- /* Here we need to get to the line where the next insert will
++ /* Here we need to get to the line where the next change will
+ begin, which is DF->pos in ORIG_LINES. We will fill up to
+ DF->pos - OFFSET in LINES with original items. */
+- for (deltaend = df->pos - offset;
+- lastmodline < deltaend;
+- lastmodline++)
++ while (lines.nlines < newpos)
+ {
+ /* we need to copy from the orig structure into new one */
+- lines.vector[lastmodline] =
+- orig_lines->vector[lastmodline + offset];
+- lines.vector[lastmodline]->refcount++;
++ lines.vector[lines.nlines] =
++ orig_lines->vector[lines.nlines + offset];
++ lines.vector[lines.nlines]->refcount++;
++ lines.nlines++;
+ }
+
+ switch (df->type)
+@@ -7246,7 +7245,12 @@ apply_rcs_changes (orig_lines, diffbuf, difflen, name, addvers, delvers)
+ struct line *q;
+ int nextline_newline;
+ size_t nextline_len;
+-
++
++ if (newpos + df->nlines > numlines)
++ {
++ err = 1;
++ break;
++ }
+ textend = df->new_lines + df->len;
+ nextline_newline = 0;
+ nextline_text = df->new_lines;
+@@ -7271,8 +7275,7 @@ apply_rcs_changes (orig_lines, diffbuf, difflen, name, addvers, delvers)
+ q->has_newline = nextline_newline;
+ q->refcount = 1;
+ memcpy (q->text, nextline_text, nextline_len);
+- lines.vector[lastmodline++] = q;
+- offset--;
++ lines.vector[lines.nlines++] = q;
+
+ nextline_text = (char *)p + 1;
+ nextline_newline = 0;
+@@ -7286,11 +7289,11 @@ apply_rcs_changes (orig_lines, diffbuf, difflen, name, addvers, delvers)
+ q->has_newline = nextline_newline;
+ q->refcount = 1;
+ memcpy (q->text, nextline_text, nextline_len);
+- lines.vector[lastmodline++] = q;
++ lines.vector[lines.nlines++] = q;
+
+ /* For each line we add the offset between the #'s
+ decreases. */
+- offset--;
++ offset -= df->nlines;
+ break;
+ }
+
+@@ -7301,7 +7304,9 @@ apply_rcs_changes (orig_lines, diffbuf, difflen, name, addvers, delvers)
+ if (df->pos + df->nlines > orig_lines->nlines)
+ err = 1;
+ else if (delvers)
++ {
+ for (ln = df->pos; ln < df->pos + df->nlines; ++ln)
++ {
+ if (orig_lines->vector[ln]->refcount > 1)
+ /* Annotate needs this but, since the original
+ * vector is disposed of before returning from
+@@ -7309,6 +7314,8 @@ apply_rcs_changes (orig_lines, diffbuf, difflen, name, addvers, delvers)
+ * there are multiple references.
+ */
+ orig_lines->vector[ln]->vers = delvers;
++ }
++ }
+ break;
+ }
+ }
+@@ -7328,21 +7335,20 @@ apply_rcs_changes (orig_lines, diffbuf, difflen, name, addvers, delvers)
+ else
+ {
+ /* add the rest of the remaining lines to the data vector */
+- for (; lastmodline < numlines; lastmodline++)
++ while (lines.nlines < numlines)
+ {
+ /* we need to copy from the orig structure into new one */
+- lines.vector[lastmodline] = orig_lines->vector[lastmodline
++ lines.vector[lines.nlines] = orig_lines->vector[lines.nlines
+ + offset];
+- lines.vector[lastmodline]->refcount++;
++ lines.vector[lines.nlines]->refcount++;
++ lines.nlines++;
+ }
+
+ /* Move the lines vector to the original structure for output,
+ * first deleting the old.
+ */
+ linevector_free (orig_lines);
+- orig_lines->vector = lines.vector;
+- orig_lines->lines_alloced = numlines;
+- orig_lines->nlines = lines.nlines;
++ *orig_lines = lines;
+ }
+
+ return !err;
+--
+1.7.2.3
+
diff --git a/testing/cvs/cvs-1.11.23-getline64.patch b/testing/cvs/cvs-1.11.23-getline64.patch
new file mode 100644
index 000000000..99942e058
--- /dev/null
+++ b/testing/cvs/cvs-1.11.23-getline64.patch
@@ -0,0 +1,34 @@
+--- cvs-1.11.23/lib/getline.c 2005-04-04 22:46:05.000000000 +0200
++++ cvs-1.11.23/lib/getline.c.old 2008-06-03 19:06:25.000000000 +0200
+@@ -154,7 +154,7 @@
+ return ret;
+ }
+
+-int
++ssize_t
+ getline (lineptr, n, stream)
+ char **lineptr;
+ size_t *n;
+@@ -163,7 +163,7 @@
+ return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT);
+ }
+
+-int
++ssize_t
+ getline_safe (lineptr, n, stream, limit)
+ char **lineptr;
+ size_t *n;
+--- cvs-1.11.23/lib/getline.h 2005-04-04 22:46:05.000000000 +0200
++++ cvs-1.11.23/lib/getline.h.old 2008-06-03 19:06:27.000000000 +0200
+@@ -11,9 +11,9 @@
+
+ #define GETLINE_NO_LIMIT -1
+
+-int
++ssize_t
+ getline __PROTO ((char **_lineptr, size_t *_n, FILE *_stream));
+-int
++ssize_t
+ getline_safe __PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
+ int limit));
+ int
diff --git a/testing/cvs/cvs.install b/testing/cvs/cvs.install
new file mode 100644
index 000000000..f1cdd1f3e
--- /dev/null
+++ b/testing/cvs/cvs.install
@@ -0,0 +1,20 @@
+infodir=/usr/share/info
+filelist=(cvs.info cvs-info-1 cvs-info-2 cvsclient.info)
+
+post_install() {
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file $infodir/dir 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ for file in ${filelist[@]}; do
+ install-info --delete $infodir/$file $infodir/dir 2> /dev/null
+ done
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/testing/cyrus-sasl-plugins/PKGBUILD b/testing/cyrus-sasl-plugins/PKGBUILD
new file mode 100644
index 000000000..5817bb657
--- /dev/null
+++ b/testing/cyrus-sasl-plugins/PKGBUILD
@@ -0,0 +1,52 @@
+# $Id: PKGBUILD 122144 2011-05-02 13:27:49Z stephane $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=cyrus-sasl-plugins
+pkgver=2.1.23
+pkgrel=5
+pkgdesc="Cyrus Simple Authentication Service Layer (SASL) library"
+arch=('i686' 'x86_64')
+url="http://cyrusimap.web.cmu.edu/"
+license=('custom')
+depends=('postgresql-libs>=9.0.3' 'krb5' 'libldap>2.4'
+ 'libmysqlclient>=5.5.10')
+source=(ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-${pkgver}.tar.gz
+ cyrus-sasl-2.1.22-gcc44.patch
+ cyrus-sasl-2.1.23-db5-fix.patch)
+md5sums=('2eb0e48106f0e9cd8001e654f267ecbc'
+ '5deb4d67b53ecba20c7887fc8fdebee1'
+ '3ae4347705141145f31cf786c38ea9ef')
+options=('!libtool')
+
+build() {
+ cd ${srcdir}/cyrus-sasl-${pkgver}
+ patch -Np1 -i $srcdir/cyrus-sasl-2.1.22-gcc44.patch
+ # from http://bugs.gentoo.org/show_bug.cgi?id=319935
+ patch -Np0 -i ${srcdir}/cyrus-sasl-2.1.23-db5-fix.patch
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --disable-login \
+ --disable-plain \
+ --enable-sql \
+ --disable-sqlite \
+ --enable-gssapi=/usr/include/gssapi \
+ --with-mysql=/usr \
+ --with-pgsql=/usr \
+ --enable-postgresql \
+ --enable-ldapdb \
+ --with-ldap=/usr
+ cd sasldb
+ make
+ cd ../plugins
+ make
+}
+
+package () {
+ cd ${srcdir}/cyrus-sasl-${pkgver}/plugins
+ make DESTDIR=${pkgdir} install
+
+ install -Dm644 ../COPYING ${pkgdir}/usr/share/licenses/${pkgname}/COPYING
+
+ rm -f ${pkgdir}/usr/lib/sasl2/libsasldb.*
+}
diff --git a/testing/cyrus-sasl-plugins/cyrus-sasl-2.1.22-gcc44.patch b/testing/cyrus-sasl-plugins/cyrus-sasl-2.1.22-gcc44.patch
new file mode 100644
index 000000000..e2621278b
--- /dev/null
+++ b/testing/cyrus-sasl-plugins/cyrus-sasl-2.1.22-gcc44.patch
@@ -0,0 +1,24 @@
+fix warnings with gcc-4.4
+
+http://bugs.gentoo.org/248738
+
+--- cyrus-sasl-2.1.22/plugins/digestmd5.c
++++ cyrus-sasl-2.1.22/plugins/digestmd5.c
+@@ -2715,7 +2715,7 @@ static sasl_server_plug_t digestmd5_serv
+ "DIGEST-MD5", /* mech_name */
+ #ifdef WITH_RC4
+ 128, /* max_ssf */
+-#elif WITH_DES
++#elif defined(WITH_DES)
+ 112,
+ #else
+ 1,
+@@ -4034,7 +4034,7 @@ static sasl_client_plug_t digestmd5_clie
+ "DIGEST-MD5",
+ #ifdef WITH_RC4 /* mech_name */
+ 128, /* max ssf */
+-#elif WITH_DES
++#elif defined(WITH_DES)
+ 112,
+ #else
+ 1,
diff --git a/testing/cyrus-sasl-plugins/cyrus-sasl-2.1.23-db5-fix.patch b/testing/cyrus-sasl-plugins/cyrus-sasl-2.1.23-db5-fix.patch
new file mode 100644
index 000000000..2ccd6cdb3
--- /dev/null
+++ b/testing/cyrus-sasl-plugins/cyrus-sasl-2.1.23-db5-fix.patch
@@ -0,0 +1,23 @@
+--- sasldb/db_berkeley.c.orig 2010-10-04 21:11:15.044010468 -0400
++++ sasldb/db_berkeley.c 2010-10-04 21:12:18.921998718 -0400
+@@ -100,7 +100,7 @@
+ ret = db_create(mbdb, NULL, 0);
+ if (ret == 0 && *mbdb != NULL)
+ {
+-#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
++#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) || DB_VERSION_MAJOR == 5
+ ret = (*mbdb)->open(*mbdb, NULL, path, NULL, DB_HASH, flags, 0660);
+ #else
+ ret = (*mbdb)->open(*mbdb, path, NULL, DB_HASH, flags, 0660);
+
+--- utils/dbconverter-2.c.orig 2010-10-04 21:23:39.778000256 -0400
++++ utils/dbconverter-2.c 2010-10-04 21:24:50.384999893 -0400
+@@ -214,7 +214,7 @@
+ ret = db_create(mbdb, NULL, 0);
+ if (ret == 0 && *mbdb != NULL)
+ {
+-#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
++#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) || DB_VERSION_MAJOR == 5
+ ret = (*mbdb)->open(*mbdb, NULL, path, NULL, DB_HASH, DB_CREATE, 0664);
+ #else
+ ret = (*mbdb)->open(*mbdb, path, NULL, DB_HASH, DB_CREATE, 0664);
diff --git a/testing/cyrus-sasl/PKGBUILD b/testing/cyrus-sasl/PKGBUILD
new file mode 100644
index 000000000..6d42f9f75
--- /dev/null
+++ b/testing/cyrus-sasl/PKGBUILD
@@ -0,0 +1,53 @@
+# $Id: PKGBUILD 122168 2011-05-02 15:13:37Z stephane $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=cyrus-sasl
+pkgver=2.1.23
+pkgrel=5
+pkgdesc="SASL authentication daemon"
+arch=('i686' 'x86_64')
+license=('custom')
+url="http://asg.web.cmu.edu/cyrus/download/"
+depends=('pam>=1.0.1-2' 'krb5' 'libldap' 'cyrus-sasl-plugins' 'db>=5.0')
+replaces=(cyrus-sasl-mysql cyrus-sasl-pgsql)
+conflicts=(cyrus-sasl-mysql cyrus-sasl-pgsql)
+backup=(etc/conf.d/saslauthd)
+source=(ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/${pkgname}-${pkgver}.tar.gz
+ saslauthd
+ saslauthd.conf.d
+ cyrus-sasl-2.1.23-gcc4.patch
+ cyrus-sasl-2.1.23+db-5.0.patch)
+md5sums=('2eb0e48106f0e9cd8001e654f267ecbc'
+ '697dfb51206c398bc976ce9f4cffe72d'
+ '96d8a2f6189501f8044838e04d5cae7f'
+ '3a71688df7d5724cd55a8de17d74f34e'
+ '35c189c8e93ad37e3ae3c49386fdeb2c')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ # Fix building with db v5.x
+ patch -Np1 -i ../cyrus-sasl-2.1.23+db-5.0.patch
+
+ # Fix error: #elif with no expression
+ patch -Np1 -i ../cyrus-sasl-2.1.23-gcc4.patch
+
+ ./configure --prefix=/usr --mandir=/usr/share/man \
+ --with-ldap=/usr --with-saslauthd=/var/run/saslauthd \
+ --disable-krb4 --with-gss_impl=mit --disable-otp
+ cd saslauthd
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}/saslauthd"
+ make DESTDIR="${pkgdir}" install
+ make testsaslauthd
+ install -m755 testsaslauthd "${pkgdir}/usr/sbin"
+
+ install -dm766 "${pkgdir}/var/run/saslauthd"
+ install -Dm755 "${srcdir}/saslauthd" "${pkgdir}/etc/rc.d/saslauthd"
+ install -Dm644 "${srcdir}/saslauthd.conf.d" "${pkgdir}/etc/conf.d/saslauthd"
+
+ install -Dm644 ../COPYING "${pkgdir}/usr/share/licenses/cyrus-sasl/COPYING"
+}
diff --git a/testing/cyrus-sasl/cyrus-sasl-2.1.23+db-5.0.patch b/testing/cyrus-sasl/cyrus-sasl-2.1.23+db-5.0.patch
new file mode 100644
index 000000000..62df3e67e
--- /dev/null
+++ b/testing/cyrus-sasl/cyrus-sasl-2.1.23+db-5.0.patch
@@ -0,0 +1,24 @@
+diff -Naur cyrus-sasl-2.1.23.ori/sasldb/db_berkeley.c cyrus-sasl-2.1.23/sasldb/db_berkeley.c
+--- cyrus-sasl-2.1.23.ori/sasldb/db_berkeley.c 2009-04-28 08:09:18.000000000 -0700
++++ cyrus-sasl-2.1.23/sasldb/db_berkeley.c 2011-05-02 07:16:42.748675977 -0700
+@@ -100,7 +100,7 @@
+ ret = db_create(mbdb, NULL, 0);
+ if (ret == 0 && *mbdb != NULL)
+ {
+-#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
++#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) || DB_VERSION_MAJOR >= 5
+ ret = (*mbdb)->open(*mbdb, NULL, path, NULL, DB_HASH, flags, 0660);
+ #else
+ ret = (*mbdb)->open(*mbdb, path, NULL, DB_HASH, flags, 0660);
+diff -Naur cyrus-sasl-2.1.23.ori/utils/dbconverter-2.c cyrus-sasl-2.1.23/utils/dbconverter-2.c
+--- cyrus-sasl-2.1.23.ori/utils/dbconverter-2.c 2003-02-13 11:56:17.000000000 -0800
++++ cyrus-sasl-2.1.23/utils/dbconverter-2.c 2011-05-02 07:16:42.748675977 -0700
+@@ -214,7 +214,7 @@
+ ret = db_create(mbdb, NULL, 0);
+ if (ret == 0 && *mbdb != NULL)
+ {
+-#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
++#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) || DB_VERSION_MAJOR >= 5
+ ret = (*mbdb)->open(*mbdb, NULL, path, NULL, DB_HASH, DB_CREATE, 0664);
+ #else
+ ret = (*mbdb)->open(*mbdb, path, NULL, DB_HASH, DB_CREATE, 0664);
diff --git a/testing/cyrus-sasl/cyrus-sasl-2.1.23-gcc4.patch b/testing/cyrus-sasl/cyrus-sasl-2.1.23-gcc4.patch
new file mode 100644
index 000000000..0d8627b1f
--- /dev/null
+++ b/testing/cyrus-sasl/cyrus-sasl-2.1.23-gcc4.patch
@@ -0,0 +1,21 @@
+diff -Naur cyrus-sasl-2.1.23.ori/plugins/digestmd5.c cyrus-sasl-2.1.23/plugins/digestmd5.c
+--- cyrus-sasl-2.1.23.ori/plugins/digestmd5.c 2009-04-28 08:09:17.000000000 -0700
++++ cyrus-sasl-2.1.23/plugins/digestmd5.c 2011-05-02 07:56:55.375403814 -0700
+@@ -2715,7 +2715,7 @@
+ "DIGEST-MD5", /* mech_name */
+ #ifdef WITH_RC4
+ 128, /* max_ssf */
+-#elif WITH_DES
++#elif defined(WITH_DES)
+ 112,
+ #else
+ 1,
+@@ -4034,7 +4034,7 @@
+ "DIGEST-MD5",
+ #ifdef WITH_RC4 /* mech_name */
+ 128, /* max ssf */
+-#elif WITH_DES
++#elif defined(WITH_DES)
+ 112,
+ #else
+ 1,
diff --git a/testing/cyrus-sasl/saslauthd b/testing/cyrus-sasl/saslauthd
new file mode 100644
index 000000000..c470c801c
--- /dev/null
+++ b/testing/cyrus-sasl/saslauthd
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/saslauthd ] && . /etc/conf.d/saslauthd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON_NAME="saslauthd"
+SASLAUTHD_BIN=/usr/sbin/saslauthd
+SASLAUTHD_PID=`pidof -o %PPID $SASLAUTHD_BIN`
+
+case "$1" in
+ start)
+ stat_busy "Starting $DAEMON_NAME"
+ [ -z "$SASLAUTHD_PID" ] && $SASLAUTHD_BIN $SASLAUTHD_OPTS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo `pidof -o %PPID $SASLAUTHD_BIN` > /var/run/$DAEMON_NAME.pid
+ fi
+ add_daemon $DAEMON_NAME
+ stat_done
+ ;;
+
+ stop)
+ stat_busy "Stopping $DAEMON_NAME"
+ [ ! -z "$SASLAUTHD_PID" ] && kill $SASLAUTHD_PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm /var/run/$DAEMON_NAME.pid &> /dev/null
+ fi
+ rm_daemon $DAEMON_NAME
+ stat_done
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+# vim: ts=2 sw=2 et ft=sh
diff --git a/testing/cyrus-sasl/saslauthd.conf.d b/testing/cyrus-sasl/saslauthd.conf.d
new file mode 100644
index 000000000..b42b5d0b0
--- /dev/null
+++ b/testing/cyrus-sasl/saslauthd.conf.d
@@ -0,0 +1 @@
+SASLAUTHD_OPTS="-m /var/run/saslauthd -a pam"
diff --git a/testing/dnsutils/PKGBUILD b/testing/dnsutils/PKGBUILD
new file mode 100644
index 000000000..823df71de
--- /dev/null
+++ b/testing/dnsutils/PKGBUILD
@@ -0,0 +1,39 @@
+# $Id: PKGBUILD 122965 2011-05-07 14:46:05Z bisson $
+# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+# Contributor: kevin <kevin@archlinux.org>
+# Contributor: mario <mario_vazq@hotmail.com>
+
+pkgname=dnsutils
+
+# Use a period and not a hyphen before the patch level for proper versioning.
+pkgver=9.8.0.P1
+_pkgver=9.8.0-P1
+pkgrel=1
+
+pkgdesc='Various DNS utilities - dig host nslookup nsupdate'
+arch=('i686' 'x86_64')
+url='https://www.isc.org/software/bind'
+license=('custom:ISC')
+depends=('openssl' 'idnkit')
+replaces=('bind-tools' 'host')
+options=('!makeflags')
+source=("http://ftp.isc.org/isc/bind9/${_pkgver}/bind-${_pkgver}.tar.gz"
+ 'tools-only.patch')
+sha1sums=('aa8f308f218e437ac4bad616e0ae83a9b9c40c29'
+ 'ac88c89e25c26d73095a3dd85e1ca1070d184ded')
+
+build() {
+ cd "${srcdir}/bind-${_pkgver}"
+ patch -p1 < ../tools-only.patch
+ export STD_CDEFINES='-DDIG_SIGCHASE'
+ ./configure \
+ --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --with-openssl=yes --with-idn=yes --disable-linux-caps
+ make
+}
+
+package() {
+ cd "${srcdir}/bind-${_pkgver}/bin"
+ make DESTDIR="${pkgdir}" install
+ install -Dm644 ../COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}
diff --git a/testing/dnsutils/tools-only.patch b/testing/dnsutils/tools-only.patch
new file mode 100644
index 000000000..b46b71f60
--- /dev/null
+++ b/testing/dnsutils/tools-only.patch
@@ -0,0 +1,25 @@
+diff -Naur bind-9.7.1-P2.orig/bin/Makefile.in bind-9.7.1-P2/bin/Makefile.in
+--- bind-9.7.1-P2.orig/bin/Makefile.in 2009-10-05 08:07:08.000000000 -0400
++++ bind-9.7.1-P2/bin/Makefile.in 2010-07-22 15:55:00.000000000 -0400
+@@ -19,8 +19,7 @@
+ VPATH = @srcdir@
+ top_srcdir = @top_srcdir@
+
+-SUBDIRS = named rndc dig dnssec tests tools nsupdate \
+- check confgen @PKCS11_TOOLS@
++SUBDIRS = dig nsupdate
+ TARGETS =
+
+ @BIND9_MAKE_RULES@
+diff -Naur bind-9.7.1-P2.orig/lib/Makefile.in bind-9.7.1-P2/lib/Makefile.in
+--- bind-9.7.1-P2.orig/lib/Makefile.in 2007-06-19 19:47:13.000000000 -0400
++++ bind-9.7.1-P2/lib/Makefile.in 2010-07-22 15:56:29.000000000 -0400
+@@ -23,7 +23,7 @@
+ # Attempt to disable parallel processing.
+ .NOTPARALLEL:
+ .NO_PARALLEL:
+-SUBDIRS = isc isccc dns isccfg bind9 lwres tests
++SUBDIRS = isc dns isccfg bind9 lwres
+ TARGETS =
+
+ @BIND9_MAKE_RULES@
diff --git a/testing/dovecot/PKGBUILD b/testing/dovecot/PKGBUILD
new file mode 100644
index 000000000..7b9a0304c
--- /dev/null
+++ b/testing/dovecot/PKGBUILD
@@ -0,0 +1,74 @@
+# $Id: PKGBUILD 121982 2011-05-01 01:05:24Z stephane $
+# Contributor: Paul Mattal <paul@mattal.com>
+# Contributor: Federico Quagliata (quaqo) <quaqo@despammed.com>
+# Contributor: GARETTE Emmanuel <gnunux at laposte dot net>
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+
+pkgname=dovecot
+pkgver=2.0.12
+pkgrel=2
+pkgdesc="An IMAP and POP3 server written with security primarily in mind"
+arch=('i686' 'x86_64')
+url="http://dovecot.org/"
+license=("LGPL")
+depends=('krb5' 'openssl' 'sqlite3>=3.7.5' 'libmysqlclient>=5.5.10'
+ 'postgresql-libs>=9.0.3' 'bzip2' 'expat' 'curl')
+makedepends=('pam>=1.1.1' 'libcap>=2.19' 'libldap>=2.4.22')
+optdepends=('libldap: ldap plugin')
+provides=('imap-server' 'pop3-server')
+options=('!libtool')
+backup=(etc/dovecot/dovecot.conf
+ etc/dovecot/conf.d/{10-auth,10-director,10-logging,10-mail,10-master,10-ssl}.conf
+ etc/dovecot/conf.d/{15-lda,20-imap,20-lmtp,20-pop3}.conf
+ etc/dovecot/conf.d/{90-acl,90-plugin,90-quota}.conf
+ etc/dovecot/conf.d/auth-{checkpassword,deny,ldap,master,passwdfile,sql,static,system,vpopmail}.conf.ext
+ etc/ssl/dovecot-openssl.cnf)
+install=$pkgname.install
+source=(http://dovecot.org/releases/2.0/${pkgname}-${pkgver}.tar.gz dovecot.sh)
+md5sums=('689e1a8863d4fb2fd252e1a6121dd181'
+ 'd020d43eab4ded6fb379dadc570a9490')
+
+build() {
+ cd ${srcdir}/$pkgname-$pkgver
+
+ # configure with openssl, mysql, and postgresql support
+ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --libexecdir=/usr/lib --with-moduledir=/usr/lib/dovecot/modules \
+ --disable-static \
+ --with-nss \
+ --with-pam \
+ --with-mysql \
+ --with-pgsql \
+ --with-sqlite \
+ --with-ssl=openssl --with-ssldir=/etc/dovecot/ssl \
+ --with-gssapi \
+ --with-ldap=plugin \
+ --with-zlib --with-bzlib \
+ --with-libcap \
+ --with-solr \
+ --with-docs
+ make
+}
+
+package() {
+ cd ${srcdir}/$pkgname-$pkgver
+ make DESTDIR=${pkgdir} install
+
+ # install the launch script
+ install -D -m755 ${srcdir}/$pkgname.sh ${pkgdir}/etc/rc.d/$pkgname
+
+ # install example conf files and ssl.conf
+ install -d -m755 ${pkgdir}/etc/dovecot/conf.d
+ install -m 644 ${pkgdir}/usr/share/doc/dovecot/example-config/conf.d/*.conf ${pkgdir}/etc/dovecot/conf.d
+ install -m 644 ${pkgdir}/usr/share/doc/dovecot/example-config/conf.d/*.conf.ext ${pkgdir}/etc/dovecot/conf.d
+ install -m 644 ${pkgdir}/usr/share/doc/dovecot/example-config/dovecot.conf ${pkgdir}/etc/dovecot/
+ install -d -m755 ${pkgdir}/etc/ssl
+ install -m 644 ${srcdir}/$pkgname-$pkgver/doc/dovecot-openssl.cnf ${pkgdir}/etc/ssl/
+
+ rm ${pkgdir}/etc/dovecot/README
+
+ # install dovecot userdir - https://bugs.archlinux.org/task/20533
+ install -d -m755 ${pkgdir}/var/run/dovecot/{login,empty}
+ chmod 755 ${pkgdir}/var/run/dovecot
+ chmod 750 ${pkgdir}/var/run/dovecot/login
+}
diff --git a/testing/dovecot/dovecot.install b/testing/dovecot/dovecot.install
new file mode 100644
index 000000000..51d1509ee
--- /dev/null
+++ b/testing/dovecot/dovecot.install
@@ -0,0 +1,57 @@
+# arg 1: the new package version
+post_install() {
+
+ # Make sure the group and user "dovecot"+"dovenull exists on this system and have the correct values
+
+ # dovecot
+ if grep -q "^dovecot:" /etc/group &> /dev/null ; then
+ groupmod -g 76 -n dovecot dovecot &> /dev/null
+ else
+ groupadd -g 76 dovecot &> /dev/null
+ fi
+
+ if grep -q "^dovecot:" /etc/passwd 2> /dev/null ; then
+ usermod -s /sbin/nologin -c "Dovecot user" -d /var/run/dovecot/login -u 76 -g dovecot dovecot &> /dev/null
+ else
+ useradd -s /sbin/nologin -c "Dovecot user" -d /var/run/dovecot/login -u 76 -g dovecot -m -r dovecot &> /dev/null
+ fi
+
+ # dovenull
+ if grep -q "^dovenull:" /etc/group &> /dev/null ; then
+ groupmod -g 74 -n dovenull dovenull &> /dev/null
+ else
+ groupadd -g 74 dovenull &> /dev/null
+ fi
+
+ if grep -q "^dovenull:" /etc/passwd 2> /dev/null ; then
+ usermod -s /sbin/nologin -c "Dovecot user for completely untrustworthy processes" -d /var/run/dovecot/login -u 74 -g dovenull dovenull &> /dev/null
+ else
+ useradd -s /sbin/nologin -c "Dovecot user for completely untrustworthy processes" -d /var/run/dovecot/login -u 74 -g dovenull -m -r dovenull &> /dev/null
+ fi
+
+ # harden some permissions
+ chgrp dovenull /var/run/dovecot/login
+}
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ post_install $1
+ if [ "`vercmp $2 2.0.0`" -lt 0 ]; then
+ # important upgrade notice
+ echo "> IMPORTANT DOVECOT 2.0 UPGRADE NOTICE"
+ echo "> ------------------------------------"
+ echo "> see http://wiki2.dovecot.org/Upgrading/2.0"
+ echo "> make sure, you convert the dovecot.conf file"
+ fi
+
+}
+
+# arg 1: the old package version
+pre_remove() {
+ userdel dovecot &> /dev/null
+ userdel dovenull &> /dev/null
+ groupdel dovecot &> /dev/null || /bin/true
+ groupdel dovenull &> /dev/null || /bin/true
+ rm -rf /var/run/dovecot/ &> /dev/null || /bin/true
+}
diff --git a/testing/dovecot/dovecot.sh b/testing/dovecot/dovecot.sh
new file mode 100755
index 000000000..b7555fe50
--- /dev/null
+++ b/testing/dovecot/dovecot.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/dovecot`
+case "$1" in
+ start)
+ stat_busy "Starting Dovecot"
+ [ -z "$PID" ] && /usr/sbin/dovecot
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon dovecot
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Dovecot"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon dovecot
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/testing/evolution-data-server/PKGBUILD b/testing/evolution-data-server/PKGBUILD
new file mode 100644
index 000000000..195be21c6
--- /dev/null
+++ b/testing/evolution-data-server/PKGBUILD
@@ -0,0 +1,29 @@
+# $Id: PKGBUILD 122571 2011-05-04 16:49:38Z ibiru $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=evolution-data-server
+pkgver=3.0.1
+pkgrel=2
+pkgdesc="Central location for addressbook and calendar storage in the GNOME Desktop"
+arch=('i686' 'x86_64')
+depends=('libsoup' 'nss' 'libgnome-keyring' 'krb5' 'libgweather' 'libical' 'db' 'libgdata')
+makedepends=('intltool' 'gperf' 'gobject-introspection')
+options=('!libtool')
+url="http://www.gnome.org"
+license=('GPL')
+source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/3.0/${pkgname}-${pkgver}.tar.bz2)
+sha256sums=('8592be94027a9848ac18670a0e86e48e857539cd2813eb345eda0ace19688dd0')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --sysconfdir=/etc \
+ --localstatedir=/var --with-openldap=yes \
+ --libexecdir=/usr/lib/evolution-data-server \
+ --with-krb5=/usr --with-libdb=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/testing/evolution-exchange/PKGBUILD b/testing/evolution-exchange/PKGBUILD
new file mode 100644
index 000000000..963b54508
--- /dev/null
+++ b/testing/evolution-exchange/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 122586 2011-05-04 18:25:32Z ibiru $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=evolution-exchange
+pkgver=3.0.1
+pkgrel=2
+pkgdesc="Ximian Connector Exchange plugin for Evolution"
+arch=('i686' 'x86_64')
+license=('GPL')
+url="http://www.ximian.com"
+depends=('evolution-data-server' 'gtkhtml4' 'gnome-desktop' 'libunique3')
+makedepends=('intltool' 'evolution')
+options=('!libtool' '!emptydirs')
+install=evolution-exchange.install
+source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/${pkgver%.*}/${pkgname}-${pkgver}.tar.bz2)
+sha256sums=('4c020f7946f534e3245806f29f48dbc9ccb98afdbc92d7bb5b14a5410668ad02')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --libexecdir=/usr/lib/evolution --disable-static \
+ --with-libdb=/usr --with-krb5=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/gconf/schemas"
+ gconf-merge-schema "${pkgdir}/usr/share/gconf/schemas/${pkgname}.schemas" --domain evolution-exchange-3.0 ${pkgdir}/etc/gconf/schemas/*.schemas
+ rm -f ${pkgdir}/etc/gconf/schemas/*.schemas
+}
diff --git a/testing/evolution-exchange/evolution-exchange.install b/testing/evolution-exchange/evolution-exchange.install
new file mode 100644
index 000000000..1179887f9
--- /dev/null
+++ b/testing/evolution-exchange/evolution-exchange.install
@@ -0,0 +1,17 @@
+pkgname=evolution-exchange
+
+post_install() {
+ usr/sbin/gconfpkg --install ${pkgname}
+}
+
+pre_upgrade() {
+ pre_remove $1
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ usr/sbin/gconfpkg --uninstall ${pkgname}
+}
diff --git a/testing/gnome-control-center/PKGBUILD b/testing/gnome-control-center/PKGBUILD
new file mode 100644
index 000000000..1031b6b1d
--- /dev/null
+++ b/testing/gnome-control-center/PKGBUILD
@@ -0,0 +1,34 @@
+# $Id: PKGBUILD 122550 2011-05-04 14:36:21Z stephane $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=gnome-control-center
+pkgver=3.0.1.1
+pkgrel=2
+pkgdesc="The Control Center for GNOME"
+arch=('i686' 'x86_64')
+depends=('gtk3' 'gsettings-desktop-schemas' 'gnome-menus' 'gnome-desktop' 'gnome-settings-daemon' 'upower' 'libgtop' 'cups-pk-helper' 'accountsservice' 'sound-theme-freedesktop' 'krb5')
+optdepends=('mesa-demos: provides glxinfo for graphics information'
+ 'apg: adds password generation for user accounts')
+makedepends=('gnome-doc-utils' 'intltool' 'networkmanager')
+url="http://www.gnome.org"
+groups=('gnome')
+install=gnome-control-center.install
+license=('GPL')
+options=('!libtool' '!emptydirs')
+source=(http://ftp.gnome.org/pub/GNOME/sources/${pkgname}/3.0/${pkgname}-${pkgver}.tar.bz2)
+sha256sums=('b191991d3932b363154e6cf2b5055bc711272065397daee2163b6fb04402ad79')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --sysconfdir=/etc \
+ --localstatedir=/var --disable-static \
+ --disable-scrollkeeper --disable-update-mimedb
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+}
+
diff --git a/testing/gnome-control-center/gnome-control-center.install b/testing/gnome-control-center/gnome-control-center.install
new file mode 100644
index 000000000..eb703319f
--- /dev/null
+++ b/testing/gnome-control-center/gnome-control-center.install
@@ -0,0 +1,19 @@
+pkgname=gnome-control-center
+
+post_install() {
+ gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+}
+
+pre_upgrade() {
+ if [ -f usr/share/gconf/schemas/${pkgname}.schemas ]; then
+ usr/sbin/gconfpkg --uninstall ${pkgname}
+ fi
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ post_install $1
+}
diff --git a/testing/gnome-settings-daemon/PKGBUILD b/testing/gnome-settings-daemon/PKGBUILD
new file mode 100644
index 000000000..06f71588b
--- /dev/null
+++ b/testing/gnome-settings-daemon/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 122583 2011-05-04 18:20:31Z ibiru $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=gnome-settings-daemon
+pkgver=3.0.1
+pkgrel=2
+pkgdesc="The GNOME Settings daemon"
+arch=('i686' 'x86_64')
+license=('GPL')
+depends=('libgnomekbd' 'gnome-desktop' 'libnotify' 'hicolor-icon-theme'
+ 'libcanberra-pulse' 'gsettings-desktop-schemas' 'nss' 'gconf'
+ 'dconf' 'pulseaudio' 'pulseaudio-alsa')
+makedepends=('intltool' 'gtk-doc')
+options=('!emptydirs' '!libtool')
+install=gnome-settings-daemon.install
+url="http://www.gnome.org"
+groups=('gnome')
+replaces=(gnome-settings-daemon-pulse)
+conflicts=(gnome-settings-daemon-pulse)
+source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/${pkgver%.*}/${pkgname}-${pkgver}.tar.bz2)
+sha256sums=('51cdd0842b907e95c79d4e2b26f554e26fc626f7c2e6c3a14e3fc7954ca91117')
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --libexecdir=/usr/bin --disable-static --enable-pulse
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/testing/gnome-settings-daemon/gnome-settings-daemon.install b/testing/gnome-settings-daemon/gnome-settings-daemon.install
new file mode 100644
index 000000000..483fb9450
--- /dev/null
+++ b/testing/gnome-settings-daemon/gnome-settings-daemon.install
@@ -0,0 +1,18 @@
+post_install() {
+ usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas
+ gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+}
+
+pre_upgrade() {
+ if (( $(vercmp $2 2.90.0) < 0 )); then
+ usr/sbin/gconfpkg --uninstall gnome-settings-daemon
+ fi
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
diff --git a/testing/gnome-vfs/PKGBUILD b/testing/gnome-vfs/PKGBUILD
new file mode 100644
index 000000000..3474b4c22
--- /dev/null
+++ b/testing/gnome-vfs/PKGBUILD
@@ -0,0 +1,45 @@
+# $Id: PKGBUILD 122580 2011-05-04 18:07:34Z ibiru $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=gnome-vfs
+pkgver=2.24.4
+pkgrel=3
+pkgdesc="The GNOME Virtual File System"
+arch=(i686 x86_64)
+license=('LGPL')
+depends=('fam' 'gconf' 'bzip2' 'avahi' 'smbclient' 'gnome-mime-data' 'krb5' 'gnutls')
+makedepends=('pkgconfig' 'intltool' 'gtk-doc' 'gnome-common')
+options=('!libtool' '!emptydirs')
+url="http://www.gnome.org"
+install=gnome-vfs.install
+source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/2.24/gnome-vfs-${pkgver}.tar.bz2
+ gnutls-config.patch)
+sha256sums=('62de64b5b804eb04104ff98fcd6a8b7276d510a49fbd9c0feb568f8996444faa'
+ '66c7cfb12995c0dd94a2caea95c7e3c55981993f05a79c585d60915ff131955d')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ #Fix build with new gnutls
+ patch -Np1 -i "${srcdir}/gnutls-config.patch"
+ libtoolize --force
+ gtkdocize
+ aclocal
+ autoconf
+ automake
+ ./configure --prefix=/usr --sysconfdir=/etc \
+ --localstatedir=/var --disable-static \
+ --libexecdir=/usr/lib/gnome-vfs-2.0 \
+ --enable-samba --disable-hal \
+ --enable-avahi --disable-howl \
+ --disable-openssl --enable-gnutls
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 DESTDIR="${pkgdir}" install
+
+ install -d -m755 "${pkgdir}/usr/share/gconf/schemas"
+ gconf-merge-schema "${pkgdir}/usr/share/gconf/schemas/${pkgname}.schemas" --domain gnome-vfs-2.0 ${pkgdir}/etc/gconf/schemas/*.schemas
+ rm -f ${pkgdir}/etc/gconf/schemas/*.schemas
+}
diff --git a/testing/gnome-vfs/gnome-vfs.install b/testing/gnome-vfs/gnome-vfs.install
new file mode 100644
index 000000000..793a3e7ab
--- /dev/null
+++ b/testing/gnome-vfs/gnome-vfs.install
@@ -0,0 +1,17 @@
+pkgname=gnome-vfs
+
+post_install() {
+ usr/sbin/gconfpkg --install ${pkgname}
+}
+
+pre_upgrade() {
+ pre_remove $1
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ usr/sbin/gconfpkg --uninstall ${pkgname}
+}
diff --git a/testing/gnome-vfs/gnutls-config.patch b/testing/gnome-vfs/gnutls-config.patch
new file mode 100644
index 000000000..f6fa18b17
--- /dev/null
+++ b/testing/gnome-vfs/gnutls-config.patch
@@ -0,0 +1,25 @@
+# Allow gnome-vfs-2.24 to build with gnutls >= 2.7.0
+# Use pkg-config in place of gnutls own macro since it's not present anymore.
+--- a/configure.in 2009-03-07 19:59:53.805507753 +0100
++++ b/configure.in 2009-03-07 18:34:36.928169018 +0100
+@@ -686,14 +686,14 @@
+ AC_MSG_ERROR([*** Can't use both openssl and gnutls at the same time. Please pick one only. ***])
+ else
+ AC_CHECK_HEADER(gcrypt.h,, AC_MSG_ERROR([*** Need gcrypt.h to compile with GnuTLS support ***]))
+- AM_PATH_LIBGNUTLS(1.0.0, [AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if GnuTLS is available])
+- have_ssl=true])
++ PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 1.0.0, [AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if GnuTLS is available])
++ have_ssl=true])
+
+ if test "x${LIBGNUTLS_LIBS}" = "x"; then
+- AM_PATH_LIBGNUTLS(0.5.1, [AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if GnuTLS is available])
+- AC_DEFINE(GNUTLS_COMPAT, 1, [FIXME])
+- have_ssl=true],
+- AC_MSG_ERROR([Unable to find GNUTLS]))
++ PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 0.5.1, [AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if GnuTLS is available])
++ AC_DEFINE(GNUTLS_COMPAT, 1, [FIXME])
++ have_ssl=true],
++ AC_MSG_ERROR([Unable to find GNUTLS]))
+ fi
+ fi
+ fi
diff --git a/testing/gtk2/PKGBUILD b/testing/gtk2/PKGBUILD
new file mode 100644
index 000000000..e67d63520
--- /dev/null
+++ b/testing/gtk2/PKGBUILD
@@ -0,0 +1,50 @@
+# $Id: PKGBUILD 122323 2011-05-03 20:18:27Z stephane $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgbase=gtk2
+pkgname=('gtk2' 'gtk-update-icon-cache')
+pkgver=2.24.4
+pkgrel=2
+arch=('i686' 'x86_64')
+url="http://www.gtk.org/"
+makedepends=('atk' 'pango' 'libxcursor' 'libxinerama' 'libxrandr' 'libxi' 'libxcomposite' 'libxdamage' 'krb5' 'gnutls'
+ 'shared-mime-info' 'cairo' 'libcups' 'gdk-pixbuf2' 'gobject-introspection')
+options=('!libtool' '!docs')
+license=('LGPL')
+source=(http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-${pkgver}.tar.bz2
+ xid-collision-debug.patch)
+sha256sums=('7d3033ad83647079977466d3e8f1a7533f47abd5cc693f01b8797ff43dd407a5'
+ 'd758bb93e59df15a4ea7732cf984d1c3c19dff67c94b957575efea132b8fe558')
+
+build() {
+ cd "${srcdir}/gtk+-${pkgver}"
+ patch -Np1 -i "${srcdir}/xid-collision-debug.patch"
+
+ CXX=/bin/false ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --with-xinput=yes
+ make
+}
+package_gtk2() {
+ pkgdesc="The GTK+ Toolkit (v2)"
+ install=gtk2.install
+ depends=('atk' 'pango' 'libxcursor' 'libxinerama' 'libxrandr' 'libxi' 'libxcomposite' 'libxdamage' 'krb5' 'gnutls' 'shared-mime-info' 'cairo' 'libcups' 'gtk-update-icon-cache')
+ backup=(etc/gtk-2.0/gtkrc)
+
+ cd "${srcdir}/gtk+-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+ sed -i "s#env python#env python2#" $pkgdir/usr/bin/gtk-builder-convert
+ echo 'gtk-fallback-icon-theme = "gnome"' > "${pkgdir}/etc/gtk-2.0/gtkrc"
+ #split this out to use with gtk3 too
+ rm ${pkgdir}/usr/bin/gtk-update-icon-cache
+}
+package_gtk-update-icon-cache() {
+ pkgdesc="The GTK+ update icon cache tool"
+ depends=('gdk-pixbuf2')
+
+ cd "${srcdir}/gtk+-${pkgver}/gtk"
+
+ install -D -m755 gtk-update-icon-cache ${pkgdir}/usr/bin/gtk-update-icon-cache
+}
diff --git a/testing/gtk2/gtk2.install b/testing/gtk2/gtk2.install
new file mode 100644
index 000000000..4e2b72f1b
--- /dev/null
+++ b/testing/gtk2/gtk2.install
@@ -0,0 +1,16 @@
+post_install() {
+ usr/bin/gtk-query-immodules-2.0 > etc/gtk-2.0/gtk.immodules
+}
+
+pre_upgrade() {
+ pre_remove
+}
+
+post_upgrade() {
+ post_install
+}
+
+pre_remove() {
+ rm -f etc/gtk-2.0/gtk.immodules &>/dev/null
+ rm -f etc/gtk-2.0/gdk-pixbuf.loaders &>/dev/null
+}
diff --git a/testing/gtk2/xid-collision-debug.patch b/testing/gtk2/xid-collision-debug.patch
new file mode 100644
index 000000000..d61238c3b
--- /dev/null
+++ b/testing/gtk2/xid-collision-debug.patch
@@ -0,0 +1,15 @@
+--- gtk+-2.18.3/gdk/x11/gdkxid.c 2009-06-19 04:59:18.000000000 +0200
++++ gtk+-2.18.3/gdk/x11/gdkxid.c.new 2009-07-22 11:30:12.000000000 +0200
+@@ -56,10 +56,10 @@
+ if (!display_x11->xid_ht)
+ display_x11->xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
+ (GEqualFunc) gdk_xid_equal);
+-
++/*
+ if (g_hash_table_lookup (display_x11->xid_ht, xid))
+ g_warning ("XID collision, trouble ahead");
+-
++*/
+ g_hash_table_insert (display_x11->xid_ht, xid, data);
+ }
+
diff --git a/testing/gtk3/PKGBUILD b/testing/gtk3/PKGBUILD
new file mode 100644
index 000000000..5550647fc
--- /dev/null
+++ b/testing/gtk3/PKGBUILD
@@ -0,0 +1,36 @@
+# $Id: PKGBUILD 122547 2011-05-04 14:30:27Z stephane $
+# Maintainer: Ionut Biru <ibiru@archlinux.org>
+
+pkgname=gtk3
+pkgver=3.0.9
+pkgrel=2
+pkgdesc="The GTK+ Toolkit (v3)"
+arch=('i686' 'x86_64')
+url="http://www.gtk.org/"
+install=gtk3.install
+depends=('atk' 'cairo' 'gtk-update-icon-cache' 'gnutls' 'krb5' 'libcups' 'libxcursor' 'libxinerama' 'libxrandr' 'libxi' 'libxcomposite' 'libxdamage' 'pango' 'shared-mime-info')
+makedepends=('gobject-introspection')
+options=('!libtool' '!docs')
+backup=(etc/gtk-3.0/settings.ini)
+license=('LGPL')
+source=(http://ftp.gnome.org/pub/gnome/sources/gtk+/3.0/gtk+-${pkgver}.tar.bz2
+ settings.ini)
+sha256sums=('88a9dda6f2a23155ac3d7aca6b414ca3b55e2817b46bcc87733f1a407e16678c'
+ 'c214d3dcdcadda3d642112287524ab3e526ad592b70895c9f3e3733c23701621')
+
+build() {
+ cd "${srcdir}/gtk+-${pkgver}"
+ CXX=/bin/false ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --enable-gtk2-dependency \
+ --disable-schemas-compile
+ make
+}
+
+package() {
+ cd "${srcdir}/gtk+-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -Dm644 "${srcdir}/settings.ini" "${pkgdir}/etc/gtk-3.0/settings.ini"
+}
diff --git a/testing/gtk3/gtk3.install b/testing/gtk3/gtk3.install
new file mode 100644
index 000000000..cd8965d1f
--- /dev/null
+++ b/testing/gtk3/gtk3.install
@@ -0,0 +1,15 @@
+post_install() {
+ usr/bin/gtk-query-immodules-3.0 --update-cache
+ usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas
+}
+
+post_upgrade() {
+ post_install
+}
+
+pre_remove() {
+ rm -f usr/lib/gtk-3.0/3.0.0/immodules.cache
+}
+post_remove() {
+ usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas
+}
diff --git a/testing/gtk3/settings.ini b/testing/gtk3/settings.ini
new file mode 100644
index 000000000..039000d38
--- /dev/null
+++ b/testing/gtk3/settings.ini
@@ -0,0 +1,2 @@
+[Settings]
+gtk-fallback-icon-theme = gnome
diff --git a/testing/gutenprint/PKGBUILD b/testing/gutenprint/PKGBUILD
new file mode 100644
index 000000000..602d12bb4
--- /dev/null
+++ b/testing/gutenprint/PKGBUILD
@@ -0,0 +1,39 @@
+# $Id: PKGBUILD 123069 2011-05-07 23:28:40Z stephane $
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+
+pkgname=gutenprint
+pkgver=5.2.7
+pkgrel=2
+pkgdesc="Top quality printer drivers for POSIX systems"
+arch=('i686' 'x86_64')
+license=('GPL')
+install=gutenprint.install
+depends=('readline' 'gnutls>=2.12.3') # needs to be checked. build log says -Lgnutls but namcap doesn't detect it
+makedepends=('gimp>=2.6.11' 'gtk2>=2.24.4' 'cups>=1.4.6' 'foomatic-db-engine' 'ghostscript>=9.02')
+optdepends=('cups: to use cups printer spooler(recommended)'
+ 'foomatic-db-engine: to use foomatic spooler'
+ 'ghostscript: adds postscript support for ijsgutenprint'
+ 'gimp: adds gutenprint plugin to gimp')
+source=(http://downloads.sourceforge.net/gimp-print/$pkgname-$pkgver.tar.bz2)
+url="http://gimp-print.sourceforge.net/"
+replaces=('gimp-print')
+options=('!libtool' '!emptydirs')
+md5sums=('b19029972bf28f6efd693270daf8f5de')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ ./configure --prefix=/usr --disable-samples --with-cups --with-gimp2 \
+ --disable-translated-cups-ppds --with-gimp2-as-gutenprint \
+ --disable-libgutenprintui --enable-libgutenprintui2 --disable-gtktest \
+ --enable-cups-ppds --enable-cups-ppds-at-top-level \
+ --with-foomatic --with-foomatic3 --with-ghostscript \
+ --disable-static --disable-static-genppd --with-ijs \
+ --disable-globalized-cups-ppds
+ make
+}
+
+package() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ make DESTDIR=${pkgdir} install
+}
+
diff --git a/testing/gutenprint/gutenprint.install b/testing/gutenprint/gutenprint.install
new file mode 100644
index 000000000..05e8bec38
--- /dev/null
+++ b/testing/gutenprint/gutenprint.install
@@ -0,0 +1,9 @@
+post_install() {
+ echo ">>please run /usr/sbin/cups-genppdupdate"
+ echo ">>and restart cups deamon"
+}
+
+post_upgrade() {
+ post_install
+}
+
diff --git a/testing/kdelibs/PKGBUILD b/testing/kdelibs/PKGBUILD
new file mode 100644
index 000000000..0f4a867d4
--- /dev/null
+++ b/testing/kdelibs/PKGBUILD
@@ -0,0 +1,62 @@
+# $Id: PKGBUILD 122843 2011-05-06 11:48:02Z andrea $
+# Maintainer: Andrea Scarpino <andrea@archlinux.org
+# Contributor: Pierre Schmitz <pierre@archlinux.de>
+
+pkgname=kdelibs
+pkgver=4.6.3
+pkgrel=2
+pkgdesc="KDE Core Libraries"
+arch=('i686' 'x86_64')
+url='http://www.kde.org'
+license=('GPL' 'LGPL' 'FDL')
+depends=('strigi' 'attica' 'libxss' 'xz' 'openssl' 'soprano' 'krb5'
+ 'shared-desktop-ontologies' 'qca' 'libdbusmenu-qt' 'polkit-qt' 'grantlee'
+ 'shared-mime-info' 'enchant' 'giflib' 'jasper' 'openexr' 'xdg-utils'
+ 'phonon' 'hicolor-icon-theme' 'upower' 'udisks' 'libxcursor'
+ 'docbook-xsl')
+makedepends=('pkgconfig' 'cmake' 'automoc4' 'intltool' 'avahi' 'libgl'
+ 'hspell')
+replaces=('arts' 'kdelibs-experimental')
+install='kdelibs.install'
+source=("http://download.kde.org/stable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2"
+ 'kde-applications-menu.patch' 'archlinux-menu.patch' 'abs-syntax-highlight.patch')
+sha1sums=('c7fb089c9d52a6b1d9188b9e788753373a3288e4'
+ '86ee8c8660f19de8141ac99cd6943964d97a1ed7'
+ '63a850ab4196b9d06934f2b4a13acd9f7739bc67'
+ 'd994f262356af5b9e4e9619646e471bd98c91efb')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+
+ # avoid file conflict with gnome-menu
+ patch -p1 -i $srcdir/kde-applications-menu.patch
+ # add Archlinux menu entry
+ patch -p1 -i $srcdir/archlinux-menu.patch
+ # add syntax highlightning for PKGBUILD and .install files
+ patch -p1 -i $srcdir/abs-syntax-highlight.patch
+
+ cd ${srcdir}
+ mkdir build
+ cd build
+ cmake ../${pkgname}-${pkgver} \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_SKIP_RPATH=ON \
+ -DKDE_DISTRIBUTION_TEXT='Arch Linux' \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DSYSCONF_INSTALL_DIR=/etc \
+ -DHTML_INSTALL_DIR=/usr/share/doc/kde/html \
+ -DKDE_DEFAULT_HOME='.kde4' \
+ -DWITH_FAM=OFF \
+ -DKAUTH_BACKEND=PolkitQt-1
+ make
+}
+
+package() {
+ cd $srcdir/build
+ make DESTDIR=$pkgdir install
+
+ # cert bundle seems to be hardcoded
+ # link it to the one from ca-certificates
+ rm -f $pkgdir/usr/share/apps/kssl/ca-bundle.crt
+ ln -sf /etc/ssl/certs/ca-certificates.crt $pkgdir/usr/share/apps/kssl/ca-bundle.crt
+}
diff --git a/testing/kdelibs/abs-syntax-highlight.patch b/testing/kdelibs/abs-syntax-highlight.patch
new file mode 100644
index 000000000..477479a9b
--- /dev/null
+++ b/testing/kdelibs/abs-syntax-highlight.patch
@@ -0,0 +1,12 @@
+diff -Nura kdelibs-4.3.0.orig/kate/syntax/data/bash.xml kdelibs-4.3.0/kate/syntax/data/bash.xml
+--- kdelibs-4.3.0.orig/kate/syntax/data/bash.xml 2009-04-15 12:26:37.000000000 +0200
++++ kdelibs-4.3.0/kate/syntax/data/bash.xml 2009-07-30 13:24:01.000000000 +0200
+@@ -8,7 +8,7 @@
+ <!ENTITY noword "(?![\w$+-])"> <!-- no word, $, + or - following -->
+ <!ENTITY pathpart "([\w_@.&#37;*?+-]|\\ )"> <!-- valid character in a file name -->
+ ]>
+-<language name="Bash" version="2.12" kateversion="2.4" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;.bashrc;.bash_profile;.bash_login;.profile" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
++<language name="Bash" version="2.12" kateversion="2.4" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD;*.install" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
+
+ <!-- (c) 2004 by Wilbert Berendsen (wilbert@kde.nl)
+ Changes by Matthew Woehlke (mw_triad@users.sourceforge.net)
diff --git a/testing/kdelibs/archlinux-menu.patch b/testing/kdelibs/archlinux-menu.patch
new file mode 100644
index 000000000..546784fa2
--- /dev/null
+++ b/testing/kdelibs/archlinux-menu.patch
@@ -0,0 +1,22 @@
+--- kdelibs-4.3.98/kded/applications.menu 2010-01-31 19:28:11.000000000 +0000
++++ kdelibs-4.3.98/kded/applications.menu 2010-01-31 22:25:53.556043077 +0000
+@@ -16,11 +16,19 @@
+ </DefaultLayout>
+ <Layout>
+ <Merge type="menus"/>
++ <Menuname>Arch Linux</Menuname>
+ <Menuname>Applications</Menuname>
+ <Merge type="files"/>
+ </Layout>
+
+ <Menu>
++ <Name>Arch Linux</Name>
++ <Directory>Archlinux.directory</Directory>
++ <Include>
++ <Category>Archlinux</Category>
++ </Include>
++ </Menu>
++ <Menu>
+ <Name>Applications</Name>
+ <Directory>kde-unknown.directory</Directory>
+ <OnlyUnallocated/>
diff --git a/testing/kdelibs/kde-applications-menu.patch b/testing/kdelibs/kde-applications-menu.patch
new file mode 100644
index 000000000..4b513298a
--- /dev/null
+++ b/testing/kdelibs/kde-applications-menu.patch
@@ -0,0 +1,22 @@
+--- kdelibs-4.3.98/kded/CMakeLists.txt 2009-10-02 14:55:17.000000000 +0000
++++ kdelibs-4.3.98/kded/CMakeLists.txt 2010-01-31 22:16:13.946933892 +0000
+@@ -69,7 +69,7 @@
+ if (WIN32)
+ install( FILES applications.menu DESTINATION ${SHARE_INSTALL_PREFIX}/xdg/menus )
+ else (WIN32)
+-install( FILES applications.menu DESTINATION ${SYSCONF_INSTALL_DIR}/xdg/menus )
++install( FILES applications.menu DESTINATION ${SYSCONF_INSTALL_DIR}/xdg/menus RENAME kde-applications.menu )
+ endif (WIN32)
+ install( FILES kdedmodule.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
+ install( FILES kded.upd DESTINATION ${DATA_INSTALL_DIR}/kconf_update )
+--- kdelibs-4.3.98/kded/kbuildsycoca.cpp 2009-12-04 23:10:18.000000000 +0000
++++ kdelibs-4.3.98/kded/kbuildsycoca.cpp 2010-01-31 22:16:13.962766572 +0000
+@@ -302,7 +302,7 @@
+ if (!m_trackId.isEmpty())
+ g_vfolder->setTrackId(m_trackId);
+
+- VFolderMenu::SubMenu *kdeMenu = g_vfolder->parseMenu("applications.menu", true);
++ VFolderMenu::SubMenu *kdeMenu = g_vfolder->parseMenu("kde-applications.menu", true);
+
+ KServiceGroup::Ptr entry = g_bsgf->addNew("/", kdeMenu->directoryFile, KServiceGroup::Ptr(), false);
+ entry->setLayoutInfo(kdeMenu->layoutList);
diff --git a/testing/kdelibs/kdelibs.install b/testing/kdelibs/kdelibs.install
new file mode 100644
index 000000000..ce5c32e1b
--- /dev/null
+++ b/testing/kdelibs/kdelibs.install
@@ -0,0 +1,12 @@
+post_install() {
+ xdg-icon-resource forceupdate --theme hicolor &> /dev/null
+ update-mime-database usr/share/mime &> /dev/null
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+} \ No newline at end of file
diff --git a/testing/krb5/PKGBUILD b/testing/krb5/PKGBUILD
new file mode 100644
index 000000000..4e3dd2c4f
--- /dev/null
+++ b/testing/krb5/PKGBUILD
@@ -0,0 +1,64 @@
+# $Id: PKGBUILD 122855 2011-05-06 19:36:38Z stephane $
+# Maintainer: Stéphane Gaudreault <stephane@archlinux.org>
+
+pkgname=krb5
+pkgver=1.9.1
+pkgrel=1
+pkgdesc="The Kerberos network authentication system"
+arch=('i686' 'x86_64')
+url="http://web.mit.edu/kerberos/"
+license=('custom')
+depends=('e2fsprogs' 'libldap' 'keyutils')
+makedepends=('perl')
+provides=('heimdal')
+replaces=('heimdal')
+conflicts=('heimdal')
+backup=('etc/krb5/krb5.conf' 'etc/krb5/kdc.conf')
+source=(http://web.mit.edu/kerberos/dist/${pkgname}/1.9/${pkgname}-${pkgver}-signed.tar
+ kadmind.rc
+ krb5-kdc.rc)
+sha1sums=('e23a1795a237521493da9cf3443ac8b98a90c066'
+ '640e3046c6558313d2be81cf2252afc8622892b0'
+ '77d2312ecd8bf12a6e72cc8fd871a8ac93b23393')
+options=('!emptydirs')
+
+build() {
+ tar zxvf ${pkgname}-${pkgver}.tar.gz
+ cd "${srcdir}/${pkgname}-${pkgver}/src"
+
+ export CFLAGS+=" -fPIC -fno-strict-aliasing -fstack-protector-all"
+ export CPPFLAGS+=" -I/usr/include/et"
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc/krb5 \
+ --mandir=/usr/share/man \
+ --localstatedir=/var/lib \
+ --enable-shared \
+ --with-system-et \
+ --with-system-ss \
+ --disable-rpath \
+ --without-tcl \
+ --enable-dns-for-realm \
+ --with-ldap
+
+ make
+}
+
+check() {
+ # We can't do this in the build directory.
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make -C src check
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}/src"
+ make DESTDIR="${pkgdir}" EXAMPLEDIR="/usr/share/doc/${pkgname}/examples" install
+
+ install -D -m 644 config-files/kdc.conf "${pkgdir}"/etc/krb5/kdc.conf
+ install -D -m 644 config-files/krb5.conf "${pkgdir}"/etc/krb5/krb5.conf
+
+ install -d -m 755 "${pkgdir}"/etc/rc.d
+ install -m 755 ../../krb5-kdc.rc "${pkgdir}"/etc/rc.d
+ install -m 755 ../../kadmind.rc "${pkgdir}"/etc/rc.d
+
+ install -Dm644 "${srcdir}"/${pkgname}-${pkgver}/NOTICE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
+}
diff --git a/testing/krb5/kadmind.rc b/testing/krb5/kadmind.rc
new file mode 100644
index 000000000..45835e35b
--- /dev/null
+++ b/testing/krb5/kadmind.rc
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/kadmind`
+case "$1" in
+ start)
+ stat_busy "Starting Kerberos Admin Daemon"
+ if [ -z "$PID" ]; then
+ /usr/sbin/kadmind
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon kadmind
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Kerberos Admin Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon kadmind
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/testing/krb5/krb5-kdc.rc b/testing/krb5/krb5-kdc.rc
new file mode 100644
index 000000000..05a03411e
--- /dev/null
+++ b/testing/krb5/krb5-kdc.rc
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/krb5kdc`
+case "$1" in
+ start)
+ stat_busy "Starting Kerberos Authentication"
+ if [ -z "$PID" ]; then
+ /usr/sbin/krb5kdc
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon krb5-kdc
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Kerberos Authentication"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon krb5-kdc
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/testing/libgnomecups/PKGBUILD b/testing/libgnomecups/PKGBUILD
new file mode 100644
index 000000000..157e18f50
--- /dev/null
+++ b/testing/libgnomecups/PKGBUILD
@@ -0,0 +1,31 @@
+# $Id: PKGBUILD 122592 2011-05-04 18:48:08Z ibiru $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Paulius Palevicius <paulius@birzai.com>
+
+pkgname=libgnomecups
+pkgver=0.2.3
+pkgrel=8
+pkgdesc="GNOME cups library"
+arch=(i686 x86_64)
+license=('LGPL' 'GPL')
+url="http://www.gnome.org"
+depends=('libcups' 'glib2' 'krb5' 'gnutls')
+makedepends=('perlxml')
+options=(!libtool)
+source=(http://ftp.gnome.org/pub/GNOME/sources/${pkgname}/0.2/${pkgname}-${pkgver}.tar.bz2
+ libgnomecups_0.2.3-ignore-ipp-not-found.patch)
+md5sums=('dc4920c15c9f886f73ea74fbff0ae48b'
+ '973a1b9d93013ce431400a14b78f5d94')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ # This avoids generating huge 'IPP request failed with status 1030' lines
+ patch -Np1 -i ${srcdir}/libgnomecups_0.2.3-ignore-ipp-not-found.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/testing/libgnomecups/libgnomecups_0.2.3-ignore-ipp-not-found.patch b/testing/libgnomecups/libgnomecups_0.2.3-ignore-ipp-not-found.patch
new file mode 100644
index 000000000..797367bf9
--- /dev/null
+++ b/testing/libgnomecups/libgnomecups_0.2.3-ignore-ipp-not-found.patch
@@ -0,0 +1,11 @@
+--- a/libgnomecups/gnome-cups-request.c 2007-01-31 10:49:17.000000000 -0800
++++ b/libgnomecups/gnome-cups-request.c 2009-11-24 12:49:30.000000000 -0800
+@@ -349,7 +349,7 @@
+ if (request->response == NULL)
+ status = IPP_INTERNAL_ERROR;
+
+- if (status > IPP_OK_CONFLICT) {
++ if (status > IPP_OK_CONFLICT && status != IPP_NOT_FOUND) {
+ g_warning ("IPP request failed with status %d", status);
+ if (request->error != NULL)
+ *(request->error) = g_error_new (GNOME_CUPS_ERROR,
diff --git a/testing/libgnomeprint/PKGBUILD b/testing/libgnomeprint/PKGBUILD
new file mode 100644
index 000000000..db2bfedcd
--- /dev/null
+++ b/testing/libgnomeprint/PKGBUILD
@@ -0,0 +1,28 @@
+# $Id: PKGBUILD 122595 2011-05-04 18:55:04Z ibiru $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=libgnomeprint
+pkgver=2.18.8
+pkgrel=2
+pkgdesc="Printing routines for GNOME"
+arch=(i686 x86_64)
+license=('LGPL' 'GPL')
+depends=('pango' 'libart-lgpl' 'libxml2' 'libgnomecups' 'krb5' 'gnutls')
+makedepends=('intltool' 'pkgconfig')
+replaces=('libgnomeprint-cups')
+conflicts=('libgnomeprint-cups')
+url="http://www.gnome.org"
+options=('!libtool')
+source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/2.18/${pkgname}-${pkgver}.tar.bz2)
+sha256sums=('1034ec8651051f84d2424e7a1da61c530422cc20ce5b2d9e107e1e46778d9691')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --disable-static
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/testing/librpcsecgss/PKGBUILD b/testing/librpcsecgss/PKGBUILD
new file mode 100644
index 000000000..c16ea175b
--- /dev/null
+++ b/testing/librpcsecgss/PKGBUILD
@@ -0,0 +1,27 @@
+# $Id: PKGBUILD 121187 2011-04-29 07:12:44Z stephane $
+# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+# Contributor: Andrew Krawchyk <krawch_a@denison.edu>, Marco Lima <cipparello gmail com>
+
+pkgname=librpcsecgss
+pkgver=0.19
+pkgrel=5
+pkgdesc="Library for RPCSECGSS support"
+arch=('i686' 'x86_64')
+url="http://www.citi.umich.edu/projects/nfsv4/linux/"
+license=('GPL')
+depends=('glibc' 'krb5' 'libgssglue')
+makedepends=('pkg-config' 'autoconf')
+options=('!libtool')
+source=("http://www.citi.umich.edu/projects/nfsv4/linux/${pkgname}/${pkgname}-${pkgver}.tar.gz")
+md5sums=('b45ed565bdc3099023aa35830ec92997')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="$pkgdir/" install
+}
diff --git a/testing/librpcsecgss/librpcsecgss-0.18-heimdal.patch b/testing/librpcsecgss/librpcsecgss-0.18-heimdal.patch
new file mode 100644
index 000000000..deb039123
--- /dev/null
+++ b/testing/librpcsecgss/librpcsecgss-0.18-heimdal.patch
@@ -0,0 +1,33 @@
+diff -NaurwB librpcsecgss-0.18.orig/configure.in librpcsecgss-0.18/configure.in
+--- librpcsecgss-0.18.orig/configure.in 2008-04-09 00:05:40.000000000 +0200
++++ librpcsecgss-0.18/configure.in 2008-06-12 19:05:51.000000000 +0200
+@@ -12,10 +12,15 @@
+ AC_PROG_RANLIB
+
+ # Checks for libraries.
+-PKG_CHECK_MODULES([GSSGLUE], [libgssglue >= 0.1], [],
++PKG_CHECK_MODULES([GSSGLUE], [libgssglue >= 0.1],
++ [echo GSSGLUE found; GSSAPI_IMPLEMENTATION=libgssglue],
++ [PKG_CHECK_MODULES([GSSGLUE], [heimdal-gssapi],
++ [echo HEIMDAL found; GSSAPI_IMPLEMENTATION=heimdal-gssapi],
+ [AC_MSG_ERROR([Unable to locate information required to use libgssglue.
+ If you have pkgconfig installed, you might try setting environment
+- variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig])])
++ variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig])])])
++
++AC_SUBST([GSSAPI_IMPLEMENTATION])
+
+ # Checks for header files.
+ AC_HEADER_STDC
+diff -NaurwB librpcsecgss-0.18.orig/librpcsecgss.pc.in librpcsecgss-0.18/librpcsecgss.pc.in
+--- librpcsecgss-0.18.orig/librpcsecgss.pc.in 2007-09-06 17:39:04.000000000 +0200
++++ librpcsecgss-0.18/librpcsecgss.pc.in 2008-06-12 19:06:40.000000000 +0200
+@@ -5,7 +5,7 @@
+
+ Name: librpcsecgss
+ Description: Library that implements rpcsec_gss interface.
+-Requires: libgssglue
++Requires: @GSSAPI_IMPLEMENTATION@
+ Version: @PACKAGE_VERSION@
+ Libs: -L@libdir@ -lrpcsecgss
+ Cflags: -I@includedir@/rpcsecgss
diff --git a/testing/libtirpc/PKGBUILD b/testing/libtirpc/PKGBUILD
new file mode 100644
index 000000000..b222249ff
--- /dev/null
+++ b/testing/libtirpc/PKGBUILD
@@ -0,0 +1,32 @@
+# $Id: PKGBUILD 121179 2011-04-29 06:50:46Z stephane $
+# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+pkgname=libtirpc
+pkgver=0.2.1
+pkgrel=3
+pkgdesc="Transport Independent RPC library (SunRPC replacement)"
+arch=(i686 x86_64)
+depends=('glibc' 'libgssglue' 'krb5')
+url="http://libtirpc.sourceforge.net/"
+license=('GPL2')
+source=(http://downloads.sourceforge.net/sourceforge/libtirpc/${pkgname}-${pkgver}.tar.bz2
+ libtirpc-0.2.1-fortify.patch)
+backup=('etc/netconfig')
+options=(!libtool)
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ # fix http://bugs.gentoo.org/293593
+ # https://bugs.archlinux.org/task/20082
+ patch -Np1 -i ../libtirpc-0.2.1-fortify.patch
+ ./configure --prefix=/usr --enable-gss
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ # install netconfig
+ install -D -m644 doc/etc_netconfig "${pkgdir}"/etc/netconfig
+}
+md5sums=('d77eb15f464bf9d6e66259eaf78b2a4e'
+ '2e5c067f1651469dfbbdc91d3c9c60e8')
diff --git a/testing/libtirpc/libtirpc-0.2.1-fortify.patch b/testing/libtirpc/libtirpc-0.2.1-fortify.patch
new file mode 100644
index 000000000..7375bf83e
--- /dev/null
+++ b/testing/libtirpc/libtirpc-0.2.1-fortify.patch
@@ -0,0 +1,18 @@
+Index: libtirpc-0.2.1/src/getrpcport.c
+===================================================================
+--- libtirpc-0.2.1.orig/src/getrpcport.c
++++ libtirpc-0.2.1/src/getrpcport.c
+@@ -54,11 +54,11 @@ getrpcport(host, prognum, versnum, proto
+
+ if ((hp = gethostbyname(host)) == NULL)
+ return (0);
++ if (hp->h_length != sizeof(addr.sin_addr.s_addr))
++ return (0);
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_family = AF_INET;
+ addr.sin_port = 0;
+- if (hp->h_length > sizeof(addr))
+- hp->h_length = sizeof(addr);
+ memcpy(&addr.sin_addr.s_addr, hp->h_addr, (size_t)hp->h_length);
+ /* Inconsistent interfaces need casts! :-( */
+ return (pmap_getport(&addr, (u_long)prognum, (u_long)versnum,
diff --git a/testing/mutt/PKGBUILD b/testing/mutt/PKGBUILD
new file mode 100644
index 000000000..9a940857c
--- /dev/null
+++ b/testing/mutt/PKGBUILD
@@ -0,0 +1,47 @@
+# $Id: PKGBUILD 121107 2011-04-29 00:34:05Z stephane $
+# Contributor: tobias [tobias [at] archlinux.org]
+# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+
+pkgname=mutt
+pkgver=1.5.21
+pkgrel=5
+pkgdesc='Small but very powerful text-based mail client'
+url='http://www.mutt.org/'
+license=('GPL')
+backup=('etc/Muttrc')
+arch=('i686' 'x86_64')
+depends=('gpgme' 'ncurses' 'openssl' 'libsasl' 'gdbm' 'libidn' 'mime-types' 'krb5')
+source=("ftp://ftp.mutt.org/mutt/devel/${pkgname}-${pkgver}.tar.gz")
+sha1sums=('a8475f2618ce5d5d33bff85c0affdf21ab1d76b9')
+
+install=install
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --enable-gpgme \
+ --enable-pop \
+ --enable-imap \
+ --enable-smtp \
+ --enable-hcache \
+ --with-curses=/usr \
+ --with-regex \
+ --with-gss=/usr \
+ --with-ssl=/usr \
+ --with-sasl \
+ --with-idn \
+
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ rm "${pkgdir}"/usr/bin/{flea,muttbug}
+ rm "${pkgdir}"/usr/share/man/man1/{flea,muttbug}.1
+ rm "${pkgdir}"/etc/mime.types{,.dist}
+ install -Dm644 contrib/gpg.rc "${pkgdir}"/etc/Muttrc.gpg.dist
+}
diff --git a/testing/mutt/install b/testing/mutt/install
new file mode 100644
index 000000000..d65675c06
--- /dev/null
+++ b/testing/mutt/install
@@ -0,0 +1,8 @@
+post_install() {
+ cat <<EOF
+
+==> For GPG support, add the following to your muttrc:
+==> source /etc/Muttrc.gpg.dist
+
+EOF
+}
diff --git a/testing/neon/PKGBUILD b/testing/neon/PKGBUILD
new file mode 100644
index 000000000..c0fe650cf
--- /dev/null
+++ b/testing/neon/PKGBUILD
@@ -0,0 +1,29 @@
+# $Id: PKGBUILD 121086 2011-04-29 00:26:05Z stephane $
+# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
+# Maintainer: Juergen Hoetzel <juergen@archlinux.org>
+
+# KEEP LIBTOOL FILES!
+pkgname=neon
+pkgver=0.29.3
+pkgrel=3
+pkgdesc="HTTP and WebDAV client library with a C interface"
+arch=('i686' 'x86_64')
+license=('GPL' 'LGPL')
+depends=('krb5' 'expat' 'ca-certificates')
+url="http://www.webdav.org/neon/"
+source=("http://www.webdav.org/neon/${pkgname}-${pkgver}.tar.gz")
+md5sums=('ba1015b59c112d44d7797b62fe7bee51')
+options=('libtool')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ ./configure --prefix=/usr \
+ --with-expat --enable-shared --disable-static \
+ --with-ssl=openssl --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt
+ make
+}
+
+package() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ make DESTDIR=${pkgdir} install
+}
diff --git a/testing/nfs-utils/PKGBUILD b/testing/nfs-utils/PKGBUILD
new file mode 100644
index 000000000..93c240267
--- /dev/null
+++ b/testing/nfs-utils/PKGBUILD
@@ -0,0 +1,69 @@
+# $Id: PKGBUILD 122900 2011-05-07 07:40:46Z tpowa $
+# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+# Contributor: John Proctor <jproctor@prium.net>
+# Contributor: dibblethewrecker <dibblethewrecker.at.jiwe.org>
+# Contributor: abelstr <abel@pinklf.eu>
+# Contributor: Marco Lima <cipparello gmail com>
+
+pkgname=nfs-utils
+pkgver=1.2.3
+pkgrel=1
+pkgdesc="Support programs for Network File Systems"
+arch=('i686' 'x86_64')
+url='http://nfs.sourceforge.net'
+license=('GPL')
+backup=(etc/{exports,idmapd.conf} etc/conf.d/{nfs-common.conf,nfs-server.conf})
+depends=('glibc' 'tcp_wrappers' 'e2fsprogs' 'rpcbind' 'libtirpc>=0.2.1' 'librpcsecgss>=0.19-2' 'nfsidmap' 'libevent>=2.0.10' 'libgssglue')
+makedepends=('pkgconfig' 'autoconf' 'automake')
+source=(http://downloads.sourceforge.net/project/nfs/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.bz2
+ nfs-common
+ nfs-common.conf
+ nfs-server
+ nfs-server.conf
+ exports
+ idmapd.conf
+ start-statd.patch
+ nfs-utils-1.1.4-mtab-sym.patch
+ nfs-utils-1.1.4-no-exec.patch)
+install=nfs-utils.install
+md5sums=('1131dc5f27c4f3905a6e7ee0d594fd4d'
+ 'fc508e10cdf5e8ddd80373b1b2bc99a1'
+ 'f73f197a16b02c3e248488ec35c4cf43'
+ '5ae080f6117cef3140f02bc162bdc755'
+ 'b9b334414baec31b97f0431d9ecdcfb9'
+ 'ff585faf410a62c4333a027c50b56bae'
+ 'eb4f4027fab6fc1201f1ca04f5954c76'
+ 'e24f81a8c8657672e262c61235d34b4a'
+ '7674106eaaa4c149bccd4f05fe3604e9'
+ '4f4827dfc93008dfadd0a530ad0872b2')
+
+build() {
+ cd $srcdir/${pkgname}-${pkgver}
+ patch -Np1 -i ../nfs-utils-1.1.4-mtab-sym.patch
+ patch -Np1 -i ../nfs-utils-1.1.4-no-exec.patch
+
+ # arch specific patch
+ patch -Np0 -i $srcdir/start-statd.patch
+
+ ./configure --prefix=/usr --enable-nfsv3 --enable-nfsv4 --enable-gss \
+ --with-tcp-wrappers --with-statedir=/var/lib/nfs --enable-ipv6 --sysconfdir=/etc
+
+ make
+}
+
+package() {
+ cd $srcdir/${pkgname}-${pkgver}
+ make DESTDIR=$pkgdir install
+
+ # NFS & NFSv4 init scripts
+ install -D -m 755 ../nfs-common "$pkgdir/"etc/rc.d/nfs-common
+ install -D -m 755 ../nfs-server "$pkgdir/"etc/rc.d/nfs-server
+ # Configuration
+ install -D -m 644 ../exports "$pkgdir/"etc/exports
+ install -D -m 644 ../idmapd.conf "$pkgdir/"etc/idmapd.conf
+ install -D -m 644 ../nfs-common.conf "$pkgdir/"etc/conf.d/nfs-common.conf
+ install -D -m 644 ../nfs-server.conf "$pkgdir/"etc/conf.d/nfs-server.conf
+ # directories
+ mkdir "$pkgdir/"var/lib/nfs/rpc_pipefs
+ mkdir "$pkgdir/"var/lib/nfs/v4recovery
+}
diff --git a/testing/nfs-utils/exports b/testing/nfs-utils/exports
new file mode 100644
index 000000000..8f4aac598
--- /dev/null
+++ b/testing/nfs-utils/exports
@@ -0,0 +1,15 @@
+# /etc/exports
+#
+# List of directories exported to NFS clients. See exports(5).
+# Use exportfs -arv to reread.
+#
+# Example for NFSv2 and NFSv3:
+# /srv/home hostname1(rw,sync) hostname2(ro,sync)
+#
+# Example for NFSv4:
+# /srv/nfs4 hostname1(rw,sync,fsid=0)
+# /srv/nfs4/home hostname1(rw,sync,nohide)
+# Using Kerberos and integrity checking:
+# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)
+# /srv/nfs4/home gss/krb5i(rw,sync,nohide)
+#
diff --git a/testing/nfs-utils/idmapd.conf b/testing/nfs-utils/idmapd.conf
new file mode 100644
index 000000000..b1b23afe9
--- /dev/null
+++ b/testing/nfs-utils/idmapd.conf
@@ -0,0 +1,14 @@
+[General]
+
+Verbosity = 0
+Pipefs-Directory = /var/lib/nfs/rpc_pipefs
+Domain = localdomain
+
+[Mapping]
+
+Nobody-User = nobody
+Nobody-Group = nobody
+
+[Translation]
+
+Method = nsswitch
diff --git a/testing/nfs-utils/nfs-common b/testing/nfs-utils/nfs-common
new file mode 100644
index 000000000..13742bde3
--- /dev/null
+++ b/testing/nfs-utils/nfs-common
@@ -0,0 +1,319 @@
+#!/bin/bash
+
+daemon_name=nfs-common
+
+# daemon dependencies
+DAEMON_DEPENDS=('rpcbind')
+
+NEED_STATD=
+STATD_OPTS=
+NEED_IDMAPD=
+IDMAPD_OPTS=
+NEED_GSSD=
+GSSD_OPTS=
+PIPEFS_MOUNTPOINT=
+PIPEFS_MOUNTOPTS=
+
+# rpc.statd daemon & binary location
+STATD_DAEMON_NAME=rpc.statd
+STATD="/usr/sbin/rpc.statd"
+
+# rpc.idmapd daemon & binary location
+IDMAPD_DAEMON_NAME=rpc.idmapd
+IDMAPD="/usr/sbin/rpc.idmapd"
+
+# rpc.gssd daemon & binary location
+GSSD_DAEMON_NAME=rpc.gssd
+GSSD="/usr/sbin/rpc.gssd"
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+# Default mountpoint and options for rpc_pipefs filesystem
+[ -z "$PIPEFS_MOUNTPOINT" ] && PIPEFS_MOUNTPOINT="/var/lib/nfs/rpc_pipefs"
+[ -z "$PIPEFS_MOUNTOPTS" ] && PIPEFS_MOUNTOPTS="defaults"
+
+# Parse the fstab file, and determine whether we need idmapd and gssd. (The
+# /etc/conf.d/nfs-common settings, if any, will override our autodetection.)
+AUTO_NEED_IDMAPD=no
+AUTO_NEED_GSSD=no
+
+if [ -f /etc/fstab ]; then
+ exec 9<&0 </etc/fstab
+
+ while read DEV MTPT FSTYPE OPTS REST; do
+ if [ "$FSTYPE" = "nfs4" ]; then
+ AUTO_NEED_IDMAPD=yes
+ fi
+ case "$OPTS" in
+ sec=krb5|*,sec=krb5|sec=krb5,*|*,sec=krb5i,*|sec=krb5i|*,sec=krb5i|sec=krb5i,*|*,sec=krb5i,*|sec=krb5p|*,sec=krb5p|sec=krb5p,*|*,sec=krb5p,*)
+ AUTO_NEED_GSSD=yes
+ ;;
+ esac
+ done
+
+ exec 0<&9 9<&-
+fi
+
+# We also need idmapd if we run an NFSv4 server. It's fairly difficult
+# to autodetect whether there are NFSv4 exports or not, and idmapd is not a
+# particularily heavy daemon, so we auto-enable it if we find an /etc/exports
+# file. This does not mean that there are NFSv4 or other mounts active (or
+# even that nfs-kernel-server is installed), but it matches what the "start"
+# condition in nfs-kernel-server's init script does, which has a value in
+# itself.
+if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' /etc/exports; then
+ AUTO_NEED_IDMAPD=yes
+fi
+
+case "$NEED_STATD" in
+ yes|no)
+ ;;
+ *)
+ NEED_STATD=yes
+ ;;
+esac
+
+case "$NEED_IDMAPD" in
+ yes|no)
+ ;;
+ *)
+ NEED_IDMAPD=$AUTO_NEED_IDMAPD
+ ;;
+esac
+
+case "$NEED_GSSD" in
+ yes|no)
+ ;;
+ *)
+ NEED_GSSD=$AUTO_NEED_GSSD
+ ;;
+esac
+
+do_modprobe() {
+ if [ -x /sbin/modprobe -a -f /proc/modules ]; then
+ modprobe -q "$1" || true
+ fi
+}
+
+do_mount() {
+ if ! grep -E "$1\$" /proc/filesystems &> /dev/null ; then
+ return 1
+ fi
+
+ if grep -vw "$1" /proc/mounts &> /dev/null ; then
+ if ! mountpoint -q "$2" ; then
+ mount -t "$1" "$1" "$2" -o "$3"
+ return
+ fi
+ fi
+ return 0
+}
+
+do_umount() {
+ if mountpoint -q "$1" ; then
+ umount "$1"
+ fi
+ return 0
+}
+
+get_pid() {
+ pidof -o %PPID "$1"
+}
+
+case "$1" in
+ start)
+ ck_depends ${DAEMON_DEPENDS[@]}
+
+ rc=0
+ if [ "$NEED_STATD" = yes ]; then
+ stat_busy "Starting $STATD_DAEMON_NAME daemon"
+ PID=$(get_pid $STATD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$STATD_DAEMON_NAME.pid ] && rm -f /var/run/$STATD_DAEMON_NAME.pid
+ # RUN
+ $STATD $STATD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $STATD) > /var/run/$STATD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ # Run sm-notify
+ /usr/sbin/sm-notify $SMNOTIFY_OPTS
+ fi
+
+ if [ "$NEED_IDMAPD" = yes ] || [ "$NEED_GSSD" = yes ]; then
+ stat_busy "Mounting pipefs filesystem"
+ do_modprobe sunrpc
+ do_modprobe nfs
+ do_modprobe nfsd
+ do_mount rpc_pipefs "$PIPEFS_MOUNTPOINT" "$PIPEFS_MOUNTOPTS"
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+
+ if [ "$NEED_IDMAPD" = yes ]; then
+ stat_busy "Starting $IDMAPD_DAEMON_NAME daemon"
+ PID=$(get_pid $IDMAPD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$IDMAPD_DAEMON_NAME.pid ] && rm -f /var/run/$IDMAPD_DAEMON_NAME.pid
+ # RUN
+ $IDMAPD $IDMAPD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $IDMAPD) > /var/run/$IDMAPD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ fi
+
+ if [ "$NEED_GSSD" = yes ]; then
+ do_modprobe rpcsec_gss_krb5
+ stat_busy "Starting $GSSD_DAEMON_NAME daemon"
+ PID=$(get_pid $GSSD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$GSSD_DAEMON_NAME.pid ] && rm -f /var/run/$GSSD_DAEMON_NAME.pid
+ # RUN
+ $GSSD $GSSD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $GSSD) > /var/run/$GSSD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ fi
+ fi
+
+ add_daemon $daemon_name
+ ;;
+
+ stop)
+ rc=0
+ if [ "$NEED_IDMAPD" = yes ] || [ "$NEED_GSSD" = yes ]; then
+
+ if [ "$NEED_GSSD" = yes ]; then
+ stat_busy "Stopping $GSSD_DAEMON_NAME daemon"
+ PID=$(get_pid $GSSD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$GSSD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+ fi
+
+ if [ "$NEED_IDMAPD" = yes ]; then
+ stat_busy "Stopping $IDMAPD_DAEMON_NAME daemon"
+ PID=$(get_pid $IDMAPD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$IDMAPD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+ fi
+ do_umount "$PIPEFS_MOUNTPOINT" 2>/dev/null || true
+ fi
+
+ if [ "$NEED_STATD" = yes ]; then
+ stat_busy "Stopping $STATD_DAEMON_NAME daemon"
+ PID=$(get_pid $STATD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$STATD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+ fi
+
+ rm_daemon $daemon_name
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+
+ if [ "$NEED_STATD" = yes ]; then
+ stat_busy "Daemon $STATD_DAEMON_NAME running"
+ PID=$(get_pid $STATD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+
+ if [ "$NEED_GSSD" = yes ]; then
+ stat_busy "Daemon $GSSD_DAEMON_NAME running"
+ PID=$(get_pid $GSSD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+
+ if [ "$NEED_IDMAPD" = yes ]; then
+ stat_busy "Daemon $IDMAPD_DAEMON_NAME running"
+ PID=$(get_pid $IDMAPD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+ echo
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|status|restart}"
+esac
+exit 0
+
diff --git a/testing/nfs-utils/nfs-common.conf b/testing/nfs-utils/nfs-common.conf
new file mode 100644
index 000000000..12466b3e5
--- /dev/null
+++ b/testing/nfs-utils/nfs-common.conf
@@ -0,0 +1,40 @@
+# Parameters to be passed to nfs-common (nfs clients & server) init script.
+#
+
+# If you do not set values for the NEED_ options, they will be attempted
+# autodetected; this should be sufficient for most people. Valid alternatives
+# for the NEED_ options are "yes" and "no".
+
+# Do you want to start the statd daemon? It is not needed for NFSv4.
+NEED_STATD=""
+
+# Options to pass to rpc.statd.
+# See rpc.statd(8) for more details.
+# N.B. statd normally runs on both client and server, and run-time
+# options should be specified accordingly.
+# STATD_OPTS="-p 32765 -o 32766"
+STATD_OPTS=""
+
+# Options to pass to sm-notify
+# e.g. SMNOTIFY_OPTS="-p 32764"
+SMNOTIFY_OPTS=""
+
+# Do you want to start the idmapd daemon? It is only needed for NFSv4.
+NEED_IDMAPD=""
+
+# Options to pass to rpc.idmapd.
+# See rpc.idmapd(8) for more details.
+IDMAPD_OPTS=""
+
+# Do you want to start the gssd daemon? It is required for Kerberos mounts.
+NEED_GSSD=""
+
+# Options to pass to rpc.gssd.
+# See rpc.gssd(8) for more details.
+GSSD_OPTS=""
+
+# Where to mount rpc_pipefs filesystem; the default is "/var/lib/nfs/rpc_pipefs".
+PIPEFS_MOUNTPOINT=""
+
+# Options used to mount rpc_pipefs filesystem; the default is "defaults".
+PIPEFS_MOUNTOPTS=""
diff --git a/testing/nfs-utils/nfs-server b/testing/nfs-utils/nfs-server
new file mode 100644
index 000000000..9574cbc12
--- /dev/null
+++ b/testing/nfs-utils/nfs-server
@@ -0,0 +1,303 @@
+#!/bin/bash
+
+daemon_name=nfs-server
+
+# daemon dependencies
+DAEMON_DEPENDS=('nfs-common')
+
+NFSD_COUNT=
+NFSD_OPTS=
+NEED_SVCGSSD=
+SVCGSSD_OPTS=
+MOUNTD_OPTS=
+PROCNFSD_MOUNTPOINT=
+PROCNFSD_MOUNTOPTS=
+
+# rpc.nfsd daemon & binary location
+NFSD_PROCESS_NAME=nfsd
+NFSD_DAEMON_NAME=rpc.nfsd
+NFSD="/usr/sbin/rpc.nfsd"
+
+# rpc.svcgssd daemon & binary location
+SVCGSSD_DAEMON_NAME=rpc.svcgssd
+SVCGSSD="/usr/sbin/rpc.svcgssd"
+
+# rpc.idmapd daemon & binary location
+IDMAPD_DAEMON_NAME=rpc.idmapd
+IDMAPD="/usr/sbin/rpc.idmapd"
+
+# rpc.mountd daemon & binary location
+MOUNTD_DAEMON_NAME=rpc.mountd
+MOUNTD="/usr/sbin/rpc.mountd"
+
+# exortfs binary location
+EXPORTFS="/usr/sbin/exportfs"
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+# Default number of nfsd servers
+[ -z "$NFSD_COUNT" ] && NFSD_COUNT=8
+
+# Default mountpoint and options for nfsd filesystem
+[ -z "$PROCNFSD_MOUNTPOINT" ] && PROCNFSD_MOUNTPOINT="/proc/fs/nfsd"
+[ -z "$PROCNFSD_MOUNTOPTS" ] && PROCNFSD_MOUNTOPTS="rw,nodev,noexec,nosuid"
+
+case "$NEED_SVCGSSD" in
+ yes|no)
+ ;;
+ *)
+ NEED_SVCGSSD=no
+ ;;
+esac
+
+do_modprobe() {
+ if [ -x /sbin/modprobe -a -f /proc/modules ]; then
+ modprobe -q "$1" || true
+ fi
+}
+
+do_mount() {
+ if ! grep -E "$1\$" /proc/filesystems &> /dev/null ; then
+ return 1
+ fi
+
+ if grep -vw "$1" /proc/mounts &> /dev/null ; then
+ if ! mountpoint -q "$2" ; then
+ mount -t "$1" "$1" "$2" -o "$3"
+ return
+ fi
+ fi
+ return 0
+}
+
+do_umount() {
+ if mountpoint -q "$1" ; then
+ umount "$1"
+ fi
+ return 0
+}
+
+get_pid() {
+ pidof -o %PPID "$1"
+}
+
+case "$1" in
+ start)
+ ck_depends ${DAEMON_DEPENDS[@]}
+
+ rc=0
+ stat_busy "Mounting nfsd filesystem"
+ do_modprobe nfsd
+ do_mount nfsd "$PROCNFSD_MOUNTPOINT" "$PROCNFSD_MOUNTOPTS"
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+
+ stat_busy "Exporting all directories"
+ $EXPORTFS -r
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+
+ stat_busy "Starting $NFSD_DAEMON_NAME daemon"
+ PID=$(get_pid $NFSD_PROCESS_NAME)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$NFSD_DAEMON_NAME.pid ] && rm -f /var/run/$NFSD_DAEMON_NAME.pid
+ # RUN
+ $NFSD $NFSD_OPTS $NFSD_COUNT
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $NFSD_PROCESS_NAME) > /var/run/$NFSD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+
+ if [ "$NEED_SVCGSSD" = yes ]; then
+ do_modprobe rpcsec_gss_krb5
+ stat_busy "Starting $SVCGSSD_DAEMON_NAME daemon"
+ PID=$(get_pid $SVCGSSD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$SVCGSSD_DAEMON_NAME.pid ] && rm -f /var/run/$SVCGSSD_DAEMON_NAME.pid
+ # RUN
+ $SVCGSSD $SVCGSSD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $SVCGSSD) > /var/run/$SVCGSSD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ fi
+
+ PID=$(get_pid $IDMAPD)
+ [ ! -z "$PID" ] && kill -SIGHUP $IDMAPD_DAEMON_NAME &> /dev/null
+
+ stat_busy "Starting $MOUNTD_DAEMON_NAME daemon"
+ PID=$(get_pid $MOUNTD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$MOUNTD_DAEMON_NAME.pid ] && rm -f /var/run/$MOUNTD_DAEMON_NAME.pid
+ # RUN
+ $MOUNTD $MOUNTD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $MOUNTD) > /var/run/$MOUNTD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+
+ add_daemon $daemon_name
+ ;;
+
+ stop)
+ rc=0
+ stat_busy "Stopping $MOUNTD_DAEMON_NAME daemon"
+ PID=$(get_pid $MOUNTD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$MOUNTD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+
+ if [ "$NEED_SVCGSSD" = yes ]; then
+ stat_busy "Stopping $SVCGSSD_DAEMON_NAME daemon"
+ PID=$(get_pid $SVCGSSD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$SVCGSSD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+ fi
+
+ stat_busy "Stopping $NFSD_DAEMON_NAME daemon"
+ PID=$(get_pid $NFSD_PROCESS_NAME)
+ # KILL (SIGINT)
+ [ ! -z "$PID" ] && kill -2 $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ sleep 1
+ PID=$(get_pid $NFSD_PROCESS_NAME)
+ # KILL (KILL) - just to be sure
+ [ ! -z "$PID" ] && kill -9 $PID &> /dev/null
+ #
+ rm -f /var/run/$NFSD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+
+ stat_busy "Unexporting all directories"
+ $EXPORTFS -au
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+
+ # flush everything out of the kernels export table
+ if mountpoint -q "$PROCNFSD_MOUNTPOINT" ; then
+ $EXPORTFS -f
+ fi
+ do_umount "$PROCNFSD_MOUNTPOINT" 2>/dev/null || true
+ rm_daemon $daemon_name
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+
+ stat_busy "Daemon $NFSD_DAEMON_NAME running"
+ PID=$(get_pid $NFSD_PROCESS_NAME)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+
+ stat_busy "Daemon $MOUNTD_DAEMON_NAME running"
+ PID=$(get_pid $MOUNTD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+
+ if [ "$NEED_SVCGSSD" = yes ]; then
+ stat_busy "Daemon $SVCGSSD_DAEMON_NAME running"
+ PID=$(get_pid $SVCGSSD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+ echo
+ ;;
+
+ reload)
+ rc=0
+ stat_busy "Re-exporting all directories"
+ $EXPORTFS -r
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|status|reload|restart}"
+esac
+exit 0
diff --git a/testing/nfs-utils/nfs-server.conf b/testing/nfs-utils/nfs-server.conf
new file mode 100644
index 000000000..cf75fb6f9
--- /dev/null
+++ b/testing/nfs-utils/nfs-server.conf
@@ -0,0 +1,29 @@
+# Parameters to be passed to nfs-server init script.
+#
+
+# Options to pass to rpc.nfsd.
+# See rpc.nfsd(8) for more details.
+NFSD_OPTS=""
+
+# Number of servers to start up; the default is 8 servers.
+NFSD_COUNT=""
+
+# Where to mount nfsd filesystem; the default is "/proc/fs/nfsd".
+PROCNFSD_MOUNTPOINT=""
+
+# Options used to mount nfsd filesystem; the default is "rw,nodev,noexec,nosuid".
+PROCNFSD_MOUNTOPTS=""
+
+# Options for rpc.mountd.
+# If you have a port-based firewall, you might want to set up
+# a fixed port here using the --port option.
+# See rpc.mountd(8) for more details.
+MOUNTD_OPTS="--no-nfs-version 1 --no-nfs-version 2"
+
+# Do you want to start the svcgssd daemon? It is only required for Kerberos
+# exports. Valid alternatives are "yes" and "no"; the default is "no".
+NEED_SVCGSSD=""
+
+# Options to pass to rpc.svcgssd.
+# See rpc.svcgssd(8) for more details.
+SVCGSSD_OPTS=""
diff --git a/testing/nfs-utils/nfs-utils-1.1.2-kerberos-ac.patch b/testing/nfs-utils/nfs-utils-1.1.2-kerberos-ac.patch
new file mode 100644
index 000000000..4a5a138e7
--- /dev/null
+++ b/testing/nfs-utils/nfs-utils-1.1.2-kerberos-ac.patch
@@ -0,0 +1,138 @@
+diff -NaurwB nfs-utils-1.1.2.orig/aclocal/kerberos5.m4 nfs-utils-1.1.2/aclocal/kerberos5.m4
+--- nfs-utils-1.1.2.orig/aclocal/kerberos5.m4 2008-03-14 16:46:29.000000000 +0100
++++ nfs-utils-1.1.2/aclocal/kerberos5.m4 2008-06-12 17:13:51.000000000 +0200
+@@ -1,112 +1,48 @@
+-dnl Checks for Kerberos
+-dnl NOTE: while we intend to do generic gss-api, currently we
+-dnl have a requirement to get an initial Kerberos machine
+-dnl credential. Thus, the requirement for Kerberos.
+-dnl The Kerberos gssapi library will be dynamically loaded?
+ AC_DEFUN([AC_KERBEROS_V5],[
++ K5CONFIG="krb5-config"
+ AC_MSG_CHECKING(for Kerberos v5)
+- AC_ARG_WITH(krb5,
+- [AC_HELP_STRING([--with-krb5=DIR], [use Kerberos v5 installation in DIR])],
++ AC_ARG_WITH(krb5-config,
++ [AC_HELP_STRING([--with-krb5-config=PATH], [Full Path to krb5-config.])],
+ [ case "$withval" in
+ yes|no)
+- krb5_with=""
++ K5CONFIG="krb5-config"
+ ;;
+ *)
+- krb5_with="$withval"
++ K5CONFIG="$withval"
+ ;;
+ esac ]
+ )
+
+- for dir in $krb5_with /usr /usr/kerberos /usr/local /usr/local/krb5 \
+- /usr/krb5 /usr/heimdal /usr/local/heimdal /usr/athena ; do
+- dnl This ugly hack brought on by the split installation of
+- dnl MIT Kerberos on Fedora Core 1
+- K5CONFIG=""
+- if test -f $dir/bin/krb5-config; then
+- K5CONFIG=$dir/bin/krb5-config
+- elif test -f "/usr/kerberos/bin/krb5-config"; then
+- K5CONFIG="/usr/kerberos/bin/krb5-config"
+- elif test -f "/usr/lib/mit/bin/krb5-config"; then
+- K5CONFIG="/usr/lib/mit/bin/krb5-config"
+- fi
+ if test "$K5CONFIG" != ""; then
+ KRBCFLAGS=`$K5CONFIG --cflags`
+ KRBLIBS=`$K5CONFIG --libs gssapi`
+- K5VERS=`$K5CONFIG --version | head -n 1 | awk '{split($(4),v,"."); if (v@<:@"3"@:>@ == "") v@<:@"3"@:>@ = "0"; print v@<:@"1"@:>@v@<:@"2"@:>@v@<:@"3"@:>@ }'`
+- AC_DEFINE_UNQUOTED(KRB5_VERSION, $K5VERS, [Define this as the Kerberos version number])
+- if test -f $dir/include/gssapi/gssapi_krb5.h -a \
+- \( -f $dir/lib/libgssapi_krb5.a -o \
+- -f $dir/lib64/libgssapi_krb5.a -o \
+- -f $dir/lib64/libgssapi_krb5.so -o \
+- -f $dir/lib/libgssapi_krb5.so \) ; then
++ if $K5CONFIG --version | grep -q -e heimdal; then
++ K5VERS=`$K5CONFIG --version | head -n 1 | cut -f2 -d ' ' | tr -d '.'`
++ AC_DEFINE(HAVE_HEIMDAL, 1, [Define this if you have Heimdal Kerberos libraries])
++ gssapi_lib=gssapi
++ KRBIMPL="heimdal"
++ elif $K5CONFIG --version | grep -q -e mit; then
++ K5VERS=`$K5CONFIG --version | head -n 1 | cut -f4 -d ' ' | tr -d '.'`
+ AC_DEFINE(HAVE_KRB5, 1, [Define this if you have MIT Kerberos libraries])
+- KRBDIR="$dir"
+- dnl If we are using MIT K5 1.3.1 and before, we *MUST* use the
+- dnl private function (gss_krb5_ccache_name) to get correct
+- dnl behavior of changing the ccache used by gssapi.
+- dnl Starting in 1.3.2, we *DO NOT* want to use
+- dnl gss_krb5_ccache_name, instead we want to set KRB5CCNAME
+- dnl to get gssapi to use a different ccache
+ if test $K5VERS -le 131; then
+ AC_DEFINE(USE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the private function, gss_krb5_cache_name, must be used to tell the Kerberos library which credentials cache to use. Otherwise, this is done by setting the KRB5CCNAME environment variable])
+ fi
+ gssapi_lib=gssapi_krb5
+- break
+- dnl The following ugly hack brought on by the split installation
+- dnl of Heimdal Kerberos on SuSe
+- elif test \( -f $dir/include/heim_err.h -o\
+- -f $dir/include/heimdal/heim_err.h \) -a \
+- -f $dir/lib/libroken.a; then
+- AC_DEFINE(HAVE_HEIMDAL, 1, [Define this if you have Heimdal Kerberos libraries])
+- KRBDIR="$dir"
+- gssapi_lib=gssapi
+- break
+- fi
+- fi
+- done
+- dnl We didn't find a usable Kerberos environment
+- if test "x$KRBDIR" = "x"; then
+- if test "x$krb5_with" = "x"; then
+- AC_MSG_ERROR(Kerberos v5 with GSS support not found: consider --disable-gss or --with-krb5=)
++ KRBIMPL="mit-krb5"
+ else
+- AC_MSG_ERROR(Kerberos v5 with GSS support not found at $krb5_with)
+- fi
++ AC_MSG_ERROR(Unknown Kerberos 5 Implementation. Is neither heimdal or mit-krb5.)
++ KRBIMPL="unknown"
+ fi
+- AC_MSG_RESULT($KRBDIR)
+-
+- dnl Check if -rpath=$(KRBDIR)/lib is needed
+- echo "The current KRBDIR is $KRBDIR"
+- if test "$KRBDIR/lib" = "/lib" -o "$KRBDIR/lib" = "/usr/lib" \
+- -o "$KRBDIR/lib" = "//lib" -o "$KRBDIR/lib" = "/usr//lib" ; then
+- KRBLDFLAGS="";
+- elif /sbin/ldconfig -p | grep > /dev/null "=> $KRBDIR/lib/"; then
+- KRBLDFLAGS="";
+- else
+- KRBLDFLAGS="-Wl,-rpath=$KRBDIR/lib"
++ AC_DEFINE_UNQUOTED(KRB5_VERSION, $K5VERS, [Define this as the Kerberos version number])
+ fi
++ AC_MSG_RESULT($KRBIMPL)
+
+- dnl Now check for functions within gssapi library
+- AC_CHECK_LIB($gssapi_lib, gss_krb5_export_lucid_sec_context,
+- AC_DEFINE(HAVE_LUCID_CONTEXT_SUPPORT, 1, [Define this if the Kerberos GSS library supports gss_krb5_export_lucid_sec_context]), ,$KRBLIBS)
+- AC_CHECK_LIB($gssapi_lib, gss_krb5_set_allowable_enctypes,
+- AC_DEFINE(HAVE_SET_ALLOWABLE_ENCTYPES, 1, [Define this if the Kerberos GSS library supports gss_krb5_set_allowable_enctypes]), ,$KRBLIBS)
+- AC_CHECK_LIB($gssapi_lib, gss_krb5_ccache_name,
+- AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the Kerberos GSS library supports gss_krb5_ccache_name]), ,$KRBLIBS)
+-
+- dnl Check for newer error message facility
+- AC_CHECK_LIB($gssapi_lib, krb5_get_error_message,
+- AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE, 1, [Define this if the function krb5_get_error_message is available]), ,$KRBLIBS)
++ AC_CHECK_LIB($gssapi_lib, gss_krb5_export_lucid_sec_context, AC_DEFINE(HAVE_LUCID_CONTEXT_SUPPORT, 1, [Define this if the Kerberos GSS library supports gss_krb5_export_lucid_sec_context]), ,$KRBLIBS)
++ AC_CHECK_LIB($gssapi_lib, gss_krb5_set_allowable_enctypes, AC_DEFINE(HAVE_SET_ALLOWABLE_ENCTYPES, 1, [Define this if the Kerberos GSS library supports gss_krb5_set_allowable_enctypes]), ,$KRBLIBS)
++ AC_CHECK_LIB($gssapi_lib, gss_krb5_ccache_name, AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the Kerberos GSS library supports gss_krb5_ccache_name]), ,$KRBLIBS)
++ AC_CHECK_LIB($gssapi_lib, krb5_get_error_message, AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE, 1, [Define this if the function krb5_get_error_message is available]), ,$KRBLIBS)
++ AC_CHECK_LIB($gssapi_lib, krb5_get_init_creds_opt_set_addressless, AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS, 1, [Define this if the function krb5_get_init_creds_opt_set_addressless is available]), ,$KRBLIBS)
+
+- dnl Check for function to specify addressless tickets
+- AC_CHECK_LIB($gssapi_lib, krb5_get_init_creds_opt_set_addressless,
+- AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS, 1, [Define this if the function krb5_get_init_creds_opt_set_addressless is available]), ,$KRBLIBS)
+-
+- dnl If they specified a directory and it didn't work, give them a warning
+- if test "x$krb5_with" != "x" -a "$krb5_with" != "$KRBDIR"; then
+- AC_MSG_WARN(Using $KRBDIR instead of requested value of $krb5_with for Kerberos!)
+- fi
+-
+- AC_SUBST([KRBDIR])
+ AC_SUBST([KRBLIBS])
+ AC_SUBST([KRBCFLAGS])
+ AC_SUBST([KRBLDFLAGS])
diff --git a/testing/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch b/testing/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch
new file mode 100644
index 000000000..c9e60afc7
--- /dev/null
+++ b/testing/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch
@@ -0,0 +1,39 @@
+ripped from Debian
+
+--- nfs-utils-1.1.4/utils/mount/fstab.c
++++ nfs-utils-1.1.4/utils/mount/fstab.c
+@@ -57,7 +57,7 @@ mtab_does_not_exist(void) {
+ return var_mtab_does_not_exist;
+ }
+
+-static int
++int
+ mtab_is_a_symlink(void) {
+ get_mtab_info();
+ return var_mtab_is_a_symlink;
+--- nfs-utils-1.1.4/utils/mount/fstab.h
++++ nfs-utils-1.1.4/utils/mount/fstab.h
+@@ -7,6 +7,7 @@
+ #define _PATH_FSTAB "/etc/fstab"
+ #endif
+
++int mtab_is_a_symlink(void);
+ int mtab_is_writable(void);
+ int mtab_does_not_exist(void);
+ void reset_mtab_info(void);
+--- nfs-utils-1.1.4/utils/mount/mount.c
++++ nfs-utils-1.1.4/utils/mount/mount.c
+@@ -230,6 +230,13 @@ create_mtab (void) {
+ int flags;
+ mntFILE *mfp;
+
++ /* Avoid writing if the mtab is a symlink to /proc/mounts, since
++ that would create a file /proc/mounts in case the proc filesystem
++ is not mounted, and the fchmod below would also fail. */
++ if (mtab_is_a_symlink()) {
++ return EX_SUCCESS;
++ }
++
+ lock_mtab();
+
+ mfp = nfs_setmntent (MOUNTED, "a+");
diff --git a/testing/nfs-utils/nfs-utils-1.1.4-no-exec.patch b/testing/nfs-utils/nfs-utils-1.1.4-no-exec.patch
new file mode 100644
index 000000000..ea50a21d8
--- /dev/null
+++ b/testing/nfs-utils/nfs-utils-1.1.4-no-exec.patch
@@ -0,0 +1,15 @@
+ripped from Debian
+
+--- nfs-utils-1.1.2/utils/mount/mount.c
++++ nfs-utils-1.1.2/utils/mount/mount.c
+@@ -381,10 +381,6 @@
+ mount_error(NULL, mount_point, ENOTDIR);
+ return 1;
+ }
+- if (access(mount_point, X_OK) < 0) {
+- mount_error(NULL, mount_point, errno);
+- return 1;
+- }
+
+ return 0;
+ }
diff --git a/testing/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch b/testing/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch
new file mode 100644
index 000000000..7f6c7a751
--- /dev/null
+++ b/testing/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch
@@ -0,0 +1,69 @@
+diff -Naur nfs-utils-1.1.6.orig/utils/gssd/krb5_util.c nfs-utils-1.1.6/utils/gssd/krb5_util.c
+--- utils/gssd/krb5_util.c 2009-04-20 19:32:50.000000000 +0200
++++ utils/gssd/krb5_util.c 2009-04-20 20:57:31.000000000 +0200
+@@ -940,9 +940,37 @@
+ {
+ krb5_error_code ret;
+ krb5_creds creds;
+- krb5_cc_cursor cur;
+ int found = 0;
+
++#ifdef HAVE_HEIMDAL
++ krb5_creds pattern;
++ krb5_realm *client_realm;
++
++ krb5_cc_clear_mcred(&pattern);
++
++ client_realm = krb5_princ_realm (context, principal);
++
++ ret = krb5_make_principal (context, &pattern.server,
++ *client_realm, KRB5_TGS_NAME, *client_realm,
++ NULL);
++ if (ret)
++ krb5_err (context, 1, ret, "krb5_make_principal");
++ pattern.client = principal;
++
++ ret = krb5_cc_retrieve_cred (context, ccache, 0, &pattern, &creds);
++ krb5_free_principal (context, pattern.server);
++ if (ret) {
++ if (ret == KRB5_CC_END)
++ return 1;
++ krb5_err (context, 1, ret, "krb5_cc_retrieve_cred");
++ }
++
++ found = creds.times.endtime > time(NULL);
++
++ krb5_free_cred_contents (context, &creds);
++#else
++ krb5_cc_cursor cur;
++
+ ret = krb5_cc_start_seq_get(context, ccache, &cur);
+ if (ret)
+ return 0;
+@@ -962,6 +990,7 @@
+ krb5_free_cred_contents(context, &creds);
+ }
+ krb5_cc_end_seq_get(context, ccache, &cur);
++#endif
+
+ return found;
+ }
+@@ -1008,6 +1037,9 @@
+ }
+ krb5_free_principal(context, principal);
+ err_princ:
++#ifdef HAVE_HEIMDAL
++#define KRB5_TC_OPENCLOSE 0x00000001
++#endif
+ krb5_cc_set_flags(context, ccache, KRB5_TC_OPENCLOSE);
+ krb5_cc_close(context, ccache);
+ err_cache:
+@@ -1262,7 +1294,7 @@
+ if (context != NULL) {
+ origmsg = krb5_get_error_message(context, code);
+ msg = strdup(origmsg);
+- krb5_free_error_message(context, origmsg);
++ krb5_free_error_string(context, origmsg);
+ }
+ #endif
+ if (msg != NULL)
diff --git a/testing/nfs-utils/nfs-utils-1.1.6-no_libgssapi.patch b/testing/nfs-utils/nfs-utils-1.1.6-no_libgssapi.patch
new file mode 100644
index 000000000..917136a8c
--- /dev/null
+++ b/testing/nfs-utils/nfs-utils-1.1.6-no_libgssapi.patch
@@ -0,0 +1,57 @@
+Index: nfs-utils-1.1.6/utils/gssd/context_lucid.c
+===================================================================
+--- nfs-utils-1.1.6.orig/utils/gssd/context_lucid.c
++++ nfs-utils-1.1.6/utils/gssd/context_lucid.c
+@@ -51,8 +51,10 @@
+ #include "context.h"
+
+ #ifndef OM_uint64
++#ifndef GSSAPI_GSSAPI_H_
+ typedef uint64_t OM_uint64;
+ #endif
++#endif
+
+ static int
+ write_lucid_keyblock(char **p, char *end, gss_krb5_lucid_key_t *key)
+@@ -177,10 +179,10 @@
+ int retcode = 0;
+
+ printerr(2, "DEBUG: serialize_krb5_ctx: lucid version!\n");
+- maj_stat = gss_export_lucid_sec_context(&min_stat, &ctx,
++ maj_stat = gss_krb5_export_lucid_sec_context(&min_stat, &ctx,
+ 1, &return_ctx);
+ if (maj_stat != GSS_S_COMPLETE) {
+- pgsserr("gss_export_lucid_sec_context",
++ pgsserr("gss_krb5_export_lucid_sec_context",
+ maj_stat, min_stat, &krb5oid);
+ goto out_err;
+ }
+@@ -204,9 +206,9 @@
+ else
+ retcode = prepare_krb5_rfc_cfx_buffer(lctx, buf, endtime);
+
+- maj_stat = gss_free_lucid_sec_context(&min_stat, ctx, return_ctx);
++ maj_stat = gss_krb5_free_lucid_sec_context(&min_stat, ctx);
+ if (maj_stat != GSS_S_COMPLETE) {
+- pgsserr("gss_export_lucid_sec_context",
++ pgsserr("gss_krb5_export_lucid_sec_context",
+ maj_stat, min_stat, &krb5oid);
+ printerr(0, "WARN: failed to free lucid sec context\n");
+ }
+Index: nfs-utils-1.1.6/utils/gssd/krb5_util.c
+===================================================================
+--- nfs-utils-1.1.6.orig/utils/gssd/krb5_util.c
++++ nfs-utils-1.1.6/utils/gssd/krb5_util.c
+@@ -332,10 +332,10 @@
+ return -1;
+ }
+
+- maj_stat = gss_set_allowable_enctypes(&min_stat, credh, &krb5oid,
++ maj_stat = gss_krb5_set_allowable_enctypes(&min_stat, credh,
+ num_enctypes, &enctypes);
+ if (maj_stat != GSS_S_COMPLETE) {
+- pgsserr("gss_set_allowable_enctypes",
++ pgsserr("gss_krb5_set_allowable_enctypes",
+ maj_stat, min_stat, &krb5oid);
+ gss_release_cred(&min_stat, &credh);
+ return -1;
diff --git a/testing/nfs-utils/nfs-utils.install b/testing/nfs-utils/nfs-utils.install
new file mode 100644
index 000000000..7dcdf9575
--- /dev/null
+++ b/testing/nfs-utils/nfs-utils.install
@@ -0,0 +1,32 @@
+## arg 1: the new package version
+post_install() {
+cat << 'EOM'
+ ==> PLEASE NOTE:
+ ==> Extended configuration options for NFS (clients & server) are available in
+ ==> /etc/conf.d/nfs-common.conf and in /etc/conf.d/nfs-server.conf
+ ==>
+ ==> Please refer to http://wiki.archlinux.org/index.php/Nfs
+ ==> for further information on NFS; for NFSv4, refer to
+ ==> http://wiki.archlinux.org/index.php/NFSv4
+EOM
+}
+
+## arg 1: the new package version
+## arg 2: the old package version
+post_upgrade() {
+ if [ "$(vercmp $2 1.2.0-2)" -lt 0 ]; then
+cat << 'EOM'
+ ==> IMPORTANT NFS UTILS CHANGES:
+ ==> This is a rather important upgrade, you are going to have to change config files.
+ ==> /etc/rc.conf daemons changes:
+ ==> Change portmap to rpcbind
+ ==> Change nfslock to nfs-common
+ ==> Change nfsd to nfs-server
+ ==>
+ ==> Extended configuration options for NFS (clients & server) are available in:
+ ==> /etc/conf.d/nfs-common
+ ==> /etc/conf.d/nfs-server
+ ==> Please change them to your needs.
+EOM
+ fi
+}
diff --git a/testing/nfs-utils/start-statd.patch b/testing/nfs-utils/start-statd.patch
new file mode 100644
index 000000000..38c60a784
--- /dev/null
+++ b/testing/nfs-utils/start-statd.patch
@@ -0,0 +1,22 @@
+--- utils/statd/start-statd 2007-05-11 04:40:57.000000000 +0100
++++ utils/statd/start-statd.new 2007-09-21 17:11:34.000000000 +0100
+@@ -1,9 +1,16 @@
+-#!/bin/sh -p
++#!/bin/sh
++
++# Original script provided by the NFS project
++# Modified for Arch Linux by Tom Killian
++
+ # nfsmount calls this script when mounting a filesystem with locking
+ # enabled, but when statd does not seem to be running (based on
+ # /var/run/rpc.statd.pid).
+ # It should run run statd with whatever flags are apropriate for this
+ # site.
+-PATH=/sbin:/usr/sbin
+-exec rpc.statd --no-notify
++
++# source application-specific settings
++[ -f /etc/conf.d/nfs-common.conf ] && . /etc/conf.d/nfs-common.conf
++
++exec /usr/sbin/rpc.statd $STATD_OPTS
+
diff --git a/testing/nss_ldap/PKGBUILD b/testing/nss_ldap/PKGBUILD
new file mode 100644
index 000000000..0a1f93d38
--- /dev/null
+++ b/testing/nss_ldap/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 121171 2011-04-29 06:45:19Z stephane $
+# Maintainer: Paul Mattal <paul@archlinux.org>
+# Contributor: Comete <la_comete@tiscali.fr>
+
+pkgname=nss_ldap
+pkgver=265
+pkgrel=2
+pkgdesc="The nss_ldap module provides the means for Linux and Solaris workstations to resolve the entities defined in RFC 2307 from LDAP directories."
+arch=(i686 x86_64)
+url="http://www.padl.com/OSS/nss_ldap.html"
+license=('LGPL')
+depends=('libldap>=2.4.18' 'krb5')
+backup=("etc/nss_ldap.conf")
+source=(http://www.padl.com/download/${pkgname}-${pkgver}.tar.gz)
+md5sums=('c1cb02d1a85538cf16bca6f6a562abe4')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure \
+ --with-ldap-conf-file=/etc/nss_ldap.conf \
+ --with-ldap=openldap \
+ --libdir=/lib \
+ --mandir=/usr/share/man \
+ --enable-schema-mapping \
+ --enable-rfc2307bis \
+ --enable-configurable-krb5-ccname-gssapi
+ env PATH=`pwd`:"$PATH" make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/testing/openssh/PKGBUILD b/testing/openssh/PKGBUILD
index 3e5e7d9e3..beb09369d 100644
--- a/testing/openssh/PKGBUILD
+++ b/testing/openssh/PKGBUILD
@@ -1,17 +1,17 @@
-# $Id: PKGBUILD 122639 2011-05-05 12:22:20Z bisson $
+# $Id: PKGBUILD 122642 2011-05-05 12:30:25Z bisson $
# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Aaron Griffin <aaron@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>
pkgname=openssh
pkgver=5.8p2
-pkgrel=3
+pkgrel=4
pkgdesc='Free version of the SSH connectivity tools'
arch=('i686' 'x86_64')
license=('custom:BSD')
url='http://www.openssh.org/portable.html'
backup=('etc/ssh/ssh_config' 'etc/ssh/sshd_config' 'etc/pam.d/sshd' 'etc/conf.d/sshd')
-depends=('tcp_wrappers' 'heimdal' 'libedit')
+depends=('tcp_wrappers' 'krb5' 'openssl' 'libedit')
source=("ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/${pkgname}-${pkgver}.tar.gz"
'sshd.confd'
'sshd.pam'
diff --git a/testing/samba/PKGBUILD b/testing/samba/PKGBUILD
new file mode 100644
index 000000000..6bd883503
--- /dev/null
+++ b/testing/samba/PKGBUILD
@@ -0,0 +1,139 @@
+# $Id: PKGBUILD 122577 2011-05-04 17:48:52Z ibiru $
+# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+# Contributor: judd <jvinet@zeroflux.org>
+pkgbase=samba
+pkgname=('smbclient' 'samba')
+pkgver=3.5.8
+# We use the 'A' to fake out pacman's version comparators. Samba chooses
+# to append 'a','b',etc to their subsequent releases, which pamcan
+# misconstrues as alpha, beta, etc. Bad samba!
+_realver=3.5.8
+pkgrel=3
+arch=(i686 x86_64)
+url="http://www.samba.org"
+license=('GPL3')
+makedepends=('db' 'popt' 'libcups' 'acl' 'libldap' 'libcap' 'krb5' 'pam' 'fam' 'gnutls>=2.4.1' 'talloc' 'tdb')
+options=(!makeflags)
+source=(http://us1.samba.org/samba/ftp/stable/${pkgbase}-${_realver}.tar.gz
+ samba samba.logrotate
+ swat.xinetd
+ samba.pam
+ samba.conf.d
+ fix-ipv6-mount.patch)
+### UNINSTALL dmapi package before building!!!
+
+build() {
+ cd ${srcdir}/${pkgbase}-${_realver}/source3
+ ./configure --prefix=/usr \
+ --libdir=/usr/lib/ \
+ --localstatedir=/var \
+ --with-configdir=/etc/samba \
+ --with-lockdir=/var/cache/samba \
+ --with-piddir=/var/run/samba \
+ --with-fhs \
+ --with-pam \
+ --with-pam_smbpass \
+ --with-pammodulesdir=/lib/security \
+ --with-ads \
+ --with-acl-support \
+ --with-cifsmount \
+ --with-libsmbclient \
+ --with-syslog \
+ --enable-external-libtalloc \
+ --disable-dnssd \
+ --disable-avahi \
+ --with-shared-modules=idmap_ad,idmap_adex,idmap_rid,idmap_hash \
+ --enable-external-libtdb
+ make
+}
+
+package_smbclient () {
+pkgdesc="Tools to access a server's filespace and printers via SMB"
+depends=('readline' 'popt' 'libldap' 'cifs-utils' 'libcap' 'krb5' 'db' 'e2fsprogs' 'tdb' 'talloc')
+ cd ${srcdir}/${pkgbase}-${_realver}/source3
+ mkdir -p ${pkgdir}/usr/bin ${pkgdir}/usr/lib
+ install -m755 bin/{smbclient,rpcclient,smbspool,smbtree,smbcacls,smbcquotas,smbget,net,nmblookup} ${pkgdir}/usr/bin/
+ for i in libnetapi* libwbclient* libsmbclient*;do
+ cp -a bin/${i}*.so* ${pkgdir}/usr/lib/
+ done
+ install -m755 script/smbtar ${pkgdir}/usr/bin/
+ mkdir -p ${pkgdir}/usr/lib/cups/backend
+ ln -sf /usr/bin/smbspool ${pkgdir}/usr/lib/cups/backend/smb
+ mkdir -p ${pkgdir}/usr/include
+ install -m644 include/libsmbclient.h ${pkgdir}/usr/include/
+ install -m644 lib/netapi/netapi.h ${pkgdir}/usr/include/
+ mkdir -p ${pkgdir}/usr/share/man/man{1,7}
+ for man in rpcclient smbcacls smbclient smbcquotas smbget \
+ smbtree smbtar nmblookup; do
+ install -m644 ../docs/manpages/${man}.1 ${pkgdir}/usr/share/man/man1/
+ done
+ install -m644 ../docs/manpages/libsmbclient.7 ${pkgdir}/usr/share/man/man7/
+}
+
+package_samba () {
+pkgdesc="Tools to access a server's filespace and printers via SMB"
+backup=(etc/logrotate.d/samba
+ etc/pam.d/samba
+ etc/samba/smb.conf
+ etc/xinetd.d/swat
+ etc/conf.d/samba)
+depends=('db' 'popt' 'libcups' 'acl' 'libldap' "smbclient>=$pkgver" 'libcap' 'krb5' 'pam' 'fam' 'gnutls' 'e2fsprogs' 'tdb' 'talloc')
+ cd ${srcdir}/samba-${_realver}/source3
+ mkdir -p ${pkgdir}/var/log/samba
+ mkdir -p ${pkgdir}/etc/samba/private
+ chmod 700 ${pkgdir}/etc/samba/private
+ make DESTDIR=${pkgdir} install
+ chmod 644 ${pkgdir}/usr/include/*.h
+ rm -rf ${pkgdir}/usr/var
+ (cd script; cp installbin.sh i; cat i | sed 's/\/sbin\///' > installbin.sh)
+ install -D -m755 ../../samba ${pkgdir}/etc/rc.d/samba
+ install -D -m644 ../../samba.conf.d ${pkgdir}/etc/conf.d/samba
+ mkdir -p ${pkgdir}/etc/samba
+ cat ../examples/smb.conf.default | \
+ sed 's|log file = .*$|log file = /var/log/samba/log.%m|g' >${pkgdir}/etc/samba/smb.conf.default
+ install -D -m644 ../../samba.logrotate ${pkgdir}/etc/logrotate.d/samba
+ install -D -m644 ../../swat.xinetd ${pkgdir}/etc/xinetd.d/swat
+ install -D -m644 ../../samba.pam ${pkgdir}/etc/pam.d/samba
+ # spool directory
+ install -d -m1777 ${pkgdir}/var/spool/samba
+ sed -i 's|/usr/spool/samba|/var/spool/samba|g' ${pkgdir}/etc/samba/smb.conf.default
+ # fix logrotate
+ sed -i -e 's|log.%m|%m.log|g' ${pkgdir}/etc/samba/smb.conf.default
+ # nsswitch libraries
+ install -D -m755 ${srcdir}/samba-${_realver}/nsswitch/libnss_wins.so ${pkgdir}/lib/libnss_wins.so
+ ln -s libnss_wins.so ${pkgdir}/lib/libnss_wins.so.2
+ install -D -m755 ${srcdir}/samba-${_realver}/nsswitch/libnss_winbind.so ${pkgdir}/lib/libnss_winbind.so
+ # remove conflict files of smbclient
+ for man in libsmbclient smbspool \
+ mount.cifs net cifs.upcall; do
+ rm -f ${pkgdir}/usr/share/man/man8/${man}.8
+ done
+ for i in libnetapi* libwbclient* libsmbclient*;do
+ rm -f ${pkgdir}/usr/lib/$i
+ done
+ for bin in net \
+ nmblookup rpcclient smbcacls smbclient \
+ smbcquotas smbget smbspool smbtar smbtree; do
+ rm -f ${pkgdir}/usr/bin/$bin
+ done
+ rm -f ${pkgdir}/usr/sbin/cifs.upcall
+ rm -f ${pkgdir}/usr/include/netapi.h
+ for man in rpcclient smbcacls smbclient smbcquotas \
+ smbtree smbtar nmblookup smbget; do
+ rm -f ${pkgdir}/usr/share/man/man1/${man}.1
+ done
+ for man in tdbbackup tdbdump tdbtool; do
+ rm -f ${pkgdir}/usr/share/man/man8/${man}.8
+ done
+ rm -f ${pkgdir}/usr/share/man/man7/libsmbclient.7
+ rm -f ${pkgdir}/usr/include/libsmbclient.h
+ # copy ldap example
+ install -D -m644 ${srcdir}/samba-${_realver}/examples/LDAP/samba.schema ${pkgdir}/usr/share/doc/samba/examples/LDAP/samba.schema
+}
+md5sums=('355b4530c20997e94aebc74cd6ea5307'
+ '891b9be03e7adf65c9a00319c76d33e5'
+ '5697da77590ec092cc8a883bae06093c'
+ 'a4bbfa39fee95bba2e7ad6b535fae7e6'
+ '96f82c38f3f540b53f3e5144900acf17'
+ 'f2f2e348acd1ccb566e95fa8a561b828'
+ 'c6a38a8c8fa24979e6217aed533358ea')
diff --git a/testing/samba/fix-ipv6-mount.patch b/testing/samba/fix-ipv6-mount.patch
new file mode 100644
index 000000000..89bef6533
--- /dev/null
+++ b/testing/samba/fix-ipv6-mount.patch
@@ -0,0 +1,11 @@
+--- client/mount.cifs.c.orig 2010-03-03 13:42:02.143936727 +1000
++++ client/mount.cifs.c 2010-03-04 01:53:22.752879004 +1000
+@@ -1563,7 +1563,7 @@
+ }
+ }
+
+- if (addr->ai_addr->sa_family == AF_INET6 && addr6->sin6_scope_id) {
++ if (addr && addr->ai_addr->sa_family == AF_INET6 && addr6->sin6_scope_id) {
+ strlcat(options, "%", options_size);
+ current_len = strnlen(options, options_size);
+ optionstail = options + current_len;
diff --git a/testing/samba/samba b/testing/samba/samba
new file mode 100755
index 000000000..1b222d6cc
--- /dev/null
+++ b/testing/samba/samba
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[ -f /etc/conf.d/samba ] && . /etc/conf.d/samba
+
+[ -z "$SAMBA_DAEMONS" ] && SAMBA_DAEMONS=(smbd nmbd)
+
+case "$1" in
+ start)
+ rc=0
+ stat_busy "Starting Samba Server"
+ if [ ! -x /var/run/samba ] ; then
+ install -m755 -g 81 -o 81 -d /var/run/samba
+ fi
+ for d in ${SAMBA_DAEMONS[@]}; do
+ PID=`pidof -o %PPID /usr/sbin/$d`
+ [ -z "$PID" ] && /usr/sbin/$d -D
+ rc=$(($rc+$?))
+ done
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon samba
+ stat_done
+ fi
+ ;;
+ stop)
+ rc=0
+ stat_busy "Stopping Samba Server"
+ for d in ${SAMBA_DAEMONS[@]}; do
+ PID=`pidof -o %PPID /usr/sbin/$d`
+ [ -z "$PID" ] || kill $PID &> /dev/null
+ rc=$(($rc+$?))
+ done
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/samba/smbd.pid &>/dev/null
+ rm /var/run/samba/nmbd.pid &>/dev/null
+ rm /var/run/samba/winbindd.pid &>/dev/null
+ rm_daemon samba
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/testing/samba/samba.conf.d b/testing/samba/samba.conf.d
new file mode 100644
index 000000000..8721f956a
--- /dev/null
+++ b/testing/samba/samba.conf.d
@@ -0,0 +1,7 @@
+#
+# Configuration for the samba init script
+#
+
+# space separated list of daemons to launch
+SAMBA_DAEMONS=(smbd nmbd)
+#SAMBA_DAEMONS=(smbd nmbd winbindd)
diff --git a/testing/samba/samba.logrotate b/testing/samba/samba.logrotate
new file mode 100644
index 000000000..581f4c33b
--- /dev/null
+++ b/testing/samba/samba.logrotate
@@ -0,0 +1,9 @@
+/var/log/samba/log.smbd /var/log/samba/log.nmbd /var/log/samba/*.log {
+ notifempty
+ missingok
+ sharedscripts
+ copytruncate
+ postrotate
+ /bin/kill -HUP `cat /var/run/samba/*.pid 2>/dev/null` 2>/dev/null || true
+ endscript
+}
diff --git a/testing/samba/samba.pam b/testing/samba/samba.pam
new file mode 100644
index 000000000..53724d1f8
--- /dev/null
+++ b/testing/samba/samba.pam
@@ -0,0 +1,3 @@
+auth required pam_unix.so
+account required pam_unix.so
+session required pam_unix.so
diff --git a/testing/samba/swat.xinetd b/testing/samba/swat.xinetd
new file mode 100644
index 000000000..2e62a82b2
--- /dev/null
+++ b/testing/samba/swat.xinetd
@@ -0,0 +1,10 @@
+service swat
+{
+ socket_type = stream
+ wait = no
+ user = root
+ server = /usr/sbin/swat
+ log_on_success += HOST DURATION
+ log_on_failure += HOST
+ disable = yes
+}
diff --git a/testing/subversion/PKGBUILD b/testing/subversion/PKGBUILD
new file mode 100644
index 000000000..0f9c0a70a
--- /dev/null
+++ b/testing/subversion/PKGBUILD
@@ -0,0 +1,92 @@
+# $Id: PKGBUILD 121110 2011-04-29 01:29:30Z stephane $
+# Maintainer: Paul Mattal <paul@archlinux.org>
+# Contributor: Jason Chu <jason@archlinux.org>
+
+pkgname=subversion
+pkgver=1.6.15
+pkgrel=2
+pkgdesc="Replacement for CVS, another versioning system (SVN)"
+arch=('i686' 'x86_64')
+license=('apache' 'bsd')
+depends=('neon' 'apr-util')
+makedepends=('krb5' 'apache' 'python2' 'perl' 'swig' 'ruby' 'java-runtime'
+ 'autoconf' 'sqlite3' 'db' 'e2fsprogs' 'libgnome-keyring' 'kdelibs')
+source=(http://subversion.tigris.org/downloads/$pkgname-$pkgver.tar.bz2
+ svnserve svn svnserve.conf svnmerge.py
+ subversion.rpath.fix.patch
+ subversion.suppress.deprecation.warnings.patch)
+
+backup=('etc/xinetd.d/svn' 'etc/conf.d/svnserve')
+url="http://subversion.apache.org/"
+provides=('svn')
+options=('!makeflags' '!libtool')
+optdepends=('libgnome-keyring' 'kdeutils-kwallet' 'bash-completion: for svn bash completion')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+
+ export PYTHON=/usr/bin/python2
+
+ # apply patches
+ patch -p0 < $srcdir/subversion.rpath.fix.patch
+ patch -p1 -i $srcdir/subversion.suppress.deprecation.warnings.patch
+
+ # configure
+ autoreconf
+ ./configure --prefix=/usr --with-apr=/usr --with-apr-util=/usr \
+ --with-zlib=/usr --with-neon=/usr --with-apxs \
+ --with-sqlite=/usr --with-berkeley-db=:/usr/include/:/usr/lib:db-5.1 \
+ --enable-javahl --with-gnome-keyring --with-kwallet
+
+ # build
+ (make external-all && make LT_LDFLAGS="-L$Fdestdir/usr/lib" local-all )
+}
+
+package() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+
+ # install
+ export LD_LIBRARY_PATH=${pkgdir}/usr/lib:$LD_LIBRARY_PATH
+ make DESTDIR=${pkgdir} install
+
+ make DESTDIR=${pkgdir} swig-py
+ make install-swig-py DESTDIR=${pkgdir}
+
+ install -d ${pkgdir}/usr/lib/python2.7
+ mv ${pkgdir}/usr/lib/svn-python/ ${pkgdir}/usr/lib/python2.7/site-packages
+
+ install -d ${pkgdir}/usr/share/subversion
+ install -d -m 755 tools/hook-scripts ${pkgdir}/usr/share/subversion/
+ rm -f ${pkgdir}/usr/share/subversion/hook-scripts/*.in
+
+ make DESTDIR=${pkgdir} swig-pl
+ make install-swig-pl DESTDIR=${pkgdir} INSTALLDIRS=vendor
+ rm -f ${pkgdir}/usr/lib/perl5/vendor_perl/auto/SVN/_Core/.packlist
+ rm -rf ${pkgdir}/usr/lib/perl5/core_perl
+
+ make DESTDIR=${pkgdir} swig-rb
+ make install-swig-rb DESTDIR=${pkgdir}
+
+ make DESTDIR=${pkgdir} javahl
+ make DESTDIR=${pkgdir} install-javahl
+
+ install -d ${pkgdir}/etc/{rc.d,xinetd.d,conf.d}
+
+ install -m 755 ${srcdir}/svnserve ${pkgdir}/etc/rc.d
+ install -m 644 ${srcdir}/svn ${pkgdir}/etc/xinetd.d
+ install -m 644 ${srcdir}/svnserve.conf ${pkgdir}/etc/conf.d/svnserve
+ install -m 755 ${srcdir}/svnmerge.py ${pkgdir}/usr/bin/svnmerge
+ install -D -m 644 ${srcdir}/subversion-$pkgver/COPYING \
+ ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
+
+ # bash completion
+ install -Dm 644 ${srcdir}/${pkgname}-${pkgver}/tools/client-side/bash_completion \
+ ${pkgdir}/etc/bash_completion.d/subversion
+}
+md5sums=('113fca1d9e4aa389d7dc2b210010fa69'
+ 'a2b029e8385007ffb99b437b30521c90'
+ 'a0db6dd43af33952739b6ec089852630'
+ 'c459e299192552f61578f3438abf0664'
+ 'a6371baeda7e224504629ecdda2749b4'
+ '6b4340ba9d8845cd8497e013ae01be3f'
+ '1166f3b7413d7e7450299b3525680bbe')
diff --git a/testing/subversion/subversion.rpath.fix.patch b/testing/subversion/subversion.rpath.fix.patch
new file mode 100644
index 000000000..ba6ee9e4e
--- /dev/null
+++ b/testing/subversion/subversion.rpath.fix.patch
@@ -0,0 +1,10 @@
+--- Makefile.in.orig 2009-02-16 14:10:48.000000000 -0200
++++ Makefile.in 2009-06-04 00:56:29.000000000 -0300
+@@ -678,6 +678,7 @@
+
+ $(SWIG_PL_DIR)/native/Makefile: $(SWIG_PL_DIR)/native/Makefile.PL
+ cd $(SWIG_PL_DIR)/native; $(PERL) Makefile.PL
++ cd $(SWIG_PL_DIR)/native; sed -i 's|LD_RUN_PATH|DIE_RPATH_DIE|g' Makefile{,.{client,delta,fs,ra,repos,wc}}
+
+ swig-pl_DEPS = autogen-swig-pl libsvn_swig_perl \
+ $(SWIG_PL_DIR)/native/Makefile
diff --git a/testing/subversion/subversion.suppress.deprecation.warnings.patch b/testing/subversion/subversion.suppress.deprecation.warnings.patch
new file mode 100644
index 000000000..94ce89b18
--- /dev/null
+++ b/testing/subversion/subversion.suppress.deprecation.warnings.patch
@@ -0,0 +1,22 @@
+diff -urN subversion-1.6.9/subversion/bindings/swig/python/svn/core.py subversion-1.6.9-fixed/subversion/bindings/swig/python/svn/core.py
+--- subversion-1.6.9/subversion/bindings/swig/python/svn/core.py 2009-02-13 11:22:26.000000000 -0500
++++ subversion-1.6.9-fixed/subversion/bindings/swig/python/svn/core.py 2010-02-08 07:46:29.000000000 -0500
+@@ -19,6 +19,7 @@
+ from libsvn.core import *
+ import libsvn.core as _libsvncore
+ import atexit as _atexit
++import warnings
+
+ class SubversionException(Exception):
+ def __init__(self, message=None, apr_err=None, child=None,
+@@ -44,7 +45,9 @@
+ Exception.__init__(self, *args)
+
+ self.apr_err = apr_err
+- self.message = message
++ with warnings.catch_warnings():
++ warnings.simplefilter("ignore", DeprecationWarning)
++ self.message = message
+ self.child = child
+ self.file = file
+ self.line = line
diff --git a/testing/subversion/svn b/testing/subversion/svn
new file mode 100644
index 000000000..8988aaf63
--- /dev/null
+++ b/testing/subversion/svn
@@ -0,0 +1,11 @@
+service svn
+{
+ flags = REUSE
+ socket_type = stream
+ wait = no
+ user = root
+ server = /usr/bin/svnserve
+ server_args = -i
+ log_on_failure += USERID
+ disable = yes
+}
diff --git a/testing/subversion/svnmerge.py b/testing/subversion/svnmerge.py
new file mode 100644
index 000000000..d8931648f
--- /dev/null
+++ b/testing/subversion/svnmerge.py
@@ -0,0 +1,2370 @@
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+# Copyright (c) 2005, Giovanni Bajo
+# Copyright (c) 2004-2005, Awarix, Inc.
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# Author: Archie Cobbs <archie at awarix dot com>
+# Rewritten in Python by: Giovanni Bajo <rasky at develer dot com>
+#
+# Acknowledgments:
+# John Belmonte <john at neggie dot net> - metadata and usability
+# improvements
+# Blair Zajac <blair at orcaware dot com> - random improvements
+# Raman Gupta <rocketraman at fastmail dot fm> - bidirectional and transitive
+# merging support
+# Dustin J. Mitchell <dustin at zmanda dot com> - support for multiple
+# location identifier formats
+#
+# $HeadURL$
+# $LastChangedDate$
+# $LastChangedBy$
+# $LastChangedRevision$
+#
+# Requisites:
+# svnmerge.py has been tested with all SVN major versions since 1.1 (both
+# client and server). It is unknown if it works with previous versions.
+#
+# Differences from svnmerge.sh:
+# - More portable: tested as working in FreeBSD and OS/2.
+# - Add double-verbose mode, which shows every svn command executed (-v -v).
+# - "svnmerge avail" now only shows commits in source, not also commits in
+# other parts of the repository.
+# - Add "svnmerge block" to flag some revisions as blocked, so that
+# they will not show up anymore in the available list. Added also
+# the complementary "svnmerge unblock".
+# - "svnmerge avail" has grown two new options:
+# -B to display a list of the blocked revisions
+# -A to display both the blocked and the available revisions.
+# - Improved generated commit message to make it machine parsable even when
+# merging commits which are themselves merges.
+# - Add --force option to skip working copy check
+# - Add --record-only option to "svnmerge merge" to avoid performing
+# an actual merge, yet record that a merge happened.
+# - Can use a variety of location-identifier formats
+#
+# TODO:
+# - Add "svnmerge avail -R": show logs in reverse order
+#
+# Information for Hackers:
+#
+# Identifiers for branches:
+# A branch is identified in three ways within this source:
+# - as a working copy (variable name usually includes 'dir')
+# - as a fully qualified URL
+# - as a path identifier (an opaque string indicating a particular path
+# in a particular repository; variable name includes 'pathid')
+# A "target" is generally user-specified, and may be a working copy or
+# a URL.
+
+import sys, os, getopt, re, types, tempfile, time, locale
+from bisect import bisect
+from xml.dom import pulldom
+
+NAME = "svnmerge"
+if not hasattr(sys, "version_info") or sys.version_info < (2, 0):
+ error("requires Python 2.0 or newer")
+
+# Set up the separator used to separate individual log messages from
+# each revision merged into the target location. Also, create a
+# regular expression that will find this same separator in already
+# committed log messages, so that the separator used for this run of
+# svnmerge.py will have one more LOG_SEPARATOR appended to the longest
+# separator found in all the commits.
+LOG_SEPARATOR = 8 * '.'
+LOG_SEPARATOR_RE = re.compile('^((%s)+)' % re.escape(LOG_SEPARATOR),
+ re.MULTILINE)
+
+# Each line of the embedded log messages will be prefixed by LOG_LINE_PREFIX.
+LOG_LINE_PREFIX = 2 * ' '
+
+# Set python to the default locale as per environment settings, same as svn
+# TODO we should really parse config and if log-encoding is specified, set
+# the locale to match that encoding
+locale.setlocale(locale.LC_ALL, '')
+
+# We want the svn output (such as svn info) to be non-localized
+# Using LC_MESSAGES should not affect localized output of svn log, for example
+if os.environ.has_key("LC_ALL"):
+ del os.environ["LC_ALL"]
+os.environ["LC_MESSAGES"] = "C"
+
+###############################################################################
+# Support for older Python versions
+###############################################################################
+
+# True/False constants are Python 2.2+
+try:
+ True, False
+except NameError:
+ True, False = 1, 0
+
+def lstrip(s, ch):
+ """Replacement for str.lstrip (support for arbitrary chars to strip was
+ added in Python 2.2.2)."""
+ i = 0
+ try:
+ while s[i] == ch:
+ i = i+1
+ return s[i:]
+ except IndexError:
+ return ""
+
+def rstrip(s, ch):
+ """Replacement for str.rstrip (support for arbitrary chars to strip was
+ added in Python 2.2.2)."""
+ try:
+ if s[-1] != ch:
+ return s
+ i = -2
+ while s[i] == ch:
+ i = i-1
+ return s[:i+1]
+ except IndexError:
+ return ""
+
+def strip(s, ch):
+ """Replacement for str.strip (support for arbitrary chars to strip was
+ added in Python 2.2.2)."""
+ return lstrip(rstrip(s, ch), ch)
+
+def rsplit(s, sep, maxsplits=0):
+ """Like str.rsplit, which is Python 2.4+ only."""
+ L = s.split(sep)
+ if not 0 < maxsplits <= len(L):
+ return L
+ return [sep.join(L[0:-maxsplits])] + L[-maxsplits:]
+
+###############################################################################
+
+def kwextract(s):
+ """Extract info from a svn keyword string."""
+ try:
+ return strip(s, "$").strip().split(": ")[1]
+ except IndexError:
+ return "<unknown>"
+
+__revision__ = kwextract('$Rev$')
+__date__ = kwextract('$Date$')
+
+# Additional options, not (yet?) mapped to command line flags
+default_opts = {
+ "svn": "svn",
+ "prop": NAME + "-integrated",
+ "block-prop": NAME + "-blocked",
+ "commit-verbose": True,
+ "verbose": 0,
+}
+logs = {}
+
+def console_width():
+ """Get the width of the console screen (if any)."""
+ try:
+ return int(os.environ["COLUMNS"])
+ except (KeyError, ValueError):
+ pass
+
+ try:
+ # Call the Windows API (requires ctypes library)
+ from ctypes import windll, create_string_buffer
+ h = windll.kernel32.GetStdHandle(-11)
+ csbi = create_string_buffer(22)
+ res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
+ if res:
+ import struct
+ (bufx, bufy,
+ curx, cury, wattr,
+ left, top, right, bottom,
+ maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw)
+ return right - left + 1
+ except ImportError:
+ pass
+
+ # Parse the output of stty -a
+ if os.isatty(1):
+ out = os.popen("stty -a").read()
+ m = re.search(r"columns (\d+);", out)
+ if m:
+ return int(m.group(1))
+
+ # sensible default
+ return 80
+
+def error(s):
+ """Subroutine to output an error and bail."""
+ print >> sys.stderr, "%s: %s" % (NAME, s)
+ sys.exit(1)
+
+def report(s):
+ """Subroutine to output progress message, unless in quiet mode."""
+ if opts["verbose"]:
+ print "%s: %s" % (NAME, s)
+
+def prefix_lines(prefix, lines):
+ """Given a string representing one or more lines of text, insert the
+ specified prefix at the beginning of each line, and return the result.
+ The input must be terminated by a newline."""
+ assert lines[-1] == "\n"
+ return prefix + lines[:-1].replace("\n", "\n"+prefix) + "\n"
+
+def recode_stdout_to_file(s):
+ if locale.getdefaultlocale()[1] is None or not hasattr(sys.stdout, "encoding") \
+ or sys.stdout.encoding is None:
+ return s
+ u = s.decode(sys.stdout.encoding)
+ return u.encode(locale.getdefaultlocale()[1])
+
+class LaunchError(Exception):
+ """Signal a failure in execution of an external command. Parameters are the
+ exit code of the process, the original command line, and the output of the
+ command."""
+
+try:
+ """Launch a sub-process. Return its output (both stdout and stderr),
+ optionally split by lines (if split_lines is True). Raise a LaunchError
+ exception if the exit code of the process is non-zero (failure).
+
+ This function has two implementations, one based on subprocess (preferred),
+ and one based on popen (for compatibility).
+ """
+ import subprocess
+ import shlex
+
+ def launch(cmd, split_lines=True):
+ # Requiring python 2.4 or higher, on some platforms we get
+ # much faster performance from the subprocess module (where python
+ # doesn't try to close an exhorbitant number of file descriptors)
+ stdout = ""
+ stderr = ""
+ try:
+ if os.name == 'nt':
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, \
+ close_fds=False, stderr=subprocess.PIPE)
+ else:
+ # Use shlex to break up the parameters intelligently,
+ # respecting quotes. shlex can't handle unicode.
+ args = shlex.split(cmd.encode('ascii'))
+ p = subprocess.Popen(args, stdout=subprocess.PIPE, \
+ close_fds=False, stderr=subprocess.PIPE)
+ stdoutAndErr = p.communicate()
+ stdout = stdoutAndErr[0]
+ stderr = stdoutAndErr[1]
+ except OSError, inst:
+ # Using 1 as failure code; should get actual number somehow? For
+ # examples see svnmerge_test.py's TestCase_launch.test_failure and
+ # TestCase_launch.test_failurecode.
+ raise LaunchError(1, cmd, stdout + " " + stderr + ": " + str(inst))
+
+ if p.returncode == 0:
+ if split_lines:
+ # Setting keepends=True for compatibility with previous logic
+ # (where file.readlines() preserves newlines)
+ return stdout.splitlines(True)
+ else:
+ return stdout
+ else:
+ raise LaunchError(p.returncode, cmd, stdout + stderr)
+except ImportError:
+ # support versions of python before 2.4 (slower on some systems)
+ def launch(cmd, split_lines=True):
+ if os.name not in ['nt', 'os2']:
+ import popen2
+ p = popen2.Popen4(cmd)
+ p.tochild.close()
+ if split_lines:
+ out = p.fromchild.readlines()
+ else:
+ out = p.fromchild.read()
+ ret = p.wait()
+ if ret == 0:
+ ret = None
+ else:
+ ret >>= 8
+ else:
+ i,k = os.popen4(cmd)
+ i.close()
+ if split_lines:
+ out = k.readlines()
+ else:
+ out = k.read()
+ ret = k.close()
+
+ if ret is None:
+ return out
+ raise LaunchError(ret, cmd, out)
+
+def launchsvn(s, show=False, pretend=False, **kwargs):
+ """Launch SVN and grab its output."""
+ username = password = configdir = ""
+ if opts.get("username", None):
+ username = "--username=" + opts["username"]
+ if opts.get("password", None):
+ password = "--password=" + opts["password"]
+ if opts.get("config-dir", None):
+ configdir = "--config-dir=" + opts["config-dir"]
+ cmd = ' '.join(filter(None, [opts["svn"], "--non-interactive",
+ username, password, configdir, s]))
+ if show or opts["verbose"] >= 2:
+ print cmd
+ if pretend:
+ return None
+ return launch(cmd, **kwargs)
+
+def svn_command(s):
+ """Do (or pretend to do) an SVN command."""
+ out = launchsvn(s, show=opts["show-changes"] or opts["dry-run"],
+ pretend=opts["dry-run"],
+ split_lines=False)
+ if not opts["dry-run"]:
+ print out
+
+def check_dir_clean(dir):
+ """Check the current status of dir for local mods."""
+ if opts["force"]:
+ report('skipping status check because of --force')
+ return
+ report('checking status of "%s"' % dir)
+
+ # Checking with -q does not show unversioned files or external
+ # directories. Though it displays a debug message for external
+ # directories, after a blank line. So, practically, the first line
+ # matters: if it's non-empty there is a modification.
+ out = launchsvn("status -q %s" % dir)
+ if out and out[0].strip():
+ error('"%s" has local modifications; it must be clean' % dir)
+
+class PathIdentifier:
+ """Abstraction for a path identifier, so that we can start talking
+ about it before we know the form that it takes in the properties (its
+ external_form). Objects are referenced in the class variable 'locobjs',
+ keyed by all known forms."""
+
+ # a map of UUID (or None) to repository root URL.
+ repo_hints = {}
+
+ # a map from any known string form to the corresponding PathIdentifier
+ locobjs = {}
+
+ def __init__(self, repo_relative_path, uuid=None, url=None, external_form=None):
+ self.repo_relative_path = repo_relative_path
+ self.uuid = uuid
+ self.url = url
+ self.external_form = external_form
+
+ def __repr__(self):
+ return "<PathIdentifier " + ', '.join('%s=%r' % i for i in self.__dict__.items()) + '>'
+
+ def __str__(self):
+ """Return a printable string representation"""
+ if self.external_form:
+ return self.external_form
+ if self.url:
+ return self.format('url')
+ if self.uuid:
+ return self.format('uuid')
+ return self.format('path')
+
+ def from_pathid(pathid_str):
+ """convert pathid_str to a PathIdentifier"""
+ if not PathIdentifier.locobjs.has_key(pathid_str):
+ if is_url(pathid_str):
+ # we can determine every form; PathIdentifier.hint knows how to do that
+ PathIdentifier.hint(pathid_str)
+ elif pathid_str[:7] == 'uuid://':
+ mo = re.match('uuid://([^/]*)(.*)', pathid_str)
+ if not mo:
+ error("Invalid path identifier '%s'" % pathid_str)
+ uuid, repo_relative_path = mo.groups()
+ pathid = PathIdentifier(repo_relative_path, uuid=uuid)
+ # we can cache this by uuid:// pathid and by repo-relative path
+ PathIdentifier.locobjs[pathid_str] = PathIdentifier.locobjs[repo_relative_path] = pathid
+ elif pathid_str and pathid_str[0] == '/':
+ # strip any trailing slashes
+ pathid_str = pathid_str.rstrip('/')
+ pathid = PathIdentifier(repo_relative_path=pathid_str)
+ # we can only cache this by repo-relative path
+ PathIdentifier.locobjs[pathid_str] = pathid
+ else:
+ error("Invalid path identifier '%s'" % pathid_str)
+ return PathIdentifier.locobjs[pathid_str]
+ from_pathid = staticmethod(from_pathid)
+
+ def from_target(target):
+ """Convert a target (either a working copy path or an URL) into a
+ path identifier."""
+ # prime the cache first if we don't know about this target yet
+ if not PathIdentifier.locobjs.has_key(target):
+ PathIdentifier.hint(target)
+
+ try:
+ return PathIdentifier.locobjs[target]
+ except KeyError:
+ error("Could not recognize path identifier '%s'" % target)
+ from_target = staticmethod(from_target)
+
+ def hint(target):
+ """Cache some information about target, as it may be referenced by
+ repo-relative path in subversion properties; the cache can help to
+ expand such a relative path to a full path identifier."""
+ if PathIdentifier.locobjs.has_key(target): return
+ if not is_url(target) and not is_wc(target): return
+
+ url = target_to_url(target)
+
+ root = get_repo_root(url)
+ assert root[-1] != "/"
+ assert url[:len(root)] == root, "url=%r, root=%r" % (url, root)
+ repo_relative_path = url[len(root):]
+
+ try:
+ uuid = get_svninfo(target)['Repository UUID']
+ uuid_pathid = 'uuid://%s%s' % (uuid, repo_relative_path)
+ except KeyError:
+ uuid = None
+ uuid_pathid = None
+
+ locobj = PathIdentifier.locobjs.get(url) or \
+ (uuid_pathid and PathIdentifier.locobjs.get(uuid_pathid))
+ if not locobj:
+ locobj = PathIdentifier(repo_relative_path, uuid=uuid, url=url)
+
+ PathIdentifier.repo_hints[uuid] = root # (uuid may be None)
+
+ PathIdentifier.locobjs[target] = locobj
+ PathIdentifier.locobjs[url] = locobj
+ if uuid_pathid:
+ PathIdentifier.locobjs[uuid_pathid] = locobj
+ if not PathIdentifier.locobjs.has_key(repo_relative_path):
+ PathIdentifier.locobjs[repo_relative_path] = locobj
+ hint = staticmethod(hint)
+
+ def format(self, fmt):
+ if fmt == 'path':
+ return self.repo_relative_path
+ elif fmt == 'uuid':
+ return "uuid://%s%s" % (self.uuid, self.repo_relative_path)
+ elif fmt == 'url':
+ return self.url
+ else:
+ error("Unkonwn path type '%s'" % fmt)
+
+ def match_substring(self, str):
+ """Test whether str is a substring of any representation of this
+ PathIdentifier."""
+ if self.repo_relative_path.find(str) >= 0:
+ return True
+
+ if self.uuid:
+ if ("uuid://%s%s" % (self.uuid, self.repo_relative_path)).find(str) >= 0:
+ return True
+
+ if self.url:
+ if (self.url + self.repo_relative_path).find(str) >= 0:
+ return True
+
+ return False
+
+ def get_url(self):
+ """Convert a pathid into a URL. If this is not possible, error out."""
+ if self.url:
+ return self.url
+ # if we have a uuid and happen to know the URL for it, use that
+ elif self.uuid and PathIdentifier.repo_hints.has_key(self.uuid):
+ self.url = PathIdentifier.repo_hints[self.uuid] + self.repo_relative_path
+ PathIdentifier.locobjs[self.url] = self
+ return self.url
+ # if we've only seen one rep, use that (a guess, but an educated one)
+ elif not self.uuid and len(PathIdentifier.repo_hints) == 1:
+ uuid, root = PathIdentifier.repo_hints.items()[0]
+ if uuid:
+ self.uuid = uuid
+ PathIdentifier.locobjs['uuid://%s%s' % (uuid, self.repo_relative_path)] = self
+ self.url = root + self.repo_relative_path
+ PathIdentifier.locobjs[self.url] = self
+ report("Guessing that '%s' refers to '%s'" % (self, self.url))
+ return self.url
+ else:
+ error("Cannot determine URL for '%s'; " % self +
+ "Explicit source argument (-S/--source) required.\n")
+
+class RevisionLog:
+ """
+ A log of the revisions which affected a given URL between two
+ revisions.
+ """
+
+ def __init__(self, url, begin, end, find_propchanges=False):
+ """
+ Create a new RevisionLog object, which stores, in self.revs, a list
+ of the revisions which affected the specified URL between begin and
+ end. If find_propchanges is True, self.propchange_revs will contain a
+ list of the revisions which changed properties directly on the
+ specified URL. URL must be the URL for a directory in the repository.
+ """
+ self.url = url
+
+ # Setup the log options (--quiet, so we don't show log messages)
+ log_opts = '--xml --quiet -r%s:%s "%s"' % (begin, end, url)
+ if find_propchanges:
+ # The --verbose flag lets us grab merge tracking information
+ # by looking at propchanges
+ log_opts = "--verbose " + log_opts
+
+ # Read the log to look for revision numbers and merge-tracking info
+ self.revs = []
+ self.propchange_revs = []
+ repos_pathid = PathIdentifier.from_target(url)
+ for chg in SvnLogParser(launchsvn("log %s" % log_opts,
+ split_lines=False)):
+ self.revs.append(chg.revision())
+ for p in chg.paths():
+ if p.action() == 'M' and p.pathid() == repos_pathid.repo_relative_path:
+ self.propchange_revs.append(chg.revision())
+
+ # Save the range of the log
+ self.begin = int(begin)
+ if end == "HEAD":
+ # If end is not provided, we do not know which is the latest
+ # revision in the repository. So we set 'end' to the latest
+ # known revision.
+ self.end = self.revs[-1]
+ else:
+ self.end = int(end)
+
+ self._merges = None
+ self._blocks = None
+
+ def merge_metadata(self):
+ """
+ Return a VersionedProperty object, with a cached view of the merge
+ metadata in the range of this log.
+ """
+
+ # Load merge metadata if necessary
+ if not self._merges:
+ self._merges = VersionedProperty(self.url, opts["prop"])
+ self._merges.load(self)
+
+ return self._merges
+
+ def block_metadata(self):
+ if not self._blocks:
+ self._blocks = VersionedProperty(self.url, opts["block-prop"])
+ self._blocks.load(self)
+
+ return self._blocks
+
+
+class VersionedProperty:
+ """
+ A read-only, cached view of a versioned property.
+
+ self.revs contains a list of the revisions in which the property changes.
+ self.values stores the new values at each corresponding revision. If the
+ value of the property is unknown, it is set to None.
+
+ Initially, we set self.revs to [0] and self.values to [None]. This
+ indicates that, as of revision zero, we know nothing about the value of
+ the property.
+
+ Later, if you run self.load(log), we cache the value of this property over
+ the entire range of the log by noting each revision in which the property
+ was changed. At the end of the range of the log, we invalidate our cache
+ by adding the value "None" to our cache for any revisions which fall out
+ of the range of our log.
+
+ Once self.revs and self.values are filled, we can find the value of the
+ property at any arbitrary revision using a binary search on self.revs.
+ Once we find the last revision during which the property was changed,
+ we can lookup the associated value in self.values. (If the associated
+ value is None, the associated value was not cached and we have to do
+ a full propget.)
+
+ An example: We know that the 'svnmerge' property was added in r10, and
+ changed in r21. We gathered log info up until r40.
+
+ revs = [0, 10, 21, 40]
+ values = [None, "val1", "val2", None]
+
+ What these values say:
+ - From r0 to r9, we know nothing about the property.
+ - In r10, the property was set to "val1". This property stayed the same
+ until r21, when it was changed to "val2".
+ - We don't know what happened after r40.
+ """
+
+ def __init__(self, url, name):
+ """View the history of a versioned property at URL with name"""
+ self.url = url
+ self.name = name
+
+ # We know nothing about the value of the property. Setup revs
+ # and values to indicate as such.
+ self.revs = [0]
+ self.values = [None]
+
+ # We don't have any revisions cached
+ self._initial_value = None
+ self._changed_revs = []
+ self._changed_values = []
+
+ def load(self, log):
+ """
+ Load the history of property changes from the specified
+ RevisionLog object.
+ """
+
+ # Get the property value before the range of the log
+ if log.begin > 1:
+ self.revs.append(log.begin-1)
+ try:
+ self._initial_value = self.raw_get(log.begin-1)
+ except LaunchError:
+ # The specified URL might not exist before the
+ # range of the log. If so, we can safely assume
+ # that the property was empty at that time.
+ self._initial_value = { }
+ self.values.append(self._initial_value)
+ else:
+ self._initial_value = { }
+ self.values[0] = self._initial_value
+
+ # Cache the property values in the log range
+ old_value = self._initial_value
+ for rev in log.propchange_revs:
+ new_value = self.raw_get(rev)
+ if new_value != old_value:
+ self._changed_revs.append(rev)
+ self._changed_values.append(new_value)
+ self.revs.append(rev)
+ self.values.append(new_value)
+ old_value = new_value
+
+ # Indicate that we know nothing about the value of the property
+ # after the range of the log.
+ if log.revs:
+ self.revs.append(log.end+1)
+ self.values.append(None)
+
+ def raw_get(self, rev=None):
+ """
+ Get the property at revision REV. If rev is not specified, get
+ the property at revision HEAD.
+ """
+ return get_revlist_prop(self.url, self.name, rev)
+
+ def get(self, rev=None):
+ """
+ Get the property at revision REV. If rev is not specified, get
+ the property at revision HEAD.
+ """
+
+ if rev is not None:
+
+ # Find the index using a binary search
+ i = bisect(self.revs, rev) - 1
+
+ # Return the value of the property, if it was cached
+ if self.values[i] is not None:
+ return self.values[i]
+
+ # Get the current value of the property
+ return self.raw_get(rev)
+
+ def changed_revs(self, key=None):
+ """
+ Get a list of the revisions in which the specified dictionary
+ key was changed in this property. If key is not specified,
+ return a list of revisions in which any key was changed.
+ """
+ if key is None:
+ return self._changed_revs
+ else:
+ changed_revs = []
+ old_val = self._initial_value
+ for rev, val in zip(self._changed_revs, self._changed_values):
+ if val.get(key) != old_val.get(key):
+ changed_revs.append(rev)
+ old_val = val
+ return changed_revs
+
+ def initialized_revs(self):
+ """
+ Get a list of the revisions in which keys were added or
+ removed in this property.
+ """
+ initialized_revs = []
+ old_len = len(self._initial_value)
+ for rev, val in zip(self._changed_revs, self._changed_values):
+ if len(val) != old_len:
+ initialized_revs.append(rev)
+ old_len = len(val)
+ return initialized_revs
+
+class RevisionSet:
+ """
+ A set of revisions, held in dictionary form for easy manipulation. If we
+ were to rewrite this script for Python 2.3+, we would subclass this from
+ set (or UserSet). As this class does not include branch
+ information, it's assumed that one instance will be used per
+ branch.
+ """
+ def __init__(self, parm):
+ """Constructs a RevisionSet from a string in property form, or from
+ a dictionary whose keys are the revisions. Raises ValueError if the
+ input string is invalid."""
+
+ self._revs = {}
+
+ revision_range_split_re = re.compile('[-:]')
+
+ if isinstance(parm, types.DictType):
+ self._revs = parm.copy()
+ elif isinstance(parm, types.ListType):
+ for R in parm:
+ self._revs[int(R)] = 1
+ else:
+ parm = parm.strip()
+ if parm:
+ for R in parm.split(","):
+ rev_or_revs = re.split(revision_range_split_re, R)
+ if len(rev_or_revs) == 1:
+ self._revs[int(rev_or_revs[0])] = 1
+ elif len(rev_or_revs) == 2:
+ for rev in range(int(rev_or_revs[0]),
+ int(rev_or_revs[1])+1):
+ self._revs[rev] = 1
+ else:
+ raise ValueError, 'Ill formatted revision range: ' + R
+
+ def sorted(self):
+ revnums = self._revs.keys()
+ revnums.sort()
+ return revnums
+
+ def normalized(self):
+ """Returns a normalized version of the revision set, which is an
+ ordered list of couples (start,end), with the minimum number of
+ intervals."""
+ revnums = self.sorted()
+ revnums.reverse()
+ ret = []
+ while revnums:
+ s = e = revnums.pop()
+ while revnums and revnums[-1] in (e, e+1):
+ e = revnums.pop()
+ ret.append((s, e))
+ return ret
+
+ def __str__(self):
+ """Convert the revision set to a string, using its normalized form."""
+ L = []
+ for s,e in self.normalized():
+ if s == e:
+ L.append(str(s))
+ else:
+ L.append(str(s) + "-" + str(e))
+ return ",".join(L)
+
+ def __contains__(self, rev):
+ return self._revs.has_key(rev)
+
+ def __sub__(self, rs):
+ """Compute subtraction as in sets."""
+ revs = {}
+ for r in self._revs.keys():
+ if r not in rs:
+ revs[r] = 1
+ return RevisionSet(revs)
+
+ def __and__(self, rs):
+ """Compute intersections as in sets."""
+ revs = {}
+ for r in self._revs.keys():
+ if r in rs:
+ revs[r] = 1
+ return RevisionSet(revs)
+
+ def __nonzero__(self):
+ return len(self._revs) != 0
+
+ def __len__(self):
+ """Return the number of revisions in the set."""
+ return len(self._revs)
+
+ def __iter__(self):
+ return iter(self.sorted())
+
+ def __or__(self, rs):
+ """Compute set union."""
+ revs = self._revs.copy()
+ revs.update(rs._revs)
+ return RevisionSet(revs)
+
+def merge_props_to_revision_set(merge_props, pathid):
+ """A converter which returns a RevisionSet instance containing the
+ revisions from PATH as known to BRANCH_PROPS. BRANCH_PROPS is a
+ dictionary of pathid -> revision set branch integration information
+ (as returned by get_merge_props())."""
+ if not merge_props.has_key(pathid):
+ error('no integration info available for path "%s"' % pathid)
+ return RevisionSet(merge_props[pathid])
+
+def dict_from_revlist_prop(propvalue):
+ """Given a property value as a string containing per-source revision
+ lists, return a dictionary whose key is a source path identifier
+ and whose value is the revisions for that source."""
+ prop = {}
+
+ # Multiple sources are separated by any whitespace.
+ for L in propvalue.split():
+ # We use rsplit to play safe and allow colons in pathids.
+ pathid_str, revs = rsplit(L.strip(), ":", 1)
+
+ pathid = PathIdentifier.from_pathid(pathid_str)
+
+ # cache the "external" form we saw
+ pathid.external_form = pathid_str
+
+ prop[pathid] = revs
+ return prop
+
+def get_revlist_prop(url_or_dir, propname, rev=None):
+ """Given a repository URL or working copy path and a property
+ name, extract the values of the property which store per-source
+ revision lists and return a dictionary whose key is a source path
+ identifier, and whose value is the revisions for that source."""
+
+ # Note that propget does not return an error if the property does
+ # not exist, it simply does not output anything. So we do not need
+ # to check for LaunchError here.
+ args = '--strict "%s" "%s"' % (propname, url_or_dir)
+ if rev:
+ args = '-r %s %s' % (rev, args)
+ out = launchsvn('propget %s' % args, split_lines=False)
+
+ return dict_from_revlist_prop(out)
+
+def get_merge_props(dir):
+ """Extract the merged revisions."""
+ return get_revlist_prop(dir, opts["prop"])
+
+def get_block_props(dir):
+ """Extract the blocked revisions."""
+ return get_revlist_prop(dir, opts["block-prop"])
+
+def get_blocked_revs(dir, source_pathid):
+ p = get_block_props(dir)
+ if p.has_key(source_pathid):
+ return RevisionSet(p[source_pathid])
+ return RevisionSet("")
+
+def format_merge_props(props, sep=" "):
+ """Formats the hash PROPS as a string suitable for use as a
+ Subversion property value."""
+ assert sep in ["\t", "\n", " "] # must be a whitespace
+ props = props.items()
+ props.sort()
+ L = []
+ for h, r in props:
+ L.append("%s:%s" % (h, r))
+ return sep.join(L)
+
+def _run_propset(dir, prop, value):
+ """Set the property 'prop' of directory 'dir' to value 'value'. We go
+ through a temporary file to not run into command line length limits."""
+ try:
+ fd, fname = tempfile.mkstemp()
+ f = os.fdopen(fd, "wb")
+ except AttributeError:
+ # Fallback for Python <= 2.3 which does not have mkstemp (mktemp
+ # suffers from race conditions. Not that we care...)
+ fname = tempfile.mktemp()
+ f = open(fname, "wb")
+
+ try:
+ f.write(value)
+ f.close()
+ report("property data written to temp file: %s" % value)
+ svn_command('propset "%s" -F "%s" "%s"' % (prop, fname, dir))
+ finally:
+ os.remove(fname)
+
+def set_props(dir, name, props):
+ props = format_merge_props(props)
+ if props:
+ _run_propset(dir, name, props)
+ else:
+ # Check if NAME exists on DIR before trying to delete it.
+ # As of 1.6 propdel no longer supports deleting a
+ # non-existent property.
+ out = launchsvn('propget "%s" "%s"' % (name, dir))
+ if out:
+ svn_command('propdel "%s" "%s"' % (name, dir))
+
+def set_merge_props(dir, props):
+ set_props(dir, opts["prop"], props)
+
+def set_block_props(dir, props):
+ set_props(dir, opts["block-prop"], props)
+
+def set_blocked_revs(dir, source_pathid, revs):
+ props = get_block_props(dir)
+ if revs:
+ props[source_pathid] = str(revs)
+ elif props.has_key(source_pathid):
+ del props[source_pathid]
+ set_block_props(dir, props)
+
+def is_url(url):
+ """Check if url looks like a valid url."""
+ return re.search(r"^[a-zA-Z][-+\.\w]*://[^\s]+$", url) is not None and url[:4] != 'uuid'
+
+def check_url(url):
+ """Similar to is_url, but actually invoke get_svninfo to find out"""
+ return get_svninfo(url) != {}
+
+def is_pathid(pathid):
+ return isinstance(pathid, PathIdentifier)
+
+def is_wc(dir):
+ """Check if a directory is a working copy."""
+ return os.path.isdir(os.path.join(dir, ".svn")) or \
+ os.path.isdir(os.path.join(dir, "_svn"))
+
+_cache_svninfo = {}
+def get_svninfo(target):
+ """Extract the subversion information for a target (through 'svn info').
+ This function uses an internal cache to let clients query information
+ many times."""
+ if _cache_svninfo.has_key(target):
+ return _cache_svninfo[target]
+ info = {}
+ for L in launchsvn('info "%s"' % target):
+ L = L.strip()
+ if not L:
+ continue
+ key, value = L.split(": ", 1)
+ info[key] = value.strip()
+ _cache_svninfo[target] = info
+ return info
+
+def target_to_url(target):
+ """Convert working copy path or repos URL to a repos URL."""
+ if is_wc(target):
+ info = get_svninfo(target)
+ return info["URL"]
+ return target
+
+_cache_reporoot = {}
+def get_repo_root(target):
+ """Compute the root repos URL given a working-copy path, or a URL."""
+ # Try using "svn info WCDIR". This works only on SVN clients >= 1.3
+ if not is_url(target):
+ try:
+ info = get_svninfo(target)
+ root = info["Repository Root"]
+ _cache_reporoot[root] = None
+ return root
+ except KeyError:
+ pass
+ url = target_to_url(target)
+ assert url[-1] != '/'
+ else:
+ url = target
+
+ # Go through the cache of the repository roots. This avoids extra
+ # server round-trips if we are asking the root of different URLs
+ # in the same repository (the cache in get_svninfo() cannot detect
+ # that of course and would issue a remote command).
+ assert is_url(url)
+ for r in _cache_reporoot:
+ if url.startswith(r):
+ return r
+
+ # Try using "svn info URL". This works only on SVN clients >= 1.2
+ try:
+ info = get_svninfo(url)
+ # info may be {}, in which case we'll see KeyError here
+ root = info["Repository Root"]
+ _cache_reporoot[root] = None
+ return root
+ except (KeyError, LaunchError):
+ pass
+
+ # Constrained to older svn clients, we are stuck with this ugly
+ # trial-and-error implementation. It could be made faster with a
+ # binary search.
+ while url:
+ temp = os.path.dirname(url)
+ try:
+ launchsvn('proplist "%s"' % temp)
+ except LaunchError:
+ _cache_reporoot[url] = None
+ return rstrip(url, "/")
+ url = temp
+
+ error("svn repos root of %s not found" % target)
+
+class SvnLogParser:
+ """
+ Parse the "svn log", going through the XML output and using pulldom (which
+ would even allow streaming the command output).
+ """
+ def __init__(self, xml):
+ self._events = pulldom.parseString(xml)
+ def __getitem__(self, idx):
+ for event, node in self._events:
+ if event == pulldom.START_ELEMENT and node.tagName == "logentry":
+ self._events.expandNode(node)
+ return self.SvnLogRevision(node)
+ raise IndexError, "Could not find 'logentry' tag in xml"
+
+ class SvnLogRevision:
+ def __init__(self, xmlnode):
+ self.n = xmlnode
+ def revision(self):
+ return int(self.n.getAttribute("revision"))
+ def author(self):
+ return self.n.getElementsByTagName("author")[0].firstChild.data
+ def paths(self):
+ return [self.SvnLogPath(n)
+ for n in self.n.getElementsByTagName("path")]
+
+ class SvnLogPath:
+ def __init__(self, xmlnode):
+ self.n = xmlnode
+ def action(self):
+ return self.n.getAttribute("action")
+ def pathid(self):
+ return self.n.firstChild.data
+ def copyfrom_rev(self):
+ try: return self.n.getAttribute("copyfrom-rev")
+ except KeyError: return None
+ def copyfrom_pathid(self):
+ try: return self.n.getAttribute("copyfrom-path")
+ except KeyError: return None
+
+def get_copyfrom(target):
+ """Get copyfrom info for a given target (it represents the
+ repository-relative path from where it was branched). NOTE:
+ repos root has no copyfrom info. In this case None is returned.
+
+ Returns the:
+ - source file or directory from which the copy was made
+ - revision from which that source was copied
+ - revision in which the copy was committed
+ """
+ repos_path = PathIdentifier.from_target(target).repo_relative_path
+ for chg in SvnLogParser(launchsvn('log -v --xml --stop-on-copy "%s"'
+ % target, split_lines=False)):
+ for p in chg.paths():
+ if p.action() == 'A' and p.pathid() == repos_path:
+ # These values will be None if the corresponding elements are
+ # not found in the log.
+ return p.copyfrom_pathid(), p.copyfrom_rev(), chg.revision()
+ return None,None,None
+
+def get_latest_rev(url):
+ """Get the latest revision of the repository of which URL is part."""
+ try:
+ info = get_svninfo(url)
+ if not info.has_key("Revision"):
+ error("Not a valid URL: %s" % url)
+ return info["Revision"]
+ except LaunchError:
+ # Alternative method for latest revision checking (for svn < 1.2)
+ report('checking latest revision of "%s"' % url)
+ L = launchsvn('proplist --revprop -r HEAD "%s"' % opts["source-url"])[0]
+ rev = re.search("revision (\d+)", L).group(1)
+ report('latest revision of "%s" is %s' % (url, rev))
+ return rev
+
+def get_created_rev(url):
+ """Lookup the revision at which the path identified by the
+ provided URL was first created."""
+ oldest_rev = -1
+ report('determining oldest revision for URL "%s"' % url)
+ ### TODO: Refactor this to use a modified RevisionLog class.
+ lines = None
+ cmd = "log -r1:HEAD --stop-on-copy -q " + url
+ try:
+ lines = launchsvn(cmd + " --limit=1")
+ except LaunchError:
+ # Assume that --limit isn't supported by the installed 'svn'.
+ lines = launchsvn(cmd)
+ if lines and len(lines) > 1:
+ i = lines[1].find(" ")
+ if i != -1:
+ oldest_rev = int(lines[1][1:i])
+ if oldest_rev == -1:
+ error('unable to determine oldest revision for URL "%s"' % url)
+ return oldest_rev
+
+def get_commit_log(url, revnum):
+ """Return the log message for a specific integer revision
+ number."""
+ out = launchsvn("log --incremental -r%d %s" % (revnum, url))
+ return recode_stdout_to_file("".join(out[1:]))
+
+def construct_merged_log_message(url, revnums):
+ """Return a commit log message containing all the commit messages
+ in the specified revisions at the given URL. The separator used
+ in this log message is determined by searching for the longest
+ svnmerge separator existing in the commit log messages and
+ extending it by one more separator. This results in a new commit
+ log message that is clearer in describing merges that contain
+ other merges. Trailing newlines are removed from the embedded
+ log messages."""
+ messages = ['']
+ longest_sep = ''
+ for r in revnums.sorted():
+ message = get_commit_log(url, r)
+ if message:
+ message = re.sub(r'(\r\n|\r|\n)', "\n", message)
+ message = rstrip(message, "\n") + "\n"
+ messages.append(prefix_lines(LOG_LINE_PREFIX, message))
+ for match in LOG_SEPARATOR_RE.findall(message):
+ sep = match[1]
+ if len(sep) > len(longest_sep):
+ longest_sep = sep
+
+ longest_sep += LOG_SEPARATOR + "\n"
+ messages.append('')
+ return longest_sep.join(messages)
+
+def get_default_source(branch_target, branch_props):
+ """Return the default source for branch_target (given its branch_props).
+ Error out if there is ambiguity."""
+ if not branch_props:
+ error("no integration info available")
+
+ props = branch_props.copy()
+ pathid = PathIdentifier.from_target(branch_target)
+
+ # To make bidirectional merges easier, find the target's
+ # repository local path so it can be removed from the list of
+ # possible integration sources.
+ if props.has_key(pathid):
+ del props[pathid]
+
+ if len(props) > 1:
+ err_msg = "multiple sources found. "
+ err_msg += "Explicit source argument (-S/--source) required.\n"
+ err_msg += "The merge sources available are:"
+ for prop in props:
+ err_msg += "\n " + str(prop)
+ error(err_msg)
+
+ return props.keys()[0]
+
+def should_find_reflected(branch_dir):
+ should_find_reflected = opts["bidirectional"]
+
+ # If the source has integration info for the target, set find_reflected
+ # even if --bidirectional wasn't specified
+ if not should_find_reflected:
+ source_props = get_merge_props(opts["source-url"])
+ should_find_reflected = source_props.has_key(PathIdentifier.from_target(branch_dir))
+
+ return should_find_reflected
+
+def analyze_revs(target_pathid, url, begin=1, end=None,
+ find_reflected=False):
+ """For the source of the merges in the source URL being merged into
+ target_pathid, analyze the revisions in the interval begin-end (which
+ defaults to 1-HEAD), to find out which revisions are changes in
+ the url, which are changes elsewhere (so-called 'phantom'
+ revisions), optionally which are reflected changes (to avoid
+ conflicts that can occur when doing bidirectional merging between
+ branches), and which revisions initialize merge tracking against other
+ branches. Return a tuple of four RevisionSet's:
+ (real_revs, phantom_revs, reflected_revs, initialized_revs).
+
+ NOTE: To maximize speed, if "end" is not provided, the function is
+ not able to find phantom revisions following the last real
+ revision in the URL.
+ """
+
+ begin = str(begin)
+ if end is None:
+ end = "HEAD"
+ else:
+ end = str(end)
+ if long(begin) > long(end):
+ return RevisionSet(""), RevisionSet(""), \
+ RevisionSet(""), RevisionSet("")
+
+ logs[url] = RevisionLog(url, begin, end, find_reflected)
+ revs = RevisionSet(logs[url].revs)
+
+ if end == "HEAD":
+ # If end is not provided, we do not know which is the latest revision
+ # in the repository. So return the phantom revision set only up to
+ # the latest known revision.
+ end = str(list(revs)[-1])
+
+ phantom_revs = RevisionSet("%s-%s" % (begin, end)) - revs
+
+ if find_reflected:
+ reflected_revs = logs[url].merge_metadata().changed_revs(target_pathid)
+ reflected_revs += logs[url].block_metadata().changed_revs(target_pathid)
+ else:
+ reflected_revs = []
+
+ initialized_revs = RevisionSet(logs[url].merge_metadata().initialized_revs())
+ reflected_revs = RevisionSet(reflected_revs)
+
+ return revs, phantom_revs, reflected_revs, initialized_revs
+
+def analyze_source_revs(branch_target, source_url, **kwargs):
+ """For the given branch and source, extract the real and phantom
+ source revisions."""
+ branch_url = target_to_url(branch_target)
+ branch_pathid = PathIdentifier.from_target(branch_target)
+
+ # Extract the latest repository revision from the URL of the branch
+ # directory (which is already cached at this point).
+ end_rev = get_latest_rev(source_url)
+
+ # Calculate the base of analysis. If there is a "1-XX" interval in the
+ # merged_revs, we do not need to check those.
+ base = 1
+ r = opts["merged-revs"].normalized()
+ if r and r[0][0] == 1:
+ base = r[0][1] + 1
+
+ # See if the user filtered the revision set. If so, we are not
+ # interested in something outside that range.
+ if opts["revision"]:
+ revs = RevisionSet(opts["revision"]).sorted()
+ if base < revs[0]:
+ base = revs[0]
+ if end_rev > revs[-1]:
+ end_rev = revs[-1]
+
+ return analyze_revs(branch_pathid, source_url, base, end_rev, **kwargs)
+
+def minimal_merge_intervals(revs, phantom_revs):
+ """Produce the smallest number of intervals suitable for merging. revs
+ is the RevisionSet which we want to merge, and phantom_revs are phantom
+ revisions which can be used to concatenate intervals, thus minimizing the
+ number of operations."""
+ revnums = revs.normalized()
+ ret = []
+
+ cur = revnums.pop()
+ while revnums:
+ next = revnums.pop()
+ assert next[1] < cur[0] # otherwise it is not ordered
+ assert cur[0] - next[1] > 1 # otherwise it is not normalized
+ for i in range(next[1]+1, cur[0]):
+ if i not in phantom_revs:
+ ret.append(cur)
+ cur = next
+ break
+ else:
+ cur = (next[0], cur[1])
+
+ ret.append(cur)
+ ret.reverse()
+ return ret
+
+def display_revisions(revs, display_style, revisions_msg, source_url):
+ """Show REVS as dictated by DISPLAY_STYLE, either numerically, in
+ log format, or as diffs. When displaying revisions numerically,
+ prefix output with REVISIONS_MSG when in verbose mode. Otherwise,
+ request logs or diffs using SOURCE_URL."""
+ if display_style == "revisions":
+ if revs:
+ report(revisions_msg)
+ print revs
+ elif display_style == "logs":
+ for start,end in revs.normalized():
+ svn_command('log --incremental -v -r %d:%d %s' % \
+ (start, end, source_url))
+ elif display_style in ("diffs", "summarize"):
+ if display_style == 'summarize':
+ summarize = '--summarize '
+ else:
+ summarize = ''
+
+ for start, end in revs.normalized():
+ print
+ if start == end:
+ print "%s: changes in revision %d follow" % (NAME, start)
+ else:
+ print "%s: changes in revisions %d-%d follow" % (NAME,
+ start, end)
+ print
+
+ # Note: the starting revision number to 'svn diff' is
+ # NOT inclusive so we have to subtract one from ${START}.
+ svn_command("diff -r %d:%d %s %s" % (start - 1, end, summarize,
+ source_url))
+ else:
+ assert False, "unhandled display style: %s" % display_style
+
+def action_init(target_dir, target_props):
+ """Initialize for merges."""
+ # Check that directory is ready for being modified
+ check_dir_clean(target_dir)
+
+ target_pathid = PathIdentifier.from_target(target_dir)
+ source_pathid = opts['source-pathid']
+ if source_pathid == target_pathid:
+ error("cannot init integration source path '%s'\nIts path identifier does not "
+ "differ from the path identifier of the current directory, '%s'."
+ % (source_pathid, target_pathid))
+
+ source_url = opts['source-url']
+
+ # If the user hasn't specified the revisions to use, see if the
+ # "source" is a copy from the current tree and if so, we can use
+ # the version data obtained from it.
+ revision_range = opts["revision"]
+ if not revision_range:
+ # If source was originally copied from target, and we are merging
+ # changes from source to target (the copy target is the merge source,
+ # and the copy source is the merge target), then we want to mark as
+ # integrated up to the rev in which the copy was committed which
+ # created the merge source:
+ cf_source, cf_rev, copy_committed_in_rev = get_copyfrom(source_url)
+
+ cf_pathid = None
+ if cf_source:
+ cf_url = get_repo_root(source_url) + cf_source
+ if is_url(cf_url) and check_url(cf_url):
+ cf_pathid = PathIdentifier.from_target(cf_url)
+
+ if target_pathid == cf_pathid:
+ report('the source "%s" was copied from "%s" in rev %s and committed in rev %s' %
+ (source_url, target_dir, cf_rev, copy_committed_in_rev))
+ revision_range = "1-" + str(copy_committed_in_rev)
+
+ if not revision_range:
+ # If the reverse is true: copy source is the merge source, and
+ # the copy target is the merge target, then we want to mark as
+ # integrated up to the specific rev of the merge target from
+ # which the merge source was copied. (Longer discussion at:
+ # http://subversion.tigris.org/issues/show_bug.cgi?id=2810 )
+ cf_source, cf_rev, copy_committed_in_rev = get_copyfrom(target_dir)
+
+ cf_pathid = None
+ if cf_source:
+ cf_url = get_repo_root(target_dir) + cf_source
+ if is_url(cf_url) and check_url(cf_url):
+ cf_pathid = PathIdentifier.from_target(cf_url)
+
+ source_pathid = PathIdentifier.from_target(source_url)
+ if source_pathid == cf_pathid:
+ report('the target "%s" was copied the source "%s" in rev %s and committed in rev %s' %
+ (target_dir, source_url, cf_rev, copy_committed_in_rev))
+ revision_range = "1-" + cf_rev
+
+ # When neither the merge source nor target is a copy of the other, and
+ # the user did not specify a revision range, then choose a default which is
+ # the current revision; saying, in effect, "everything has been merged, so
+ # mark as integrated up to the latest rev on source url).
+ if not revision_range:
+ revision_range = "1-" + get_latest_rev(source_url)
+
+ revs = RevisionSet(revision_range)
+
+ report('marking "%s" as already containing revisions "%s" of "%s"' %
+ (target_dir, revs, source_url))
+
+ revs = str(revs)
+ # If the local svnmerge-integrated property already has an entry
+ # for the source-pathid, simply error out.
+ if not opts["force"] and target_props.has_key(source_pathid):
+ error('Repository-relative path %s has already been initialized at %s\n'
+ 'Use --force to re-initialize' % (source_pathid, target_dir))
+ # set the pathid's external_form based on the user's options
+ source_pathid.external_form = source_pathid.format(opts['location-type'])
+
+ revs = str(revs)
+ target_props[source_pathid] = revs
+
+ # Set property
+ set_merge_props(target_dir, target_props)
+
+ # Write out commit message if desired
+ if opts["commit-file"]:
+ f = open(opts["commit-file"], "w")
+ print >>f, 'Initialized merge tracking via "%s" with revisions "%s" from ' \
+ % (NAME, revs)
+ print >>f, '%s' % source_url
+ f.close()
+ report('wrote commit message to "%s"' % opts["commit-file"])
+
+def action_avail(branch_dir, branch_props):
+ """Show commits available for merges."""
+ source_revs, phantom_revs, reflected_revs, initialized_revs = \
+ analyze_source_revs(branch_dir, opts["source-url"],
+ find_reflected=
+ should_find_reflected(branch_dir))
+ report('skipping phantom revisions: %s' % phantom_revs)
+ if reflected_revs:
+ report('skipping reflected revisions: %s' % reflected_revs)
+ report('skipping initialized revisions: %s' % initialized_revs)
+
+ blocked_revs = get_blocked_revs(branch_dir, opts["source-pathid"])
+ avail_revs = source_revs - opts["merged-revs"] - blocked_revs - \
+ reflected_revs - initialized_revs
+
+ # Compose the set of revisions to show
+ revs = RevisionSet("")
+ report_msg = "revisions available to be merged are:"
+ if "avail" in opts["avail-showwhat"]:
+ revs |= avail_revs
+ if "blocked" in opts["avail-showwhat"]:
+ revs |= blocked_revs
+ report_msg = "revisions blocked are:"
+
+ # Limit to revisions specified by -r (if any)
+ if opts["revision"]:
+ revs = revs & RevisionSet(opts["revision"])
+
+ display_revisions(revs, opts["avail-display"],
+ report_msg,
+ opts["source-url"])
+
+def action_integrated(branch_dir, branch_props):
+ """Show change sets already merged. This set of revisions is
+ calculated from taking svnmerge-integrated property from the
+ branch, and subtracting any revision older than the branch
+ creation revision."""
+ # Extract the integration info for the branch_dir
+ branch_props = get_merge_props(branch_dir)
+ revs = merge_props_to_revision_set(branch_props, opts["source-pathid"])
+
+ # Lookup the oldest revision on the branch path.
+ oldest_src_rev = get_created_rev(opts["source-url"])
+
+ # Subtract any revisions which pre-date the branch.
+ report("subtracting revisions which pre-date the source URL (%d)" %
+ oldest_src_rev)
+ revs = revs - RevisionSet(range(1, oldest_src_rev))
+
+ # Limit to revisions specified by -r (if any)
+ if opts["revision"]:
+ revs = revs & RevisionSet(opts["revision"])
+
+ display_revisions(revs, opts["integrated-display"],
+ "revisions already integrated are:", opts["source-url"])
+
+def action_merge(branch_dir, branch_props):
+ """Record merge meta data, and do the actual merge (if not
+ requested otherwise via --record-only)."""
+ # Check branch directory is ready for being modified
+ check_dir_clean(branch_dir)
+
+ source_revs, phantom_revs, reflected_revs, initialized_revs = \
+ analyze_source_revs(branch_dir, opts["source-url"],
+ find_reflected=
+ should_find_reflected(branch_dir))
+
+ if opts["revision"]:
+ revs = RevisionSet(opts["revision"])
+ else:
+ revs = source_revs
+
+ blocked_revs = get_blocked_revs(branch_dir, opts["source-pathid"])
+ merged_revs = opts["merged-revs"]
+
+ # Show what we're doing
+ if opts["verbose"]: # just to avoid useless calculations
+ if merged_revs & revs:
+ report('"%s" already contains revisions %s' % (branch_dir,
+ merged_revs & revs))
+ if phantom_revs:
+ report('memorizing phantom revision(s): %s' % phantom_revs)
+ if reflected_revs:
+ report('memorizing reflected revision(s): %s' % reflected_revs)
+ if blocked_revs & revs:
+ report('skipping blocked revisions(s): %s' % (blocked_revs & revs))
+ if initialized_revs:
+ report('skipping initialized revision(s): %s' % initialized_revs)
+
+ # Compute final merge set.
+ revs = revs - merged_revs - blocked_revs - reflected_revs - \
+ phantom_revs - initialized_revs
+ if not revs:
+ report('no revisions to merge, exiting')
+ return
+
+ # When manually marking revisions as merged, we only update the
+ # integration meta data, and don't perform an actual merge.
+ record_only = opts["record-only"]
+
+ if record_only:
+ report('recording merge of revision(s) %s from "%s"' %
+ (revs, opts["source-url"]))
+ else:
+ report('merging in revision(s) %s from "%s"' %
+ (revs, opts["source-url"]))
+
+ # Do the merge(s). Note: the starting revision number to 'svn merge'
+ # is NOT inclusive so we have to subtract one from start.
+ # We try to keep the number of merge operations as low as possible,
+ # because it is faster and reduces the number of conflicts.
+ old_block_props = get_block_props(branch_dir)
+ merge_metadata = logs[opts["source-url"]].merge_metadata()
+ block_metadata = logs[opts["source-url"]].block_metadata()
+ for start,end in minimal_merge_intervals(revs, phantom_revs):
+ if not record_only:
+ # Preset merge/blocked properties to the source value at
+ # the start rev to avoid spurious property conflicts
+ set_merge_props(branch_dir, merge_metadata.get(start - 1))
+ set_block_props(branch_dir, block_metadata.get(start - 1))
+ # Do the merge
+ svn_command("merge --force -r %d:%d %s %s" % \
+ (start - 1, end, opts["source-url"], branch_dir))
+ # TODO: to support graph merging, add logic to merge the property
+ # meta-data manually
+
+ # Update the set of merged revisions.
+ merged_revs = merged_revs | revs | reflected_revs | phantom_revs | initialized_revs
+ branch_props[opts["source-pathid"]] = str(merged_revs)
+ set_merge_props(branch_dir, branch_props)
+ # Reset the blocked revs
+ set_block_props(branch_dir, old_block_props)
+
+ # Write out commit message if desired
+ if opts["commit-file"]:
+ f = open(opts["commit-file"], "w")
+ if record_only:
+ print >>f, 'Recorded merge of revisions %s via %s from ' % \
+ (revs, NAME)
+ else:
+ print >>f, 'Merged revisions %s via %s from ' % \
+ (revs, NAME)
+ print >>f, '%s' % opts["source-url"]
+ if opts["commit-verbose"]:
+ print >>f
+ print >>f, construct_merged_log_message(opts["source-url"], revs),
+
+ f.close()
+ report('wrote commit message to "%s"' % opts["commit-file"])
+
+def action_block(branch_dir, branch_props):
+ """Block revisions."""
+ # Check branch directory is ready for being modified
+ check_dir_clean(branch_dir)
+
+ source_revs, phantom_revs, reflected_revs, initialized_revs = \
+ analyze_source_revs(branch_dir, opts["source-url"])
+ revs_to_block = source_revs - opts["merged-revs"]
+
+ # Limit to revisions specified by -r (if any)
+ if opts["revision"]:
+ revs_to_block = RevisionSet(opts["revision"]) & revs_to_block
+
+ if not revs_to_block:
+ error('no available revisions to block')
+
+ # Change blocked information
+ blocked_revs = get_blocked_revs(branch_dir, opts["source-pathid"])
+ blocked_revs = blocked_revs | revs_to_block
+ set_blocked_revs(branch_dir, opts["source-pathid"], blocked_revs)
+
+ # Write out commit message if desired
+ if opts["commit-file"]:
+ f = open(opts["commit-file"], "w")
+ print >>f, 'Blocked revisions %s via %s' % (revs_to_block, NAME)
+ if opts["commit-verbose"]:
+ print >>f
+ print >>f, construct_merged_log_message(opts["source-url"],
+ revs_to_block),
+
+ f.close()
+ report('wrote commit message to "%s"' % opts["commit-file"])
+
+def action_unblock(branch_dir, branch_props):
+ """Unblock revisions."""
+ # Check branch directory is ready for being modified
+ check_dir_clean(branch_dir)
+
+ blocked_revs = get_blocked_revs(branch_dir, opts["source-pathid"])
+ revs_to_unblock = blocked_revs
+
+ # Limit to revisions specified by -r (if any)
+ if opts["revision"]:
+ revs_to_unblock = revs_to_unblock & RevisionSet(opts["revision"])
+
+ if not revs_to_unblock:
+ error('no available revisions to unblock')
+
+ # Change blocked information
+ blocked_revs = blocked_revs - revs_to_unblock
+ set_blocked_revs(branch_dir, opts["source-pathid"], blocked_revs)
+
+ # Write out commit message if desired
+ if opts["commit-file"]:
+ f = open(opts["commit-file"], "w")
+ print >>f, 'Unblocked revisions %s via %s' % (revs_to_unblock, NAME)
+ if opts["commit-verbose"]:
+ print >>f
+ print >>f, construct_merged_log_message(opts["source-url"],
+ revs_to_unblock),
+ f.close()
+ report('wrote commit message to "%s"' % opts["commit-file"])
+
+def action_rollback(branch_dir, branch_props):
+ """Rollback previously integrated revisions."""
+
+ # Make sure the revision arguments are present
+ if not opts["revision"]:
+ error("The '-r' option is mandatory for rollback")
+
+ # Check branch directory is ready for being modified
+ check_dir_clean(branch_dir)
+
+ # Extract the integration info for the branch_dir
+ branch_props = get_merge_props(branch_dir)
+ # Get the list of all revisions already merged into this source-pathid.
+ merged_revs = merge_props_to_revision_set(branch_props,
+ opts["source-pathid"])
+
+ # At which revision was the src created?
+ oldest_src_rev = get_created_rev(opts["source-url"])
+ src_pre_exist_range = RevisionSet("1-%d" % oldest_src_rev)
+
+ # Limit to revisions specified by -r (if any)
+ revs = merged_revs & RevisionSet(opts["revision"])
+
+ # make sure there's some revision to rollback
+ if not revs:
+ report("Nothing to rollback in revision range r%s" % opts["revision"])
+ return
+
+ # If even one specified revision lies outside the lifetime of the
+ # merge source, error out.
+ if revs & src_pre_exist_range:
+ err_str = "Specified revision range falls out of the rollback range.\n"
+ err_str += "%s was created at r%d" % (opts["source-pathid"],
+ oldest_src_rev)
+ error(err_str)
+
+ record_only = opts["record-only"]
+
+ if record_only:
+ report('recording rollback of revision(s) %s from "%s"' %
+ (revs, opts["source-url"]))
+ else:
+ report('rollback of revision(s) %s from "%s"' %
+ (revs, opts["source-url"]))
+
+ # Do the reverse merge(s). Note: the starting revision number
+ # to 'svn merge' is NOT inclusive so we have to subtract one from start.
+ # We try to keep the number of merge operations as low as possible,
+ # because it is faster and reduces the number of conflicts.
+ rollback_intervals = minimal_merge_intervals(revs, [])
+ # rollback in the reverse order of merge
+ rollback_intervals.reverse()
+ for start, end in rollback_intervals:
+ if not record_only:
+ # Do the merge
+ svn_command("merge --force -r %d:%d %s %s" % \
+ (end, start - 1, opts["source-url"], branch_dir))
+
+ # Write out commit message if desired
+ # calculate the phantom revs first
+ if opts["commit-file"]:
+ f = open(opts["commit-file"], "w")
+ if record_only:
+ print >>f, 'Recorded rollback of revisions %s via %s from ' % \
+ (revs , NAME)
+ else:
+ print >>f, 'Rolled back revisions %s via %s from ' % \
+ (revs , NAME)
+ print >>f, '%s' % opts["source-url"]
+
+ f.close()
+ report('wrote commit message to "%s"' % opts["commit-file"])
+
+ # Update the set of merged revisions.
+ merged_revs = merged_revs - revs
+ branch_props[opts["source-pathid"]] = str(merged_revs)
+ set_merge_props(branch_dir, branch_props)
+
+def action_uninit(branch_dir, branch_props):
+ """Uninit SOURCE URL."""
+ # Check branch directory is ready for being modified
+ check_dir_clean(branch_dir)
+
+ # If the source-pathid does not have an entry in the svnmerge-integrated
+ # property, simply error out.
+ if not branch_props.has_key(opts["source-pathid"]):
+ error('Repository-relative path "%s" does not contain merge '
+ 'tracking information for "%s"' \
+ % (opts["source-pathid"], branch_dir))
+
+ del branch_props[opts["source-pathid"]]
+
+ # Set merge property with the selected source deleted
+ set_merge_props(branch_dir, branch_props)
+
+ # Set blocked revisions for the selected source to None
+ set_blocked_revs(branch_dir, opts["source-pathid"], None)
+
+ # Write out commit message if desired
+ if opts["commit-file"]:
+ f = open(opts["commit-file"], "w")
+ print >>f, 'Removed merge tracking for "%s" for ' % NAME
+ print >>f, '%s' % opts["source-url"]
+ f.close()
+ report('wrote commit message to "%s"' % opts["commit-file"])
+
+###############################################################################
+# Command line parsing -- options and commands management
+###############################################################################
+
+class OptBase:
+ def __init__(self, *args, **kwargs):
+ self.help = kwargs["help"]
+ del kwargs["help"]
+ self.lflags = []
+ self.sflags = []
+ for a in args:
+ if a.startswith("--"): self.lflags.append(a)
+ elif a.startswith("-"): self.sflags.append(a)
+ else:
+ raise TypeError, "invalid flag name: %s" % a
+ if kwargs.has_key("dest"):
+ self.dest = kwargs["dest"]
+ del kwargs["dest"]
+ else:
+ if not self.lflags:
+ raise TypeError, "cannot deduce dest name without long options"
+ self.dest = self.lflags[0][2:]
+ if kwargs:
+ raise TypeError, "invalid keyword arguments: %r" % kwargs.keys()
+ def repr_flags(self):
+ f = self.sflags + self.lflags
+ r = f[0]
+ for fl in f[1:]:
+ r += " [%s]" % fl
+ return r
+
+class Option(OptBase):
+ def __init__(self, *args, **kwargs):
+ self.default = kwargs.setdefault("default", 0)
+ del kwargs["default"]
+ self.value = kwargs.setdefault("value", None)
+ del kwargs["value"]
+ OptBase.__init__(self, *args, **kwargs)
+ def apply(self, state, value):
+ assert value == ""
+ if self.value is not None:
+ state[self.dest] = self.value
+ else:
+ state[self.dest] += 1
+
+class OptionArg(OptBase):
+ def __init__(self, *args, **kwargs):
+ self.default = kwargs["default"]
+ del kwargs["default"]
+ self.metavar = kwargs.setdefault("metavar", None)
+ del kwargs["metavar"]
+ OptBase.__init__(self, *args, **kwargs)
+
+ if self.metavar is None:
+ if self.dest is not None:
+ self.metavar = self.dest.upper()
+ else:
+ self.metavar = "arg"
+ if self.default:
+ self.help += " (default: %s)" % self.default
+ def apply(self, state, value):
+ assert value is not None
+ state[self.dest] = value
+ def repr_flags(self):
+ r = OptBase.repr_flags(self)
+ return r + " " + self.metavar
+
+class CommandOpts:
+ class Cmd:
+ def __init__(self, *args):
+ self.name, self.func, self.usage, self.help, self.opts = args
+ def short_help(self):
+ return self.help.split(".")[0]
+ def __str__(self):
+ return self.name
+ def __call__(self, *args, **kwargs):
+ return self.func(*args, **kwargs)
+
+ def __init__(self, global_opts, common_opts, command_table, version=None):
+ self.progname = NAME
+ self.version = version.replace("%prog", self.progname)
+ self.cwidth = console_width() - 2
+ self.ctable = command_table.copy()
+ self.gopts = global_opts[:]
+ self.copts = common_opts[:]
+ self._add_builtins()
+ for k in self.ctable.keys():
+ cmd = self.Cmd(k, *self.ctable[k])
+ opts = []
+ for o in cmd.opts:
+ if isinstance(o, types.StringType) or \
+ isinstance(o, types.UnicodeType):
+ o = self._find_common(o)
+ opts.append(o)
+ cmd.opts = opts
+ self.ctable[k] = cmd
+
+ def _add_builtins(self):
+ self.gopts.append(
+ Option("-h", "--help", help="show help for this command and exit"))
+ if self.version is not None:
+ self.gopts.append(
+ Option("-V", "--version", help="show version info and exit"))
+ self.ctable["help"] = (self._cmd_help,
+ "help [COMMAND]",
+ "Display help for a specific command. If COMMAND is omitted, "
+ "display brief command description.",
+ [])
+
+ def _cmd_help(self, cmd=None, *args):
+ if args:
+ self.error("wrong number of arguments", "help")
+ if cmd is not None:
+ cmd = self._command(cmd)
+ self.print_command_help(cmd)
+ else:
+ self.print_command_list()
+
+ def _paragraph(self, text, width=78):
+ chunks = re.split("\s+", text.strip())
+ chunks.reverse()
+ lines = []
+ while chunks:
+ L = chunks.pop()
+ while chunks and len(L) + len(chunks[-1]) + 1 <= width:
+ L += " " + chunks.pop()
+ lines.append(L)
+ return lines
+
+ def _paragraphs(self, text, *args, **kwargs):
+ pars = text.split("\n\n")
+ lines = self._paragraph(pars[0], *args, **kwargs)
+ for p in pars[1:]:
+ lines.append("")
+ lines.extend(self._paragraph(p, *args, **kwargs))
+ return lines
+
+ def _print_wrapped(self, text, indent=0):
+ text = self._paragraphs(text, self.cwidth - indent)
+ print text.pop(0)
+ for t in text:
+ print " " * indent + t
+
+ def _find_common(self, fl):
+ for o in self.copts:
+ if fl in o.lflags+o.sflags:
+ return o
+ assert False, fl
+
+ def _compute_flags(self, opts, check_conflicts=True):
+ back = {}
+ sfl = ""
+ lfl = []
+ for o in opts:
+ sapp = lapp = ""
+ if isinstance(o, OptionArg):
+ sapp, lapp = ":", "="
+ for s in o.sflags:
+ if check_conflicts and back.has_key(s):
+ raise RuntimeError, "option conflict: %s" % s
+ back[s] = o
+ sfl += s[1:] + sapp
+ for l in o.lflags:
+ if check_conflicts and back.has_key(l):
+ raise RuntimeError, "option conflict: %s" % l
+ back[l] = o
+ lfl.append(l[2:] + lapp)
+ return sfl, lfl, back
+
+ def _extract_command(self, args):
+ """
+ Try to extract the command name from the argument list. This is
+ non-trivial because we want to allow command-specific options even
+ before the command itself.
+ """
+ opts = self.gopts[:]
+ for cmd in self.ctable.values():
+ opts.extend(cmd.opts)
+ sfl, lfl, _ = self._compute_flags(opts, check_conflicts=False)
+
+ lopts,largs = getopt.getopt(args, sfl, lfl)
+ if not largs:
+ return None
+ return self._command(largs[0])
+
+ def _fancy_getopt(self, args, opts, state=None):
+ if state is None:
+ state= {}
+ for o in opts:
+ if not state.has_key(o.dest):
+ state[o.dest] = o.default
+
+ sfl, lfl, back = self._compute_flags(opts)
+ try:
+ lopts,args = getopt.gnu_getopt(args, sfl, lfl)
+ except AttributeError:
+ # Before Python 2.3, there was no gnu_getopt support.
+ # So we can't parse intermixed positional arguments
+ # and options.
+ lopts,args = getopt.getopt(args, sfl, lfl)
+
+ for o,v in lopts:
+ back[o].apply(state, v)
+ return state, args
+
+ def _command(self, cmd):
+ if not self.ctable.has_key(cmd):
+ self.error("unknown command: '%s'" % cmd)
+ return self.ctable[cmd]
+
+ def parse(self, args):
+ if not args:
+ self.print_small_help()
+ sys.exit(0)
+
+ cmd = None
+ try:
+ cmd = self._extract_command(args)
+ opts = self.gopts[:]
+ if cmd:
+ opts.extend(cmd.opts)
+ args.remove(cmd.name)
+ state, args = self._fancy_getopt(args, opts)
+ except getopt.GetoptError, e:
+ self.error(e, cmd)
+
+ # Handle builtins
+ if self.version is not None and state["version"]:
+ self.print_version()
+ sys.exit(0)
+ if state["help"]: # special case for --help
+ if cmd:
+ self.print_command_help(cmd)
+ sys.exit(0)
+ cmd = self.ctable["help"]
+ else:
+ if cmd is None:
+ self.error("command argument required")
+ if str(cmd) == "help":
+ cmd(*args)
+ sys.exit(0)
+ return cmd, args, state
+
+ def error(self, s, cmd=None):
+ print >>sys.stderr, "%s: %s" % (self.progname, s)
+ if cmd is not None:
+ self.print_command_help(cmd)
+ else:
+ self.print_small_help()
+ sys.exit(1)
+ def print_small_help(self):
+ print "Type '%s help' for usage" % self.progname
+ def print_usage_line(self):
+ print "usage: %s <subcommand> [options...] [args...]\n" % self.progname
+ def print_command_list(self):
+ print "Available commands (use '%s help COMMAND' for more details):\n" \
+ % self.progname
+ cmds = self.ctable.keys()
+ cmds.sort()
+ indent = max(map(len, cmds))
+ for c in cmds:
+ h = self.ctable[c].short_help()
+ print " %-*s " % (indent, c),
+ self._print_wrapped(h, indent+6)
+ def print_command_help(self, cmd):
+ cmd = self.ctable[str(cmd)]
+ print 'usage: %s %s\n' % (self.progname, cmd.usage)
+ self._print_wrapped(cmd.help)
+ def print_opts(opts, self=self):
+ if not opts: return
+ flags = [o.repr_flags() for o in opts]
+ indent = max(map(len, flags))
+ for f,o in zip(flags, opts):
+ print " %-*s :" % (indent, f),
+ self._print_wrapped(o.help, indent+5)
+ print '\nCommand options:'
+ print_opts(cmd.opts)
+ print '\nGlobal options:'
+ print_opts(self.gopts)
+
+ def print_version(self):
+ print self.version
+
+###############################################################################
+# Options and Commands description
+###############################################################################
+
+global_opts = [
+ Option("-F", "--force",
+ help="force operation even if the working copy is not clean, or "
+ "there are pending updates"),
+ Option("-n", "--dry-run",
+ help="don't actually change anything, just pretend; "
+ "implies --show-changes"),
+ Option("-s", "--show-changes",
+ help="show subversion commands that make changes"),
+ Option("-v", "--verbose",
+ help="verbose mode: output more information about progress"),
+ OptionArg("-u", "--username",
+ default=None,
+ help="invoke subversion commands with the supplied username"),
+ OptionArg("-p", "--password",
+ default=None,
+ help="invoke subversion commands with the supplied password"),
+ OptionArg("-c", "--config-dir", metavar="DIR",
+ default=None,
+ help="cause subversion commands to consult runtime config directory DIR"),
+]
+
+common_opts = [
+ Option("-b", "--bidirectional",
+ value=True,
+ default=False,
+ help="remove reflected and initialized revisions from merge candidates. "
+ "Not required but may be specified to speed things up slightly"),
+ OptionArg("-f", "--commit-file", metavar="FILE",
+ default="svnmerge-commit-message.txt",
+ help="set the name of the file where the suggested log message "
+ "is written to"),
+ Option("-M", "--record-only",
+ value=True,
+ default=False,
+ help="do not perform an actual merge of the changes, yet record "
+ "that a merge happened"),
+ OptionArg("-r", "--revision",
+ metavar="REVLIST",
+ default="",
+ help="specify a revision list, consisting of revision numbers "
+ 'and ranges separated by commas, e.g., "534,537-539,540"'),
+ OptionArg("-S", "--source", "--head",
+ default=None,
+ help="specify a merge source for this branch. It can be either "
+ "a working directory path, a full URL, or an unambiguous "
+ "substring of one of the locations for which merge tracking was "
+ "already initialized. Needed only to disambiguate in case of "
+ "multiple merge sources"),
+]
+
+command_table = {
+ "init": (action_init,
+ "init [OPTION...] [SOURCE]",
+ """Initialize merge tracking from SOURCE on the current working
+ directory.
+
+ If SOURCE is specified, all the revisions in SOURCE are marked as already
+ merged; if this is not correct, you can use --revision to specify the
+ exact list of already-merged revisions.
+
+ If SOURCE is omitted, then it is computed from the "svn cp" history of the
+ current working directory (searching back for the branch point); in this
+ case, %s assumes that no revision has been integrated yet since
+ the branch point (unless you teach it with --revision).""" % NAME,
+ [
+ "-f", "-r", # import common opts
+ OptionArg("-L", "--location-type",
+ dest="location-type",
+ default="path",
+ help="Use this type of location identifier in the new " +
+ "Subversion properties; 'uuid', 'url', or 'path' " +
+ "(default)"),
+ ]),
+
+ "avail": (action_avail,
+ "avail [OPTION...] [PATH]",
+ """Show unmerged revisions available for PATH as a revision list.
+ If --revision is given, the revisions shown will be limited to those
+ also specified in the option.
+
+ When svnmerge is used to bidirectionally merge changes between a
+ branch and its source, it is necessary to not merge the same changes
+ forth and back: e.g., if you committed a merge of a certain
+ revision of the branch into the source, you do not want that commit
+ to appear as available to merged into the branch (as the code
+ originated in the branch itself!). svnmerge will automatically
+ exclude these so-called "reflected" revisions.""",
+ [
+ Option("-A", "--all",
+ dest="avail-showwhat",
+ value=["blocked", "avail"],
+ default=["avail"],
+ help="show both available and blocked revisions (aka ignore "
+ "blocked revisions)"),
+ "-b",
+ Option("-B", "--blocked",
+ dest="avail-showwhat",
+ value=["blocked"],
+ help="show the blocked revision list (see '%s block')" % NAME),
+ Option("-d", "--diff",
+ dest="avail-display",
+ value="diffs",
+ default="revisions",
+ help="show corresponding diff instead of revision list"),
+ Option("--summarize",
+ dest="avail-display",
+ value="summarize",
+ help="show summarized diff instead of revision list"),
+ Option("-l", "--log",
+ dest="avail-display",
+ value="logs",
+ help="show corresponding log history instead of revision list"),
+ "-r",
+ "-S",
+ ]),
+
+ "integrated": (action_integrated,
+ "integrated [OPTION...] [PATH]",
+ """Show merged revisions available for PATH as a revision list.
+ If --revision is given, the revisions shown will be limited to
+ those also specified in the option.""",
+ [
+ Option("-d", "--diff",
+ dest="integrated-display",
+ value="diffs",
+ default="revisions",
+ help="show corresponding diff instead of revision list"),
+ Option("-l", "--log",
+ dest="integrated-display",
+ value="logs",
+ help="show corresponding log history instead of revision list"),
+ "-r",
+ "-S",
+ ]),
+
+ "rollback": (action_rollback,
+ "rollback [OPTION...] [PATH]",
+ """Rollback previously merged in revisions from PATH. The
+ --revision option is mandatory, and specifies which revisions
+ will be rolled back. Only the previously integrated merges
+ will be rolled back.
+
+ When manually rolling back changes, --record-only can be used to
+ instruct %s that a manual rollback of a certain revision
+ already happened, so that it can record it and offer that
+ revision for merge henceforth.""" % (NAME),
+ [
+ "-f", "-r", "-S", "-M", # import common opts
+ ]),
+
+ "merge": (action_merge,
+ "merge [OPTION...] [PATH]",
+ """Merge in revisions into PATH from its source. If --revision is omitted,
+ all the available revisions will be merged. In any case, already merged-in
+ revisions will NOT be merged again.
+
+ When svnmerge is used to bidirectionally merge changes between a
+ branch and its source, it is necessary to not merge the same changes
+ forth and back: e.g., if you committed a merge of a certain
+ revision of the branch into the source, you do not want that commit
+ to appear as available to merged into the branch (as the code
+ originated in the branch itself!). svnmerge will automatically
+ exclude these so-called "reflected" revisions.
+
+ When manually merging changes across branches, --record-only can
+ be used to instruct %s that a manual merge of a certain revision
+ already happened, so that it can record it and not offer that
+ revision for merge anymore. Conversely, when there are revisions
+ which should not be merged, use '%s block'.""" % (NAME, NAME),
+ [
+ "-b", "-f", "-r", "-S", "-M", # import common opts
+ ]),
+
+ "block": (action_block,
+ "block [OPTION...] [PATH]",
+ """Block revisions within PATH so that they disappear from the available
+ list. This is useful to hide revisions which will not be integrated.
+ If --revision is omitted, it defaults to all the available revisions.
+
+ Do not use this option to hide revisions that were manually merged
+ into the branch. Instead, use '%s merge --record-only', which
+ records that a merge happened (as opposed to a merge which should
+ not happen).""" % NAME,
+ [
+ "-f", "-r", "-S", # import common opts
+ ]),
+
+ "unblock": (action_unblock,
+ "unblock [OPTION...] [PATH]",
+ """Revert the effect of '%s block'. If --revision is omitted, all the
+ blocked revisions are unblocked""" % NAME,
+ [
+ "-f", "-r", "-S", # import common opts
+ ]),
+
+ "uninit": (action_uninit,
+ "uninit [OPTION...] [PATH]",
+ """Remove merge tracking information from PATH. It cleans any kind of merge
+ tracking information (including the list of blocked revisions). If there
+ are multiple sources, use --source to indicate which source you want to
+ forget about.""",
+ [
+ "-f", "-S", # import common opts
+ ]),
+}
+
+
+def main(args):
+ global opts
+
+ # Initialize default options
+ opts = default_opts.copy()
+ logs.clear()
+
+ optsparser = CommandOpts(global_opts, common_opts, command_table,
+ version="%%prog r%s\n modified: %s\n\n"
+ "Copyright (C) 2004,2005 Awarix Inc.\n"
+ "Copyright (C) 2005, Giovanni Bajo"
+ % (__revision__, __date__))
+
+ cmd, args, state = optsparser.parse(args)
+ opts.update(state)
+
+ source = opts.get("source", None)
+ branch_dir = "."
+
+ if str(cmd) == "init":
+ if len(args) == 1:
+ source = args[0]
+ elif len(args) > 1:
+ optsparser.error("wrong number of parameters", cmd)
+ elif str(cmd) in command_table.keys():
+ if len(args) == 1:
+ branch_dir = args[0]
+ elif len(args) > 1:
+ optsparser.error("wrong number of parameters", cmd)
+ else:
+ assert False, "command not handled: %s" % cmd
+
+ # Validate branch_dir
+ if not is_wc(branch_dir):
+ if str(cmd) == "avail":
+ info = None
+ # it should be noted here that svn info does not error exit
+ # if an invalid target is specified to it (as is
+ # intuitive). so the try, except code is not absolutely
+ # necessary. but, I retain it to indicate the intuitive
+ # handling.
+ try:
+ info = get_svninfo(branch_dir)
+ except LaunchError:
+ pass
+ # test that we definitely targeted a subversion directory,
+ # mirroring the purpose of the earlier is_wc() call
+ if info is None or not info.has_key("Node Kind") or info["Node Kind"] != "directory":
+ error('"%s" is neither a valid URL, nor a working directory' % branch_dir)
+ else:
+ error('"%s" is not a subversion working directory' % branch_dir)
+
+ # give out some hints as to potential pathids
+ PathIdentifier.hint(branch_dir)
+ if source: PathIdentifier.hint(source)
+
+ # Extract the integration info for the branch_dir
+ branch_props = get_merge_props(branch_dir)
+
+ # Calculate source_url and source_path
+ report("calculate source path for the branch")
+ if not source:
+ if str(cmd) == "init":
+ cf_source, cf_rev, copy_committed_in_rev = get_copyfrom(branch_dir)
+ if not cf_source:
+ error('no copyfrom info available. '
+ 'Explicit source argument (-S/--source) required.')
+ opts["source-url"] = get_repo_root(branch_dir) + cf_source
+ opts["source-pathid"] = PathIdentifier.from_target(opts["source-url"])
+
+ if not opts["revision"]:
+ opts["revision"] = "1-" + cf_rev
+ else:
+ opts["source-pathid"] = get_default_source(branch_dir, branch_props)
+ opts["source-url"] = opts["source-pathid"].get_url()
+
+ assert is_pathid(opts["source-pathid"])
+ assert is_url(opts["source-url"])
+ else:
+ # The source was given as a command line argument and is stored in
+ # SOURCE. Ensure that the specified source does not end in a /,
+ # otherwise it's easy to have the same source path listed more
+ # than once in the integrated version properties, with and without
+ # trailing /'s.
+ source = rstrip(source, "/")
+ if not is_wc(source) and not is_url(source):
+ # Check if it is a substring of a pathid recorded
+ # within the branch properties.
+ found = []
+ for pathid in branch_props.keys():
+ if pathid.match_substring(source):
+ found.append(pathid)
+ if len(found) == 1:
+ # (assumes pathid is a repository-relative-path)
+ source_pathid = found[0]
+ source = source_pathid.get_url()
+ else:
+ error('"%s" is neither a valid URL, nor an unambiguous '
+ 'substring of a repository path, nor a working directory'
+ % source)
+ else:
+ source_pathid = PathIdentifier.from_target(source)
+
+ source_pathid = PathIdentifier.from_target(source)
+ if str(cmd) == "init" and \
+ source_pathid == PathIdentifier.from_target("."):
+ error("cannot init integration source path '%s'\n"
+ "Its repository-relative path must differ from the "
+ "repository-relative path of the current directory."
+ % source_pathid)
+ opts["source-pathid"] = source_pathid
+ opts["source-url"] = target_to_url(source)
+
+ # Sanity check source_url
+ assert is_url(opts["source-url"])
+ # SVN does not support non-normalized URL (and we should not
+ # have created them)
+ assert opts["source-url"].find("/..") < 0
+
+ report('source is "%s"' % opts["source-url"])
+
+ # Get previously merged revisions (except when command is init)
+ if str(cmd) != "init":
+ opts["merged-revs"] = merge_props_to_revision_set(branch_props,
+ opts["source-pathid"])
+
+ # Perform the action
+ cmd(branch_dir, branch_props)
+
+
+if __name__ == "__main__":
+ try:
+ main(sys.argv[1:])
+ except LaunchError, (ret, cmd, out):
+ err_msg = "command execution failed (exit code: %d)\n" % ret
+ err_msg += cmd + "\n"
+ err_msg += "".join(out)
+ error(err_msg)
+ except KeyboardInterrupt:
+ # Avoid traceback on CTRL+C
+ print "aborted by user"
+ sys.exit(1)
diff --git a/testing/subversion/svnserve b/testing/subversion/svnserve
new file mode 100755
index 000000000..670fee742
--- /dev/null
+++ b/testing/subversion/svnserve
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/svnserve
+
+PID=`pidof -o %PPID /usr/bin/svnserve`
+case "$1" in
+ start)
+ stat_busy "Starting svnserve"
+ if [ -z "$PID" ]; then
+ if [ -n "$SVNSERVE_USER" ]; then
+ su -s '/bin/sh' $SVNSERVE_USER -c "/usr/bin/svnserve -d $SVNSERVE_ARGS" &
+ else
+ /usr/bin/svnserve -d $SVNSERVE_ARGS &
+ fi
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon svnserve
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping svnserve"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon svnserve
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/testing/subversion/svnserve.conf b/testing/subversion/svnserve.conf
new file mode 100644
index 000000000..37fb7ea10
--- /dev/null
+++ b/testing/subversion/svnserve.conf
@@ -0,0 +1,7 @@
+#
+# Parameters to be passed to svnserve
+#
+#SVNSERVE_ARGS="-r /path/to/some/repos"
+SVNSERVE_ARGS=""
+
+#SVNSERVE_USER="svn"
diff --git a/testing/syslog-ng/PKGBUILD b/testing/syslog-ng/PKGBUILD
new file mode 100644
index 000000000..3a25d87e4
--- /dev/null
+++ b/testing/syslog-ng/PKGBUILD
@@ -0,0 +1,52 @@
+# $Id: PKGBUILD 123085 2011-05-08 03:28:44Z eric $
+# Maintainer: Eric BĂ©langer <eric@archlinux.org>
+# Maintainer: Aaron Griffin <aaron@archlinux.org>
+
+pkgname=syslog-ng
+pkgver=3.2.4
+pkgrel=1
+pkgdesc="Next-generation syslogd with advanced networking and filtering capabilities"
+arch=('i686' 'x86_64')
+license=('GPL2')
+groups=('base')
+url="http://www.balabit.com/network-security/syslog-ng/"
+depends=('glib2' 'eventlog' 'tcp_wrappers' 'openssl' 'libcap' 'awk')
+makedepends=('flex' 'pkg-config')
+optdepends=('logrotate: for rotating log files')
+provides=('logger')
+options=('!libtool')
+backup=('etc/syslog-ng/modules.conf' 'etc/syslog-ng/scl.conf' \
+ 'etc/syslog-ng/syslog-ng.conf' 'etc/logrotate.d/syslog-ng')
+source=(http://www.balabit.com/downloads/files/syslog-ng/sources/${pkgver}/source/${pkgname}_${pkgver}.tar.gz \
+ syslog-ng.conf syslog-ng.logrotate syslog-ng.rc cap_syslog.patch)
+md5sums=('5995f7dad0053a478b60a63f6f754203'
+ '344dddfff946300f5576b13a7e8ea19f'
+ '735636090be4582885974542d2a75855'
+ '8b4441343d859c2f01c2cf799a7e6f98'
+ '46e5dcff71f820d497898331a3f608fe')
+sha1sums=('ff732f7223bd2bd0424d4b9028b523cf62133af1'
+ 'b9eb8c61f7cccda543fc5c97fe1d40a8d15e713f'
+ 'ac997b25d7d8e69e66782d3771a0e12aff55ae7f'
+ '4481819762fd1b6f25903016a8878e63c0058fcb'
+ 'f093a09626a528d23f0f2aeece018cab15a735a9')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+# fix #22555 for kernels >=2.6.38
+ patch -p1 -i ../cap_syslog.patch
+ ./configure --prefix=/usr --sysconfdir=/etc/syslog-ng \
+ --libexecdir=/usr/lib --localstatedir=/var/lib/syslog-ng \
+ --enable-tcp-wrapper \
+ --with-pidfile-dir=/var/run \
+ --disable-spoof-source
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -dm755 "${pkgdir}/var/lib/syslog-ng" "${pkgdir}/etc/syslog-ng/patterndb.d"
+ install -Dm644 "${srcdir}/syslog-ng.conf" "${pkgdir}/etc/syslog-ng/syslog-ng.conf"
+ install -Dm644 "${srcdir}/syslog-ng.logrotate" "${pkgdir}/etc/logrotate.d/syslog-ng"
+ install -Dm755 "${srcdir}/syslog-ng.rc" "${pkgdir}/etc/rc.d/syslog-ng"
+}
diff --git a/testing/syslog-ng/cap_syslog.patch b/testing/syslog-ng/cap_syslog.patch
new file mode 100644
index 000000000..b6e6db6e4
--- /dev/null
+++ b/testing/syslog-ng/cap_syslog.patch
@@ -0,0 +1,101 @@
+diff --git a/lib/gprocess.h b/lib/gprocess.h
+index cda35b0..5c449f7 100644
+--- a/lib/gprocess.h
++++ b/lib/gprocess.h
+@@ -28,9 +28,14 @@
+ #include "syslog-ng.h"
+
+ #include <sys/types.h>
++#include <sys/utsname.h>
+
+ #if ENABLE_LINUX_CAPS
+ # include <sys/capability.h>
++#
++# ifndef CAP_SYSLOG
++# define CAP_SYSLOG 34
++# endif
+ #endif
+
+ typedef enum
+@@ -78,5 +83,8 @@ void g_process_finish(void);
+
+ void g_process_add_option_group(GOptionContext *ctx);
+
++extern int kernel_version;
++extern void get_kernel_version(void);
++#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
+
+ #endif
+diff --git a/modules/affile/affile.c b/modules/affile/affile.c
+index e145324..886fa72 100644
+--- a/modules/affile/affile.c
++++ b/modules/affile/affile.c
+@@ -59,7 +59,12 @@ affile_open_file(gchar *name, gint flags,
+ if (privileged)
+ {
+ g_process_cap_modify(CAP_DAC_READ_SEARCH, TRUE);
+- g_process_cap_modify(CAP_SYS_ADMIN, TRUE);
++ if (!kernel_version)
++ get_kernel_version();
++ if (kernel_version < LINUX_VERSION(2, 6, 38))
++ g_process_cap_modify(CAP_SYS_ADMIN, TRUE);
++ else
++ g_process_cap_modify(CAP_SYSLOG, TRUE);
+ }
+ else
+ {
+diff --git a/syslog-ng/main.c b/syslog-ng/main.c
+index 9880c1f..ee5031b 100644
+--- a/syslog-ng/main.c
++++ b/syslog-ng/main.c
+@@ -67,6 +67,7 @@ static gboolean syntax_only = FALSE;
+ static gboolean display_version = FALSE;
+ static gchar *ctlfilename = PATH_CONTROL_SOCKET;
+ static gchar *preprocess_into = NULL;
++int kernel_version;
+
+ static volatile sig_atomic_t sig_hup_received = FALSE;
+ static volatile sig_atomic_t sig_term_received = FALSE;
+@@ -363,6 +364,20 @@ version(void)
+ ON_OFF_STR(ENABLE_PACCT_MODULE));
+ }
+
++void
++get_kernel_version(void) {
++ static struct utsname uts;
++ int x = 0, y = 0, z = 0;
++
++ if (uname(&uts) == -1) {
++ fprintf(stderr, "Unable to retrieve kernel version.\n");
++ exit(1);
++ }
++
++ sscanf(uts.release, "%d.%d.%d", &x, &y, &z);
++ kernel_version = LINUX_VERSION(x, y, z);
++}
++
+ int
+ main(int argc, char *argv[])
+ {
+@@ -379,9 +394,20 @@ main(int argc, char *argv[])
+ * indicate readability. Enabling/disabling cap_sys_admin on every poll
+ * invocation seems to be too expensive. So I enable it for now. */
+
+- g_process_set_caps("cap_net_bind_service,cap_net_broadcast,cap_net_raw,"
++ if (!kernel_version)
++ get_kernel_version();
++ if (kernel_version < LINUX_VERSION(2, 6, 34))
++ g_process_set_caps("cap_net_bind_service,cap_net_broadcast,cap_net_raw,"
+ "cap_dac_read_search,cap_dac_override,cap_chown,cap_fowner=p "
+ "cap_sys_admin=ep");
++ else if (kernel_version < LINUX_VERSION(2, 6, 38))
++ g_process_set_caps("cap_net_bind_service,cap_net_broadcast,cap_net_raw,"
++ "cap_dac_read_search,cap_dac_override,cap_chown,cap_fowner,"
++ "cap_sys_admin=p");
++ else
++ g_process_set_caps("cap_net_bind_service,cap_net_broadcast,cap_net_raw,"
++ "cap_dac_read_search,cap_dac_override,cap_chown,cap_fowner,"
++ "cap_syslog=p");
+ ctx = g_option_context_new("syslog-ng");
+ g_process_add_option_group(ctx);
+ msg_add_option_group(ctx);
diff --git a/testing/syslog-ng/syslog-ng.conf b/testing/syslog-ng/syslog-ng.conf
new file mode 100644
index 000000000..6e3362681
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.conf
@@ -0,0 +1,92 @@
+@version: 3.2
+#
+# /etc/syslog-ng/syslog-ng.conf
+#
+
+options {
+ stats_freq (0);
+ flush_lines (0);
+ time_reopen (10);
+ log_fifo_size (1000);
+ long_hostnames(off);
+ use_dns (no);
+ use_fqdn (no);
+ create_dirs (no);
+ keep_hostname (yes);
+ perm(0640);
+ group("log");
+};
+
+source src {
+ unix-dgram("/dev/log");
+ internal();
+ file("/proc/kmsg");
+};
+
+destination d_authlog { file("/var/log/auth.log"); };
+destination d_syslog { file("/var/log/syslog.log"); };
+destination d_cron { file("/var/log/crond.log"); };
+destination d_daemon { file("/var/log/daemon.log"); };
+destination d_kernel { file("/var/log/kernel.log"); };
+destination d_lpr { file("/var/log/lpr.log"); };
+destination d_user { file("/var/log/user.log"); };
+destination d_uucp { file("/var/log/uucp.log"); };
+destination d_mail { file("/var/log/mail.log"); };
+destination d_news { file("/var/log/news.log"); };
+destination d_ppp { file("/var/log/ppp.log"); };
+destination d_debug { file("/var/log/debug.log"); };
+destination d_messages { file("/var/log/messages.log"); };
+destination d_errors { file("/var/log/errors.log"); };
+destination d_everything { file("/var/log/everything.log"); };
+destination d_iptables { file("/var/log/iptables.log"); };
+destination d_acpid { file("/var/log/acpid.log"); };
+destination d_console { usertty("root"); };
+
+# Log everything to tty12
+destination console_all { file("/dev/tty12"); };
+
+filter f_auth { facility(auth); };
+filter f_authpriv { facility(auth, authpriv); };
+filter f_syslog { program(syslog-ng); };
+filter f_cron { facility(cron); };
+filter f_daemon { facility(daemon); };
+filter f_kernel { facility(kern) and not filter(f_iptables); };
+filter f_lpr { facility(lpr); };
+filter f_mail { facility(mail); };
+filter f_news { facility(news); };
+filter f_user { facility(user); };
+filter f_uucp { facility(uucp); };
+filter f_ppp { facility(local2); };
+filter f_debug { not facility(auth, authpriv, news, mail); };
+filter f_messages { level(info..warn) and not facility(auth, authpriv, mail, news, cron) and not program(syslog-ng) and not filter(f_iptables); };
+filter f_everything { level(debug..emerg) and not facility(auth, authpriv); };
+filter f_emergency { level(emerg); };
+filter f_info { level(info); };
+filter f_notice { level(notice); };
+filter f_warn { level(warn); };
+filter f_crit { level(crit); };
+filter f_err { level(err); };
+filter f_iptables { match("IN=" value("MESSAGE")) and match("OUT=" value("MESSAGE")); };
+filter f_acpid { program("acpid"); };
+
+log { source(src); filter(f_acpid); destination(d_acpid); };
+log { source(src); filter(f_authpriv); destination(d_authlog); };
+log { source(src); filter(f_syslog); destination(d_syslog); };
+log { source(src); filter(f_cron); destination(d_cron); };
+log { source(src); filter(f_daemon); destination(d_daemon); };
+log { source(src); filter(f_kernel); destination(d_kernel); };
+log { source(src); filter(f_lpr); destination(d_lpr); };
+log { source(src); filter(f_mail); destination(d_mail); };
+log { source(src); filter(f_news); destination(d_news); };
+log { source(src); filter(f_ppp); destination(d_ppp); };
+log { source(src); filter(f_user); destination(d_user); };
+log { source(src); filter(f_uucp); destination(d_uucp); };
+#log { source(src); filter(f_debug); destination(d_debug); };
+log { source(src); filter(f_messages); destination(d_messages); };
+log { source(src); filter(f_err); destination(d_errors); };
+log { source(src); filter(f_emergency); destination(d_console); };
+log { source(src); filter(f_everything); destination(d_everything); };
+log { source(src); filter(f_iptables); destination(d_iptables); };
+
+# Log everything to tty12
+#log { source(src); destination(console_all); };
diff --git a/testing/syslog-ng/syslog-ng.logrotate b/testing/syslog-ng/syslog-ng.logrotate
new file mode 100644
index 000000000..e0e6929f2
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.logrotate
@@ -0,0 +1,7 @@
+/var/log/messages.log /var/log/auth.log /var/log/mail.log /var/log/kernel.log /var/log/errors.log /var/log/daemon.log /var/log/user.log /var/log/iptables.log /var/log/everything.log /var/log/syslog.log /var/log/acpid.log /var/log/crond.log /var/log/lpr.log /var/log/uucp.log /var/log/news.log /var/log/ppp.log /var/log/debug.log {
+ missingok
+ sharedscripts
+ postrotate
+ /bin/kill -HUP `cat /var/run/syslog-ng.pid 2>/dev/null` 2> /dev/null || true
+ endscript
+}
diff --git a/testing/syslog-ng/syslog-ng.rc b/testing/syslog-ng/syslog-ng.rc
new file mode 100755
index 000000000..bb5320b2c
--- /dev/null
+++ b/testing/syslog-ng/syslog-ng.rc
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+checkconfig() {
+ syslog-ng -s -f /etc/syslog-ng/syslog-ng.conf
+ if [ $? -gt 0 ]; then
+ stat_busy "Configuration error. Please fix your config file (/etc/syslog-ng/syslog-ng.conf)."
+ stat_fail
+ exit 0
+ fi
+}
+
+PID=`pidof -o %PPID /usr/sbin/syslog-ng`
+case "$1" in
+ start)
+ stat_busy "Starting Syslog-NG"
+ checkconfig
+ [ -z "$PID" ] && /usr/sbin/syslog-ng
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon syslog-ng
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Syslog-NG"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/syslog-ng.pid
+# Removing stale syslog-ng.persist file. Its new location, as of 2.0.6-1, is /var/lib/syslog-ng/
+ rm -f /var/syslog-ng.persist
+ rm_daemon syslog-ng
+ stat_done
+ fi
+ ;;
+ reload)
+ stat_busy "Reloading Syslog-NG configuration and re-opening log files"
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ checkconfig
+ kill -HUP $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|reload}"
+esac
+exit 0
diff --git a/testing/wget/PKGBUILD b/testing/wget/PKGBUILD
new file mode 100644
index 000000000..6712f4491
--- /dev/null
+++ b/testing/wget/PKGBUILD
@@ -0,0 +1,55 @@
+# $Id: PKGBUILD 122950 2011-05-07 12:59:07Z allan $
+# Maintainer: Allan McRae <allan@archlinux.org>
+# Contributor: Judd Vinet <jvinet@zeroflux.org>
+
+pkgname=wget
+pkgver=1.12
+pkgrel=7
+pkgdesc="A network utility to retrieve files from the Web"
+arch=('i686' 'x86_64')
+url="http://www.gnu.org/software/wget/wget.html"
+license=('GPL3')
+groups=('base')
+depends=('glibc' 'openssl')
+optdepends=('ca-certificates: HTTPS downloads')
+backup=('etc/wgetrc')
+install=wget.install
+source=(ftp://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz
+ wget-1.12-CVE-2010-2252.patch
+ wget-1.12-subjectAltName.patch)
+md5sums=('141461b9c04e454dc8933c9d1f2abf83'
+ '2c8bc23eff98fd4efc3f96394fc8e61e'
+ 'bd589403b7bb4967a6f41b0f43b1c8aa')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ # Fix arbitrary file overwrite via 3xx redirect (CVE-2010-2252)
+ patch -Np1 -i $srcdir/wget-1.12-CVE-2010-2252.patch
+
+ # https://savannah.gnu.org/bugs/index.php?20421
+ patch -Np0 -i $srcdir/wget-1.12-subjectAltName.patch
+
+ # Note : We do not build with --enable-nls, because there is a bug in wget causing
+ # international domain names to be not properly converted to punycode if
+ # the current locale is a UTF-8 one
+ # See : http://lists.gnu.org/archive/html/bug-wget/2011-02/msg00026.html
+
+ ./configure -with-ssl --prefix=/usr --sysconfdir=/etc
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ cat >> "$pkgdir/etc/wgetrc" <<EOF
+
+# default root certs location
+ca_certificate=/etc/ssl/certs/ca-certificates.crt
+EOF
+
+ # remove IRI option from wgetrc as it does not work (see above)
+ sed -i '118,120d' $pkgdir/etc/wgetrc
+
+}
diff --git a/testing/wget/wget-1.12-CVE-2010-2252.patch b/testing/wget/wget-1.12-CVE-2010-2252.patch
new file mode 100644
index 000000000..d1d797a2c
--- /dev/null
+++ b/testing/wget/wget-1.12-CVE-2010-2252.patch
@@ -0,0 +1,155 @@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' wget~/doc/wget.texi wget/doc/wget.texi
+--- wget~/doc/wget.texi 2010-09-05 15:32:44.000000000 +0200
++++ wget/doc/wget.texi 2010-09-05 15:32:44.000000000 +0200
+@@ -1487,6 +1487,13 @@
+ @code{Content-Disposition} headers to describe what the name of a
+ downloaded file should be.
+
++@cindex Trust server names
++@item --trust-server-names
++
++If this is set to on, on a redirect the last component of the
++redirection URL will be used as the local file name. By default it is
++used the last component in the original URL.
++
+ @cindex authentication
+ @item --auth-no-challenge
+
+@@ -2797,6 +2804,10 @@
+ Turn on recognition of the (non-standard) @samp{Content-Disposition}
+ HTTP header---if set to @samp{on}, the same as @samp{--content-disposition}.
+
++@item trust_server_names = on/off
++If set to on, use the last component of a redirection URL for the local
++file name.
++
+ @item continue = on/off
+ If set to on, force continuation of preexistent partially retrieved
+ files. See @samp{-c} before setting it.
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' wget~/src/http.c wget/src/http.c
+--- wget~/src/http.c 2010-09-05 15:30:22.000000000 +0200
++++ wget/src/http.c 2010-09-05 15:32:44.000000000 +0200
+@@ -2410,8 +2410,9 @@
+ /* The genuine HTTP loop! This is the part where the retrieval is
+ retried, and retried, and retried, and... */
+ uerr_t
+-http_loop (struct url *u, char **newloc, char **local_file, const char *referer,
+- int *dt, struct url *proxy, struct iri *iri)
++http_loop (struct url *u, struct url *original_url, char **newloc,
++ char **local_file, const char *referer, int *dt, struct url *proxy,
++ struct iri *iri)
+ {
+ int count;
+ bool got_head = false; /* used for time-stamping and filename detection */
+@@ -2457,7 +2458,8 @@
+ }
+ else if (!opt.content_disposition)
+ {
+- hstat.local_file = url_file_name (u);
++ hstat.local_file =
++ url_file_name (opt.trustservernames ? u : original_url);
+ got_name = true;
+ }
+
+@@ -2497,7 +2499,7 @@
+
+ /* Send preliminary HEAD request if -N is given and we have an existing
+ * destination file. */
+- file_name = url_file_name (u);
++ file_name = url_file_name (opt.trustservernames ? u : original_url);
+ if (opt.timestamping
+ && !opt.content_disposition
+ && file_exists_p (file_name))
+@@ -2852,9 +2854,9 @@
+
+ /* Remember that we downloaded the file for later ".orig" code. */
+ if (*dt & ADDED_HTML_EXTENSION)
+- downloaded_file(FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED, hstat.local_file);
++ downloaded_file (FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED, hstat.local_file);
+ else
+- downloaded_file(FILE_DOWNLOADED_NORMALLY, hstat.local_file);
++ downloaded_file (FILE_DOWNLOADED_NORMALLY, hstat.local_file);
+
+ ret = RETROK;
+ goto exit;
+@@ -2885,9 +2887,9 @@
+
+ /* Remember that we downloaded the file for later ".orig" code. */
+ if (*dt & ADDED_HTML_EXTENSION)
+- downloaded_file(FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED, hstat.local_file);
++ downloaded_file (FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED, hstat.local_file);
+ else
+- downloaded_file(FILE_DOWNLOADED_NORMALLY, hstat.local_file);
++ downloaded_file (FILE_DOWNLOADED_NORMALLY, hstat.local_file);
+
+ ret = RETROK;
+ goto exit;
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' wget~/src/http.h wget/src/http.h
+--- wget~/src/http.h 2010-09-05 15:30:22.000000000 +0200
++++ wget/src/http.h 2010-09-05 15:32:44.000000000 +0200
+@@ -33,8 +33,8 @@
+
+ struct url;
+
+-uerr_t http_loop (struct url *, char **, char **, const char *, int *,
+- struct url *, struct iri *);
++uerr_t http_loop (struct url *, struct url *, char **, char **, const char *,
++ int *, struct url *, struct iri *);
+ void save_cookies (void);
+ void http_cleanup (void);
+ time_t http_atotm (const char *);
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' wget~/src/init.c wget/src/init.c
+--- wget~/src/init.c 2010-09-05 15:30:22.000000000 +0200
++++ wget/src/init.c 2010-09-05 15:32:44.000000000 +0200
+@@ -243,6 +243,7 @@
+ { "timeout", NULL, cmd_spec_timeout },
+ { "timestamping", &opt.timestamping, cmd_boolean },
+ { "tries", &opt.ntry, cmd_number_inf },
++ { "trustservernames", &opt.trustservernames, cmd_boolean },
+ { "useproxy", &opt.use_proxy, cmd_boolean },
+ { "user", &opt.user, cmd_string },
+ { "useragent", NULL, cmd_spec_useragent },
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' wget~/src/main.c wget/src/main.c
+--- wget~/src/main.c 2010-09-05 15:30:22.000000000 +0200
++++ wget/src/main.c 2010-09-05 15:32:44.000000000 +0200
+@@ -266,6 +266,7 @@
+ { "timeout", 'T', OPT_VALUE, "timeout", -1 },
+ { "timestamping", 'N', OPT_BOOLEAN, "timestamping", -1 },
+ { "tries", 't', OPT_VALUE, "tries", -1 },
++ { "trust-server-names", 0, OPT_BOOLEAN, "trustservernames", -1 },
+ { "user", 0, OPT_VALUE, "user", -1 },
+ { "user-agent", 'U', OPT_VALUE, "useragent", -1 },
+ { "verbose", 'v', OPT_BOOLEAN, "verbose", -1 },
+@@ -675,6 +676,8 @@
+ N_("\
+ -I, --include-directories=LIST list of allowed directories.\n"),
+ N_("\
++ --trust-server-names use the name specified by the redirection url last component.\n"),
++ N_("\
+ -X, --exclude-directories=LIST list of excluded directories.\n"),
+ N_("\
+ -np, --no-parent don't ascend to the parent directory.\n"),
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' wget~/src/options.h wget/src/options.h
+--- wget~/src/options.h 2010-09-05 15:30:22.000000000 +0200
++++ wget/src/options.h 2010-09-05 15:32:44.000000000 +0200
+@@ -242,6 +242,7 @@
+ char *encoding_remote;
+ char *locale;
+
++ bool trustservernames;
+ #ifdef __VMS
+ int ftp_stmlf; /* Force Stream_LF format for binary FTP. */
+ #endif /* def __VMS */
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' wget~/src/retr.c wget/src/retr.c
+--- wget~/src/retr.c 2010-09-05 15:30:22.000000000 +0200
++++ wget/src/retr.c 2010-09-05 15:32:44.000000000 +0200
+@@ -689,7 +689,8 @@
+ #endif
+ || (proxy_url && proxy_url->scheme == SCHEME_HTTP))
+ {
+- result = http_loop (u, &mynewloc, &local_file, refurl, dt, proxy_url, iri);
++ result = http_loop (u, orig_parsed, &mynewloc, &local_file, refurl, dt,
++ proxy_url, iri);
+ }
+ else if (u->scheme == SCHEME_FTP)
+ {
diff --git a/testing/wget/wget-1.12-subjectAltName.patch b/testing/wget/wget-1.12-subjectAltName.patch
new file mode 100644
index 000000000..20f08d216
--- /dev/null
+++ b/testing/wget/wget-1.12-subjectAltName.patch
@@ -0,0 +1,216 @@
+=== modified file 'src/openssl.c'
+--- src/openssl.c 2009-09-22 16:16:43 +0000
++++ src/openssl.c 2009-10-24 23:06:44 +0000
+@@ -39,7 +39,7 @@
+ #include <string.h>
+
+ #include <openssl/ssl.h>
+-#include <openssl/x509.h>
++#include <openssl/x509v3.h>
+ #include <openssl/err.h>
+ #include <openssl/rand.h>
+
+@@ -486,9 +486,11 @@
+ ssl_check_certificate (int fd, const char *host)
+ {
+ X509 *cert;
++ GENERAL_NAMES *subjectAltNames;
+ char common_name[256];
+ long vresult;
+ bool success = true;
++ bool alt_name_checked = false;
+
+ /* If the user has specified --no-check-cert, we still want to warn
+ him about problems with the server's certificate. */
+@@ -536,7 +538,8 @@
+ break;
+ case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
+ case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
+- logprintf (LOG_NOTQUIET, _(" Self-signed certificate encountered.\n"));
++ logprintf (LOG_NOTQUIET,
++ _(" Self-signed certificate encountered.\n"));
+ break;
+ case X509_V_ERR_CERT_NOT_YET_VALID:
+ logprintf (LOG_NOTQUIET, _(" Issued certificate not yet valid.\n"));
+@@ -558,10 +561,6 @@
+ /* Check that HOST matches the common name in the certificate.
+ #### The following remains to be done:
+
+- - It should use dNSName/ipAddress subjectAltName extensions if
+- available; according to rfc2818: "If a subjectAltName extension
+- of type dNSName is present, that MUST be used as the identity."
+-
+ - When matching against common names, it should loop over all
+ common names and choose the most specific one, i.e. the last
+ one, not the first one, which the current code picks.
+@@ -569,50 +568,123 @@
+ - Ensure that ASN1 strings from the certificate are encoded as
+ UTF-8 which can be meaningfully compared to HOST. */
+
+- X509_NAME *xname = X509_get_subject_name(cert);
+- common_name[0] = '\0';
+- X509_NAME_get_text_by_NID (xname, NID_commonName, common_name,
+- sizeof (common_name));
++ subjectAltNames = X509_get_ext_d2i (cert, NID_subject_alt_name, NULL, NULL);
+
+- if (!pattern_match (common_name, host))
++ if (subjectAltNames)
+ {
+- logprintf (LOG_NOTQUIET, _("\
+-%s: certificate common name %s doesn't match requested host name %s.\n"),
+- severity, quote_n (0, common_name), quote_n (1, host));
+- success = false;
++ /* Test subject alternative names */
++
++ /* Do we want to check for dNSNAmes or ipAddresses (see RFC 2818)?
++ * Signal it by host_in_octet_string. */
++ ASN1_OCTET_STRING *host_in_octet_string = NULL;
++ host_in_octet_string = a2i_IPADDRESS (host);
++
++ int numaltnames = sk_GENERAL_NAME_num (subjectAltNames);
++ int i;
++ for (i=0; i < numaltnames; i++)
++ {
++ const GENERAL_NAME *name =
++ sk_GENERAL_NAME_value (subjectAltNames, i);
++ if (name)
++ {
++ if (host_in_octet_string)
++ {
++ if (name->type == GEN_IPADD)
++ {
++ /* Check for ipAddress */
++ /* TODO: Should we convert between IPv4-mapped IPv6
++ * addresses and IPv4 addresses? */
++ alt_name_checked = true;
++ if (!ASN1_STRING_cmp (host_in_octet_string,
++ name->d.iPAddress))
++ break;
++ }
++ }
++ else if (name->type == GEN_DNS)
++ {
++ /* Check for dNSName */
++ alt_name_checked = true;
++ /* dNSName should be IA5String (i.e. ASCII), however who
++ * does trust CA? Convert it into UTF-8 for sure. */
++ unsigned char *name_in_utf8 = NULL;
++ if (0 <= ASN1_STRING_to_UTF8 (&name_in_utf8, name->d.dNSName))
++ {
++ /* Compare and check for NULL attack in ASN1_STRING */
++ if (pattern_match ((char *)name_in_utf8, host) &&
++ (strlen ((char *)name_in_utf8) ==
++ ASN1_STRING_length (name->d.dNSName)))
++ {
++ OPENSSL_free (name_in_utf8);
++ break;
++ }
++ OPENSSL_free (name_in_utf8);
++ }
++ }
++ }
++ }
++ sk_GENERAL_NAME_free (subjectAltNames);
++ if (host_in_octet_string)
++ ASN1_OCTET_STRING_free(host_in_octet_string);
++
++ if (alt_name_checked == true && i >= numaltnames)
++ {
++ logprintf (LOG_NOTQUIET,
++ _("%s: no certificate subject alternative name matches\n"
++ "\trequested host name %s.\n"),
++ severity, quote_n (1, host));
++ success = false;
++ }
+ }
+- else
++
++ if (alt_name_checked == false)
+ {
+- /* We now determine the length of the ASN1 string. If it differs from
+- * common_name's length, then there is a \0 before the string terminates.
+- * This can be an instance of a null-prefix attack.
+- *
+- * https://www.blackhat.com/html/bh-usa-09/bh-usa-09-archives.html#Marlinspike
+- * */
+-
+- int i = -1, j;
+- X509_NAME_ENTRY *xentry;
+- ASN1_STRING *sdata;
+-
+- if (xname) {
+- for (;;)
+- {
+- j = X509_NAME_get_index_by_NID (xname, NID_commonName, i);
+- if (j == -1) break;
+- i = j;
++ /* Test commomName */
++ X509_NAME *xname = X509_get_subject_name(cert);
++ common_name[0] = '\0';
++ X509_NAME_get_text_by_NID (xname, NID_commonName, common_name,
++ sizeof (common_name));
++
++ if (!pattern_match (common_name, host))
++ {
++ logprintf (LOG_NOTQUIET, _("\
++ %s: certificate common name %s doesn't match requested host name %s.\n"),
++ severity, quote_n (0, common_name), quote_n (1, host));
++ success = false;
++ }
++ else
++ {
++ /* We now determine the length of the ASN1 string. If it
++ * differs from common_name's length, then there is a \0
++ * before the string terminates. This can be an instance of a
++ * null-prefix attack.
++ *
++ * https://www.blackhat.com/html/bh-usa-09/bh-usa-09-archives.html#Marlinspike
++ * */
++
++ int i = -1, j;
++ X509_NAME_ENTRY *xentry;
++ ASN1_STRING *sdata;
++
++ if (xname) {
++ for (;;)
++ {
++ j = X509_NAME_get_index_by_NID (xname, NID_commonName, i);
++ if (j == -1) break;
++ i = j;
++ }
+ }
+- }
+
+- xentry = X509_NAME_get_entry(xname,i);
+- sdata = X509_NAME_ENTRY_get_data(xentry);
+- if (strlen (common_name) != ASN1_STRING_length (sdata))
+- {
+- logprintf (LOG_NOTQUIET, _("\
+-%s: certificate common name is invalid (contains a NUL character).\n\
+-This may be an indication that the host is not who it claims to be\n\
+-(that is, it is not the real %s).\n"),
+- severity, quote (host));
+- success = false;
++ xentry = X509_NAME_get_entry(xname,i);
++ sdata = X509_NAME_ENTRY_get_data(xentry);
++ if (strlen (common_name) != ASN1_STRING_length (sdata))
++ {
++ logprintf (LOG_NOTQUIET, _("\
++ %s: certificate common name is invalid (contains a NUL character).\n\
++ This may be an indication that the host is not who it claims to be\n\
++ (that is, it is not the real %s).\n"),
++ severity, quote (host));
++ success = false;
++ }
+ }
+ }
+
+@@ -631,3 +703,7 @@
+ /* Allow --no-check-cert to disable certificate checking. */
+ return opt.check_cert ? success : true;
+ }
++
++/*
++ * vim: tabstop=2 shiftwidth=2 softtabstop=2
++ */
+
diff --git a/testing/wget/wget.install b/testing/wget/wget.install
new file mode 100644
index 000000000..171533352
--- /dev/null
+++ b/testing/wget/wget.install
@@ -0,0 +1,20 @@
+infodir=/usr/share/info
+filelist=(wget.info)
+
+post_install() {
+ [ -x usr/bin/install-info ] || return 0
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file $infodir/dir 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ [ -x usr/bin/install-info ] || return 0
+ for file in ${filelist[@]}; do
+ install-info --delete $infodir/$file $infodir/dir 2> /dev/null
+ done
+}
diff --git a/testing/wireshark/PKGBUILD b/testing/wireshark/PKGBUILD
new file mode 100644
index 000000000..a83355164
--- /dev/null
+++ b/testing/wireshark/PKGBUILD
@@ -0,0 +1,54 @@
+# $Id: PKGBUILD 121168 2011-04-29 06:39:53Z stephane $
+# Maintainer: Guillaume ALAUX <guillaume at alaux dot net>
+# Contributor: Florian Pritz <bluewind at jabber dot ccc dot de>
+pkgname=(wireshark-cli wireshark-gtk)
+pkgbase=wireshark
+pkgver=1.4.6
+pkgrel=2
+arch=('i686' 'x86_64')
+license=('GPL2')
+makedepends=('bison' 'flex' 'gtk2' 'krb5' 'libpcap' 'bash' 'gnutls' 'libcap')
+url="http://www.wireshark.org/"
+options=(!libtool)
+source=(http://www.wireshark.org/download/src/${pkgbase}-${pkgver}.tar.bz2)
+md5sums=('fd301004ebc5fac8e56c2f0d4ef6173f')
+
+build() {
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ export CFLAGS="-fno-unit-at-a-time ${CFLAGS}"
+
+ ./configure --prefix=/usr --with-ssl --with-zlib=no
+ make all
+}
+
+package_wireshark-cli() {
+ pkgdesc="A free network protocol analyzer for Unix/Linux and Windows - CLI version"
+ depends=('krb5' 'libpcap' 'bash' 'gnutls' 'libcap' 'glib2')
+ install=wireshark.install
+ conflicts=(wireshark)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ #wireshark uid group is 150
+ chgrp 150 "${pkgdir}/usr/bin/dumpcap"
+ chmod 754 "${pkgdir}/usr/bin/dumpcap"
+ rm "$pkgdir/usr/bin/wireshark"
+}
+
+package_wireshark-gtk() {
+ pkgdesc="A free network protocol analyzer for Unix/Linux and Windows - GTK frontend"
+ depends=('gtk2' 'wireshark-cli')
+ install=wireshark-gtk.install
+ replaces=(wireshark)
+ conflicts=(wireshark)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+
+ install -Dm755 .libs/wireshark "$pkgdir/usr/bin/wireshark"
+ for d in 16 32 48; do
+ install -Dm644 image/hi${d}-app-wireshark.png ${pkgdir}/usr/share/icons/hicolor/${d}x${d}/apps/wireshark.png
+ done
+ install -Dm644 wireshark.desktop ${pkgdir}/usr/share/applications/wireshark.desktop
+}
diff --git a/testing/wireshark/wireshark-gtk.install b/testing/wireshark/wireshark-gtk.install
new file mode 100644
index 000000000..6b1b64bdd
--- /dev/null
+++ b/testing/wireshark/wireshark-gtk.install
@@ -0,0 +1,11 @@
+post_install() {
+ gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
diff --git a/testing/wireshark/wireshark.install b/testing/wireshark/wireshark.install
new file mode 100644
index 000000000..6585ba272
--- /dev/null
+++ b/testing/wireshark/wireshark.install
@@ -0,0 +1,18 @@
+post_install() {
+ getent group wireshark >/dev/null 2>&1 || usr/sbin/groupadd -g 150 wireshark &>/dev/null
+
+ setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' usr/bin/dumpcap
+ echo "NOTE: To run wireshark as normal user you have to add yourself into wireshark group"
+}
+
+post_upgrade() {
+ getent group wireshark >/dev/null 2>&1 || usr/sbin/groupadd -g 150 wireshark &>/dev/null
+
+ setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' usr/bin/dumpcap
+}
+
+post_remove() {
+ if getent group wireshark >/dev/null 2>&1; then
+ groupdel wireshark
+ fi
+}
diff --git a/testing/xfprint/PKGBUILD b/testing/xfprint/PKGBUILD
new file mode 100644
index 000000000..1d622e190
--- /dev/null
+++ b/testing/xfprint/PKGBUILD
@@ -0,0 +1,35 @@
+# $Id: PKGBUILD 122851 2011-05-06 14:01:10Z stephane $
+# Maintainer: Tobias Kieslich <tobias funnychar archlinux.org>
+
+pkgname=xfprint
+pkgver=4.6.1
+pkgrel=5
+pkgdesc="A print dialog and a printer manager for Xfce"
+arch=(i686 x86_64)
+license=('GPL2')
+url="http://www.xfce.org/"
+groups=('xfce4')
+depends=("libxfcegui4>=$pkgver" "xfconf>=$pkgver" 'libcups>=1.3.10' 'a2ps' 'krb5'
+ 'gnutls>=2.6.5' 'hicolor-icon-theme')
+makedepends=('pkgconfig' 'intltool')
+options=('!libtool')
+install=${pkgname}.install
+source=(http://archive.xfce.org/xfce/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2
+ xfprint-manager-fix.diff)
+md5sums=('d92fca97a42816085080baf07a99a62e'
+ '69b3619a285e94d602a1d0ac08f4ca06')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ # fix xfprint-manager not showing cups printers
+ # see http://bugs.archlinux.org/task/19965, http://bugs.gentoo.org/278047, http://bugzilla.xfce.org/show_bug.cgi?id=6089
+ patch -Np0 -i ${srcdir}/xfprint-manager-fix.diff
+ ./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib \
+ --localstatedir=/var --disable-static
+ make
+}
+
+package() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ make DESTDIR=${pkgdir} install
+}
diff --git a/testing/xfprint/xfprint-manager-fix.diff b/testing/xfprint/xfprint-manager-fix.diff
new file mode 100644
index 000000000..1bf0725f8
--- /dev/null
+++ b/testing/xfprint/xfprint-manager-fix.diff
@@ -0,0 +1,29 @@
+--- xfprint-manager/main.c 2009-02-24 21:34:16.000000000 +0000
++++ xfprint-manager/main.c.new 2010-07-15 21:30:51.098745852 +0000
+@@ -41,6 +41,7 @@
+ #include <libxfprint/printer-list-window.h>
+
+ #define CHANNEL "xfprint"
++#define PROP_PRINTING_SYSTEM "/printing-system"
+
+ extern void mainwin_setup (void);
+
+@@ -66,15 +67,15 @@
+ channel = xfconf_channel_new (CHANNEL);
+ if (channel) {
+
+- if (xfconf_channel_has_property (channel, "/XfPrint/system")) {
+- const gchar *system_name = xfconf_channel_get_string (channel, "/XfPrint/system", "none");
++ if (xfconf_channel_has_property (channel, PROP_PRINTING_SYSTEM)) {
++ const gchar *system_name = xfconf_channel_get_string (channel, PROP_PRINTING_SYSTEM, "none");
+ if (g_ascii_strcasecmp (system_name, "none") != 0) {
+ ps = printing_system_new (system_name);
+ if (ps == NULL);
+ g_warning ("Unable to load printing system module %s", system_name);
+ }
+ } else {
+- g_warning ("%s: XfPrint/system is not set", PACKAGE);
++ g_warning ("%s: XfPrint/printing-system is not set", PACKAGE);
+ }
+ }
+
diff --git a/testing/xfprint/xfprint.install b/testing/xfprint/xfprint.install
new file mode 100644
index 000000000..21b79d2d4
--- /dev/null
+++ b/testing/xfprint/xfprint.install
@@ -0,0 +1,11 @@
+post_install() {
+ gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+}