diff options
75 files changed, 6281 insertions, 84 deletions
diff --git a/community-staging/fcron/PKGBUILD b/community-staging/fcron/PKGBUILD new file mode 100644 index 000000000..0785774f7 --- /dev/null +++ b/community-staging/fcron/PKGBUILD @@ -0,0 +1,80 @@ +# $Id: PKGBUILD 72351 2012-06-12 20:43:12Z ttopper $ +# Contributor: Giorgio Lando <lando at imap dot cc> +# Contributor: Sergej Pupykin +# Contributor: Thomas Bächler +# Maintainer: Thorsten Töpper <atsutane-tu@freethoughts.de> + +pkgname=fcron +pkgver=3.0.6 +pkgrel=7 +pkgdesc="feature-rich cron implementation" +arch=(i686 x86_64) +url="http://fcron.free.fr" +license=('GPL') +depends=('pam') +makedepends=('smtp-server') +optdepends=('smtp-server: to receive mails from cron jobs') +provides=('cron') +conflicts=('dcron') +backup=(etc/fcron/fcron.conf etc/fcron/fcron.allow etc/fcron/fcron.deny \ + var/spool/fcron/systab var/spool/fcron/systab.orig) +options=('emptydirs' '!makeflags') +source=(http://fcron.free.fr/archives/$pkgname-$pkgver.src.tar.gz fcron.rc \ + systab systab.orig run-cron fcron.service) +md5sums=('69ebcb41921e2a282f41ebecb3a27053' + 'e0c3f0bdc3c98fbbe46eff19001c18f2' + '938722c6654ef7b07f4aa10001905ba1' + 'bfb7daa22ebe22b9917e455c1ca4a382' + '5ff0cdcb9ec99778938ac6ef26800327' + 'ab589cc6813ec32b5e96bf05c2b51c4c') + +build() { + cd "$srcdir/$pkgname-$pkgver" + ./configure --prefix=/usr \ + --sysconfdir=/etc/fcron \ + --with-answer-all=no \ + --with-boot-install=no \ + --with-username=root \ + --with-groupname=root \ + --datarootdir=/usr/share \ + --datadir=/usr/share \ + --with-docdir=/usr/share/doc \ + --localstatedir=/var \ + --with-editor=/usr/bin/vi \ + --with-sendmail=/usr/sbin/sendmail + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir/" install + install -D -m755 "$srcdir/fcron.rc" "$pkgdir/etc/rc.d/fcron" + install -D -m644 "$srcdir/$pkgname-$pkgver/files/fcron.pam" "$pkgdir/etc/pam.d/fcron" + + install -D -m644 "$srcdir/$pkgname-$pkgver/files/fcrontab.pam" "$pkgdir/etc/pam.d/fcrontab" + # Install default fcrontab so that fcron can completely replace dcron + + install -D -m600 "$srcdir/systab" "$pkgdir/var/spool/fcron/systab" + # In order to preserve the systab crontab in any case it is better to have + # it in non-binary form too + install -D -m600 "$srcdir/systab.orig" "$pkgdir/var/spool/fcron/systab.orig" + + # Add cron.* directories + install -d -m755 "$pkgdir/etc/cron.daily" + install -d -m755 "$pkgdir/etc/cron.hourly" + install -d -m755 "$pkgdir/etc/cron.monthly" + install -d -m755 "$pkgdir/etc/cron.weekly" + + # Install run-cron script to make fcron run without dcron + install -D -m755 "$srcdir/run-cron" "$pkgdir/usr/sbin/run-cron" + + # Install systemd service + install -D -m644 "$srcdir/fcron.service" \ + "$pkgdir/usr/lib/systemd/system/fcron.service" + + # avoid conflict with filesystem>=2012.06 + rmdir "$pkgdir/var/run" +} + +# vim:set ts=2 sw=2 et: diff --git a/community-staging/fcron/fcron.rc b/community-staging/fcron/fcron.rc new file mode 100644 index 000000000..880439a1d --- /dev/null +++ b/community-staging/fcron/fcron.rc @@ -0,0 +1,36 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /usr/sbin/fcron` +case "$1" in + start) + stat_busy "Starting Fcron Daemon" + [ -z "$PID" ] && /usr/sbin/fcron -b + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon fcron + stat_done + fi + ;; + stop) + stat_busy "Stopping Fcron Daemon" + [ -n "$PID" ] && kill $PID >/dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon fcron + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/community-staging/fcron/fcron.service b/community-staging/fcron/fcron.service new file mode 100644 index 000000000..a47b4f19b --- /dev/null +++ b/community-staging/fcron/fcron.service @@ -0,0 +1,10 @@ +[Unit] +Description=Cron Daemon + +[Service] +Type=forking +PIDFile=/run/fcron.pid +ExecStart=/usr/sbin/fcron + +[Install] +WantedBy=multi-user.target diff --git a/community-staging/fcron/run-cron b/community-staging/fcron/run-cron new file mode 100644 index 000000000..51007a15a --- /dev/null +++ b/community-staging/fcron/run-cron @@ -0,0 +1,14 @@ +#!/bin/sh + + +if [ -z $1 ]; then + echo "Usage: $0 crondir" + exit 1 +fi + +for cron in $1/* ; do + if [ -x $cron ]; then + $cron + fi +done +unset cron diff --git a/community-staging/fcron/systab b/community-staging/fcron/systab Binary files differnew file mode 100644 index 000000000..11c7e2fd0 --- /dev/null +++ b/community-staging/fcron/systab diff --git a/community-staging/fcron/systab.orig b/community-staging/fcron/systab.orig new file mode 100644 index 000000000..5b0045626 --- /dev/null +++ b/community-staging/fcron/systab.orig @@ -0,0 +1,4 @@ +&bootrun 01 * * * * /usr/sbin/run-cron /etc/cron.hourly +&bootrun 02 00 * * * /usr/sbin/run-cron /etc/cron.daily +&bootrun 22 00 * * 0 /usr/sbin/run-cron /etc/cron.weekly +&bootrun 42 00 1 * * /usr/sbin/run-cron /etc/cron.monthly diff --git a/community-staging/polipo/PKGBUILD b/community-staging/polipo/PKGBUILD new file mode 100644 index 000000000..558d0eacc --- /dev/null +++ b/community-staging/polipo/PKGBUILD @@ -0,0 +1,55 @@ +# $Id: PKGBUILD 72349 2012-06-12 20:25:00Z ttopper $ +# Maintainer: Thorsten Töpper <atsutane-tu@freethoughts.de> +# Contributor: Jelle van der Waa <jelle vdwaa nl> +# Contributor: Thomas Holmquist <thomas@vorget.com> +# Contributor: Jan Boehringer <ja(a)bm-boehringer.de> +# Contributor: Alex Griffin <griffin.aj(a)gmail.com> + +pkgname=polipo +pkgver=1.0.4.1 +pkgrel=3 +pkgdesc="A small and fast caching web proxy." +arch=('i686' 'x86_64') +url="http://www.pps.jussieu.fr/~jch/software/polipo/" +license=('GPL') +depends=('bash') +makedepends=('texinfo') +install=polipo.install +source=("http://freehaven.net/~chrisd/polipo/polipo-$pkgver.tar.gz" + "polipo.cron" "polipo.rc.d" "polipo.conf.d" "polipo.service") +md5sums=('bfc5c85289519658280e093a270d6703' + 'bac0e1a871964c931eb5f7a369b3243c' + '8f096b7d77a71e0772ce71a8c8b1b3e3' + '685aa0c6070dee11c701932d23afcc6a' + '109d0e8c15d669281ff14f8991ad0ed8') + +build() { + cd "$srcdir/$pkgname-$pkgver" + + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + make PREFIX="$pkgdir/usr" \ + MANDIR="$pkgdir/usr/share/man" \ + INFODIR="$pkgdir/usr/share/info" \ + LOCAL_ROOT="$pkgdir/usr/share/polipo/www" \ + DISK_CACHE_ROOT="$pkgdir/var/cache/polipo" \ + install + + + # install config files + install -Dm 644 config.sample $pkgdir/etc/polipo/config.sample + install -Dm 644 forbidden.sample $pkgdir/etc/polipo/forbidden.sample + + # install license + install -Dm644 COPYING $pkgdir/usr/share/licenses/polipo/LICENSE + + # install daemon scripts / cron + install -Dm 755 $srcdir/polipo.rc.d $pkgdir/etc/rc.d/polipo + install -Dm 755 $srcdir/polipo.cron $pkgdir/usr/share/polipo/polipo.cron + install -Dm 644 $srcdir/polipo.service $pkgdir/usr/lib/systemd/system/polipo.service +} + +# vim:set ts=2 sw=2 et: diff --git a/community-staging/polipo/polipo.conf.d b/community-staging/polipo/polipo.conf.d new file mode 100644 index 000000000..dc879d32b --- /dev/null +++ b/community-staging/polipo/polipo.conf.d @@ -0,0 +1,4 @@ +# +# Parameters to be passed to polipo +# +POLIPO_ARGS="daemonise=true logFile=\"/var/log/polipo.log\"" diff --git a/community-staging/polipo/polipo.cron b/community-staging/polipo/polipo.cron new file mode 100644 index 000000000..8270d0a05 --- /dev/null +++ b/community-staging/polipo/polipo.cron @@ -0,0 +1,2 @@ +#!/bin/bash +/etc/rc.d/polipo purge >/dev/null 2>&1 diff --git a/community-staging/polipo/polipo.install b/community-staging/polipo/polipo.install new file mode 100644 index 000000000..bacc46377 --- /dev/null +++ b/community-staging/polipo/polipo.install @@ -0,0 +1,25 @@ +infodir=/usr/share/info +filelist=(polipo.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 + install -d /var/cache/polipo 2> /dev/null + touch /var/log/polipo.log 2> /dev/null + chown -R nobody:nobody /var/cache/polipo /var/log/polipo.log 2> /dev/null +} + +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 +} + +# vim:set ts=2 sw=2 et: diff --git a/community-staging/polipo/polipo.rc.d b/community-staging/polipo/polipo.rc.d new file mode 100644 index 000000000..260fab050 --- /dev/null +++ b/community-staging/polipo/polipo.rc.d @@ -0,0 +1,71 @@ +#!/bin/bash + +daemon_name=polipo + +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/conf.d/$daemon_name.conf + +get_pid() { + pidof -o %PPID $daemon_name +} + +case "$1" in + start) + stat_busy "Starting $daemon_name daemon" + + PID=$(get_pid) + if [[ -z $PID ]]; then + [[ -f /run/$daemon_name.pid ]] && + rm -f /run/$daemon_name.pid + # RUN + sudo -u nobody /usr/bin/$daemon_name ${POLIPO_ARGS} + # + if [[ $? -gt 0 ]]; then + stat_fail + exit 1 + else + echo $(get_pid) > /run/$daemon_name.pid + add_daemon $daemon_name + stat_done + fi + else + stat_fail + exit 1 + fi + ;; + + stop) + stat_busy "Stopping $daemon_name daemon" + PID=$(get_pid) + # KILL + [[ -n $PID ]] && kill $PID &> /dev/null + # + if [[ $? -gt 0 ]]; then + stat_fail + exit 1 + else + rm -f /run/$daemon_name.pid &> /dev/null + rm_daemon $daemon_name + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + status) + stat_busy "Checking $daemon_name status"; + ck_status $daemon_name + ;; + + *) + echo "usage: $0 {start|stop|restart|status}" +esac + +exit 0 + +# vim:set ts=2 sw=2 et: diff --git a/community-staging/polipo/polipo.service b/community-staging/polipo/polipo.service new file mode 100644 index 000000000..a1bdd9aa2 --- /dev/null +++ b/community-staging/polipo/polipo.service @@ -0,0 +1,10 @@ +[Unit] +Description=Polipo Proxy Server + +[Service] +ExecStart=/usr/bin/polipo +User=nobody +ExecReload=/bin/kill -USR1 $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/community/emacs-nox/PKGBUILD b/community/emacs-nox/PKGBUILD index c47461314..69fac4ce8 100644 --- a/community/emacs-nox/PKGBUILD +++ b/community/emacs-nox/PKGBUILD @@ -1,15 +1,14 @@ -# $Id: PKGBUILD 67599 2012-03-13 13:43:30Z lcarlier $ +# $Id: PKGBUILD 72353 2012-06-12 21:10:00Z jlichtblau $ # Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org> # Contributor: Chris Brannon <cmbrannon@cox.net> pkgname=emacs-nox -pkgver=23.4 +pkgver=24.1 pkgrel=1 pkgdesc="The Emacs Editor, without X11 support" arch=('i686' 'x86_64') url="http://www.gnu.org/software/emacs/emacs.html" license=('GPL') -replaces=('cedet') depends=('dbus-core' 'ncurses' 'perl') provides=('emacs') conflicts=('emacs' 'emacs-cvs') @@ -17,43 +16,33 @@ options=('docs') changelog=$pkgname.changelog install=$pkgname.install source=(ftp://ftp.gnu.org/gnu/emacs/emacs-${pkgver}.tar.gz) -sha256sums=('b9a2b8434052771f797d2032772eba862ff9aa143029efc72295170607289c18') +sha256sums=('60d26dd1d9c0b955543ae83a2f4dd7c8b6af59e16a06822cfb175f1bf97c8bab') build() { cd ${srcdir}/emacs-$pkgver - # gcc 4.5 Workaround: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43904 - CFLAGS="${CFLAGS} -fno-optimize-sibling-calls"\ - ./configure --prefix=/usr --without-x --without-sound - - # we don't want to use /usr/libexec - sed -i "s|\"/usr/libexec/emacs.*$|\"/usr/lib/emacs/$pkgver\"|g" src/epaths.h - # mv newepaths.h src/epaths.h - - make libexecdir=/usr/lib archlibdir=/usr/lib/emacs/${pkgver} + ./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib \ + --localstatedir=/var --without-x --without-sound + make } package() { cd ${srcdir}/emacs-$pkgver - - make prefix=${pkgdir}/usr libexecdir=${pkgdir}/usr/lib \ - archlibdir=${pkgdir}/usr/lib/emacs/${pkgver} install - + make DESTDIR=${pkgdir} install + # remove conflict with ctags package mv ${pkgdir}/usr/bin/{ctags,ctags.emacs} - mv ${pkgdir}/usr/bin/{etags,etags.emacs} - mv ${pkgdir}/usr/share/man/man1/{etags.1,etags.emacs.1} - mv ${pkgdir}/usr/share/man/man1/{ctags.1,ctags.emacs.1} + mv ${pkgdir}/usr/share/man/man1/{ctags.1.gz,ctags.emacs.1} + # fix all the 777 perms on directories find ${pkgdir}/usr/share/emacs/$pkgver -type d -exec chmod 755 {} \; # fix user/root permissions on usr/share files find ${pkgdir}/usr/share/emacs/$pkgver -exec chown root.root {} \; - # remove empty files - rm -rf ${pkgdir}/usr/var # remove .desktop file and icons rm -rf ${pkgdir}/usr/share/{applications,icons} - - # get rid of the package's info directory, install-info adds entries for us at install-time - rm ${pkgdir}/usr/share/info/dir - gzip -9nf ${pkgdir}/usr/share/info/* + # fix perms on /var/games + chmod 775 ${pkgdir}/var/games + chmod 775 ${pkgdir}/var/games/emacs + chmod 664 ${pkgdir}/var/games/emacs/* + chown -R root:games ${pkgdir}/var/games } diff --git a/community/emacs-nox/emacs-nox.changelog b/community/emacs-nox/emacs-nox.changelog index 1ed424b05..5e4d8f206 100644 --- a/community/emacs-nox/emacs-nox.changelog +++ b/community/emacs-nox/emacs-nox.changelog @@ -1,3 +1,6 @@ +2012-06-12 Jaroslav Lichtblau <dragonlord@aur.archlinux.org> + * emacs-nox 24.1-1 + 2011-03-13 Jaroslav Lichtblau <dragonlord@aur.archlinux.org> * emacs-nox 23.3-1 diff --git a/community/emacs-nox/emacs-nox.install b/community/emacs-nox/emacs-nox.install index ea8630090..740640994 100644 --- a/community/emacs-nox/emacs-nox.install +++ b/community/emacs-nox/emacs-nox.install @@ -1,12 +1,15 @@ -info_dir=/usr/share/info -info_files=(ada-mode autotype calc ccmode cl dired-x ebrowse -ediff efaq eintr elisp emacs emacs-mime erc eshell eudc flymake forms -gnus idlwave info message mh-e newsticker org pcl-cvs pgg rcirc reftex -sc ses sieve smtpmail speedbar tramp url vip viper widget woman) +INFO_DIR=usr/share/info + +INFO_FILES=(ada-mode auth autotype calc ccmode cl dbus dired-x ebrowse +ede ediff edt efaq eieio eintr elisp emacs emacs-mime epa erc eshell eudc flymake +forms gnus idlwave info mairix-el message mh-e newsticker nxml-mode +org pcl-cvs pgg rcirc reftex remember sasl sc semantic ses sieve smtpmail +speedbar tramp url vip viper widget woman) post_install() { - for f in ${info_files[@]}; do - install-info ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null + [[ -x usr/bin/install-info ]] || return 0 + for f in ${INFO_FILES[@]}; do + install-info ${INFO_DIR}/$f.gz ${INFO_DIR}/dir 2> /dev/null done } @@ -15,7 +18,8 @@ post_upgrade() { } pre_remove() { - for f in ${info_files[@]}; do - install-info --delete ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null + [[ -x usr/bin/install-info ]] || return 0 + for f in ${INFO_FILES[@]}; do + install-info --delete ${INFO_DIR}/$f.gz ${INFO_DIR}/dir 2> /dev/null done } diff --git a/community/gtkwave/PKGBUILD b/community/gtkwave/PKGBUILD index cb28d7fa3..cf147e271 100644 --- a/community/gtkwave/PKGBUILD +++ b/community/gtkwave/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 70580 2012-05-12 02:21:28Z kkeen $ +# $Id: PKGBUILD 72340 2012-06-12 09:32:15Z kkeen $ # Maintainer: Kyle Keen <keenerd@gmail.com> # Contributor: Thomas Dziedzic < gostrc at gmail > # Contributor: Jared Casper <jaredcasper@gmail.com> pkgname=gtkwave -pkgver=3.3.36 +pkgver=3.3.37 pkgrel=1 pkgdesc='A wave viewer which reads LXT, LXT2, VZT, GHW and VCD/EVCD files' arch=('i686' 'x86_64') @@ -14,7 +14,7 @@ depends=('bzip2' 'xz' 'gtk2') makedepends=('gperf') install='gtkwave.install' source=("http://gtkwave.sourceforge.net/gtkwave-${pkgver}.tar.gz") -md5sums=('a4275363369b0b7011afbaa7ec1667e6') +md5sums=('8747205c6cf1abb34b5a8b2f157f37e0') build() { cd "${srcdir}/gtkwave-${pkgver}" diff --git a/community/lxpanel/PKGBUILD b/community/lxpanel/PKGBUILD index e689d6f89..47eccccde 100644 --- a/community/lxpanel/PKGBUILD +++ b/community/lxpanel/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 69844 2012-04-24 15:37:58Z bpiotrowski $ +# $Id: PKGBUILD 72336 2012-06-12 05:13:20Z bpiotrowski $ # Maintainer: Bartłomiej Piotrowski <barthalion@gmail.com> # Contributor: Angel Velasquez <angvp@archlinux.org> # Contributor: Juergen Hoetzel <juergen@archlinux.org> pkgname=lxpanel -pkgver=0.5.9 +pkgver=0.5.10 pkgrel=1 pkgdesc="Panel of the LXDE Desktop" arch=('i686' 'x86_64') @@ -15,7 +15,7 @@ depends=('gtk2' 'alsa-lib' 'menu-cache' 'lxmenu-data' 'libwnck') makedepends=('wireless_tools') optdepends=('wireless_tools: netstat plugin') source=(http://ftp.de.debian.org/debian/pool/main/l/$pkgname/${pkgname}_${pkgver}.orig.tar.xz) -md5sums=('c0b5864ea53113f4b1d4b8a46e9fb8ee') +md5sums=('86a87723ec15274d4c0fe191e8a2fa52') build() { cd "$srcdir/$pkgname-$pkgver" diff --git a/community/nodejs/PKGBUILD b/community/nodejs/PKGBUILD index a4767c36c..923d5f82e 100644 --- a/community/nodejs/PKGBUILD +++ b/community/nodejs/PKGBUILD @@ -1,5 +1,5 @@ -# $Id: PKGBUILD 70788 2012-05-16 16:52:49Z bpiotrowski $ -# Maintainer: Nartłomiej Piotrowski <nospam@bpiotrowski.pl> +# $Id: PKGBUILD 72338 2012-06-12 05:36:21Z bpiotrowski $ +# Maintainer: Bartłomiej Piotrowski <nospam@bpiotrowski.pl> # Contributor: Thomas Dziedzic < gostrc at gmail > # Contributor: James Campos <james.r.campos@gmail.com> # Contributor: BlackEagle < ike DOT devolder AT gmail DOT com > @@ -8,7 +8,7 @@ # Contributor: TIanyi Cui <tianyicui@gmail.com> pkgname=nodejs -pkgver=0.6.18 +pkgver=0.6.19 pkgrel=1 pkgdesc='Evented I/O for V8 javascript' arch=('i686' 'x86_64') @@ -19,7 +19,7 @@ checkdepends=('curl') # curl used for check() optdepends=('openssl: TLS support') options=('!emptydirs') source=("http://nodejs.org/dist/v${pkgver}/node-v${pkgver}.tar.gz") -md5sums=('4a3d3123ccc7b9b21c1990fe074e3d14') +md5sums=('f5669a9717422b811c6bad1cc961b1e5') build() { cd node-v${pkgver} @@ -55,7 +55,7 @@ package() { # install docs as per user request install -d ${pkgdir}/usr/share/doc/nodejs - cp -r doc/api/api/* \ + cp -r doc/api/*.html \ ${pkgdir}/usr/share/doc/nodejs install -D -m644 LICENSE \ diff --git a/community/pcmanfm/PKGBUILD b/community/pcmanfm/PKGBUILD index 092d2aa4b..5d5befdb4 100644 --- a/community/pcmanfm/PKGBUILD +++ b/community/pcmanfm/PKGBUILD @@ -1,22 +1,26 @@ +# $Id: PKGBUILD 72347 2012-06-12 17:01:09Z bpiotrowski $ +# Maintainer: Bartłomiej Piotrowski <barthalion@gmail.com> # Contributor: Unknown47 <unknown47r@gmail.com> # Contributor: Angel Velasquez <angvp@archlinux.org> # Contributor: Juergen Hoetzel <juergen@archlinux.org> pkgname=pcmanfm pkgver=0.9.10 -pkgrel=1 -pkgdesc="File manager of the LXDE Desktop" +pkgrel=2 +pkgdesc="An extremely fast and lightweight file manager" arch=('i686' 'x86_64') url="http://pcmanfm.sourceforge.net/" license=('GPL') groups=('lxde') depends=('gtk2' 'desktop-file-utils' 'libfm' 'lxmenu-data') makedepends=('intltool' 'pkgconfig') +install=$pkgname.install source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-$pkgver.tar.gz) md5sums=('d34a3530a6c5dcd674d23021d71c3e95') build() { cd "$srcdir/$pkgname-$pkgver" + LDFLAGS+=' -lm' ./configure --sysconfdir=/etc --prefix=/usr make } diff --git a/community/pcmanfm/pcmanfm.install b/community/pcmanfm/pcmanfm.install new file mode 100644 index 000000000..8f20cf484 --- /dev/null +++ b/community/pcmanfm/pcmanfm.install @@ -0,0 +1,11 @@ +post_install() { + update-desktop-database -q +} + +post_upgrade() { + update-desktop-database -q +} + +post_remove() { + update-desktop-database -q +} diff --git a/extra/colord/PKGBUILD b/extra/colord/PKGBUILD index 531b66b53..7d8596688 100644 --- a/extra/colord/PKGBUILD +++ b/extra/colord/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 160605 2012-06-02 20:59:03Z ibiru $ -# Maintainer: Jan "heftig" Steffens <jan.steffens@gmail.com> +# $Id: PKGBUILD 161614 2012-06-12 13:49:01Z heftig $ +# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> # Contributor: Ionut Biru <ibiru@archlinux.org> pkgname=colord pkgver=0.1.21 -pkgrel=1 +pkgrel=2 pkgdesc="Color daemon" arch=('i686' 'x86_64') url="http://www.freedesktop.org/software/colord" @@ -30,7 +30,8 @@ build() { package() { cd "$pkgname-$pkgver" - make DESTDIR="$pkgdir" install + make DESTDIR="$pkgdir" install \ + bashcompletiondir=/usr/share/bash-completion/completions } # vim:set ts=2 sw=2 et: diff --git a/extra/dconf/PKGBUILD b/extra/dconf/PKGBUILD index 62cddc3ea..8b4743dc0 100644 --- a/extra/dconf/PKGBUILD +++ b/extra/dconf/PKGBUILD @@ -1,9 +1,9 @@ -# $Id: PKGBUILD 158084 2012-05-02 16:51:02Z ibiru $ +# $Id: PKGBUILD 161615 2012-06-12 13:50:01Z heftig $ # Maintainer: Ionut Biru <ibiru@archlinux.org> pkgname=dconf pkgver=0.12.1 -pkgrel=1 +pkgrel=2 pkgdesc="A low-level configuration system." arch=(i686 x86_64) url="http://live.gnome.org/dconf" @@ -25,7 +25,7 @@ build() { package() { cd "$pkgname-$pkgver" - make DESTDIR="$pkgdir" install + make completiondir=/usr/share/bash-completion/completions DESTDIR="$pkgdir" install } # vim:set ts=2 sw=2 et: diff --git a/extra/mysql/PKGBUILD b/extra/mysql/PKGBUILD index 5958f8989..bf9c650c0 100644 --- a/extra/mysql/PKGBUILD +++ b/extra/mysql/PKGBUILD @@ -1,11 +1,11 @@ -# $Id: PKGBUILD 158713 2012-05-08 07:40:05Z andrea $ +# $Id: PKGBUILD 161633 2012-06-12 18:06:14Z andrea $ # Maintainer: # Contributor: Andrea Scarpino <andrea@archlinux.org> # Contributor: Douglas Soares de Andrade <douglas@archlinux.org> pkgbase=mysql pkgname=('libmysqlclient' 'mysql-clients' 'mysql') -pkgver=5.5.24 +pkgver=5.5.25 pkgrel=1 arch=('i686' 'x86_64') license=('GPL') @@ -15,7 +15,7 @@ options=('!libtool') source=("http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-5.5/${pkgbase}-${pkgver}.tar.gz" 'mysqld' 'my.cnf') -md5sums=('dc84f8a0305e054c859533944e79f803' +md5sums=('9e2a3d5b41eac7fae41b93e5b71ea49c' '2234207625baa29b2ff7d7b4f088abce' '1c949c0dbea5206af0db14942d9927b6') diff --git a/extra/sqlite/PKGBUILD b/extra/sqlite/PKGBUILD index 19314794c..062789e17 100644 --- a/extra/sqlite/PKGBUILD +++ b/extra/sqlite/PKGBUILD @@ -1,14 +1,14 @@ -# $Id: PKGBUILD 159464 2012-05-24 16:48:31Z andyrtr $ +# $Id: PKGBUILD 161621 2012-06-12 15:12:59Z andyrtr $ # Maintainer: Andreas Radke <andyrtr@archlinux.org> # Contributor: Tom Newsom <Jeepster@gmx.co.uk> pkgbase="sqlite" pkgname=('sqlite' 'sqlite-tcl' 'sqlite-doc') -_amalgamationver=3071201 +_amalgamationver=3071300 _amalgamationver2=${_amalgamationver/00/} _docver=${_amalgamationver} #3070700 #pkgver=${_amalgamationver2//0/.} -pkgver=3.7.12.1 +pkgver=3.7.13 pkgrel=1 pkgdesc="A C library that implements an SQL database engine" arch=('i686' 'x86_64') @@ -21,8 +21,8 @@ source=( # tarball containing the amalgamation for SQLite >= 3.7.5 together with http://www.sqlite.org/sqlite-doc-${_docver}.zip license.txt) options=('!libtool' '!emptydirs') -md5sums=('eb7bbd258913518ad30971ea7ecb0ca9' - '3d2b368a64a08766ea37b5162e019091' +md5sums=('c97df403e8a3d5b67bb408fcd6aabd8e' + '16a003d5a619a6c725e3d81cf5aaba2a' 'c1cdbc5544034d9012e421e75a5e4890') build() { diff --git a/extra/udisks2/PKGBUILD b/extra/udisks2/PKGBUILD index 5b2177e49..c08d468bc 100644 --- a/extra/udisks2/PKGBUILD +++ b/extra/udisks2/PKGBUILD @@ -1,9 +1,9 @@ -# $Id: PKGBUILD 156994 2012-04-23 09:10:49Z ibiru $ +# $Id: PKGBUILD 161616 2012-06-12 13:51:10Z heftig $ # Maintainer: Ionut Biru <ibiru@archlinux.org> pkgname=udisks2 pkgver=1.94.0 -pkgrel=1 +pkgrel=2 pkgdesc="Disk Management Service, version 2" arch=('i686' 'x86_64') url="http://www.freedesktop.org/wiki/Software/udisks" @@ -26,5 +26,6 @@ build() { package() { cd "udisks-$pkgver" - make DESTDIR="$pkgdir" install + make DESTDIR="$pkgdir" install \ + bash_completiondir=/usr/share/bash-completion/completions } diff --git a/extra/xf86-input-synaptics/PKGBUILD b/extra/xf86-input-synaptics/PKGBUILD index 9900010da..58583a274 100644 --- a/extra/xf86-input-synaptics/PKGBUILD +++ b/extra/xf86-input-synaptics/PKGBUILD @@ -1,11 +1,11 @@ -# $Id: PKGBUILD 158878 2012-05-12 16:51:09Z andyrtr $ +# $Id: PKGBUILD 161623 2012-06-12 15:20:16Z andyrtr $ # Maintainer: Jan de Groot <jgc@archlinux.org> # Contributor: Tobias Powalowski <tpowa@archlinux.org> # Contributor: Thomas Bächler <thomas@archlinux.org> # Contributor: Alexander Baldeck <alexander@archlinux.org> pkgname=xf86-input-synaptics -pkgver=1.6.1 +pkgver=1.6.2 pkgrel=1 pkgdesc="Synaptics driver for notebook touchpads" arch=('i686' 'x86_64') @@ -22,8 +22,8 @@ options=(!libtool) backup=('etc/X11/xorg.conf.d/10-synaptics.conf') source=(http://xorg.freedesktop.org/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2 10-synaptics.conf) -sha1sums=('963276a5dd240e84efff28d516f8d23cfeedaa13' - '68e1f4ef5e1038231d210eb422fa4d18c5922f0f') +sha256sums=('c3f7d6a085d480c352f030aeb43db2e5560d1468ed34be24d44a0fc3fda25920' + 'bd506a0545c335faa6da7ec42b3f60f2c09b5ed9e26f03003d6f59be88107ee2') build() { cd "${srcdir}/${pkgname}-${pkgver}" diff --git a/extra/xorg-xdm/PKGBUILD b/extra/xorg-xdm/PKGBUILD index 1edcddd16..4ca16b66e 100644 --- a/extra/xorg-xdm/PKGBUILD +++ b/extra/xorg-xdm/PKGBUILD @@ -1,38 +1,42 @@ -# $Id: PKGBUILD 140275 2011-10-11 21:28:00Z jgc $ +# $Id: PKGBUILD 161610 2012-06-12 11:02:41Z jgc $ # Maintainer: Alexander Baldeck <alexander@archlinux.org> # Contributor: Jan de Groot <jgc@archlinux.org> pkgname=xorg-xdm pkgver=1.1.11 -pkgrel=1 +pkgrel=2 pkgdesc="X Display Manager" arch=(i686 x86_64) url="http://xorg.freedesktop.org/" license=('custom') depends=('pam' 'libxaw' 'libxinerama' 'xorg-xrdb' 'xorg-sessreg' 'libxft' 'consolekit') -makedepends=('pkgconfig' 'xorg-util-macros') +makedepends=('pkgconfig' 'xorg-util-macros' 'systemd' 'xtrans') backup=(etc/X11/xdm/Xaccess etc/X11/xdm/Xresources etc/X11/xdm/Xservers etc/X11/xdm/xdm-config etc/pam.d/xdm etc/X11/xdm/Xsetup_0 etc/X11/xdm/Xsession) options=('!libtool') source=(${url}/releases/individual/app/xdm-${pkgver}.tar.bz2 Xsession-loginshell.patch Xsession-xsm.patch xdm-consolekit.patch + xdm-1.0.5-sessreg-utmp-fix-bug177890.patch xdm.pam) md5sums=('64a1af1f7eb69feae12e75d4cc3aaf19' '234ae568e7b22cbc09433bb396ff3d80' '2c30078c50bc653d72eb5114506eb313' - '46b11173b58e2241577d5ffd48ab8f8d' - '419d6289ba6f851135f5c70c0e3cbec4') + '25c6d8adeed0796d432b2bbf1d83a7e9' + '13032add23a0a8d48a638418094bfc00' + '6de9362b1bf0835026270b20d8029909') sha256sums=('d4da426ddea0124279a3f2e00a26db61944690628ee818a64df9d27352081c47' 'fd3e7c20837b42a8ab111369fd6dc9612f9edb91c1f6904cca1d6a1fa3cfa0ff' '77a1ce9bdf363591b72798db08b4df3589bd4e64737fd32cf9028f9245450edb' - '47190f311c97c0d85b1fcab47ee5a8575013db1200a5e30a57a7ea4ef3e0c23a' - '36cf924a893ef851855ebcdc5468523a9d182c3620698e01dffc35d05d74764b') + '10ce850e6a93c6ba68b5d71104b1fd6680ad9760274068512f43a694b1edda76' + '5f380a2d6f77feb910d77f7f6843fce9b00ff7610c159fc029ee44cc6c23a48a' + '7d6818a1c1a44e9bd38774c035e03b0b831f6646681bc2bf556761aec7baf418') build() { cd "${srcdir}/xdm-${pkgver}" patch -Np0 -i "${srcdir}/Xsession-loginshell.patch" patch -Np1 -i "${srcdir}/Xsession-xsm.patch" patch -Np1 -i "${srcdir}/xdm-consolekit.patch" + patch -Np0 -i "${srcdir}/xdm-1.0.5-sessreg-utmp-fix-bug177890.patch" autoreconf -fi ./configure --prefix=/usr \ diff --git a/extra/xorg-xdm/xdm-1.0.5-sessreg-utmp-fix-bug177890.patch b/extra/xorg-xdm/xdm-1.0.5-sessreg-utmp-fix-bug177890.patch new file mode 100644 index 000000000..195858883 --- /dev/null +++ b/extra/xorg-xdm/xdm-1.0.5-sessreg-utmp-fix-bug177890.patch @@ -0,0 +1,8 @@ +--- config/GiveConsole.sessreg-utmp-fix-bug177890 2006-07-24 04:20:10.000000000 -0400 ++++ config/GiveConsole 2006-07-24 04:21:16.000000000 -0400 +@@ -8,3 +8,5 @@ + # causing serious grief. + # + chown $USER /dev/console ++exec /usr/bin/sessreg -a -w "/var/log/wtmp" -u "/run/utmp" \ ++ -x "/etc/X11/xdm/Xservers" -l $DISPLAY -h "" $USER diff --git a/extra/xorg-xdm/xdm-consolekit.patch b/extra/xorg-xdm/xdm-consolekit.patch index 7d85b97e0..c52a26138 100644 --- a/extra/xorg-xdm/xdm-consolekit.patch +++ b/extra/xorg-xdm/xdm-consolekit.patch @@ -97,7 +97,7 @@ + LogError("console-kit-daemon not running?\n"); + ck_connector_unref(connector); + connector = NULL; -+ return 0; ++ return 1; + } + + verify->userEnviron = setEnv(verify->userEnviron, diff --git a/extra/xorg-xdm/xdm.pam b/extra/xorg-xdm/xdm.pam index 862b83fa2..a0b601db6 100644 --- a/extra/xorg-xdm/xdm.pam +++ b/extra/xorg-xdm/xdm.pam @@ -6,3 +6,5 @@ account required pam_unix.so password required pam_unix.so session required pam_unix.so session required pam_limits.so +session required pam_loginuid.so +-session optional pam_systemd.so diff --git a/multilib/lib32-pixman/PKGBUILD b/multilib/lib32-pixman/PKGBUILD index e6c0dc51e..326946296 100644 --- a/multilib/lib32-pixman/PKGBUILD +++ b/multilib/lib32-pixman/PKGBUILD @@ -1,8 +1,8 @@ -# $Id: PKGBUILD 65618 2012-02-21 10:54:05Z bluewind $ +# $Id: PKGBUILD 72357 2012-06-12 21:30:48Z bluewind $ # Maintainer : Ionut Biru <ibiru@archlinux.org> _pkgbasename=pixman pkgname=lib32-$_pkgbasename -pkgver=0.24.4 +pkgver=0.26.0 pkgrel=1 pkgdesc="Pixman library (32-bit)" arch=('x86_64') @@ -12,7 +12,7 @@ depends=('lib32-glibc' $_pkgbasename) makedepends=('gcc-multilib') options=('!libtool') source=(http://xorg.freedesktop.org/releases/individual/lib/${_pkgbasename}-${pkgver}.tar.bz2) -sha1sums=('683450f917015366ac7918fc517c76801aeff374') +sha1sums=('d772cf794ec5da0966eba3cb360919a0a5e0d23f') build() { export CC="gcc -m32" diff --git a/multilib/lib32-sqlite3/PKGBUILD b/multilib/lib32-sqlite3/PKGBUILD index dab989b09..cf29253da 100644 --- a/multilib/lib32-sqlite3/PKGBUILD +++ b/multilib/lib32-sqlite3/PKGBUILD @@ -4,8 +4,8 @@ _pkgbasename=sqlite3 pkgname=lib32-sqlite3 -_amalgamationver=3071100 -pkgver=3.7.11 +_amalgamationver=3071300 +pkgver=3.7.13 pkgrel=1 pkgdesc="A C library that implements an SQL database engine (32-bit)" arch=('x86_64') @@ -15,7 +15,7 @@ depends=(lib32-glibc $_pkgbasename) makedepends=('tcl' 'gcc-multilib' 'lib32-readline') source=(http://www.sqlite.org/sqlite-src-${_amalgamationver}.zip) options=(!libtool) -md5sums=('73e2340ca2682ae914168d99c1f26e66') +md5sums=('13bb3eaae94592ef3220ea23582763f5') build() { export CC="gcc -m32" diff --git a/staging/sane/PKGBUILD b/staging/sane/PKGBUILD new file mode 100644 index 000000000..f9f2742be --- /dev/null +++ b/staging/sane/PKGBUILD @@ -0,0 +1,72 @@ +# $Id: PKGBUILD 161619 2012-06-12 14:13:06Z tpowa $ +# Maintainer: Tobias Powalowski <tpowa@archlinux.org> +# Contributor: Sarah Hay <sarahhay@mb.sympatico.ca> +# Contributor: Simo L. <neotuli@yahoo.com> +# Contributor: eric <eric@archlinux.org> + +pkgname=sane +pkgver=1.0.22 +pkgrel=9 +pkgdesc="Scanner Access Now Easy" +url="http://www.sane-project.org/" +arch=('i686' 'x86_64') +license=('GPL') +depends=('libtiff>=4.0.0' 'libgphoto2>=2.4.7-2' 'libjpeg>=8' 'libusb-compat' 'libieee1284' 'v4l-utils' 'avahi' 'bash' 'net-snmp') +makedepends=('texlive-latexextra') +install=$pkgname.install +backup=(etc/sane.d/{abaton.conf,agfafocus.conf,apple.conf,artec.conf,artec_eplus48u.conf,avision.conf,bh.conf,canon.conf,canon630u.conf,canon_dr.conf,canon_pp.conf,cardscan.conf,coolscan2.conf,coolscan3.conf,coolscan.conf,dc25.conf,dc210.conf,dc240.conf,dell1600n_net.conf,dll.conf,dmc.conf,epjitsu.conf,epson.conf,epson2.conf,fujitsu.conf,genesys.conf,gphoto2.conf,gt68xx.conf,hp.conf,hp3900.conf,hp4200.conf,hp5400.conf,hpsj5s.conf,hs2p.conf,ibm.conf,kodak.conf,leo.conf,lexmark.conf,ma1509.conf,magicolor.conf,matsushita.conf,microtek.conf,microtek2.conf,mustek.conf,mustek_pp.conf,mustek_usb.conf,mustek_usb2.conf,nec.conf,net.conf,p5.conf,pie.conf,pixma.conf,plustek.conf,plustek_pp.conf,qcam.conf,ricoh.conf,rts8891.conf,s9036.conf,saned.conf,sceptre.conf,sharp.conf,sm3840.conf,snapscan.conf,sp15c.conf,st400.conf,stv680.conf,tamarack.conf,teco1.conf,teco2.conf,teco3.conf,test.conf,u12.conf,umax.conf,umax1220u.conf,umax_pp.conf,xerox_mfp.conf,v4l.conf} etc/xinetd.d/sane) +source=(ftp://ftp2.sane-project.org/pub/sane/$pkgname-backends-$pkgver/$pkgname-backends-$pkgver.tar.gz + 'sane.xinetd' + 'libv4l-0.8.3.patch' + 'xerox_mfp_fix_usb_devices.patch' + 'saned.socket' + 'saned.service') +options=(!libtool) +md5sums=('fadf56a60f4776bfb24491f66b617cf5' + 'da946cc36fb83612162cf9505986d4b2' + 'e645a8921cff9f18ffbdabb2ed885060' + 'cfef73e7db7c28308914d3db6767d852' + 'e57e9e15528f47f5f1b3f1411135ed5d' + 'e44bd4c994a52d6f472463d1eb0a03be') + +build() { + cd "${srcdir}/${pkgname}-backends-${pkgver}" + + patch -p1 -i "${srcdir}"/libv4l-0.8.3.patch + # fix https://bugs.archlinux.org/task/26114 + patch -Np1 -i "${srcdir}"/xerox_mfp_fix_usb_devices.patch + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --with-docdir=/usr/share/doc/sane \ + --enable-avahi \ + --enable-pthread \ + --disable-rpath \ + --disable-locking + make +} + +package () { + cd "${srcdir}/${pkgname}-backends-${pkgver}" + make DESTDIR="${pkgdir}" install + # fix hp officejets + echo "#hpaio" >> "${pkgdir}/etc/sane.d/dll.conf" + # install udev files + install -D -m0644 tools/udev/libsane.rules \ + "${pkgdir}/usr/lib/udev/rules.d/53-sane.rules" + # fix udev rules + sed -i 's|NAME="%k", ||g' "${pkgdir}/usr/lib/udev/rules.d/53-sane.rules" + + # install xinetd file + install -D -m644 "${srcdir}/sane.xinetd" "${pkgdir}/etc/xinetd.d/sane" + + # Install the pkg-config file + install -D -m644 tools/sane-backends.pc \ + "${pkgdir}/usr/lib/pkgconfig/sane-backends.pc" + # install systemd files + install -D -m644 ${srcdir}/saned.socket \ + "${pkgdir}/usr/lib/systemd/system/saned.socket" + install -D -m644 ${srcdir}/saned.service \ + "${pkgdir}/usr/lib/systemd/system/saned@.service" +} diff --git a/staging/sane/libv4l-0.8.3.patch b/staging/sane/libv4l-0.8.3.patch new file mode 100644 index 000000000..4e240e0cf --- /dev/null +++ b/staging/sane/libv4l-0.8.3.patch @@ -0,0 +1,64 @@ +From 26c69b228b29f612faf4b0cc85db969ee7cc4ea6 Mon Sep 17 00:00:00 2001 +From: Nils Philippsen <nils@redhat.com> +Date: Mon, 14 Mar 2011 13:35:05 +0100 +Subject: [PATCH] patch: v4l + +Squashed commit of the following: + +commit 23381932c76846191b42a48e505b37cd74711265 +Author: Julien BLACHE <jb@jblache.org> +Date: Wed Feb 16 19:37:43 2011 +0100 + + Fix v4l build with libv4l 0.8.3+ + + (cherry picked from commit c5ca46c2d1be78c651afb843cc834cf2b5b24953) + + Conflicts: + + ChangeLog + + Signed-off-by: Nils Philippsen <nils@redhat.com> +--- + backend/v4l.c | 3 +-- + backend/v4l.h | 3 ++- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/backend/v4l.c b/backend/v4l.c +index 6510ef0..38595ed 100644 +--- a/backend/v4l.c ++++ b/backend/v4l.c +@@ -84,9 +84,8 @@ + #include "../include/sane/sanei_config.h" + #define V4L_CONFIG_FILE "v4l.conf" + +-#include "v4l.h" +- + #include <libv4l1.h> ++#include "v4l.h" + + static const SANE_Device **devlist = NULL; + static int num_devices; +diff --git a/backend/v4l.h b/backend/v4l.h +index 588b96e..6aee586 100644 +--- a/backend/v4l.h ++++ b/backend/v4l.h +@@ -29,6 +29,7 @@ + #ifndef v4l_h + #define v4l_h + ++#ifndef __LINUX_VIDEODEV_H + /* Kernel interface */ + /* Only the stuff we need. For more features, more defines are needed */ + +@@ -165,7 +166,7 @@ struct video_channel + + + /* end of kernel interface */ +- ++#endif /* !__LINUX_VIDEODEV_H */ + + #include <../include/sane/sane.h> + +-- +1.7.4 + diff --git a/staging/sane/sane.install b/staging/sane/sane.install new file mode 100644 index 000000000..5ec361eea --- /dev/null +++ b/staging/sane/sane.install @@ -0,0 +1,7 @@ +post_install() { + /bin/cat <<THEEND +NOTE +---- +Add your user to group 'scanner' to use scanner devices. +THEEND +} diff --git a/staging/sane/sane.xinetd b/staging/sane/sane.xinetd new file mode 100644 index 000000000..b035664b4 --- /dev/null +++ b/staging/sane/sane.xinetd @@ -0,0 +1,11 @@ +service sane-port +{ + port = 6566 + socket_type = stream + wait = no + user = root + group = scanner + server = /usr/sbin/saned + # disabled by default! + disable = yes + } diff --git a/staging/sane/saned.service b/staging/sane/saned.service new file mode 100644 index 000000000..69e833e7e --- /dev/null +++ b/staging/sane/saned.service @@ -0,0 +1,8 @@ +[Unit] +Description=Scanner Service + +[Service] +Group=scanner +ExecStart=/usr/sbin/saned +StandardInput=socket +StandardError=syslog diff --git a/staging/sane/saned.socket b/staging/sane/saned.socket new file mode 100644 index 000000000..66ef9c9c8 --- /dev/null +++ b/staging/sane/saned.socket @@ -0,0 +1,9 @@ +[Unit] +Description=saned incoming socket + +[Socket] +ListenStream=6566 +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/staging/sane/xerox_mfp_fix_usb_devices.patch b/staging/sane/xerox_mfp_fix_usb_devices.patch new file mode 100644 index 000000000..5ed29b974 --- /dev/null +++ b/staging/sane/xerox_mfp_fix_usb_devices.patch @@ -0,0 +1,67 @@ +commit 5ea227caeacd504b64eef301e83fa63e0a25b3f7 +Author: Alex Belkin <abc@telekom.ru> +Date: Tue Mar 8 17:57:19 2011 +0300 + + keep usb device by default (correct for bug introduced by tcp sub-backend + +diff --git a/backend/xerox_mfp.c b/backend/xerox_mfp.c +index e08b50f..d4672a7 100644 +--- a/backend/xerox_mfp.c ++++ b/backend/xerox_mfp.c +@@ -37,10 +37,10 @@ + static const SANE_Device **devlist = NULL; /* sane_get_devices array */ + static struct device *devices_head = NULL; /* sane_get_devices list */ + +-transport available_transports[] = { ++enum { TRANSPORT_USB, TRANSPORT_TCP, TRANSPORTS_MAX }; ++transport available_transports[TRANSPORTS_MAX] = { + { "usb", usb_dev_request, usb_dev_open, usb_dev_close, usb_configure_device }, + { "tcp", tcp_dev_request, tcp_dev_open, tcp_dev_close, tcp_configure_device }, +- { 0 } + }; + + static int resolv_state(int state) +@@ -824,7 +824,13 @@ free_devices (void) + devices_head = NULL; + } + +-/* SANE API ignores return code of this callback */ ++static transport *tr_from_devname(SANE_String_Const devname) ++{ ++ if (strncmp("tcp", devname, 3) == 0) ++ return &available_transports[TRANSPORT_TCP]; ++ return &available_transports[TRANSPORT_USB]; ++} ++ + static SANE_Status + list_one_device (SANE_String_Const devname) + { +@@ -839,12 +845,7 @@ list_one_device (SANE_String_Const devname) + return SANE_STATUS_GOOD; + } + +- for (tr = available_transports; tr->ttype; tr++) { +- if (!strncmp (devname, tr->ttype, strlen(tr->ttype))) +- break; +- } +- if (!tr->ttype) +- return SANE_STATUS_INVAL; ++ tr = tr_from_devname(devname); + + dev = calloc (1, sizeof (struct device)); + if (dev == NULL) +@@ -878,13 +879,7 @@ list_one_device (SANE_String_Const devname) + static SANE_Status + list_conf_devices (UNUSED (SANEI_Config * config), const char *devname) + { +- transport *tr; +- +- for (tr = available_transports; tr->ttype; tr++) { +- if (!strncmp (devname, tr->ttype, strlen(tr->ttype))) +- return tr->configure_device(devname, list_one_device); +- } +- return SANE_STATUS_INVAL; ++ return tr_from_devname(devname)->configure_device(devname, list_one_device); + } + + SANE_Status diff --git a/staging/sox/PKGBUILD b/staging/sox/PKGBUILD new file mode 100644 index 000000000..0b370fe65 --- /dev/null +++ b/staging/sox/PKGBUILD @@ -0,0 +1,45 @@ +# $Id: PKGBUILD 161504 2012-06-12 05:34:19Z eric $ +# Maintainer: Eric Bélanger <eric@archlinux.org> + +pkgname=sox +pkgver=14.4.0 +pkgrel=3 +pkgdesc="The Swiss Army knife of sound processing tools" +arch=('i686' 'x86_64') +url="http://sox.sourceforge.net/" +license=('GPL' 'LGPL') +depends=('libltdl' 'file' 'libsndfile' 'libpng' 'lame' 'opencore-amr' 'gsm') +makedepends=('ffmpeg' 'libao' 'libmad' 'libid3tag' 'wavpack' 'libpulse') +checkdepends=('time') +optdepends=('libao: for ao plugin' + 'ffmpeg: for ffmpeg plugin' + 'libmad: for mp3 plugin' + 'libid3tag: for mp3 plugin' + 'wavpack: for wavpack plugin' + 'libpulse: for pulse plugin') +options=('!libtool') +source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2 + sox_default_audio_driver_fallback.patch sox-ffmpeg0.11.patch) +sha1sums=('12dfc57e503ed4e18cedcac292cdae7982281978' + 'ab304f1fc17269262dbc4977aa9b7e97ec805ae4' + '2f92bcaebcaf300782396f106cdd27c72048a851') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + patch -p0 -i "${srcdir}/sox_default_audio_driver_fallback.patch" + patch -p1 -i "${srcdir}/sox-ffmpeg0.11.patch" + sed -i 's|man1/sox.1 soxeffect.7|man1/sox.1.gz soxeffect.7.gz|' Makefile.in + ./configure --prefix=/usr --sysconfdir=/etc \ + --with-dyn-default --with-distro="Arch Linux" + make +} + +check() { + cd "${srcdir}/${pkgname}-${pkgver}" + make bindir=. installcheck +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" install +} diff --git a/staging/sox/sox-ffmpeg0.11.patch b/staging/sox/sox-ffmpeg0.11.patch new file mode 100644 index 000000000..901c81582 --- /dev/null +++ b/staging/sox/sox-ffmpeg0.11.patch @@ -0,0 +1,130 @@ +diff -Naur sox-14.4.0-orig/configure sox-14.4.0/configure +--- sox-14.4.0-orig/configure 2012-06-12 00:35:53.462360803 -0400 ++++ sox-14.4.0/configure 2012-06-12 00:36:08.572361294 -0400 +@@ -15781,9 +15781,9 @@ + cat >>confdefs.h <<_ACEOF + #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 + _ACEOF +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_open_input_file in -lavformat" >&5 +-$as_echo_n "checking for av_open_input_file in -lavformat... " >&6; } +-if ${ac_cv_lib_avformat_av_open_input_file+:} false; then : ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avformat_open_input in -lavformat" >&5 ++$as_echo_n "checking for avformat_open_input in -lavformat... " >&6; } ++if ${ac_cv_lib_avformat_avformat_open_input+:} false; then : + $as_echo_n "(cached) " >&6 + else + ac_check_lib_save_LIBS=$LIBS +@@ -15797,27 +15797,27 @@ + #ifdef __cplusplus + extern "C" + #endif +-char av_open_input_file (); ++char avformat_open_input (); + int + main () + { +-return av_open_input_file (); ++return avformat_open_input (); + ; + return 0; + } + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_lib_avformat_av_open_input_file=yes ++ ac_cv_lib_avformat_avformat_open_input=yes + else +- ac_cv_lib_avformat_av_open_input_file=no ++ ac_cv_lib_avformat_avformat_open_input=no + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_av_open_input_file" >&5 +-$as_echo "$ac_cv_lib_avformat_av_open_input_file" >&6; } +-if test "x$ac_cv_lib_avformat_av_open_input_file" = xyes; then : ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_avformat_open_input" >&5 ++$as_echo "$ac_cv_lib_avformat_avformat_open_input" >&6; } ++if test "x$ac_cv_lib_avformat_avformat_open_input" = xyes; then : + for ac_header in libavcodec/avcodec.h ffmpeg/avcodec.h + do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +diff -Naur sox-14.4.0-orig/src/ffmpeg.c sox-14.4.0/src/ffmpeg.c +--- sox-14.4.0-orig/src/ffmpeg.c 2012-06-12 00:35:53.459027469 -0400 ++++ sox-14.4.0/src/ffmpeg.c 2012-06-12 00:36:26.539028545 -0400 +@@ -93,7 +93,7 @@ + #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) + enc->error_resilience = 1; + #else +- enc->error_recognition = 1; ++ enc->err_recognition = 1; + #endif + + if (!codec || avcodec_open(enc, codec) < 0) +@@ -157,7 +157,7 @@ + static int startread(sox_format_t * ft) + { + priv_t * ffmpeg = (priv_t *)ft->priv; +- AVFormatParameters params; ++ AVDictionary *params; + int ret; + int i; + +@@ -172,7 +172,7 @@ + + /* Open file and get format */ + memset(¶ms, 0, sizeof(params)); +- if ((ret = av_open_input_file(&ffmpeg->ctxt, ft->filename, NULL, 0, ¶ms)) < 0) { ++ if ((ret = avformat_open_input(&ffmpeg->ctxt, ft->filename, NULL, ¶ms)) < 0) { + lsx_fail("ffmpeg cannot open file for reading: %s (code %d)", ft->filename, ret); + return SOX_EOF; + } +@@ -231,7 +231,7 @@ + /* If input buffer empty, read more data */ + if (ffmpeg->audio_buf_index * 2 >= ffmpeg->audio_buf_size) { + if ((ret = av_read_frame(ffmpeg->ctxt, pkt)) < 0 && +- (ret == AVERROR_EOF || url_ferror(ffmpeg->ctxt->pb))) ++ (ret == AVERROR_EOF || ffmpeg->ctxt->pb->error)) + break; + ffmpeg->audio_buf_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE); + ffmpeg->audio_buf_index = 0; +@@ -373,13 +373,6 @@ + return SOX_EOF; + } + +- /* set the output parameters (must be done even if no +- parameters). */ +- if (av_set_parameters(ffmpeg->ctxt, NULL) < 0) { +- lsx_fail("ffmpeg invalid output format parameters"); +- return SOX_EOF; +- } +- + /* Next line for debugging */ + /* dump_format(ffmpeg->ctxt, 0, ft->filename, 1); */ + +@@ -391,14 +384,14 @@ + + /* open the output file, if needed */ + if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) { +- if (url_fopen(&ffmpeg->ctxt->pb, ft->filename, URL_WRONLY) < 0) { ++ if (avio_open(&ffmpeg->ctxt->pb, ft->filename, AVIO_FLAG_WRITE) < 0) { + lsx_fail("ffmpeg could not open `%s'", ft->filename); + return SOX_EOF; + } + } + + /* write the stream header, if any */ +- av_write_header(ffmpeg->ctxt); ++ avformat_write_header(ffmpeg->ctxt, NULL); + + return SOX_SUCCESS; + } +@@ -478,7 +471,7 @@ + #if (LIBAVFORMAT_VERSION_INT < 0x340000) + url_fclose(&ffmpeg->ctxt->pb); + #else +- url_fclose(ffmpeg->ctxt->pb); ++ avio_close(ffmpeg->ctxt->pb); + #endif + } + diff --git a/staging/sox/sox_default_audio_driver_fallback.patch b/staging/sox/sox_default_audio_driver_fallback.patch new file mode 100644 index 000000000..9f9060e17 --- /dev/null +++ b/staging/sox/sox_default_audio_driver_fallback.patch @@ -0,0 +1,51 @@ +--- src/sox.c.old 2012-05-06 22:45:45.380564154 -0400 ++++ src/sox.c 2012-05-06 22:47:11.948248987 -0400 +@@ -2538,20 +2538,38 @@ + return name? from_env? from_env : name : NULL; + } + ++static char const * try_device(char const * name) ++{ ++ sox_format_handler_t const * handler = sox_find_format(name, sox_false); ++ if (handler) { ++ sox_format_t format, * ft = &format; ++ memset(ft, 0, sizeof(*ft)); ++ ft->filename = (char *)device_name(name); ++ ft->priv = lsx_calloc(1, handler->priv_size); ++ if (handler->startwrite(ft) == SOX_SUCCESS) { ++ handler->stopwrite(ft); ++ free(ft->priv); ++ return name; ++ } ++ free(ft->priv); ++ } ++ return NULL; ++} ++ + static char const * set_default_device(file_t * f) + { + /* Default audio driver type in order of preference: */ + if (!f->filetype) f->filetype = getenv("AUDIODRIVER"); +- if (!f->filetype && sox_find_format("coreaudio", sox_false)) f->filetype = "coreaudio"; +- if (!f->filetype && sox_find_format("pulseaudio" , sox_false)) f->filetype = "pulseaudio"; +- if (!f->filetype && sox_find_format("alsa", sox_false)) f->filetype = "alsa"; +- if (!f->filetype && sox_find_format("waveaudio" , sox_false)) f->filetype = "waveaudio"; +- if (!f->filetype && sox_find_format("sndio", sox_false)) f->filetype = "sndio"; +- if (!f->filetype && sox_find_format("oss" , sox_false)) f->filetype = "oss"; +- if (!f->filetype && sox_find_format("sunau",sox_false)) f->filetype = "sunau"; +- if (!f->filetype && sox_find_format("ao" , sox_false) && file_count) /*!rec*/ +- f->filetype = "ao"; +- ++ if (!f->filetype) f->filetype = try_device("coreaudio"); ++ if (!f->filetype) f->filetype = try_device("pulseaudio"); ++ if (!f->filetype) f->filetype = try_device("alsa"); ++ if (!f->filetype) f->filetype = try_device("waveaudio"); ++ if (!f->filetype) f->filetype = try_device("sndio"); ++ if (!f->filetype) f->filetype = try_device("oss"); ++ if (!f->filetype) f->filetype = try_device("sunau"); ++ if (!f->filetype && file_count) /*!rec*/ ++ f->filetype = try_device("ao"); ++ + if (!f->filetype) { + lsx_fail("Sorry, there is no default audio device configured"); + exit(1); diff --git a/staging/xf86-video-ati/PKGBUILD b/staging/xf86-video-ati/PKGBUILD new file mode 100644 index 000000000..4cafa5c9d --- /dev/null +++ b/staging/xf86-video-ati/PKGBUILD @@ -0,0 +1,32 @@ +# $Id: PKGBUILD 161625 2012-06-12 15:45:26Z andyrtr $ +# Maintainer: Jan de Groot <jgc@archlinux.org> +# Contributor: Alexander Baldeck <alexander@archlinux.org> + +pkgname=xf86-video-ati +pkgver=6.14.5 +epoch=1 +pkgrel=1 +pkgdesc="X.org ati video driver" +arch=('i686' 'x86_64') +url="http://xorg.freedesktop.org/" +license=('custom') +depends=('libdrm>=2.4.35' 'systemd-tools' 'ati-dri') +makedepends=('xorg-server-devel>=1.11.99.902' 'xf86driproto' 'mesa') +conflicts=('xorg-server<1.11.99.902') +groups=('xorg-drivers' 'xorg') +options=('!libtool') +source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2) +sha256sums=('ef879d2845de50cec1aa98e37185271e1d535c0009efd6713ec88206b7197d53') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + ./configure --prefix=/usr #--enable-dri --help + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + make "DESTDIR=${pkgdir}" install + install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}" + install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/" +} diff --git a/testing/cinepaint/LICENSE b/testing/cinepaint/LICENSE new file mode 100644 index 000000000..746207229 --- /dev/null +++ b/testing/cinepaint/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2005, Kai-Uwe Behrmann +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution.ntributors may be used to endorse or promote + products derived from this software without specific prior written + permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/testing/cinepaint/PKGBUILD b/testing/cinepaint/PKGBUILD new file mode 100644 index 000000000..d207cea74 --- /dev/null +++ b/testing/cinepaint/PKGBUILD @@ -0,0 +1,51 @@ +# $Id: PKGBUILD 161639 2012-06-12 18:43:54Z andyrtr $ +# Maintainer: tobias [tobias.archlinux.org] +# Contributor: tobias [tobias.justdreams.de] + +pkgname=cinepaint +pkgver=1.3 +pkgrel=2 +pkgdesc="Sophisticated graphics manipulation programm supporting > 8bit pictures" +arch=('i686' 'x86_64') +license=('LGPL' 'GPL' 'MIT') +url="http://www.cinepaint.org" +depends=('gtk2' 'openexr' 'lcms' 'libxpm' 'fltk' 'ftgl' 'libxxf86vm') +makedepends=('python2' 'gutenprint>=5.2.8') +optdepends=('python2: for python plug-ins' + 'gutenprint: for print plug-ins' + 'ghostscript: for pdf plug-ins') +options=('!libtool') +install=cinepaint.install +source=(http://downloads.sourceforge.net/project/cinepaint/CinePaint/CinePaint-${pkgver}/${pkgname}-${pkgver}.tgz + LICENSE cinepaint-libpng15.patch cinepaint-missing-include.patch) +sha1sums=('1982e32b0f461f4fd0ff0fe17a2e81ccd8dbd52b' + 'ca8411db87f3fc51bbdfade22f4e1f555b2ee19e' + '3dfc9f06f02791aee59b60d33ddf9d305b0f1de5' + 'a4f43aabdbb33d059f1a38442cd6625e4f00c5b9') + +build() { + cd "${srcdir}/${pkgname}" + patch -p1 -i ../cinepaint-libpng15.patch + patch -p1 -i ../cinepaint-missing-include.patch + find plug-ins/pygimp -type f -exec sed -i 's#env python#env python2#' {} + + sed -i 's|$(LDFLAGS) -o|$(LDFLAGS) $(GTK_LIBS) -o|' lib/Makefile.in + +# aclocal -I aclocal +# autoconf + sh autogen.sh + + LIBS+="-lstdc++ -lm -lX11" ./configure --prefix=/usr --libdir=/usr/lib --mandir=/usr/share/man \ + --enable-gtk2 --enable-pygimp --with-python=/usr/bin/python2 + sed -i 's/-Wl,,/-Wl,/' lib/fl_i18n/Makefile plug-ins/bracketing_to_hdr/Makefile \ + plug-ins/collect/Makefile plug-ins/icc_examin/icc_examin/Makefile plug-ins/pdf/Makefile + make +} + +package() { + cd "${srcdir}/${pkgname}" + make DESTDIR="${pkgdir}" install + sed -i -e "s|-I$srcdir/cinepaint||" -e "s|-I$srcdir/cinepaint/lib||" -e "/libcinepaint.la/d" \ + -e "s|$srcdir/cinepaint/lib/.libs/\$dlname||" "${pkgdir}/usr/bin/cinepainttool" + sed -i "s/cinepaint.png/cinepaint/" "${pkgdir}/usr/share/applications/cinepaint.desktop" + install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} diff --git a/testing/cinepaint/cinepaint-libpng15.patch b/testing/cinepaint/cinepaint-libpng15.patch new file mode 100644 index 000000000..e22edafae --- /dev/null +++ b/testing/cinepaint/cinepaint-libpng15.patch @@ -0,0 +1,452 @@ +diff -Naur cinepaint.old/plug-ins/png/png.c cinepaint/plug-ins/png/png.c +--- cinepaint.old/plug-ins/png/png.c 2012-01-23 12:39:42.000000000 -0500 ++++ cinepaint/plug-ins/png/png.c 2012-01-23 12:39:50.000000000 -0500 +@@ -390,6 +390,16 @@ + gchar *progress; /* Title for progress display... */ + guchar alpha[256], /* Index -> Alpha */ + *alpha_ptr; /* Temporary pointer */ ++ png_byte color_type; ++ png_byte bit_depth; ++ png_colorp palette; ++ int num_palette; ++ png_charpp iccp_name; ++ int compression_type; ++ png_bytepp iccp_profile; ++ png_uint_32 iccp_proflen; ++ png_uint_32 width, height; ++ png_byte channels; + + /* + * PNG 0.89 and newer have a sane, forwards compatible constructor. +@@ -405,7 +415,7 @@ + info = (png_infop)calloc(sizeof(png_info), 1); + #endif /* PNG_LIBPNG_VER > 88 */ + +- if (setjmp (pp->jmpbuf)) ++ if (setjmp (png_jmpbuf(pp))) + { + g_message ("%s\nPNG error. File corrupted?", filename); + return image; +@@ -442,21 +452,26 @@ + */ + + png_read_info(pp, info); ++ color_type = png_get_color_type(pp, info); ++ width=png_get_image_width(pp, info); ++ height=png_get_image_height(pp, info); + + /* + * Latest attempt, this should be my best yet :) + */ + ++ bit_depth = png_get_bit_depth(pp, info); ++ + #ifndef WORDS_BIGENDIAN +- if(info->bit_depth == 16) ++ if(bit_depth == 16) + png_set_swap(pp); + #endif + +- if (info->color_type == PNG_COLOR_TYPE_GRAY && info->bit_depth < 8) { ++ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) { + png_set_expand(pp); + } + +- if (info->color_type == PNG_COLOR_TYPE_PALETTE && info->bit_depth < 8) { ++ if (color_type == PNG_COLOR_TYPE_PALETTE && bit_depth < 8) { + png_set_packing(pp); + } + +@@ -464,8 +479,8 @@ + * Expand G+tRNS to GA, RGB+tRNS to RGBA + */ + +- if (info->color_type != PNG_COLOR_TYPE_PALETTE && +- (info->valid & PNG_INFO_tRNS)) { ++ if (color_type != PNG_COLOR_TYPE_PALETTE && ++ (png_get_valid(pp, info, PNG_INFO_tRNS))) { + png_set_expand(pp); + } + +@@ -482,7 +497,7 @@ + + #if PNG_LIBPNG_VER > 99 + if (png_get_valid(pp, info, PNG_INFO_tRNS) && +- info->color_type == PNG_COLOR_TYPE_PALETTE) ++ color_type == PNG_COLOR_TYPE_PALETTE) + { + png_get_tRNS(pp, info, &alpha_ptr, &num, NULL); + /* Copy the existing alpha values from the tRNS chunk */ +@@ -505,9 +520,9 @@ + + png_read_update_info(pp, info); + +- if(info->bit_depth==16) ++ if(bit_depth==16) + { +- switch (info->color_type) ++ switch (color_type) + { + case PNG_COLOR_TYPE_RGB : /* RGB */ + bpp = 6; +@@ -545,7 +560,7 @@ + } + else + { +- switch (info->color_type) ++ switch (color_type) + { + case PNG_COLOR_TYPE_RGB : /* RGB */ + bpp = 3; +@@ -582,7 +597,7 @@ + }; + } + +- image = gimp_image_new(info->width, info->height, image_type); ++ image = gimp_image_new(width, height, image_type); + if (image == -1) + { + g_message("Can't allocate new image\n%s", filename); +@@ -595,7 +610,7 @@ + * Create the "background" layer to hold the image... + */ + +- layer = gimp_layer_new(image, _("Background"), info->width, info->height, ++ layer = gimp_layer_new(image, _("Background"), width, height, + layer_type, 100, NORMAL_MODE); + gimp_image_add_layer(image, layer, 0); + +@@ -627,20 +642,21 @@ + + empty= 0; /* by default assume no full transparent palette entries */ + +- if (info->color_type & PNG_COLOR_MASK_PALETTE) { ++ if (color_type & PNG_COLOR_MASK_PALETTE) { + + #if PNG_LIBPNG_VER > 99 ++ png_get_PLTE(pp, info, &palette, &num_palette); + if (png_get_valid(pp, info, PNG_INFO_tRNS)) { + for (empty= 0; empty < 256 && alpha[empty] == 0; ++empty); + /* Calculates number of fully transparent "empty" entries */ + +- gimp_image_set_cmap(image, (guchar *) (info->palette + empty), +- info->num_palette - empty); ++ gimp_image_set_cmap(image, (guchar *) (palette + empty), ++ num_palette - empty); + } else { +- gimp_image_set_cmap(image, (guchar *)info->palette, info->num_palette); ++ gimp_image_set_cmap(image, (guchar *)palette, num_palette); + } + #else +- gimp_image_set_cmap(image, (guchar *)info->palette, info->num_palette); ++ gimp_image_set_cmap(image, (guchar *)palette, num_palette); + #endif /* PNG_LIBPNG_VER > 99 */ + + } +@@ -659,18 +675,19 @@ + */ + + tile_height = gimp_tile_height (); +- pixel = g_new(guchar, tile_height * info->width * bpp); ++ pixel = g_new(guchar, tile_height * width * bpp); + pixels = g_new(guchar *, tile_height); ++ channels=png_get_channels(pp, info); + +- if(info->bit_depth==16) ++ if(bit_depth==16) + { + for (i = 0; i < tile_height; i ++) +- pixels[i] = pixel + info->width * info->channels * i * 2; ++ pixels[i] = pixel + width * channels * i * 2; + } + else + { + for (i = 0; i < tile_height; i ++) +- pixels[i] = pixel + info->width * info->channels * i; ++ pixels[i] = pixel + width * channels * i; + } + + for (pass = 0; pass < num_passes; pass ++) +@@ -680,11 +697,11 @@ + */ + + for (begin = 0, end = tile_height; +- begin < info->height; ++ begin < height; + begin += tile_height, end += tile_height) + { +- if (end > info->height) +- end = info->height; ++ if (end > height) ++ end = height; + + num = end - begin; + +@@ -697,20 +714,21 @@ + gimp_pixel_rgn_set_rect(&pixel_rgn, pixel, 0, begin, + drawable->width, num); + +- gimp_progress_update(((double)pass + (double)end / (double)info->height) / ++ gimp_progress_update(((double)pass + (double)end / (double)height) / + (double)num_passes); + }; + }; + + #if defined(PNG_iCCP_SUPPORTED) + /* set icc profile */ +- if (info->iccp_proflen > 0) { +- gimp_image_set_icc_profile_by_mem (image, info->iccp_proflen, +- info->iccp_profile, +- ICC_IMAGE_PROFILE); ++ png_get_iCCP(pp, info, (png_charpp)iccp_name, &compression_type, iccp_profile, &iccp_proflen); ++ if (iccp_proflen > 0) { ++ gimp_image_set_icc_profile_by_mem (image, iccp_proflen, ++ (gchar *)iccp_profile, ++ ICC_IMAGE_PROFILE); + printf ("%s:%d %s() set embedded profile \"%s\"\n", + __FILE__,__LINE__,__func__, +- info->iccp_name); ++ (char *)iccp_name); + } + #endif + +@@ -808,6 +826,14 @@ + blue; /* Used for palette background */ + time_t cutime; /* Time since epoch */ + struct tm *gmt; /* GMT broken down */ ++ png_byte color_type; ++ png_byte bit_depth; ++ int filter_method=0; ++ png_colorp palette; ++ int num_palette; ++ png_charpp iccp_name; ++ png_uint_32 height; ++ int compression_type; + + /* + * PNG 0.89 and newer have a sane, forwards compatible constructor. +@@ -824,7 +849,7 @@ + info = (png_infop)calloc(sizeof(png_info), 1); + #endif /* PNG_LIBPNG_VER > 88 */ + +- if (setjmp (pp->jmpbuf)) ++ if (setjmp (png_jmpbuf(pp))) + { + g_message ("%s\nPNG error. Couldn't save image", filename); + return 0; +@@ -857,15 +882,6 @@ + drawable = gimp_drawable_get (drawable_ID); + type = gimp_drawable_type (drawable_ID); + +- /* +- * Set the image dimensions, bit depth, interlacing and compression +- */ +- +- png_set_compression_level (pp, pngvals.compression_level); +- +- info->width = drawable->width; +- info->height = drawable->height; +- info->interlace_type = pngvals.interlaced; + + /* + * Set color type and remember bytes per pixel count +@@ -874,71 +890,69 @@ + switch (type) + { + case RGB_IMAGE : +- info->color_type = PNG_COLOR_TYPE_RGB; +- info->bit_depth = 8; ++ color_type = PNG_COLOR_TYPE_RGB; ++ bit_depth = 8; + bpp = 3; + break; + case RGBA_IMAGE : +- info->color_type = PNG_COLOR_TYPE_RGB_ALPHA; +- info->bit_depth = 8; ++ color_type = PNG_COLOR_TYPE_RGB_ALPHA; ++ bit_depth = 8; + bpp = 4; + break; + case GRAY_IMAGE : +- info->color_type = PNG_COLOR_TYPE_GRAY; +- info->bit_depth = 8; ++ color_type = PNG_COLOR_TYPE_GRAY; ++ bit_depth = 8; + bpp = 1; + break; + case GRAYA_IMAGE : +- info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA; +- info->bit_depth = 8; ++ color_type = PNG_COLOR_TYPE_GRAY_ALPHA; ++ bit_depth = 8; + bpp = 2; + break; + case INDEXED_IMAGE : + bpp = 1; +- info->bit_depth = 8; +- info->color_type = PNG_COLOR_TYPE_PALETTE; +- info->valid |= PNG_INFO_PLTE; +- info->palette= (png_colorp) gimp_image_get_cmap(image_ID, &num_colors); +- info->num_palette= num_colors; ++ bit_depth = 8; ++ color_type = PNG_COLOR_TYPE_PALETTE; ++ png_get_valid(pp, info, PNG_INFO_PLTE); ++ png_set_PLTE(pp, info, (png_colorp) gimp_image_get_cmap(image_ID, &num_colors), num_colors); + break; + case INDEXEDA_IMAGE : + bpp = 2; +- info->bit_depth = 8; +- info->color_type = PNG_COLOR_TYPE_PALETTE; ++ bit_depth = 8; ++ color_type = PNG_COLOR_TYPE_PALETTE; + respin_cmap (pp, info, image_ID); /* fix up transparency */ + break; + case U16_RGB_IMAGE : +- info->color_type = PNG_COLOR_TYPE_RGB; +- info->bit_depth = 16; ++ color_type = PNG_COLOR_TYPE_RGB; ++ bit_depth = 16; + bpp = 6; + break; + case U16_RGBA_IMAGE : +- info->color_type = PNG_COLOR_TYPE_RGB_ALPHA; +- info->bit_depth = 16; ++ color_type = PNG_COLOR_TYPE_RGB_ALPHA; ++ bit_depth = 16; + bpp = 8; + break; + case U16_GRAY_IMAGE : +- info->color_type = PNG_COLOR_TYPE_GRAY; +- info->bit_depth = 16; ++ color_type = PNG_COLOR_TYPE_GRAY; ++ bit_depth = 16; + bpp = 2; + break; + case U16_GRAYA_IMAGE : +- info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA; +- info->bit_depth = 16; ++ color_type = PNG_COLOR_TYPE_GRAY_ALPHA; ++ bit_depth = 16; + bpp = 4; + break; + case U16_INDEXED_IMAGE : + bpp = 2; +- info->bit_depth = 16; +- info->color_type = PNG_COLOR_TYPE_PALETTE; +- info->valid |= PNG_INFO_PLTE; +- info->palette= (png_colorp) gimp_image_get_cmap(image_ID, &num_colors); +- info->num_palette= num_colors; ++ bit_depth = 16; ++ color_type = PNG_COLOR_TYPE_PALETTE; ++ png_get_valid(pp, info, PNG_INFO_PLTE); ++ png_set_PLTE(pp, info, (png_colorp) gimp_image_get_cmap(image_ID, &num_colors), num_colors); + break; + case U16_INDEXEDA_IMAGE : + bpp = 4; +- info->bit_depth = 16; +- info->color_type = PNG_COLOR_TYPE_PALETTE; ++ bit_depth = 16; ++ color_type = PNG_COLOR_TYPE_PALETTE; + respin_cmap (pp, info, image_ID); /* fix up transparency */ + break; + default: +@@ -950,30 +964,36 @@ + * Fix bit depths for (possibly) smaller colormap images + */ + +- if (info->valid & PNG_INFO_PLTE) { +- if (info->num_palette <= 2) +- info->bit_depth= 1; +- else if (info->num_palette <= 4) +- info->bit_depth= 2; +- else if (info->num_palette <= 16) +- info->bit_depth= 4; ++ if (png_get_valid(pp, info, PNG_INFO_PLTE)) { ++ png_get_PLTE(pp, info, &palette, &num_palette); ++ if (num_palette <= 2) ++ bit_depth= 1; ++ else if (num_palette <= 4) ++ bit_depth= 2; ++ else if (num_palette <= 16) ++ bit_depth= 4; + /* otherwise the default is fine */ + } + ++ png_set_compression_level (pp, pngvals.compression_level); ++ png_set_IHDR(pp, info, drawable->width, drawable->height, ++ bit_depth, color_type, pngvals.interlaced, compression_type, filter_method); ++ ++ + // write icc profile + #if defined(PNG_iCCP_SUPPORTED) + if (gimp_image_has_icc_profile (image_ID, ICC_IMAGE_PROFILE)) { +- int size; ++ int size; + char *buffer; + + buffer = gimp_image_get_icc_profile_by_mem (image_ID, &size, + ICC_IMAGE_PROFILE); + png_set_iCCP (pp, info, + gimp_image_get_icc_profile_description (image_ID, ICC_IMAGE_PROFILE), +- 0, buffer, size); ++ 0, (png_const_bytep)buffer, size); + printf ("%s:%d %s() embedd icc profile \"%s\"\n", + __FILE__,__LINE__,__func__, +- info->iccp_name); ++ (char *)iccp_name); + } + #endif + +@@ -1039,13 +1059,13 @@ + * Convert unpacked pixels to packed if necessary + */ + +- if (info->color_type == PNG_COLOR_TYPE_PALETTE && info->bit_depth < 8) ++ if (color_type == PNG_COLOR_TYPE_PALETTE && bit_depth < 8) + png_set_packing(pp); + + /* Set swapping for 16 bit per sample images */ + + #ifndef WORDS_BIGENDIAN +- if (info->bit_depth == 16) ++ if (bit_depth == 16) + png_set_swap(pp); + #endif + +@@ -1063,6 +1083,7 @@ + + gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0, drawable->width, + drawable->height, FALSE, FALSE); ++ height=png_get_image_height(pp, info); + + for (pass = 0; pass < num_passes; pass ++) + { +@@ -1077,7 +1098,7 @@ + num = end - begin; + + gimp_pixel_rgn_get_rect (&pixel_rgn, pixel, 0, begin, drawable->width, num); +- if (info->valid & PNG_INFO_tRNS) { ++ if (png_get_valid(pp, info, PNG_INFO_tRNS)) { + for (i = 0; i < num; ++i) { + fixed= pixels[i]; + for (k = 0; k < drawable->width; ++k) { +@@ -1085,7 +1106,7 @@ + } + } + /* Forgot this case before, what if there are too many colors? */ +- } else if (info->valid & PNG_INFO_PLTE && bpp == 2) { ++ } else if (png_get_valid(pp, info, PNG_INFO_PLTE) && bpp == 2) { + for (i = 0; i < num; ++i) { + fixed= pixels[i]; + for (k = 0; k < drawable->width; ++k) { +@@ -1095,9 +1116,8 @@ + } + + png_write_rows (pp, pixels, num); +- + gimp_progress_update (((double)pass + (double)end / +- (double)info->height) / (double)num_passes); ++ (double)height) / (double)num_passes); + }; + }; + diff --git a/testing/cinepaint/cinepaint-missing-include.patch b/testing/cinepaint/cinepaint-missing-include.patch new file mode 100644 index 000000000..ed159213a --- /dev/null +++ b/testing/cinepaint/cinepaint-missing-include.patch @@ -0,0 +1,11 @@ +diff -Naur cinepaint-orig/plug-ins/icc_examin/icc_examin/icc_modell_beobachter.cpp cinepaint/plug-ins/icc_examin/icc_examin/icc_modell_beobachter.cpp +--- cinepaint-orig/plug-ins/icc_examin/icc_examin/icc_modell_beobachter.cpp 2012-04-20 18:51:10.625503826 -0400 ++++ cinepaint/plug-ins/icc_examin/icc_examin/icc_modell_beobachter.cpp 2012-04-20 18:52:04.478835055 -0400 +@@ -32,6 +32,7 @@ + + #include <list> + #include <string> ++#include <unistd.h> + + #include "icc_modell_beobachter.h" + diff --git a/testing/cinepaint/cinepaint.install b/testing/cinepaint/cinepaint.install new file mode 100644 index 000000000..5e5cfef4d --- /dev/null +++ b/testing/cinepaint/cinepaint.install @@ -0,0 +1,11 @@ +post_install() { + update-desktop-database -q +} + +post_upgrade() { + post_install $1 +} + +post_remove() { + update-desktop-database -q +} diff --git a/testing/cups/PKGBUILD b/testing/cups/PKGBUILD new file mode 100644 index 000000000..2cd366016 --- /dev/null +++ b/testing/cups/PKGBUILD @@ -0,0 +1,174 @@ +# $Id: PKGBUILD 161631 2012-06-12 16:40:20Z andyrtr $ +# Maintainer: Andreas Radke <andyrtr@archlinux.org> + +pkgbase="cups" +pkgname=('libcups' 'cups') +pkgver=1.5.3 +pkgrel=5 +arch=('i686' 'x86_64') +license=('GPL') +url="http://www.cups.org/" +makedepends=('libtiff>=4.0.0' 'libpng>=1.5.7' 'acl' 'openslp' 'pam' 'xdg-utils' 'krb5' 'gnutls>=2.8.3' 'cups-filters' 'bc' + 'xinetd' 'gzip' 'autoconf' 'php' 'libusb' 'dbus-core' 'avahi' 'hicolor-icon-theme' 'systemd') +source=(ftp://ftp.easysw.com/pub/cups/${pkgver}/cups-${pkgver}-source.tar.bz2 + cups-avahi-1-config.patch + cups-avahi-2-backend.patch + cups-avahi-3-timeouts.patch + cups-avahi-4-poll.patch + cups-avahi-5-services.patch + cups-no-export-ssllibs.patch + cups-no-gcrypt.patch + cups-no-gzip-man.patch + cups-systemd-socket.patch + cups cups.logrotate cups.pam) +#options=('!emptydirs') +md5sums=('e1ad15257aa6f162414ea3beae0c5df8' + '12c8af5bcd3b8f84240280b3dfaf9e89' + 'cdc1322c8014297ae349e2db78a03c5a' + '1a5112f63958643f2888abc9418dbcac' + 'c37d1bf1bb76acc3fe93362c80d91b7c' + '5d302860559960042f3b47a91b97c5fe' + '9b8467a1e51d360096b70e2c3c081e6c' + '3733c23e77eb503bd94cc368e02830dc' + 'c9159ba1233902ba6ddbbe6885a46b72' + '4505b8b2c57a7c28ea79e08388bbbbb9' + '9657daa21760bb0b5fa3d8b51d5e01a1' + 'f861b18f4446c43918c8643dcbbd7f6d' + '96f82c38f3f540b53f3e5144900acf17') + +build() { + cd ${srcdir}/${pkgbase}-${pkgver} + # http://www.cups.org/str.php?L3066 + # Avahi support in the dnssd backend. patches from upstream/FC RawHide + patch -Np1 -i ${srcdir}/cups-avahi-1-config.patch + patch -Np1 -i ${srcdir}/cups-avahi-2-backend.patch + patch -Np1 -i ${srcdir}/cups-avahi-3-timeouts.patch + patch -Np1 -i ${srcdir}/cups-avahi-4-poll.patch + patch -Np1 -i ${srcdir}/cups-avahi-5-services.patch + + # add systemd socket support - Fedora patch, also used in Gentoo + patch -Np1 -i ${srcdir}/cups-systemd-socket.patch + + # Do not export SSL libs in cups-config + patch -Np1 -i "${srcdir}/cups-no-export-ssllibs.patch" + + patch -Np1 -i "${srcdir}/cups-no-gcrypt.patch" + # don't zip man pages in make install, let makepkg do that / Fedora + patch -Np1 -i ${srcdir}/cups-no-gzip-man.patch + + # Rebuild configure script for --enable-avahi. + aclocal -I config-scripts + autoconf -I config-scripts + + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ + --libdir=/usr/lib \ + --with-systemdsystemunitdir=/usr/lib/systemd/system \ + --with-logdir=/var/log/cups \ + --with-docdir=/usr/share/cups/doc \ + --with-cups-user=daemon \ + --with-cups-group=lp \ + --enable-pam=yes \ + --disable-ldap \ + --enable-raw-printing \ + --enable-dbus --with-dbusdir=/etc/dbus-1 \ + --enable-ssl=yes --enable-gnutls \ + --enable-threads \ + --enable-avahi\ + --with-php=/usr/bin/php-cgi \ + --with-pdftops=pdftops \ + --with-optim="$CFLAGS" + make +} + +check() { + cd "$srcdir/$pkgbase-$pkgver" + #httpAddrGetList(workstation64): FAIL + #1 TESTS FAILED! + #make[1]: *** [testhttp] Error 1 + make -k check || /bin/true +} + +package_libcups() { +pkgdesc="The CUPS Printing System - client libraries and headers" +depends=('gnutls>=2.8.3' 'libtiff>=4.0.0' 'libpng>=1.5.7' 'krb5' 'avahi') +backup=(etc/cups/client.conf) + + cd ${srcdir}/${pkgbase}-${pkgver} + make BUILDROOT=${pkgdir} install-headers install-libs + # 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 + + # install client.conf man page and config file + install -dm755 ${pkgdir}/usr/share/man/man5 + #install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5.gz ${pkgdir}/usr/share/man/man5/ + install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5 ${pkgdir}/usr/share/man/man5/ + install -dm755 ${pkgdir}/etc/cups + 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 + chgrp lp ${pkgdir}/etc/cups/client.conf +} + +package_cups() { +pkgdesc="The CUPS Printing System - daemon package" +install=cups.install +backup=(etc/cups/cupsd.conf + etc/cups/snmp.conf + etc/cups/printers.conf + etc/cups/classes.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}" 'cups-filters' 'bc' 'libusb' 'dbus-core' 'libsystemd' 'hicolor-icon-theme') +optdepends=('php: for included phpcups.so module' + 'xdg-utils: xdg .desktop file support') + + cd ${srcdir}/${pkgbase}-${pkgver} + make BUILDROOT=${pkgdir} install-data install-exec + + # 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/cupsd + 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 + + # install ssl directory where to store the certs, solves some samba issues + install -dm700 -g lp ${pkgdir}/etc/cups/ssl + # remove directory from package, we create it in cups rc.d file + rm -rf ${pkgdir}/var/run + + # 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/subscriptions.conf + chgrp lp ${pkgdir}/etc/cups/{printers.conf,classes.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 + + # remove client.conf man page + rm -f ${pkgdir}/usr/share/man/man5/client.conf.5 + + # remove files now part of cups-filters - check cups-filters INSTALL for packagers instructions + rm -v ${pkgdir}/usr/lib/cups/backend/{parallel,serial} + rm -v ${pkgdir}/usr/lib/cups/filter/{bannertops,commandtoescpx,commandtopclx,imagetops,imagetoraster,pdftops,rastertoescpx,rastertopclx,texttops} + rm -v ${pkgdir}/usr/share/cups/banners/* + rm -v ${pkgdir}/usr/share/cups/data/{testprint,psglyphs} + rm -v ${pkgdir}/usr/share/cups/fonts/* + # comment out all conversion rules which use any of the removed filters + perl -p -i -e 's:^(.*\s+(pdftops|texttops|imagetops|bannertops|imagetoraster)\s*)$:#\1:' ${pkgdir}/usr/share/cups/mime/mime.convs +} diff --git a/testing/cups/PKGBUILD.16 b/testing/cups/PKGBUILD.16 new file mode 100644 index 000000000..01faba047 --- /dev/null +++ b/testing/cups/PKGBUILD.16 @@ -0,0 +1,146 @@ +# $Id: PKGBUILD 159509 2012-05-25 16:34:34Z andyrtr $ +# Maintainer: Andreas Radke <andyrtr@archlinux.org> + +pkgbase="cups" +pkgname=('libcups' 'cups') +pkgver=1.6b1 +pkgrel=1 +arch=('i686' 'x86_64') +license=('GPL') +url="http://www.cups.org/" +makedepends=('libtiff>=4.0.0' 'libpng>=1.5.7' 'acl' 'openslp' 'pam' 'xdg-utils' 'krb5' 'gnutls>=2.8.3' 'cups-filters' 'bc' 'colord' + 'xinetd' 'gzip' 'autoconf' 'libusb' 'dbus-core' 'avahi' 'hicolor-icon-theme') +source=(ftp://ftp.easysw.com/pub/cups/${pkgver}/cups-${pkgver}-source.tar.bz2 + cups-no-export-ssllibs.patch + cups-no-gcrypt.patch + cups-no-gzip-man.patch + cups cups.logrotate cups.pam) +#options=('!emptydirs') +md5sums=('468a40755a872d84be89111ce97a69d1' + '9b8467a1e51d360096b70e2c3c081e6c' + '3733c23e77eb503bd94cc368e02830dc' + '90c30380d4c8cd48a908cfdadae1ea24' + '9657daa21760bb0b5fa3d8b51d5e01a1' + 'f861b18f4446c43918c8643dcbbd7f6d' + '96f82c38f3f540b53f3e5144900acf17') + +build() { + cd ${srcdir}/${pkgbase}-${pkgver} + + # Do not export SSL libs in cups-config + patch -Np1 -i "${srcdir}/cups-no-export-ssllibs.patch" + + patch -Np1 -i "${srcdir}/cups-no-gcrypt.patch" + # don't zip man pages in make install, let makepkg do that / Fedora + patch -Np1 -i ${srcdir}/cups-no-gzip-man.patch + + # Rebuild configure script for not zipping man-pages. + aclocal -I config-scripts + autoconf -I config-scripts + + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ + --libdir=/usr/lib \ + --with-logdir=/var/log/cups \ + --with-docdir=/usr/share/cups/doc \ + --with-cups-user=daemon \ + --with-cups-group=lp \ + --enable-pam=yes \ + --enable-raw-printing \ + --enable-dbus --with-dbusdir=/etc/dbus-1 \ + --enable-ssl=yes --enable-gnutls \ + --enable-threads \ + --enable-avahi\ + --with-php=/usr/bin/php-cgi \ + --with-optim="$CFLAGS" + make +} + +check() { + cd "$srcdir/$pkgbase-$pkgver" + #httpAddrGetList(workstation64): FAIL + #1 TESTS FAILED! + #make[1]: *** [testhttp] Error 1 + make -k check || /bin/true +} + +package_libcups() { +pkgdesc="The CUPS Printing System - client libraries and headers" +depends=('gnutls>=2.8.3' 'libtiff>=4.0.0' 'libpng>=1.5.7' 'krb5' 'avahi') +backup=(etc/cups/client.conf) + + cd ${srcdir}/${pkgbase}-${pkgver} + make BUILDROOT=${pkgdir} install-headers install-libs + # 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 + + # install client.conf man page and config file + install -dm755 ${pkgdir}/usr/share/man/man5 + #install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5.gz ${pkgdir}/usr/share/man/man5/ + install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5 ${pkgdir}/usr/share/man/man5/ + install -dm755 ${pkgdir}/etc/cups + 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 + chgrp lp ${pkgdir}/etc/cups/client.conf +} + +package_cups() { +pkgdesc="The CUPS Printing System - daemon package" +install=cups.install +backup=(etc/cups/cupsd.conf + etc/cups/snmp.conf + etc/cups/printers.conf + etc/cups/classes.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}" 'cups-filters' 'bc' 'libusb' 'dbus-core' 'hicolor-icon-theme') +optdepends=('xdg-utils: xdg .desktop file support') + + cd ${srcdir}/${pkgbase}-${pkgver} + make BUILDROOT=${pkgdir} install-data install-exec + + # 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/cupsd + 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 + + # install ssl directory where to store the certs, solves some samba issues + install -dm700 -g lp ${pkgdir}/etc/cups/ssl + # remove directory from package, we create it in cups rc.d file + rm -rf ${pkgdir}/var/run + + # 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/subscriptions.conf + chgrp lp ${pkgdir}/etc/cups/{printers.conf,classes.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 + + # remove client.conf man page + rm -f ${pkgdir}/usr/share/man/man5/client.conf.5 + + # remove files now part of cups-filters + rm -v ${pkgdir}/usr/lib/cups/filter/bannertops + rm -v ${pkgdir}/usr/share/cups/banners/* + rm -v ${pkgdir}/usr/share/cups/data/testprint + # comment out all conversion rules which use any of the removed filters + perl -p -i -e 's:^(.*\s+bannertops\s*)$:#\1:' /usr/share/cups/mime/mime.convs +} diff --git a/testing/cups/cups b/testing/cups/cups new file mode 100755 index 000000000..744c8e663 --- /dev/null +++ b/testing/cups/cups @@ -0,0 +1,68 @@ +#!/bin/bash + +daemon_name=cupsd + +. /etc/rc.conf +. /etc/rc.d/functions +#. /etc/conf.d/$daemon_name.conf + +get_pid() { + pidof -o %PPID $daemon_name +} + +case "$1" in + start) + stat_busy "Starting $daemon_name daemon" + + PID=$(get_pid) + if [ -z "$PID" ]; then + [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid + # RUN + $daemon_name + # + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + echo $(get_pid) > /var/run/$daemon_name.pid + add_daemon $daemon_name + stat_done + fi + else + stat_fail + exit 1 + fi + ;; + + stop) + stat_busy "Stopping $daemon_name daemon" + PID=$(get_pid) + # KILL + [ ! -z "$PID" ] && kill $PID &> /dev/null + # + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + rm -f /var/run/$daemon_name.pid &> /dev/null + rm_daemon $daemon_name + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + status) + stat_busy "Checking $daemon_name status"; + ck_status $daemon_name + ;; + + *) + echo "usage: $0 {start|stop|restart|status}" +esac + +exit 0 diff --git a/testing/cups/cups-avahi-1-config.patch b/testing/cups/cups-avahi-1-config.patch new file mode 100644 index 000000000..304cd2607 --- /dev/null +++ b/testing/cups/cups-avahi-1-config.patch @@ -0,0 +1,42 @@ +diff -up cups-1.5.2/config.h.in.avahi-1-config cups-1.5.2/config.h.in +--- cups-1.5.2/config.h.in.avahi-1-config 2011-06-16 21:12:16.000000000 +0100 ++++ cups-1.5.2/config.h.in 2012-03-14 15:04:51.365347165 +0000 +@@ -390,6 +390,13 @@ + + + /* ++ * Do we have Avahi for DNS Service Discovery? ++ */ ++ ++#undef HAVE_AVAHI ++ ++ ++/* + * Do we have <sys/ioctl.h>? + */ + +diff -up cups-1.5.2/config-scripts/cups-dnssd.m4.avahi-1-config cups-1.5.2/config-scripts/cups-dnssd.m4 +--- cups-1.5.2/config-scripts/cups-dnssd.m4.avahi-1-config 2011-05-12 06:21:56.000000000 +0100 ++++ cups-1.5.2/config-scripts/cups-dnssd.m4 2012-03-14 15:04:51.365347165 +0000 +@@ -23,6 +23,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
\ No newline at end of file diff --git a/testing/cups/cups-avahi-2-backend.patch b/testing/cups/cups-avahi-2-backend.patch new file mode 100644 index 000000000..00e12a0a3 --- /dev/null +++ b/testing/cups/cups-avahi-2-backend.patch @@ -0,0 +1,1118 @@ +diff -up cups-1.5.3/backend/dnssd.c.avahi-2-backend cups-1.5.3/backend/dnssd.c +--- cups-1.5.3/backend/dnssd.c.avahi-2-backend 2012-05-15 16:53:18.164774446 +0200 ++++ cups-1.5.3/backend/dnssd.c 2012-05-15 17:09:07.684155704 +0200 +@@ -15,14 +15,21 @@ + * + * Contents: + * ++ * next_txt_record() - Get next TXT record from a cups_txt_records_t. ++ * parse_txt_record_pair() - Read key/value pair in cups_txt_records_t. + * main() - Browse for printers. + * browse_callback() - Browse devices. + * browse_local_callback() - Browse local devices. + * compare_devices() - Compare two devices. + * exec_backend() - Execute the backend that corresponds to the + * resolved service name. ++ * device_type() - Get DNS-SD type enumeration from string. + * get_device() - Create or update a device. + * query_callback() - Process query data. ++ * avahi_client_callback() - Avahi client callback function. ++ * avahi_query_callback() - Avahi query callback function. ++ * avahi_browse_callback() - Avahi browse callback function. ++ * find_device() - Find a device from its name and domain. + * sigterm_handler() - Handle termination signals... + * unquote() - Unquote a name string. + */ +@@ -33,7 +40,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 */ + + + /* +@@ -53,7 +71,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 */ +@@ -65,6 +88,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... +@@ -78,6 +115,7 @@ static int job_canceled = 0; + * Local functions... + */ + ++#ifdef HAVE_DNSSD + static void browse_callback(DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, +@@ -95,13 +133,6 @@ static void browse_local_callback(DNSSe + const char *replyDomain, + void *context) + __attribute__((nonnull(1,5,6,7,8))); +-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) +- __attribute__((nonnull(1,2,3,4))); + static void query_callback(DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, +@@ -111,10 +142,119 @@ static void query_callback(DNSServiceRe + const void *rdata, uint32_t ttl, + void *context) + __attribute__((nonnull(1,5,9,11))); ++#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) ++ __attribute__((nonnull(1,2,3,4))); + static void sigterm_handler(int sig); + static void unquote(char *dst, const char *src, size_t dstsize) + __attribute__((nonnull(1,2))); + ++#ifdef HAVE_AVAHI ++static AvahiSimplePoll *simple_poll = NULL; ++static int avahi_got_callback; ++#endif /* HAVE_AVAHI */ ++ ++ ++/* ++ * 'next_txt_record()' - Get next TXT record from a cups_txt_records_t. ++ */ ++ ++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; ++} ++ ++ ++/* ++ * 'parse_txt_record_pair()' - Read key/value pair in cups_txt_records_t. ++ */ ++ ++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. +@@ -125,6 +265,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 */ +@@ -138,12 +285,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 */ +@@ -203,6 +349,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 ("DEBUG: Unable to create avahi client"); ++ return (0); ++ } ++ ++ 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"); +@@ -263,6 +452,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... +@@ -270,6 +460,9 @@ main(int argc, /* I - Number of comm + + while (!job_canceled) + { ++ int announce = 0; ++ ++#ifdef HAVE_DNSSD + FD_ZERO(&input); + FD_SET(fd, &input); + +@@ -289,11 +482,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 */ +@@ -307,6 +524,7 @@ main(int argc, /* I - Number of comm + if (device->sent) + sent ++; + ++#ifdef HAVE_DNSSD + if (device->ref) + count ++; + +@@ -338,14 +556,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; +@@ -406,6 +633,7 @@ main(int argc, /* I - Number of comm + } + + ++#ifdef HAVE_DNSSD + /* + * 'browse_callback()' - Browse devices. + */ +@@ -494,6 +722,7 @@ browse_local_callback( + device->fullName); + device->sent = 1; + } ++#endif /* HAVE_DNSSD */ + + + /* +@@ -574,6 +803,41 @@ exec_backend(char **argv) /* I - Comman + + + /* ++ * 'device_type()' - Get DNS-SD type enumeration from string. ++ */ ++ ++static int ++device_type (const char *regtype) ++{ ++#ifdef HAVE_AVAHI ++ if (!strcmp(regtype, "_ipp._tcp")) ++ return (CUPS_DEVICE_IPP); ++ else if (!strcmp(regtype, "_ipps._tcp") || ++ !strcmp(regtype, "_ipp-tls._tcp")) ++ return (CUPS_DEVICE_IPPS); ++ 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.")) ++ return (CUPS_DEVICE_IPP); ++ else if (!strcmp(regtype, "_ipps._tcp.") || ++ !strcmp(regtype, "_ipp-tls._tcp.")) ++ return (CUPS_DEVICE_IPPS); ++ 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. + */ + +@@ -594,20 +858,7 @@ get_device(cups_array_t *devices, /* I - + */ + + key.name = (char *)serviceName; +- +- if (!strcmp(regtype, "_ipp._tcp.")) +- key.type = CUPS_DEVICE_IPP; +- else if (!strcmp(regtype, "_ipps._tcp.") || +- !strcmp(regtype, "_ipp-tls._tcp.")) +- key.type = CUPS_DEVICE_IPPS; +- 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; +@@ -627,8 +878,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); + } +@@ -648,6 +905,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); + +@@ -655,13 +915,20 @@ 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); + } + + ++#ifdef HAVE_DNSSD + /* + * 'query_callback()' - Process query data. + */ +@@ -685,7 +952,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\", " +@@ -719,94 +986,233 @@ query_callback( + if ((ptr = strstr(name, "._")) != NULL) + *ptr = '\0'; + +- if (strstr(fullName, "_ipp._tcp.")) +- dkey.type = CUPS_DEVICE_IPP; +- else if (strstr(fullName, "_ipps._tcp.") || +- strstr(fullName, "_ipp-tls._tcp.")) +- dkey.type = CUPS_DEVICE_IPPS; +- 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 ++/* ++ * 'avahi_client_callback()' - Avahi client callback function. ++ */ ++ ++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); ++ } ++} ++ ++ ++/* ++ * 'avahi_query_callback()' - Avahi query callback function. ++ */ ++ ++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); + +- for (device = cupsArrayFind(devices, &dkey); ++ avahi_service_resolver_free (resolver); ++} ++ ++ ++/* ++ * 'avahi_browse_callback()' - Avahi browse callback function. ++ */ ++ ++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; ++ ++ case AVAHI_BROWSER_REMOVE: ++ case AVAHI_BROWSER_ALL_FOR_NOW: ++ case AVAHI_BROWSER_CACHE_EXHAUSTED: ++ break; ++ } ++} ++#endif /* HAVE_AVAHI */ ++ ++ ++/* ++ * 'find_device()' - Find a device from its name and domain. ++ */ ++ ++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 (_cups_strcasecmp(device->name, dkey.name) || +- _cups_strcasecmp(device->domain, dkey.domain)) ++ if (_cups_strcasecmp(device->name, dkey->name) || ++ _cups_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; +- +- for (ptr = key; data < datanext && *data != '='; data ++) +- *ptr++ = *data; +- *ptr = '\0'; ++ char *key; ++ char *value; + +- if (data < datanext && *data == '=') +- { +- data ++; +- +- if (data < datanext) +- memcpy(value, data, datanext - data); +- value[datanext - data] = '\0'; ++ if (parse_txt_record_pair (txt)) ++ goto next; + +- fprintf(stderr, "DEBUG2: query_callback: \"%s=%s\".\n", +- key, value); +- } +- else +- { +- fprintf(stderr, "DEBUG2: query_callback: \"%s\" with no value.\n", +- key); +- continue; +- } +- +- if (!_cups_strncasecmp(key, "usb_", 4)) ++ key = txt->key; ++ value = txt->value; ++ if (!strncasecmp(key, "usb_", 4)) + { + /* + * Add USB device ID information... +@@ -861,6 +1267,10 @@ query_callback( + if (device->type == CUPS_DEVICE_PRINTER) + device->sent = 1; + } ++ ++ next: ++ if (next_txt_record (txt) == NULL) ++ break; + } + + if (device->device_id) +@@ -917,11 +1327,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.5.3/cups/http-support.c.avahi-2-backend cups-1.5.3/cups/http-support.c +--- cups-1.5.3/cups/http-support.c.avahi-2-backend 2012-02-15 02:06:12.000000000 +0100 ++++ cups-1.5.3/cups/http-support.c 2012-05-15 17:04:51.045944634 +0200 +@@ -43,6 +43,10 @@ + * http_copy_decode() - Copy and decode a URI. + * http_copy_encode() - Copy and encode a URI. + * http_resolve_cb() - Build a device URI for the given service name. ++ * avahi_resolve_uri_client_cb() ++ * - Avahi client callback for resolving URI. ++ * avahi_resolve_uri_resolver_cb() ++ * - Avahi resolver callback for resolving URI. + */ + + /* +@@ -60,6 +64,11 @@ + # include <sys/select.h> + # endif /* WIN32 */ + #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 */ + + + /* +@@ -127,6 +136,24 @@ static void DNSSD_API http_resolve_cb(DN + 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 +@@ -1434,6 +1461,9 @@ _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 + # ifdef WIN32 + # pragma comment(lib, "dnssd.lib") +@@ -1452,6 +1482,17 @@ _httpResolveURI( + fd_set input_set; /* Input set for select() */ + struct timeval stimeout; /* Timeout value for select() */ + #endif /* HAVE_POLL */ ++#else /* HAVE_AVAHI */ ++ AvahiSimplePoll *simple_poll; ++ AvahiClient *client; ++ int error; ++ struct ++ { ++ AvahiSimplePoll *poll; ++ _http_uribuf_t uribuf; ++ } user_data; ++#endif /* HAVE_DNSSD */ ++ + + if (options & _HTTP_RESOLVE_STDERR) + fprintf(stderr, "DEBUG: Resolving \"%s\"...\n", hostname); +@@ -1488,9 +1529,16 @@ _httpResolveURI( + if (domain) + *domain++ = '\0'; + ++#ifdef HAVE_DNSSD + uribuf.buffer = resolved_uri; + uribuf.bufsize = resolved_size; + uribuf.options = options; ++#else ++ user_data.uribuf.buffer = resolved_uri; ++ user_data.uribuf.bufsize = resolved_size; ++ user_data.uribuf.options = options; ++#endif ++ + resolved_uri[0] = '\0'; + + DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", " +@@ -1504,6 +1552,7 @@ _httpResolveURI( + + uri = NULL; + ++#ifdef HAVE_DNSSD + if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError) + { + localref = ref; +@@ -1611,6 +1660,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 (options & _HTTP_RESOLVE_STDERR) + { +@@ -1622,13 +1701,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 ((options & _HTTP_RESOLVE_STDERR) && !uri) + _cupsLangPrintFilter(stderr, "ERROR", _("Unable to find printer.")); +@@ -1916,6 +1995,115 @@ http_resolve_cb( + } + #endif /* HAVE_DNSSD */ + ++#ifdef HAVE_AVAHI ++/* ++ * 'avahi_resolve_uri_client_cb()' - Avahi client callback for resolving URI. ++ */ ++ ++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); ++} ++ ++ ++/* ++ * 'avahi_resolve_uri_resolver_cb()' - Avahi resolver callback for resolving ++ * URI. ++ */ ++ ++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 10284 2012-02-15 01:06:12Z mike $".
\ No newline at end of file diff --git a/testing/cups/cups-avahi-3-timeouts.patch b/testing/cups/cups-avahi-3-timeouts.patch new file mode 100644 index 000000000..daf852a0f --- /dev/null +++ b/testing/cups/cups-avahi-3-timeouts.patch @@ -0,0 +1,381 @@ +diff -up cups-1.5.2/scheduler/cupsd.h.avahi-3-timeouts cups-1.5.2/scheduler/cupsd.h +--- cups-1.5.2/scheduler/cupsd.h.avahi-3-timeouts 2011-05-11 23:17:34.000000000 +0100 ++++ cups-1.5.2/scheduler/cupsd.h 2012-03-14 15:06:36.509476983 +0000 +@@ -140,6 +140,15 @@ extern const char *cups_hstrerror(int); + + typedef void (*cupsd_selfunc_t)(void *data); + ++#ifdef HAVE_AVAHI ++/* ++ * Timeout callback function type... ++ */ ++ ++typedef struct _cupsd_timeout_s cupsd_timeout_t; ++typedef void (*cupsd_timeoutfunc_t)(cupsd_timeout_t *timeout, void *data); ++#endif /* HAVE_AVAHI */ ++ + + /* + * Globals... +@@ -173,6 +182,11 @@ VAR int Launchd VALUE(0); + /* Running from launchd */ + #endif /* HAVE_LAUNCH_H */ + ++#ifdef HAVE_AVAHI ++VAR cups_array_t *Timeouts; /* Timed callbacks for main loop */ ++#endif /* HAVE_AVAHI */ ++ ++ + + /* + * Prototypes... +@@ -242,6 +256,20 @@ extern void cupsdStopSelect(void); + extern void cupsdStartServer(void); + extern void cupsdStopServer(void); + ++#ifdef HAVE_AVAHI ++extern void cupsdInitTimeouts(void); ++extern cupsd_timeout_t *cupsdAddTimeout (const struct timeval *tv, ++ cupsd_timeoutfunc_t cb, ++ void *data); ++extern cupsd_timeout_t *cupsdNextTimeout (long *delay); ++extern void cupsdRunTimeout (cupsd_timeout_t *timeout); ++extern void cupsdUpdateTimeout (cupsd_timeout_t *timeout, ++ const struct timeval *tv); ++extern void cupsdRemoveTimeout (cupsd_timeout_t *timeout); ++#endif /* HAVE_AVAHI */ ++ ++extern int cupsdRemoveFile(const char *filename); ++ + + /* + * End of "$Id: cupsd.h 9766 2011-05-11 22:17:34Z mike $". +diff -up cups-1.5.2/scheduler/main.c.avahi-3-timeouts cups-1.5.2/scheduler/main.c +--- cups-1.5.2/scheduler/main.c.avahi-3-timeouts 2012-03-14 15:04:17.655305548 +0000 ++++ cups-1.5.2/scheduler/main.c 2012-03-14 15:06:36.511476986 +0000 +@@ -146,6 +146,10 @@ main(int argc, /* I - Number of comm + int launchd_idle_exit; + /* Idle exit on select timeout? */ + #endif /* HAVE_LAUNCHD */ ++#ifdef HAVE_AVAHI ++ cupsd_timeout_t *tmo; /* Next scheduled timed callback */ ++ long tmo_delay; /* Time before it must be called */ ++#endif /* HAVE_AVAHI */ + + + #ifdef HAVE_GETEUID +@@ -535,6 +539,14 @@ main(int argc, /* I - Number of comm + + httpInitialize(); + ++#ifdef HAVE_AVAHI ++ /* ++ * Initialize timed callback structures. ++ */ ++ ++ cupsdInitTimeouts(); ++#endif /* HAVE_AVAHI */ ++ + cupsdStartServer(); + + /* +@@ -874,6 +886,16 @@ main(int argc, /* I - Number of comm + } + #endif /* __APPLE__ */ + ++#ifdef HAVE_AVAHI ++ /* ++ * If a timed callback is due, run it. ++ */ ++ ++ tmo = cupsdNextTimeout (&tmo_delay); ++ if (tmo && tmo_delay == 0) ++ cupsdRunTimeout (tmo); ++#endif /* HAVE_AVAHI */ ++ + #ifndef __APPLE__ + /* + * Update the network interfaces once a minute... +@@ -1787,6 +1809,10 @@ select_timeout(int fds) /* I - Number + cupsd_job_t *job; /* Job information */ + cupsd_subscription_t *sub; /* Subscription information */ + const char *why; /* Debugging aid */ ++#ifdef HAVE_AVAHI ++ cupsd_timeout_t *tmo; /* Timed callback */ ++ long tmo_delay; /* Seconds before calling it */ ++#endif /* HAVE_AVAHI */ + + + /* +@@ -1829,6 +1855,19 @@ select_timeout(int fds) /* I - Number + } + #endif /* __APPLE__ */ + ++#ifdef HAVE_AVAHI ++ /* ++ * See if there are any scheduled timed callbacks to run. ++ */ ++ ++ if ((tmo = cupsdNextTimeout(&tmo_delay)) != NULL && ++ (now + tmo_delay) < timeout) ++ { ++ timeout = tmo_delay; ++ why = "run a timed callback"; ++ } ++#endif /* HAVE_AVAHI */ ++ + /* + * Check whether we are accepting new connections... + */ +diff -up cups-1.5.2/scheduler/Makefile.avahi-3-timeouts cups-1.5.2/scheduler/Makefile +--- cups-1.5.2/scheduler/Makefile.avahi-3-timeouts 2012-03-14 15:04:17.685305586 +0000 ++++ cups-1.5.2/scheduler/Makefile 2012-03-14 15:06:36.508476980 +0000 +@@ -39,7 +39,8 @@ CUPSDOBJS = \ + server.o \ + statbuf.o \ + subscriptions.o \ +- sysman.o ++ sysman.o \ ++ timeout.o + LIBOBJS = \ + filter.o \ + mime.o \ +diff -up cups-1.5.2/scheduler/timeout.c.avahi-3-timeouts cups-1.5.2/scheduler/timeout.c +--- cups-1.5.2/scheduler/timeout.c.avahi-3-timeouts 2012-03-14 15:06:36.552477037 +0000 ++++ cups-1.5.2/scheduler/timeout.c 2012-03-14 15:06:36.552477037 +0000 +@@ -0,0 +1,235 @@ ++/* ++ * "$Id$" ++ * ++ * Timeout functions for the Common UNIX Printing System (CUPS). ++ * ++ * Copyright (C) 2010, 2011 Red Hat, Inc. ++ * Authors: ++ * Tim Waugh <twaugh@redhat.com> ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++ * OF THE POSSIBILITY OF SUCH DAMAGE. ++ * ++ * Contents: ++ * ++ * cupsdInitTimeouts() - Initialise timeout structure. ++ * cupsdAddTimeout() - Add a timed callback. ++ * cupsdNextTimeout() - Find the next enabled timed callback. ++ * cupsdUpdateTimeout() - Adjust the time of a timed callback or disable it. ++ * cupsdRemoveTimeout() - Discard a timed callback. ++ * compare_timeouts() - Compare timed callbacks for array sorting. ++ */ ++ ++#include <config.h> ++ ++#ifdef HAVE_AVAHI /* Applies to entire file... */ ++ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "cupsd.h" ++ ++#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) ++# include <malloc.h> ++#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */ ++ ++#ifdef HAVE_AVAHI ++# include <avahi-common/timeval.h> ++#endif /* HAVE_AVAHI */ ++ ++ ++struct _cupsd_timeout_s ++{ ++ struct timeval when; ++ int enabled; ++ cupsd_timeoutfunc_t callback; ++ void *data; ++}; ++ ++/* ++ * Local functions... ++ */ ++ ++/* ++ * 'compare_timeouts()' - Compare timed callbacks for array sorting. ++ */ ++ ++static int ++compare_addrs (void *p0, void *p1) ++{ ++ if (p0 == p1) ++ return (0); ++ if (p0 < p1) ++ return (-1); ++ return (1); ++} ++ ++static int ++compare_timeouts (cupsd_timeout_t *p0, cupsd_timeout_t *p1) ++{ ++ int addrsdiff = compare_addrs (p0, p1); ++ int tvdiff; ++ ++ if (addrsdiff == 0) ++ return (0); ++ ++ if (!p0->enabled || !p1->enabled) ++ { ++ if (!p0->enabled && !p1->enabled) ++ return (addrsdiff); ++ ++ return (p0->enabled ? -1 : 1); ++ } ++ ++ tvdiff = avahi_timeval_compare (&p0->when, &p1->when); ++ if (tvdiff != 0) ++ return (tvdiff); ++ ++ return (addrsdiff); ++} ++ ++ ++/* ++ * 'cupsdInitTimeouts()' - Initialise timeout structures. ++ */ ++ ++void ++cupsdInitTimeouts(void) ++{ ++ Timeouts = cupsArrayNew ((cups_array_func_t)compare_timeouts, NULL); ++} ++ ++ ++/* ++ * 'cupsdAddTimeout()' - Add a timed callback. ++ */ ++ ++cupsd_timeout_t * /* O - Timeout handle */ ++cupsdAddTimeout(const struct timeval *tv, /* I - Absolute time */ ++ cupsd_timeoutfunc_t cb, /* I - Callback function */ ++ void *data) /* I - User data */ ++{ ++ cupsd_timeout_t *timeout; ++ ++ timeout = malloc (sizeof(cupsd_timeout_t)); ++ if (timeout != NULL) ++ { ++ timeout->enabled = (tv != NULL); ++ if (tv) ++ { ++ timeout->when.tv_sec = tv->tv_sec; ++ timeout->when.tv_usec = tv->tv_usec; ++ } ++ ++ timeout->callback = cb; ++ timeout->data = data; ++ cupsArrayAdd (Timeouts, timeout); ++ } ++ ++ return timeout; ++} ++ ++ ++/* ++ * 'cupsdNextTimeout()' - Find the next enabled timed callback. ++ */ ++ ++cupsd_timeout_t * /* O - Next enabled timeout or NULL */ ++cupsdNextTimeout(long *delay) /* O - Seconds before scheduled */ ++{ ++ cupsd_timeout_t *first = cupsArrayFirst (Timeouts); ++ struct timeval curtime; ++ ++ if (first && !first->enabled) ++ first = NULL; ++ ++ if (first && delay) ++ { ++ gettimeofday (&curtime, NULL); ++ if (avahi_timeval_compare (&curtime, &first->when) > 0) ++ { ++ *delay = 0; ++ } else { ++ *delay = 1 + first->when.tv_sec - curtime.tv_sec; ++ if (first->when.tv_usec < curtime.tv_usec) ++ (*delay)--; ++ } ++ } ++ ++ return (first); ++} ++ ++ ++/* ++ * 'cupsdRunTimeout()' - Run a timed callback. ++ */ ++ ++void ++cupsdRunTimeout(cupsd_timeout_t *timeout) /* I - Timeout */ ++{ ++ if (!timeout) ++ return; ++ timeout->enabled = 0; ++ if (!timeout->callback) ++ return; ++ timeout->callback (timeout, timeout->data); ++} ++ ++/* ++ * 'cupsdUpdateTimeout()' - Adjust the time of a timed callback or disable it. ++ */ ++ ++void ++cupsdUpdateTimeout(cupsd_timeout_t *timeout, /* I - Timeout */ ++ const struct timeval *tv) /* I - Absolute time or NULL */ ++{ ++ cupsArrayRemove (Timeouts, timeout); ++ timeout->enabled = (tv != NULL); ++ if (tv) ++ { ++ timeout->when.tv_sec = tv->tv_sec; ++ timeout->when.tv_usec = tv->tv_usec; ++ } ++ cupsArrayAdd (Timeouts, timeout); ++} ++ ++ ++/* ++ * 'cupsdRemoveTimeout()' - Discard a timed callback. ++ */ ++ ++void ++cupsdRemoveTimeout(cupsd_timeout_t *timeout) /* I - Timeout */ ++{ ++ cupsArrayRemove (Timeouts, timeout); ++ free (timeout); ++} ++ ++ ++#endif /* HAVE_AVAHI ... from top of file */ ++ ++/* ++ * End of "$Id$". ++ */ diff --git a/testing/cups/cups-avahi-4-poll.patch b/testing/cups/cups-avahi-4-poll.patch new file mode 100644 index 000000000..d7fa5fd56 --- /dev/null +++ b/testing/cups/cups-avahi-4-poll.patch @@ -0,0 +1,529 @@ +diff -up cups-1.5.2/scheduler/avahi.c.avahi-4-poll cups-1.5.2/scheduler/avahi.c +--- cups-1.5.2/scheduler/avahi.c.avahi-4-poll 2012-03-14 15:07:29.477542381 +0000 ++++ cups-1.5.2/scheduler/avahi.c 2012-03-14 15:07:29.477542381 +0000 +@@ -0,0 +1,441 @@ ++/* ++ * "$Id$" ++ * ++ * Avahi poll implementation for the CUPS scheduler. ++ * ++ * Copyright (C) 2010, 2011 Red Hat, Inc. ++ * Authors: ++ * Tim Waugh <twaugh@redhat.com> ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++ * OF THE POSSIBILITY OF SUCH DAMAGE. ++ * ++ * Contents: ++ * ++ * watch_read_cb - Read callback for file descriptor ++ * watch_write_cb - Write callback for file descriptor ++ * watched_fd_add_select() - Call cupsdAddSelect() as needed ++ * watch_new() - Create a new file descriptor watch ++ * watch_free() - Free a file descriptor watch ++ * watch_update() - Update watched events for a file descriptor ++ * watch_get_events() - Get events that happened for a file descriptor ++ * timeout_cb() - Run a timed Avahi callback ++ * timeout_new() - Set a wakeup time ++ * timeout_update() - Update the expiration time for a timeout ++ * timeout_free() - Free a timeout ++ * compare_watched_fds() - Compare watched file descriptors for array sorting ++ * avahi_cups_poll_new() - Create a new Avahi main loop object for CUPS ++ * avahi_cups_poll_free() - Free an Avahi main loop object for CUPS ++ * avahi_cups_poll_get() - Get the abstract poll API structure ++ */ ++ ++#include <config.h> ++ ++#ifdef HAVE_AVAHI /* Applies to entire file... */ ++ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "cupsd.h" ++ ++#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) ++# include <malloc.h> ++#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */ ++ ++#ifdef HAVE_AVAHI ++# include <avahi-common/timeval.h> ++#endif /* HAVE_AVAHI */ ++ ++ ++typedef struct ++{ ++ AvahiCupsPoll *cups_poll; ++ ++ int fd; ++ AvahiWatchEvent occurred; ++ cups_array_t *watches; ++} cupsd_watched_fd_t; ++ ++struct AvahiWatch ++{ ++ cupsd_watched_fd_t *watched_fd; ++ ++ AvahiWatchEvent events; ++ AvahiWatchCallback callback; ++ void *userdata; ++}; ++ ++struct AvahiTimeout ++{ ++ AvahiCupsPoll *cups_poll; ++ AvahiTimeoutCallback callback; ++ void *userdata; ++ cupsd_timeout_t *cupsd_timeout; ++}; ++ ++/* ++ * Local functions... ++ */ ++ ++static AvahiWatch * watch_new(const AvahiPoll *api, ++ int fd, ++ AvahiWatchEvent events, ++ AvahiWatchCallback callback, ++ void *userdata); ++static void watch_free(AvahiWatch *watch); ++static void watch_update(AvahiWatch *watch, ++ AvahiWatchEvent events); ++static AvahiWatchEvent watch_get_events(AvahiWatch *watch); ++ ++ ++/* ++ * 'watch_read_cb' - Read callback for file descriptor ++ */ ++ ++static void ++watch_read_cb (void *userdata) ++{ ++ AvahiWatch *watch; ++ cupsd_watched_fd_t *watched_fd = userdata; ++ watched_fd->occurred |= AVAHI_WATCH_IN; ++ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches); ++ watch; ++ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) ++ { ++ if (watch->events & watched_fd->occurred) ++ { ++ (watch->callback) (watch, watched_fd->fd, ++ AVAHI_WATCH_IN, watch->userdata); ++ watched_fd->occurred &= ~AVAHI_WATCH_IN; ++ break; ++ } ++ } ++} ++ ++ ++/* ++ * 'watch_write_cb' - Write callback for file descriptor ++ */ ++ ++static void ++watch_write_cb (void *userdata) ++{ ++ AvahiWatch *watch; ++ cupsd_watched_fd_t *watched_fd = userdata; ++ watched_fd->occurred |= AVAHI_WATCH_OUT; ++ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches); ++ watch; ++ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) ++ { ++ if (watch->events & watched_fd->occurred) ++ { ++ (watch->callback) (watch, watched_fd->fd, ++ AVAHI_WATCH_OUT, watch->userdata); ++ watched_fd->occurred &= ~AVAHI_WATCH_OUT; ++ break; ++ } ++ } ++} ++ ++ ++/* ++ * 'watched_fd_add_select' - Call cupsdAddSelect() as needed ++ */ ++ ++static int /* O - Watches? */ ++watched_fd_add_select (cupsd_watched_fd_t *watched_fd) ++{ ++ AvahiWatch *watch; ++ cupsd_selfunc_t read_cb = NULL, write_cb = NULL; ++ int any_watches = 0; ++ ++ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches); ++ watch; ++ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) ++ { ++ any_watches = 1; ++ if (watch->events & (AVAHI_WATCH_IN | ++ AVAHI_WATCH_ERR | ++ AVAHI_WATCH_HUP)) ++ { ++ read_cb = (cupsd_selfunc_t)watch_read_cb; ++ if (write_cb != NULL) ++ break; ++ } ++ ++ if (watch->events & AVAHI_WATCH_OUT) ++ { ++ write_cb = (cupsd_selfunc_t)watch_write_cb; ++ if (read_cb != NULL) ++ break; ++ } ++ } ++ ++ if (read_cb || write_cb) ++ cupsdAddSelect (watched_fd->fd, read_cb, write_cb, watched_fd); ++ else ++ cupsdRemoveSelect (watched_fd->fd); ++ ++ return (any_watches); ++} ++ ++/* ++ * 'watch_new' - Create a new file descriptor watch ++ */ ++ ++static AvahiWatch * ++watch_new (const AvahiPoll *api, ++ int fd, ++ AvahiWatchEvent events, ++ AvahiWatchCallback callback, ++ void *userdata) ++{ ++ cupsd_watched_fd_t key, *watched_fd; ++ AvahiCupsPoll *cups_poll = api->userdata; ++ AvahiWatch *watch = malloc(sizeof(AvahiWatch)); ++ if (watch == NULL) ++ return (NULL); ++ ++ watch->events = events; ++ watch->callback = callback; ++ watch->userdata = userdata; ++ ++ key.fd = fd; ++ watched_fd = cupsArrayFind (cups_poll->watched_fds, &key); ++ if (watched_fd == NULL) ++ { ++ watched_fd = malloc(sizeof(cupsd_watched_fd_t)); ++ if (watched_fd == NULL) ++ { ++ free (watch); ++ return (NULL); ++ } ++ ++ watched_fd->fd = fd; ++ watched_fd->occurred = 0; ++ watched_fd->cups_poll = cups_poll; ++ watched_fd->watches = cupsArrayNew (NULL, NULL); ++ cupsArrayAdd (cups_poll->watched_fds, watched_fd); ++ } ++ ++ watch->watched_fd = watched_fd; ++ cupsArrayAdd(watched_fd->watches, watch); ++ watched_fd_add_select (watched_fd); ++ return (watch); ++} ++ ++ ++/* ++ * 'watch_free' - Free a file descriptor watch ++ */ ++ ++static void ++watch_free (AvahiWatch *watch) ++{ ++ cupsd_watched_fd_t *watched_fd = watch->watched_fd; ++ AvahiCupsPoll *cups_poll = watched_fd->cups_poll; ++ ++ cupsArrayRemove (watched_fd->watches, watch); ++ free (watch); ++ ++ if (!watched_fd_add_select (watched_fd)) ++ { ++ /* No more watches */ ++ cupsArrayRemove (cups_poll->watched_fds, watched_fd); ++ free (watched_fd); ++ } ++} ++ ++ ++/* ++ * 'watch_update' - Update watched events for a file descriptor ++ */ ++ ++static void ++watch_update (AvahiWatch *watch, ++ AvahiWatchEvent events) ++{ ++ watch->events = events; ++ watched_fd_add_select (watch->watched_fd); ++} ++ ++ ++/* ++ * 'watch_get_events' - Get events that happened for a file descriptor ++ */ ++ ++static AvahiWatchEvent ++watch_get_events (AvahiWatch *watch) ++{ ++ return (watch->watched_fd->occurred); ++} ++ ++ ++/* ++ * 'timeout_cb()' - Run a timed Avahi callback ++ */ ++ ++static void ++timeout_cb (cupsd_timeout_t *cupsd_timeout, void *userdata) ++{ ++ AvahiTimeout *timeout = userdata; ++ (timeout->callback) (timeout, timeout->userdata); ++} ++ ++ ++/* ++ * 'timeout_new' - Set a wakeup time ++ */ ++ ++static AvahiTimeout * ++timeout_new (const AvahiPoll *api, ++ const struct timeval *tv, ++ AvahiTimeoutCallback callback, ++ void *userdata) ++{ ++ AvahiTimeout *timeout; ++ AvahiCupsPoll *cups_poll = api->userdata; ++ ++ timeout = malloc(sizeof(AvahiTimeout)); ++ if (timeout == NULL) ++ return (NULL); ++ ++ timeout->cups_poll = cups_poll; ++ timeout->callback = callback; ++ timeout->userdata = userdata; ++ timeout->cupsd_timeout = cupsdAddTimeout (tv, ++ (cupsd_timeoutfunc_t)timeout_cb, ++ timeout); ++ cupsArrayAdd (cups_poll->timeouts, timeout); ++ return (timeout); ++} ++ ++ ++/* ++ * 'timeout_update' - Update the expiration time for a timeout ++ */ ++ ++static void ++timeout_update (AvahiTimeout *timeout, ++ const struct timeval *tv) ++{ ++ cupsdUpdateTimeout (timeout->cupsd_timeout, tv); ++} ++ ++ ++/* ++ * ' timeout_free' - Free a timeout ++ */ ++ ++static void ++timeout_free (AvahiTimeout *timeout) ++{ ++ cupsArrayRemove (timeout->cups_poll->timeouts, timeout); ++ cupsdRemoveTimeout (timeout->cupsd_timeout); ++ free (timeout); ++} ++ ++ ++/* ++ * 'compare_watched_fds' - Compare watched file descriptors for array sorting ++ */ ++static int ++compare_watched_fds(cupsd_watched_fd_t *p0, ++ cupsd_watched_fd_t *p1) ++{ ++ /* ++ * Compare by fd (no two elements have the same fd) ++ */ ++ ++ if (p0->fd == p1->fd) ++ return 0; ++ ++ return (p0->fd < p1->fd ? -1 : 1); ++} ++ ++ ++/* ++ * 'avahi_cups_poll_new' - Create a new Avahi main loop object for CUPS ++ */ ++ ++AvahiCupsPoll * ++avahi_cups_poll_new (void) ++{ ++ AvahiCupsPoll *cups_poll = malloc(sizeof(AvahiCupsPoll)); ++ if (cups_poll == NULL) ++ return (NULL); ++ ++ cups_poll->watched_fds = cupsArrayNew ((cups_array_func_t)compare_watched_fds, ++ NULL); ++ cups_poll->timeouts = cupsArrayNew (NULL, NULL); ++ ++ cups_poll->api.userdata = cups_poll; ++ cups_poll->api.watch_new = watch_new; ++ cups_poll->api.watch_free = watch_free; ++ cups_poll->api.watch_update = watch_update; ++ cups_poll->api.watch_get_events = watch_get_events; ++ ++ cups_poll->api.timeout_new = timeout_new; ++ cups_poll->api.timeout_update = timeout_update; ++ cups_poll->api.timeout_free = timeout_free; ++ ++ return (cups_poll); ++} ++ ++ ++/* ++ * 'avahi_cups_poll_free' - Free an Avahi main loop object for CUPS ++ */ ++void ++avahi_cups_poll_free (AvahiCupsPoll *cups_poll) ++{ ++ cupsd_watched_fd_t *watched_fd; ++ ++ for (watched_fd = (cupsd_watched_fd_t*)cupsArrayFirst(cups_poll->watched_fds); ++ watched_fd; ++ watched_fd = (cupsd_watched_fd_t*)cupsArrayNext(cups_poll->watched_fds)) ++ cupsArrayClear (watched_fd->watches); ++ ++ cupsArrayClear (cups_poll->watched_fds); ++ cupsArrayClear (cups_poll->timeouts); ++} ++ ++ ++/* ++ * 'avahi_cups_poll_get' - Get the abstract poll API structure ++ */ ++ ++const AvahiPoll * ++avahi_cups_poll_get (AvahiCupsPoll *cups_poll) ++{ ++ return (&cups_poll->api); ++} ++ ++ ++#endif /* HAVE_AVAHI ... from top of file */ ++ ++/* ++ * End of "$Id$". ++ */ +diff -up cups-1.5.2/scheduler/avahi.h.avahi-4-poll cups-1.5.2/scheduler/avahi.h +--- cups-1.5.2/scheduler/avahi.h.avahi-4-poll 2012-03-14 15:07:29.477542381 +0000 ++++ cups-1.5.2/scheduler/avahi.h 2012-03-14 15:07:29.477542381 +0000 +@@ -0,0 +1,69 @@ ++/* ++ * "$Id$" ++ * ++ * Avahi poll implementation for the CUPS scheduler. ++ * ++ * Copyright (C) 2010, 2011 Red Hat, Inc. ++ * Authors: ++ * Tim Waugh <twaugh@redhat.com> ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++ * OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include <config.h> ++ ++#ifdef HAVE_AVAHI ++# include <avahi-client/client.h> ++# include <avahi-client/publish.h> ++#endif /* HAVE_AVAHI */ ++ ++#ifdef HAVE_AUTHORIZATION_H ++# include <Security/Authorization.h> ++#endif /* HAVE_AUTHORIZATION_H */ ++ ++ ++#ifdef HAVE_AVAHI ++typedef struct ++{ ++ AvahiPoll api; ++ cups_array_t *watched_fds; ++ cups_array_t *timeouts; ++} AvahiCupsPoll; ++#endif /* HAVE_AVAHI */ ++ ++/* ++ * Prototypes... ++ */ ++ ++#ifdef HAVE_AVAHI ++extern AvahiCupsPoll * avahi_cups_poll_new(void); ++extern void avahi_cups_poll_free(AvahiCupsPoll *cups_poll); ++extern const AvahiPoll *avahi_cups_poll_get(AvahiCupsPoll *cups_poll); ++#endif /* HAVE_AVAHI */ ++ ++ ++/* ++ * End of "$Id$". ++ */ +diff -up cups-1.5.2/scheduler/Makefile.avahi-4-poll cups-1.5.2/scheduler/Makefile +--- cups-1.5.2/scheduler/Makefile.avahi-4-poll 2012-03-14 15:06:36.508476980 +0000 ++++ cups-1.5.2/scheduler/Makefile 2012-03-14 15:07:29.476542380 +0000 +@@ -17,6 +17,7 @@ include ../Makedefs + + CUPSDOBJS = \ + auth.o \ ++ avahi.o \ + banners.o \ + cert.o \ + classes.o \ diff --git a/testing/cups/cups-avahi-5-services.patch b/testing/cups/cups-avahi-5-services.patch new file mode 100644 index 000000000..820b3c32b --- /dev/null +++ b/testing/cups/cups-avahi-5-services.patch @@ -0,0 +1,1272 @@ +diff -up cups-1.5.2/cgi-bin/admin.c.avahi-5-services cups-1.5.2/cgi-bin/admin.c +--- cups-1.5.2/cgi-bin/admin.c.avahi-5-services 2011-08-17 22:01:53.000000000 +0100 ++++ cups-1.5.2/cgi-bin/admin.c 2012-03-14 15:08:25.701611799 +0000 +@@ -1643,7 +1643,7 @@ do_config_server(http_t *http) /* I - H + else + local_protocols[0] = '\0'; + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + if (cgiGetVariable("BROWSE_LOCAL_DNSSD")) + { + if (local_protocols[0]) +@@ -1651,7 +1651,7 @@ do_config_server(http_t *http) /* I - H + else + strcat(local_protocols, "dnssd"); + } +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + #ifdef HAVE_LDAP + if (cgiGetVariable("BROWSE_LOCAL_LDAP")) +@@ -2718,9 +2718,9 @@ do_menu(http_t *http) /* I - HTTP conn + #endif /* HAVE_GSSAPI */ + cgiSetVariable("KERBEROS", ""); + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + cgiSetVariable("HAVE_DNSSD", "1"); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + #ifdef HAVE_LDAP + cgiSetVariable("HAVE_LDAP", "1"); +diff -up cups-1.5.2/scheduler/avahi.h.avahi-5-services cups-1.5.2/scheduler/avahi.h +--- cups-1.5.2/scheduler/avahi.h.avahi-5-services 2012-03-14 15:07:29.477542381 +0000 ++++ cups-1.5.2/scheduler/avahi.h 2012-03-14 15:08:25.701611799 +0000 +@@ -3,7 +3,7 @@ + * + * Avahi poll implementation for the CUPS scheduler. + * +- * Copyright (C) 2010, 2011 Red Hat, Inc. ++ * Copyright (C) 2010, 2011, 2012 Red Hat, Inc. + * Authors: + * Tim Waugh <twaugh@redhat.com> + * +@@ -32,37 +32,40 @@ + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <config.h> ++#ifndef _CUPS_AVAHI_H_ ++# define _CUPS_AVAHI_H_ + +-#ifdef HAVE_AVAHI +-# include <avahi-client/client.h> +-# include <avahi-client/publish.h> +-#endif /* HAVE_AVAHI */ ++/* ++ * Include necessary headers... ++ */ + +-#ifdef HAVE_AUTHORIZATION_H +-# include <Security/Authorization.h> +-#endif /* HAVE_AUTHORIZATION_H */ ++# include <config.h> + ++# ifdef HAVE_AVAHI ++# include <avahi-client/client.h> ++# include <avahi-client/publish.h> ++# endif /* HAVE_AVAHI */ + +-#ifdef HAVE_AVAHI ++# ifdef HAVE_AVAHI + typedef struct + { + AvahiPoll api; + cups_array_t *watched_fds; + cups_array_t *timeouts; + } AvahiCupsPoll; +-#endif /* HAVE_AVAHI */ ++# endif /* HAVE_AVAHI */ + + /* + * Prototypes... + */ + +-#ifdef HAVE_AVAHI ++# ifdef HAVE_AVAHI + extern AvahiCupsPoll * avahi_cups_poll_new(void); + extern void avahi_cups_poll_free(AvahiCupsPoll *cups_poll); + extern const AvahiPoll *avahi_cups_poll_get(AvahiCupsPoll *cups_poll); +-#endif /* HAVE_AVAHI */ ++# endif /* HAVE_AVAHI */ + ++#endif /* !_CUPS_AVAHI_H_ */ + + /* + * End of "$Id$". +diff -up cups-1.5.2/scheduler/client.c.avahi-5-services cups-1.5.2/scheduler/client.c +--- cups-1.5.2/scheduler/client.c.avahi-5-services 2012-01-13 23:00:22.000000000 +0000 ++++ cups-1.5.2/scheduler/client.c 2012-03-14 15:08:25.703611797 +0000 +@@ -4989,7 +4989,7 @@ valid_host(cupsd_client_t *con) /* I - + !strncmp(host, "[::1]:", 6)); + } + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + /* + * Check if the hostname is something.local (Bonjour); if so, allow it. + */ +@@ -4998,7 +4998,7 @@ valid_host(cupsd_client_t *con) /* I - + (!_cups_strcasecmp(end, ".local") || !_cups_strncasecmp(end, ".local:", 7) || + !_cups_strcasecmp(end, ".local.") || !_cups_strncasecmp(end, ".local.:", 8))) + return (1); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + /* + * Check if the hostname is an IP address... +diff -up cups-1.5.2/scheduler/conf.c.avahi-5-services cups-1.5.2/scheduler/conf.c +--- cups-1.5.2/scheduler/conf.c.avahi-5-services 2012-03-14 15:04:17.636305526 +0000 ++++ cups-1.5.2/scheduler/conf.c 2012-03-14 15:08:25.706611803 +0000 +@@ -652,7 +652,7 @@ cupsdReadConfiguration(void) + Browsing = CUPS_DEFAULT_BROWSING; + DefaultShared = CUPS_DEFAULT_DEFAULT_SHARED; + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + cupsdSetString(&DNSSDRegType, "_ipp._tcp,_cups"); + #endif /* HAVE_DNSSD */ + +diff -up cups-1.5.2/scheduler/dirsvc.c.avahi-5-services cups-1.5.2/scheduler/dirsvc.c +--- cups-1.5.2/scheduler/dirsvc.c.avahi-5-services 2012-03-14 15:04:17.674305572 +0000 ++++ cups-1.5.2/scheduler/dirsvc.c 2012-03-14 15:08:25.709611806 +0000 +@@ -27,6 +27,7 @@ + * ldap_connect() - Start new LDAP connection + * ldap_reconnect() - Reconnect to LDAP Server + * ldap_disconnect() - Disconnect from LDAP Server ++ * cupsdStartAvahiClient() - Start an Avahi client if needed + * cupsdStartBrowsing() - Start sending and receiving broadcast + * information. + * cupsdStartPolling() - Start polling servers as needed. +@@ -40,11 +41,12 @@ + * dequote() - Remote quotes from a string. + * dnssdAddAlias() - Add a DNS-SD alias name. + * dnssdBuildTxtRecord() - Build a TXT record from printer info. +- * dnssdComparePrinters() - Compare the registered names of two printers. + * dnssdDeregisterPrinter() - Stop sending broadcast information for a + * printer. + * dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT + * record format. ++ * avahiPackTxtRecord() - Pack an array of key/value pairs into an ++ * AvahiStringList. + * dnssdRegisterCallback() - DNSServiceRegister callback. + * dnssdRegisterPrinter() - Start sending broadcast information for a + * printer or update the broadcast contents. +@@ -83,6 +85,7 @@ + */ + + #include "cupsd.h" ++#include <assert.h> + #include <grp.h> + + #ifdef HAVE_DNSSD +@@ -97,6 +100,17 @@ + # endif /* HAVE_SYSTEMCONFIGURATION */ + # endif /* __APPLE__ */ + #endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++# include <avahi-common/domain.h> ++#endif /* HAVE_AVAHI */ ++ ++ ++#ifdef HAVE_DNSSD ++typedef char *cupsd_txt_record_t; ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++typedef AvahiStringList *cupsd_txt_record_t; ++#endif /* HAVE_AVAHI */ + + + /* +@@ -159,27 +173,38 @@ static void update_polling(void); + static void update_smb(int onoff); + + ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) ++static cupsd_txt_record_t dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p, ++ int for_lpd); ++static void dnssdDeregisterPrinter(cupsd_printer_t *p); ++static void dnssdRegisterPrinter(cupsd_printer_t *p); ++static void dnssdStop(void); ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ ++ + #ifdef HAVE_DNSSD + # ifdef HAVE_COREFOUNDATION + static void dnssdAddAlias(const void *key, const void *value, + void *context); + # endif /* HAVE_COREFOUNDATION */ +-static char *dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p, +- int for_lpd); +-static int dnssdComparePrinters(cupsd_printer_t *a, cupsd_printer_t *b); +-static void dnssdDeregisterPrinter(cupsd_printer_t *p); +-static char *dnssdPackTxtRecord(int *txt_len, char *keyvalue[][2], +- int count); + static void dnssdRegisterCallback(DNSServiceRef sdRef, + DNSServiceFlags flags, + DNSServiceErrorType errorCode, + const char *name, const char *regtype, + const char *domain, void *context); +-static void dnssdRegisterPrinter(cupsd_printer_t *p); +-static void dnssdStop(void); + static void dnssdUpdate(void); + #endif /* HAVE_DNSSD */ + ++#ifdef HAVE_AVAHI ++static AvahiStringList *avahiPackTxtRecord(char *keyvalue[][2], ++ int count); ++static void avahi_entry_group_cb (AvahiEntryGroup *group, ++ AvahiEntryGroupState state, ++ void *userdata); ++static void avahi_client_cb (AvahiClient *client, ++ AvahiClientState state, ++ void *userdata); ++#endif /* HAVE_AVAHI */ ++ + #ifdef HAVE_LDAP + static const char * const ldap_attrs[] =/* CUPS LDAP attributes */ + { +@@ -283,10 +308,10 @@ cupsdDeregisterPrinter( + ldap_dereg_printer(p); + #endif /* HAVE_LDAP */ + +-#ifdef HAVE_DNSSD +- if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef) ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) ++ if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD)) + dnssdDeregisterPrinter(p); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + } + + +@@ -702,10 +727,10 @@ cupsdRegisterPrinter(cupsd_printer_t *p) + slpRegisterPrinter(p); */ + #endif /* HAVE_LIBSLP */ + +-#ifdef HAVE_DNSSD +- if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef) ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) ++ if ((BrowseLocalProtocols & BROWSE_DNSSD)) + dnssdRegisterPrinter(p); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + } + + +@@ -1419,6 +1444,36 @@ ldap_disconnect(LDAP *ld) /* I - LDAP h + #endif /* HAVE_LDAP */ + + ++#ifdef HAVE_AVAHI ++/* ++ * 'cupsdStartAvahiClient()' - Start an Avahi client if needed ++ */ ++ ++void ++cupsdStartAvahiClient(void) ++{ ++ int error = 0; ++ ++ if (!AvahiCupsClient && !AvahiCupsClientConnecting) ++ { ++ if (!AvahiCupsPollHandle) ++ AvahiCupsPollHandle = avahi_cups_poll_new (); ++ ++ if (AvahiCupsPollHandle) ++ { ++ if (avahi_client_new (avahi_cups_poll_get (AvahiCupsPollHandle), ++ AVAHI_CLIENT_NO_FAIL, ++ avahi_client_cb, NULL, ++ &error) != NULL) ++ AvahiCupsClientConnecting = 1; ++ else ++ cupsdLogMessage (CUPSD_LOG_WARN, "Avahi client failed: %d", error); ++ } ++ } ++} ++#endif /* HAVE_AVAHI */ ++ ++ + /* + * 'cupsdStartBrowsing()' - Start sending and receiving broadcast information. + */ +@@ -1542,13 +1597,16 @@ cupsdStartBrowsing(void) + else + BrowseSocket = -1; + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_DNSSD) + { ++#ifdef HAVE_DNSSD + DNSServiceErrorType error; /* Error from service creation */ ++#endif /* HAVE_DNSSD */ + cupsd_listener_t *lis; /* Current listening socket */ + + ++#ifdef HAVE_DNSSD + /* + * First create a "master" connection for all registrations... + */ +@@ -1573,6 +1631,7 @@ cupsdStartBrowsing(void) + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); + + cupsdAddSelect(fd, (cupsd_selfunc_t)dnssdUpdate, NULL, NULL); ++#endif /* HAVE_DNSSD */ + + /* + * Then get the port we use for registrations. If we are not listening +@@ -1598,17 +1657,23 @@ cupsdStartBrowsing(void) + */ + + if (BrowseRemoteProtocols & BROWSE_DNSSD) +- DNSSDPrinters = cupsArrayNew((cups_array_func_t)dnssdComparePrinters, +- NULL); ++ DNSSDPrinters = cupsArrayNew(NULL, NULL); + + /* + * Set the computer name and register the web interface... + */ + + cupsdUpdateDNSSDName(); ++ ++#ifdef HAVE_AVAHI ++ cupsdStartAvahiClient (); ++#endif /* HAVE_AVAHI */ ++ ++#ifdef HAVE_DNSSD + } +- } + #endif /* HAVE_DNSSD */ ++ } ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + #ifdef HAVE_LIBSLP + if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) +@@ -1834,10 +1899,10 @@ cupsdStopBrowsing(void) + BrowseSocket = -1; + } + +-#ifdef HAVE_DNSSD +- if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef) ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) ++ if ((BrowseLocalProtocols & BROWSE_DNSSD)) + dnssdStop(); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + #ifdef HAVE_LIBSLP + if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) && +@@ -1902,7 +1967,7 @@ cupsdStopPolling(void) + } + + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + /* + * 'cupsdUpdateDNSSDName()' - Update the computer name we use for browsing... + */ +@@ -1910,8 +1975,14 @@ cupsdStopPolling(void) + void + cupsdUpdateDNSSDName(void) + { ++#ifdef HAVE_DNSSD + DNSServiceErrorType error; /* Error from service creation */ + char webif[1024]; /* Web interface share name */ ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ int ret; /* Error from service creation */ ++ char webif[AVAHI_LABEL_MAX]; /* Web interface share name */ ++#endif /* HAVE_AVAHI */ + # ifdef HAVE_SYSTEMCONFIGURATION + SCDynamicStoreRef sc; /* Context for dynamic store */ + CFDictionaryRef btmm; /* Back-to-My-Mac domains */ +@@ -2042,6 +2113,7 @@ cupsdUpdateDNSSDName(void) + else + strlcpy(webif, "CUPS Web Interface", sizeof(webif)); + ++#ifdef HAVE_DNSSD + if (WebIFRef) + DNSServiceRefDeallocate(WebIFRef); + +@@ -2054,9 +2126,45 @@ cupsdUpdateDNSSDName(void) + NULL)) != kDNSServiceErr_NoError) + cupsdLogMessage(CUPSD_LOG_ERROR, + "DNS-SD web interface registration failed: %d", error); ++#endif /* HAVE_DNSSD */ ++ ++#ifdef HAVE_AVAHI ++ if (!AvahiCupsClient) ++ /* ++ * Client not yet running. ++ */ ++ return; ++ ++ if (AvahiWebIFGroup) ++ avahi_entry_group_reset (AvahiWebIFGroup); ++ else ++ AvahiWebIFGroup = avahi_entry_group_new (AvahiCupsClient, ++ avahi_entry_group_cb, ++ NULL); ++ ++ if (AvahiWebIFGroup) ++ { ++ ret = avahi_entry_group_add_service (AvahiWebIFGroup, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, /* flags */ ++ webif, /* name */ ++ "_http._tcp", /* type */ ++ NULL, /* domain */ ++ NULL, /* host */ ++ DNSSDPort, /* port */ ++ "path=/", NULL); ++ if (ret == 0) ++ ret = avahi_entry_group_commit (AvahiWebIFGroup); ++ ++ if (ret != 0) ++ cupsdLogMessage (CUPSD_LOG_ERROR, ++ "Avahi web interface registration failed: %d", ret); ++ } ++#endif /* HAVE_AVAHI */ + } + } +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + + #ifdef HAVE_LDAP +@@ -2334,13 +2442,15 @@ dnssdAddAlias(const void *key, /* I - K + "Bad Back to My Mac domain in dynamic store!"); + } + # endif /* HAVE_COREFOUNDATION */ ++#endif /* HAVE_DNSSD */ + + ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + /* + * 'dnssdBuildTxtRecord()' - Build a TXT record from printer info. + */ + +-static char * /* O - TXT record */ ++static cupsd_txt_record_t /* O - TXT record */ + dnssdBuildTxtRecord( + int *txt_len, /* O - TXT record length */ + cupsd_printer_t *p, /* I - Printer information */ +@@ -2379,7 +2489,12 @@ dnssdBuildTxtRecord( + keyvalue[i ][0] = "ty"; + keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown"; + +- snprintf(admin_hostname, sizeof(admin_hostname), "%s.local.", DNSSDHostName); ++ snprintf(admin_hostname, sizeof(admin_hostname), ++ "%s.local" ++#ifdef HAVE_DNSSD ++ "." /* terminating dot no good for Avahi */ ++#endif /* HAVE_DNSSD */ ++ , DNSSDHostName); + httpAssembleURIf(HTTP_URI_CODING_ALL, adminurl_str, sizeof(adminurl_str), + "http", NULL, admin_hostname, DNSSDPort, "/%s/%s", + (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers", +@@ -2462,19 +2577,12 @@ dnssdBuildTxtRecord( + * Then pack them into a proper txt record... + */ + ++#ifdef HAVE_DNSSD + return (dnssdPackTxtRecord(txt_len, keyvalue, i)); +-} +- +- +-/* +- * 'dnssdComparePrinters()' - Compare the registered names of two printers. +- */ +- +-static int /* O - Result of comparison */ +-dnssdComparePrinters(cupsd_printer_t *a,/* I - First printer */ +- cupsd_printer_t *b)/* I - Second printer */ +-{ +- return (_cups_strcasecmp(a->reg_name, b->reg_name)); ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ return (avahiPackTxtRecord(keyvalue, i)); ++#endif /* HAVE_AVAHI */ + } + + +@@ -2489,6 +2597,10 @@ dnssdDeregisterPrinter( + { + cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdDeregisterPrinter(%s)", p->name); + ++#ifdef HAVE_DNSSD ++ if (!DNSSDRef) ++ return; ++ + /* + * Closing the socket deregisters the service + */ +@@ -2524,6 +2636,24 @@ dnssdDeregisterPrinter( + free(p->printer_txt); + p->printer_txt = NULL; + } ++#endif /* HAVE_DNSSD */ ++ ++#ifdef HAVE_AVAHI ++ if (p->avahi_group) ++ { ++ avahi_entry_group_reset (p->avahi_group); ++ avahi_entry_group_free (p->avahi_group); ++ p->avahi_group = NULL; ++ ++ if (p->ipp_txt) ++ avahi_string_list_free (p->ipp_txt); ++ ++ if (p->printer_txt) ++ avahi_string_list_free (p->printer_txt); ++ ++ p->ipp_txt = p->printer_txt = NULL; ++ } ++#endif /* HAVE_AVAHI */ + + /* + * Remove the printer from the array of DNS-SD printers, then clear the +@@ -2533,8 +2663,10 @@ dnssdDeregisterPrinter( + cupsArrayRemove(DNSSDPrinters, p); + cupsdClearString(&p->reg_name); + } ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + ++#ifdef HAVE_DNSSD + /* + * 'dnssdPackTxtRecord()' - Pack an array of key/value pairs into the + * TXT record format. +@@ -2644,8 +2776,10 @@ dnssdRegisterCallback( + LastEvent |= CUPSD_EVENT_PRINTER_MODIFIED; + } + } ++#endif /* HAVE_DNSSD */ + + ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + /* + * 'dnssdRegisterPrinter()' - Start sending broadcast information for a printer + * or update the broadcast contents. +@@ -2654,20 +2788,40 @@ dnssdRegisterCallback( + static void + dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */ + { ++#ifdef HAVE_DNSSD + DNSServiceErrorType se; /* dnssd errors */ + char *ipp_txt, /* IPP TXT record buffer */ + *printer_txt, /* LPD TXT record buffer */ +- name[1024], /* Service name */ +- *nameptr; /* Pointer into name */ ++ name[1024]; /* Service name */ + int ipp_len, /* IPP TXT record length */ + printer_len, /* LPD TXT record length */ + printer_port; /* LPD port number */ ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ int ret; /* Error code */ ++ AvahiStringList *ipp_txt, /* IPP TXT record */ ++ *printer_txt; /* LPD TXT record */ ++ char name[AVAHI_LABEL_MAX], /* Service name */ ++ fullsubtype[AVAHI_LABEL_MAX]; /* Full subtype */ ++ char *regtype_copy, /* Writeable copy of reg type */ ++ *subtype, /* Current service sub type */ ++ *nextsubtype; /* Next service sub type */ ++#endif /* HAVE_AVAHI */ ++ char *nameptr; /* Pointer into name */ + const char *regtype; /* Registration type */ + + ++#ifdef HAVE_DNSSD ++ if (!DNSSDRef) ++ return; ++ + cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name, + !p->ipp_ref ? "new" : "update"); +- ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name, ++ !p->avahi_group ? "new" : "update"); ++#endif /* HAVE_AVAHI */ + /* + * If per-printer sharing was just disabled make sure we're not + * registered before returning. +@@ -2686,12 +2840,36 @@ dnssdRegisterPrinter(cupsd_printer_t *p) + if (p->info && strlen(p->info) > 0) + { + if (DNSSDComputerName) +- snprintf(name, sizeof(name), "%s @ %s", p->info, DNSSDComputerName); ++ { ++ /* ++ * Make sure there is room for at least 15 characters of ++ * DNSSDComputerName. ++ */ ++ ++ assert(sizeof(name) >= 15 + 4); ++ nameptr = name + strlcpy(name, p->info, ++ sizeof(name) - 4 - ++ strnlen(DNSSDComputerName, 15)); ++ nameptr += strlcpy(nameptr, " @ ", sizeof(name) - (nameptr - name)); ++ strlcpy(nameptr, DNSSDComputerName, sizeof(name) - (nameptr - name)); ++ } + else + strlcpy(name, p->info, sizeof(name)); + } + else if (DNSSDComputerName) +- snprintf(name, sizeof(name), "%s @ %s", p->name, DNSSDComputerName); ++ { ++ /* ++ * Make sure there is room for at least 15 characters of ++ * DNSSDComputerName. ++ */ ++ ++ assert(sizeof(name) >= 15 + 4); ++ nameptr = name + strlcpy(name, p->info, ++ sizeof(name) - 4 - ++ strnlen(DNSSDComputerName, 15)); ++ nameptr += strlcpy(nameptr, " @ ", sizeof(name) - (nameptr - name)); ++ strlcpy(nameptr, DNSSDComputerName, sizeof(name) - (nameptr - name)); ++ } + else + strlcpy(name, p->name, sizeof(name)); + +@@ -2712,6 +2890,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p) + * Register IPP and (optionally) LPD... + */ + ++#ifdef HAVE_DNSSD + ipp_len = 0; /* anti-compiler-warning-code */ + ipp_txt = dnssdBuildTxtRecord(&ipp_len, p, 0); + +@@ -2884,6 +3063,209 @@ dnssdRegisterPrinter(cupsd_printer_t *p) + + if (printer_txt) + free(printer_txt); ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ if (!AvahiCupsClient) ++ /* ++ * Client not running yet. The client callback will call us again later. ++ */ ++ return; ++ ++ ipp_txt = dnssdBuildTxtRecord(NULL, p, 0); ++ printer_txt = dnssdBuildTxtRecord(NULL, p, 1); ++ regtype = (p->type & CUPS_PRINTER_FAX) ? "_fax-ipp._tcp" : DNSSDRegType; ++ ++ if (p->avahi_group && p->ipp_txt && ipp_txt && ++ !avahi_string_list_equal (p->ipp_txt, ipp_txt)) ++ { ++ /* ++ * Update the existing registration... ++ */ ++ ++ avahi_string_list_free (p->ipp_txt); ++ ++ if (p->printer_txt) ++ avahi_string_list_free (p->printer_txt); ++ ++ /* ++ * Update the service group entry. ++ */ ++ ++ regtype_copy = strdup (regtype); ++ subtype = strchr (regtype_copy, ','); ++ if (subtype) ++ *subtype = '\0'; ++ ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Updating TXT record for %s (%s)", name, regtype_copy); ++ ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, ++ regtype_copy, ++ NULL, ipp_txt); ++ free (regtype_copy); ++ ++ if (ret < 0) ++ goto update_failed; ++ ++ p->ipp_txt = ipp_txt; ++ ipp_txt = NULL; ++ ++ if (BrowseLocalProtocols & BROWSE_LPD) ++ { ++ ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, ++ "_printer._tcp", NULL, ++ printer_txt); ++ if (ret < 0) ++ goto update_failed; ++ ++ p->printer_txt = printer_txt; ++ printer_txt = NULL; ++ } ++ ++ ret = avahi_entry_group_commit (p->avahi_group); ++ if (ret < 0) ++ { ++ update_failed: ++ cupsdLogMessage (CUPSD_LOG_ERROR, ++ "Failed to update TXT record for %s: %d", ++ name, ret); ++ avahi_entry_group_reset (p->avahi_group); ++ avahi_entry_group_free (p->avahi_group); ++ p->avahi_group = NULL; ++ ipp_txt = p->ipp_txt; ++ p->ipp_txt = NULL; ++ } ++ } ++ ++ if (!p->avahi_group) ++ { ++ /* ++ * Initial registration. Use the _fax subtype for fax queues... ++ */ ++ ++ p->avahi_group = avahi_entry_group_new (AvahiCupsClient, ++ avahi_entry_group_cb, ++ p); ++ ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "Registering Avahi printer %s with name \"%s\" and " ++ "type \"%s\"", p->name, name, regtype); ++ ++ if (!p->avahi_group) ++ { ++ ret = 0; ++ goto add_failed; ++ } ++ ++ /* ++ * Add each service type (DNSSDRegType may contain several, ++ * separated by commas). ++ */ ++ ++ subtype = regtype_copy = strdup (regtype); ++ while (subtype && *subtype) ++ { ++ nextsubtype = strchr (subtype, ','); ++ if (nextsubtype) ++ *nextsubtype++ = '\0'; ++ ++ if (subtype == regtype_copy) ++ { ++ /* ++ * Main type entry. ++ */ ++ ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Adding TXT record for %s (%s)", name, regtype_copy); ++ ret = avahi_entry_group_add_service_strlst (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, regtype_copy, ++ NULL, NULL, ++ DNSSDPort, ++ ipp_txt); ++ } ++ else ++ { ++ /* ++ * Sub-type entry. ++ */ ++ ++ snprintf (fullsubtype, sizeof(fullsubtype), ++ "%s._sub.%s", subtype, regtype_copy); ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Adding TXT record for %s (%s)", name, fullsubtype); ++ ret = avahi_entry_group_add_service_subtype (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, ++ regtype_copy, ++ NULL, fullsubtype); ++ } ++ ++ if (ret < 0) ++ { ++ free (regtype_copy); ++ goto add_failed; ++ } ++ ++ subtype = nextsubtype; ++ } ++ ++ free (regtype_copy); ++ p->ipp_txt = ipp_txt; ++ ipp_txt = NULL; ++ ++ if (BrowseLocalProtocols & BROWSE_LPD) ++ { ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "Registering Avahi printer %s with name \"%s\" and " ++ "type \"_printer._tcp\"", p->name, name); ++ ++ ret = avahi_entry_group_add_service_strlst (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, ++ "_printer._tcp", NULL, NULL, ++ 515, ++ printer_txt); ++ if (ret < 0) ++ goto add_failed; ++ ++ p->printer_txt = printer_txt; ++ printer_txt = NULL; ++ } ++ ++ ret = avahi_entry_group_commit (p->avahi_group); ++ ++ if (ret < 0) ++ { ++ add_failed: ++ cupsdLogMessage (CUPSD_LOG_ERROR, ++ "Failed to add Avahi entry for %s: %d", ++ name, ret); ++ if (p->avahi_group) ++ { ++ avahi_entry_group_reset (p->avahi_group); ++ avahi_entry_group_free (p->avahi_group); ++ p->avahi_group = NULL; ++ } ++ ipp_txt = p->ipp_txt; ++ p->ipp_txt = NULL; ++ } ++ } ++ ++ if (ipp_txt) ++ avahi_string_list_free (ipp_txt); ++ ++ if (printer_txt) ++ avahi_string_list_free (printer_txt); ++#endif /* HAVE_AVAHI */ + } + + +@@ -2896,6 +3278,10 @@ dnssdStop(void) + { + cupsd_printer_t *p; /* Current printer */ + ++#ifdef HAVE_DNSSD ++ if (!DNSSDRef) ++ return; ++#endif /* HAVE_DNSSD */ + + /* + * De-register the individual printers +@@ -2910,12 +3296,23 @@ dnssdStop(void) + * Shutdown the rest of the service refs... + */ + ++#ifdef HAVE_DNSSD + if (WebIFRef) + { + DNSServiceRefDeallocate(WebIFRef); + WebIFRef = NULL; + } ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ if (AvahiWebIFGroup) ++ { ++ avahi_entry_group_reset (AvahiWebIFGroup); ++ avahi_entry_group_free (AvahiWebIFGroup); ++ AvahiWebIFGroup = NULL; ++ } ++#endif /* HAVE_AVAHI */ + ++#ifdef HAVE_DNSSD + if (RemoteRef) + { + DNSServiceRefDeallocate(RemoteRef); +@@ -2926,14 +3323,17 @@ dnssdStop(void) + + DNSServiceRefDeallocate(DNSSDRef); + DNSSDRef = NULL; ++#endif /* HAVE_DNSSD */ + + cupsArrayDelete(DNSSDPrinters); + DNSSDPrinters = NULL; + + DNSSDPort = 0; + } ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + ++#ifdef HAVE_DNSSD + /* + * 'dnssdUpdate()' - Handle DNS-SD queries. + */ +@@ -2955,6 +3355,153 @@ dnssdUpdate(void) + #endif /* HAVE_DNSSD */ + + ++#ifdef HAVE_AVAHI ++/* ++ * 'avahiPackTxtRecord()' - Pack an array of key/value pairs into an ++ * AvahiStringList. ++ */ ++ ++static AvahiStringList * /* O - new string list */ ++avahiPackTxtRecord(char *keyvalue[][2], /* I - Table of key value pairs */ ++ int count) /* I - Number of items in table */ ++{ ++ AvahiStringList *strlst = NULL; ++ char **elements; ++ size_t len; ++ int i = 0; ++ ++ elements = malloc ((1 + count) * sizeof (char *)); ++ if (!elements) ++ goto cleanup; ++ ++ for (i = 0; i < count; i++) ++ { ++ len = (1 + strlen (keyvalue[i][0]) + ++ (keyvalue[i][1] ? 1 + strlen (keyvalue[i][1]) : 1)); ++ elements[i] = malloc (len * sizeof (char)); ++ if (!elements[i]) ++ goto cleanup; ++ ++ snprintf (elements[i], len, "%s=%s", keyvalue[i][0], keyvalue[i][1]); ++ } ++ ++ strlst = avahi_string_list_new_from_array ((const char **) elements, count); ++ ++cleanup: ++ while (--i >= 0) ++ free (elements[i]); ++ ++ free (elements); ++ return (strlst); ++} ++ ++ ++/* ++ * 'avahi_entry_group_cb()' - Avahi entry group callback function. ++ */ ++static void ++avahi_entry_group_cb (AvahiEntryGroup *group, ++ AvahiEntryGroupState state, ++ void *userdata) ++{ ++ char *name; ++ ++ if (userdata) ++ name = ((cupsd_printer_t *) userdata)->reg_name; ++ else ++ name = "CUPS web interface"; ++ ++ switch (state) ++ { ++ case AVAHI_ENTRY_GROUP_UNCOMMITED: ++ case AVAHI_ENTRY_GROUP_REGISTERING: ++ break; ++ ++ case AVAHI_ENTRY_GROUP_ESTABLISHED: ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Avahi entry group established for %s", name); ++ break; ++ ++ default: ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Avahi entry group %s has state %d", ++ name, state); ++ break; ++ } ++} ++ ++ ++/* ++ * 'avahi_client_cb()' - Avahi client callback function. ++ */ ++static void ++avahi_client_cb (AvahiClient *client, ++ AvahiClientState state, ++ void *userdata) ++{ ++ cupsd_printer_t *printer; ++ switch (state) ++ { ++ case AVAHI_CLIENT_S_RUNNING: ++ /* ++ * Avahi client started successfully. ++ */ ++ AvahiCupsClient = client; ++ AvahiCupsClientConnecting = 0; ++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client started"); ++ ++ cupsdUpdateDNSSDName (); ++ ++ for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers); ++ printer; ++ printer = (cupsd_printer_t *)cupsArrayNext(Printers)) ++ if (Browsing && (BrowseLocalProtocols & BROWSE_DNSSD) && ++ (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT | ++ CUPS_PRINTER_SCANNER))) && printer->shared) ++ dnssdRegisterPrinter (printer); ++ ++ break; ++ ++ case AVAHI_CLIENT_CONNECTING: ++ /* ++ * No Avahi daemon, client is waiting. ++ */ ++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client connecting"); ++ break; ++ ++ case AVAHI_CLIENT_S_REGISTERING: ++ /* ++ * Not yet registered. ++ */ ++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client registering"); ++ break; ++ ++ case AVAHI_CLIENT_FAILURE: ++ /* ++ * Avahi client failed, close it to allow a clean restart. ++ */ ++ cupsdLogMessage (CUPSD_LOG_ERROR, ++ "Avahi client failed, " ++ "closing client to allow a clean restart"); ++ ++ for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers); ++ printer; ++ printer = (cupsd_printer_t *)cupsArrayNext(Printers)) ++ dnssdDeregisterPrinter (printer); ++ ++ avahi_client_free(client); ++ AvahiCupsClientConnecting = 0; ++ AvahiCupsClient = NULL; ++ ++ break; ++ ++ default: ++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client state: %d", state); ++ } ++} ++#endif /* HAVE_AVAHI */ ++ ++ + /* + * 'get_auth_info_required()' - Get the auth-info-required value to advertise. + */ +diff -up cups-1.5.2/scheduler/dirsvc.h.avahi-5-services cups-1.5.2/scheduler/dirsvc.h +--- cups-1.5.2/scheduler/dirsvc.h.avahi-5-services 2011-03-21 02:12:14.000000000 +0000 ++++ cups-1.5.2/scheduler/dirsvc.h 2012-03-14 15:08:25.711611808 +0000 +@@ -31,6 +31,10 @@ + # endif /* HAVE_LDAP_SSL_H */ + #endif /* HAVE_LDAP */ + ++#ifdef HAVE_AVAHI ++# include <avahi-client/publish.h> ++#endif /* HAVE_AVAHI */ ++ + /* + * Browse protocols... + */ +@@ -131,19 +135,22 @@ VAR int PollPipe VALUE(0); + VAR cupsd_statbuf_t *PollStatusBuffer VALUE(NULL); + /* Status buffer for pollers */ + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + VAR char *DNSSDComputerName VALUE(NULL), + /* Computer/server name */ + *DNSSDHostName VALUE(NULL), + /* Hostname */ + *DNSSDRegType VALUE(NULL); + /* Bonjour registration type */ +-VAR cups_array_t *DNSSDAlias VALUE(NULL); +- /* List of dynamic ServerAlias's */ + VAR int DNSSDPort VALUE(0); + /* Port number to register */ + VAR cups_array_t *DNSSDPrinters VALUE(NULL); + /* Printers we have registered */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ ++ ++#ifdef HAVE_DNSSD ++VAR cups_array_t *DNSSDAlias VALUE(NULL); ++ /* List of dynamic ServerAlias's */ + VAR DNSServiceRef DNSSDRef VALUE(NULL), + /* Master DNS-SD service reference */ + WebIFRef VALUE(NULL), +@@ -152,6 +159,17 @@ VAR DNSServiceRef DNSSDRef VALUE(NULL), + /* Remote printer browse reference */ + #endif /* HAVE_DNSSD */ + ++#ifdef HAVE_AVAHI ++VAR AvahiCupsPoll *AvahiCupsPollHandle VALUE(NULL); ++ /* AvahiCupsPoll object */ ++VAR AvahiClient *AvahiCupsClient VALUE(NULL); ++ /* AvahiClient object */ ++VAR int AvahiCupsClientConnecting VALUE(0); ++ /* Is AvahiClient object connecting? */ ++VAR AvahiEntryGroup *AvahiWebIFGroup VALUE(NULL); ++ /* Web interface entry group */ ++#endif /* HAVE_AVAHI */ ++ + #ifdef HAVE_LIBSLP + VAR SLPHandle BrowseSLPHandle VALUE(NULL); + /* SLP API handle */ +@@ -195,13 +213,14 @@ extern void cupsdRegisterPrinter(cupsd_p + extern void cupsdRestartPolling(void); + extern void cupsdSaveRemoteCache(void); + extern void cupsdSendBrowseList(void); ++extern void cupsdStartAvahiClient(void); + extern void cupsdStartBrowsing(void); + extern void cupsdStartPolling(void); + extern void cupsdStopBrowsing(void); + extern void cupsdStopPolling(void); +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + extern void cupsdUpdateDNSSDName(void); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + #ifdef HAVE_LDAP + extern void cupsdUpdateLDAPBrowse(void); + #endif /* HAVE_LDAP */ +diff -up cups-1.5.2/scheduler/ipp.c.avahi-5-services cups-1.5.2/scheduler/ipp.c +--- cups-1.5.2/scheduler/ipp.c.avahi-5-services 2012-03-14 15:04:17.665305560 +0000 ++++ cups-1.5.2/scheduler/ipp.c 2012-03-14 15:08:25.715611813 +0000 +@@ -6099,7 +6099,7 @@ copy_printer_attrs( + ippAddDate(con->response, IPP_TAG_PRINTER, "printer-current-time", + ippTimeToDate(curtime)); + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + if (!ra || cupsArrayFind(ra, "printer-dns-sd-name")) + { + if (printer->reg_name) +@@ -6109,7 +6109,7 @@ copy_printer_attrs( + ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_NOVALUE, + "printer-dns-sd-name", 0); + } +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + if (!ra || cupsArrayFind(ra, "printer-error-policy")) + ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_NAME, +diff -up cups-1.5.2/scheduler/main.c.avahi-5-services cups-1.5.2/scheduler/main.c +--- cups-1.5.2/scheduler/main.c.avahi-5-services 2012-03-14 15:06:36.511476986 +0000 ++++ cups-1.5.2/scheduler/main.c 2012-03-14 15:08:25.718611817 +0000 +@@ -120,6 +120,10 @@ main(int argc, /* I - Number of comm + cupsd_listener_t *lis; /* Current listener */ + time_t current_time, /* Current time */ + activity, /* Client activity timer */ ++#ifdef HAVE_AVAHI ++ avahi_client_time, /* Time for next Avahi client ++ check */ ++#endif /* HAVE_AVAHI */ + browse_time, /* Next browse send time */ + senddoc_time, /* Send-Document time */ + expire_time, /* Subscription expire time */ +@@ -672,6 +676,9 @@ main(int argc, /* I - Number of comm + */ + + current_time = time(NULL); ++#ifdef HAVE_AVAHI ++ avahi_client_time = current_time; ++#endif /* HAVE_AVAHI */ + browse_time = current_time; + event_time = current_time; + expire_time = current_time; +@@ -894,6 +901,16 @@ main(int argc, /* I - Number of comm + tmo = cupsdNextTimeout (&tmo_delay); + if (tmo && tmo_delay == 0) + cupsdRunTimeout (tmo); ++ ++ /* ++ * Try to restart the Avahi client every 10 seconds if needed... ++ */ ++ ++ if ((current_time - avahi_client_time) >= 10) ++ { ++ avahi_client_time = current_time; ++ cupsdStartAvahiClient(); ++ } + #endif /* HAVE_AVAHI */ + + #ifndef __APPLE__ +diff -up cups-1.5.2/scheduler/printers.c.avahi-5-services cups-1.5.2/scheduler/printers.c +--- cups-1.5.2/scheduler/printers.c.avahi-5-services 2012-03-14 15:04:17.646305537 +0000 ++++ cups-1.5.2/scheduler/printers.c 2012-03-14 15:08:25.720611819 +0000 +@@ -883,9 +883,9 @@ cupsdDeletePrinter( + cupsdClearString(&p->alert); + cupsdClearString(&p->alert_description); + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + cupsdClearString(&p->pdl); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + cupsArrayDelete(p->filetypes); + +@@ -3787,7 +3787,7 @@ add_printer_formats(cupsd_printer_t *p) + attr->values[i].string.text = _cupsStrAlloc(mimetype); + } + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + { + char pdl[1024]; /* Buffer to build pdl list */ + mime_filter_t *filter; /* MIME filter looping var */ +@@ -3843,7 +3843,7 @@ add_printer_formats(cupsd_printer_t *p) + + cupsdSetString(&p->pdl, pdl); + } +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + } + + +diff -up cups-1.5.2/scheduler/printers.h.avahi-5-services cups-1.5.2/scheduler/printers.h +--- cups-1.5.2/scheduler/printers.h.avahi-5-services 2011-03-18 18:42:46.000000000 +0000 ++++ cups-1.5.2/scheduler/printers.h 2012-03-14 15:08:25.721611820 +0000 +@@ -16,6 +16,9 @@ + #ifdef HAVE_DNSSD + # include <dns_sd.h> + #endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++# include "avahi.h" ++#endif /* HAVE_AVAHI */ + #include <cups/pwg-private.h> + + +@@ -95,16 +98,23 @@ struct cupsd_printer_s + time_t marker_time; /* Last time marker attributes were updated */ + _ppd_cache_t *pc; /* PPD cache and mapping data */ + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + char *reg_name, /* Name used for service registration */ +- *pdl, /* pdl value for TXT record */ +- *ipp_txt, /* IPP TXT record contents */ ++ *pdl; /* pdl value for TXT record */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ ++#ifdef HAVE_DNSSD ++ char *ipp_txt, /* IPP TXT record contents */ + *printer_txt; /* LPD TXT record contents */ + int ipp_len, /* IPP TXT record length */ + printer_len; /* LPD TXT record length */ + DNSServiceRef ipp_ref, /* Reference for _ipp._tcp,_cups */ + printer_ref; /* Reference for _printer._tcp */ + #endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ AvahiStringList *ipp_txt, /* IPP TXT record */ ++ *printer_txt; /* LPD TXT record */ ++ AvahiEntryGroup *avahi_group; /* Avahi entry group */ ++#endif /* HAVE_AVAHI */ + }; + + diff --git a/testing/cups/cups-no-export-ssllibs.patch b/testing/cups/cups-no-export-ssllibs.patch new file mode 100644 index 000000000..9be3c819b --- /dev/null +++ b/testing/cups/cups-no-export-ssllibs.patch @@ -0,0 +1,12 @@ +diff -up cups-1.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.5b1/config-scripts/cups-ssl.m4 +--- cups-1.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs 2011-05-11 02:52:08.000000000 +0200 ++++ cups-1.5b1/config-scripts/cups-ssl.m4 2011-05-23 17:47:27.000000000 +0200 +@@ -164,7 +164,7 @@ AC_SUBST(IPPALIASES) + AC_SUBST(SSLFLAGS) + AC_SUBST(SSLLIBS) + +-EXPORT_SSLLIBS="$SSLLIBS" ++EXPORT_SSLLIBS="" + AC_SUBST(EXPORT_SSLLIBS) + + diff --git a/testing/cups/cups-no-gcrypt.patch b/testing/cups/cups-no-gcrypt.patch new file mode 100644 index 000000000..42f71d0d4 --- /dev/null +++ b/testing/cups/cups-no-gcrypt.patch @@ -0,0 +1,38 @@ +diff -ruN cups-1.4.7.orig//config-scripts/cups-ssl.m4 cups-1.4.7/config-scripts/cups-ssl.m4 +--- cups-1.5.0.orig//config-scripts/cups-ssl.m4 2011-01-11 08:05:58.000000000 +0100 ++++ cups-1.5.0/config-scripts/cups-ssl.m4 2011-08-02 10:44:26.011047900 +0200 +@@ -96,7 +96,6 @@ + dnl Then look for GNU TLS... + if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then + AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config) +- AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config) + if $PKGCONFIG --exists gnutls; then + have_ssl=1 + SSLLIBS=`$PKGCONFIG --libs gnutls` +@@ -110,16 +109,6 @@ + AC_DEFINE(HAVE_SSL) + AC_DEFINE(HAVE_GNUTLS) + fi +- +- if test $have_ssl = 1; then +- if $PKGCONFIG --exists gcrypt; then +- SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`" +- SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`" +- elif test "x$LIBGCRYPTCONFIG" != x; then +- SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`" +- SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`" +- fi +- fi + fi + + dnl Check for the OpenSSL library last... +--- cups-1.5.0.orig//cups/http-private.h 2011-01-22 01:07:22.000000000 +0100 ++++ cups-1.5.0/cups/http-private.h 2011-08-02 10:42:43.341604107 +0200 +@@ -93,7 +93,6 @@ + # elif defined HAVE_GNUTLS + # include <gnutls/gnutls.h> + # include <gnutls/x509.h> +-# include <gcrypt.h> + # elif defined(HAVE_CDSASSL) + # include <CoreFoundation/CoreFoundation.h> + # include <Security/Security.h> diff --git a/testing/cups/cups-no-gzip-man.patch b/testing/cups/cups-no-gzip-man.patch new file mode 100644 index 000000000..6786c4430 --- /dev/null +++ b/testing/cups/cups-no-gzip-man.patch @@ -0,0 +1,18 @@ +diff -up cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man cups-1.5b1/config-scripts/cups-manpages.m4 +--- cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man 2011-05-12 07:21:56.000000000 +0200 ++++ cups-1.5b1/config-scripts/cups-manpages.m4 2011-05-23 17:25:50.000000000 +0200 +@@ -69,10 +69,10 @@ case "$uname" in + ;; + Linux* | GNU* | Darwin*) + # Linux, GNU Hurd, and Mac OS X +- MAN1EXT=1.gz +- MAN5EXT=5.gz +- MAN7EXT=7.gz +- MAN8EXT=8.gz ++ MAN1EXT=1 ++ MAN5EXT=5 ++ MAN7EXT=7 ++ MAN8EXT=8 + MAN8DIR=8 + ;; + *) diff --git a/testing/cups/cups-no-gzip-man.patch.16 b/testing/cups/cups-no-gzip-man.patch.16 new file mode 100644 index 000000000..69899b9cb --- /dev/null +++ b/testing/cups/cups-no-gzip-man.patch.16 @@ -0,0 +1,18 @@ +diff -up cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man cups-1.5b1/config-scripts/cups-manpages.m4 +--- cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man 2011-05-12 07:21:56.000000000 +0200 ++++ cups-1.5b1/config-scripts/cups-manpages.m4 2011-05-23 17:25:50.000000000 +0200 +@@ -69,10 +69,10 @@ case "$uname" in + ;; + Linux* | GNU* | Darwin*) + # Linux, GNU Hurd, and OS X +- MAN1EXT=1.gz +- MAN5EXT=5.gz +- MAN7EXT=7.gz +- MAN8EXT=8.gz ++ MAN1EXT=1 ++ MAN5EXT=5 ++ MAN7EXT=7 ++ MAN8EXT=8 + MAN8DIR=8 + ;; + *) diff --git a/testing/cups/cups-systemd-socket.patch b/testing/cups/cups-systemd-socket.patch new file mode 100644 index 000000000..09d17d415 --- /dev/null +++ b/testing/cups/cups-systemd-socket.patch @@ -0,0 +1,527 @@ +diff -up cups-1.5.2/config.h.in.systemd-socket cups-1.5.2/config.h.in +--- cups-1.5.2/config.h.in.systemd-socket 2012-03-16 14:50:57.089449755 +0000 ++++ cups-1.5.2/config.h.in 2012-03-16 14:50:57.146449787 +0000 +@@ -503,6 +503,13 @@ + + + /* ++ * Do we have systemd support? ++ */ ++ ++#undef HAVE_SYSTEMD ++ ++ ++/* + * Various scripting languages... + */ + +diff -up cups-1.5.2/config-scripts/cups-systemd.m4.systemd-socket cups-1.5.2/config-scripts/cups-systemd.m4 +--- cups-1.5.2/config-scripts/cups-systemd.m4.systemd-socket 2012-03-16 14:50:57.146449787 +0000 ++++ cups-1.5.2/config-scripts/cups-systemd.m4 2012-03-16 14:50:57.146449787 +0000 +@@ -0,0 +1,36 @@ ++dnl ++dnl "$Id$" ++dnl ++dnl systemd stuff for CUPS. ++ ++dnl Find whether systemd is available ++ ++SDLIBS="" ++AC_ARG_WITH([systemdsystemunitdir], ++ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), ++ [], [with_systemdsystemunitdir=$($PKGCONFIG --variable=systemdsystemunitdir systemd)]) ++if test "x$with_systemdsystemunitdir" != xno; then ++ AC_MSG_CHECKING(for libsystemd-daemon) ++ if $PKGCONFIG --exists libsystemd-daemon; then ++ AC_MSG_RESULT(yes) ++ SDCFLAGS=`$PKGCONFIG --cflags libsystemd-daemon` ++ SDLIBS=`$PKGCONFIG --libs libsystemd-daemon` ++ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) ++ AC_DEFINE(HAVE_SYSTEMD) ++ else ++ AC_MSG_RESULT(no) ++ fi ++fi ++ ++if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then ++ SYSTEMD_UNITS="cups.service cups.socket cups.path" ++else ++ SYSTEMD_UNITS="" ++fi ++ ++AC_SUBST(SYSTEMD_UNITS) ++AC_SUBST(SDLIBS) ++ ++dnl ++dnl "$Id$" ++dnl +diff -up cups-1.5.2/configure.in.systemd-socket cups-1.5.2/configure.in +--- cups-1.5.2/configure.in.systemd-socket 2011-08-31 02:36:33.000000000 +0100 ++++ cups-1.5.2/configure.in 2012-03-16 14:50:57.146449787 +0000 +@@ -37,6 +37,7 @@ sinclude(config-scripts/cups-pam.m4) + sinclude(config-scripts/cups-largefile.m4) + sinclude(config-scripts/cups-dnssd.m4) + sinclude(config-scripts/cups-launchd.m4) ++sinclude(config-scripts/cups-systemd.m4) + sinclude(config-scripts/cups-defaults.m4) + sinclude(config-scripts/cups-pdf.m4) + sinclude(config-scripts/cups-scripting.m4) +@@ -71,6 +72,9 @@ AC_OUTPUT(Makedefs + conf/snmp.conf + cups-config + data/testprint ++ data/cups.service ++ data/cups.socket ++ data/cups.path + desktop/cups.desktop + doc/help/ref-cupsd-conf.html + doc/help/standard.html +diff -up cups-1.5.2/cups/usersys.c.systemd-socket cups-1.5.2/cups/usersys.c +--- cups-1.5.2/cups/usersys.c.systemd-socket 2012-03-16 14:50:57.054449734 +0000 ++++ cups-1.5.2/cups/usersys.c 2012-03-16 14:50:57.148449788 +0000 +@@ -778,7 +778,7 @@ cups_read_client_conf( + struct stat sockinfo; /* Domain socket information */ + + if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) && +- (sockinfo.st_mode & S_IRWXO) == S_IRWXO) ++ (sockinfo.st_mode & (S_IROTH | S_IWOTH)) == (S_IROTH | S_IWOTH)) + cups_server = CUPS_DEFAULT_DOMAINSOCKET; + else + #endif /* CUPS_DEFAULT_DOMAINSOCKET */ +diff -up cups-1.5.2/data/cups.path.in.systemd-socket cups-1.5.2/data/cups.path.in +--- cups-1.5.2/data/cups.path.in.systemd-socket 2012-03-16 14:50:57.148449788 +0000 ++++ cups-1.5.2/data/cups.path.in 2012-03-16 14:50:57.148449788 +0000 +@@ -0,0 +1,8 @@ ++[Unit] ++Description=CUPS Printer Service Spool ++ ++[Path] ++PathExistsGlob=@CUPS_REQUESTS@/d* ++ ++[Install] ++WantedBy=multi-user.target +diff -up cups-1.5.2/data/cups.service.in.systemd-socket cups-1.5.2/data/cups.service.in +--- cups-1.5.2/data/cups.service.in.systemd-socket 2012-03-16 14:50:57.149449788 +0000 ++++ cups-1.5.2/data/cups.service.in 2012-03-16 14:50:57.149449788 +0000 +@@ -0,0 +1,10 @@ ++[Unit] ++Description=CUPS Printing Service ++ ++[Service] ++ExecStart=@sbindir@/cupsd -f ++PrivateTmp=true ++ ++[Install] ++Also=cups.socket cups.path ++WantedBy=printer.target +diff -up cups-1.5.2/data/cups.socket.in.systemd-socket cups-1.5.2/data/cups.socket.in +--- cups-1.5.2/data/cups.socket.in.systemd-socket 2012-03-16 14:50:57.150449788 +0000 ++++ cups-1.5.2/data/cups.socket.in 2012-03-16 14:50:57.150449788 +0000 +@@ -0,0 +1,11 @@ ++[Unit] ++Description=CUPS Printing Service Sockets ++ ++[Socket] ++ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@ ++ListenStream=631 ++ListenDatagram=0.0.0.0:631 ++BindIPv6Only=ipv6-only ++ ++[Install] ++WantedBy=sockets.target +diff -up cups-1.5.2/data/Makefile.systemd-socket cups-1.5.2/data/Makefile +--- cups-1.5.2/data/Makefile.systemd-socket 2011-05-12 06:21:56.000000000 +0100 ++++ cups-1.5.2/data/Makefile 2012-03-16 14:50:57.151449789 +0000 +@@ -112,6 +112,12 @@ install-data: + $(INSTALL_DATA) $$file $(DATADIR)/ppdc; \ + done + $(INSTALL_DIR) -m 755 $(DATADIR)/profiles ++ if test "x$(SYSTEMD_UNITS)" != "x" ; then \ ++ $(INSTALL_DIR) -m 755 $(SYSTEMDUNITDIR); \ ++ for file in $(SYSTEMD_UNITS); do \ ++ $(INSTALL_DATA) $$file $(SYSTEMDUNITDIR); \ ++ done; \ ++ fi + + + # +@@ -159,6 +165,9 @@ uninstall: + -$(RMDIR) $(DATADIR)/charsets + -$(RMDIR) $(DATADIR)/banners + -$(RMDIR) $(DATADIR) ++ for file in $(SYSTEMD_UNITS); do \ ++ $(RM) $(SYSTEMDUNITDIR)/$$file; \ ++ done + + + # +diff -up cups-1.5.2/Makedefs.in.systemd-socket cups-1.5.2/Makedefs.in +--- cups-1.5.2/Makedefs.in.systemd-socket 2012-03-16 14:50:57.081449751 +0000 ++++ cups-1.5.2/Makedefs.in 2012-03-16 14:50:57.152449790 +0000 +@@ -143,6 +143,7 @@ CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ + CXXLIBS = @CXXLIBS@ + DBUS_NOTIFIER = @DBUS_NOTIFIER@ + DBUS_NOTIFIERLIBS = @DBUS_NOTIFIERLIBS@ ++SYSTEMD_UNITS = @SYSTEMD_UNITS@ + DNSSD_BACKEND = @DNSSD_BACKEND@ + DSOFLAGS = -L../cups @DSOFLAGS@ + DSOLIBS = @DSOLIBS@ $(COMMONLIBS) +@@ -151,6 +152,7 @@ FONTS = @FONTS@ + IMGLIBS = @IMGLIBS@ + IMGFILTERS = @IMGFILTERS@ + LAUNCHDLIBS = @LAUNCHDLIBS@ ++SDLIBS = @SDLIBS@ + LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \ + -L../scheduler @LDARCHFLAGS@ \ + @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM) +@@ -267,6 +269,7 @@ PAMFILE = @PAMFILE@ + + DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@ + DBUSDIR = @DBUSDIR@ ++SYSTEMDUNITDIR = $(BUILDROOT)@systemdsystemunitdir@ + + + # +diff -up cups-1.5.2/scheduler/client.h.systemd-socket cups-1.5.2/scheduler/client.h +--- cups-1.5.2/scheduler/client.h.systemd-socket 2011-03-25 21:25:38.000000000 +0000 ++++ cups-1.5.2/scheduler/client.h 2012-03-16 14:50:57.153449791 +0000 +@@ -75,6 +75,9 @@ typedef struct + int fd; /* File descriptor for this server */ + http_addr_t address; /* Bind address of socket */ + http_encryption_t encryption; /* To encrypt or not to encrypt... */ ++#ifdef HAVE_SYSTEMD ++ int is_systemd; /* Is this a systemd socket? */ ++#endif /* HAVE_SYSTEMD */ + } cupsd_listener_t; + + +diff -up cups-1.5.2/scheduler/dirsvc.c.systemd-socket cups-1.5.2/scheduler/dirsvc.c +--- cups-1.5.2/scheduler/dirsvc.c.systemd-socket 2012-03-16 14:50:57.112449768 +0000 ++++ cups-1.5.2/scheduler/dirsvc.c 2012-03-16 14:50:57.155449792 +0000 +@@ -1512,7 +1512,7 @@ cupsdStartBrowsing(void) + } + } + +- if (BrowseSocket >= 0) ++ if (BrowseSocket >= 0 && !BrowseSocketIsSystemd) + { + /* + * Bind the socket to browse port... +@@ -1556,13 +1556,17 @@ cupsdStartBrowsing(void) + cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to set broadcast mode - %s.", + strerror(errno)); + ++ if (!BrowseSocketIsSystemd) ++ { + #ifdef WIN32 +- closesocket(BrowseSocket); ++ closesocket(BrowseSocket); + #else +- close(BrowseSocket); ++ close(BrowseSocket); + #endif /* WIN32 */ + +- BrowseSocket = -1; ++ BrowseSocket = -1; ++ } ++ + BrowseLocalProtocols &= ~BROWSE_CUPS; + BrowseRemoteProtocols &= ~BROWSE_CUPS; + +@@ -1885,15 +1889,22 @@ cupsdStopBrowsing(void) + if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS) && + BrowseSocket >= 0) + { +- /* +- * Close the socket and remove it from the input selection set. +- */ ++ if (!BrowseSocketIsSystemd) ++ { ++ /* ++ * Close the socket. ++ */ + + #ifdef WIN32 +- closesocket(BrowseSocket); ++ closesocket(BrowseSocket); + #else +- close(BrowseSocket); ++ close(BrowseSocket); + #endif /* WIN32 */ ++ } ++ ++ /* ++ * Remove it from the input selection set. ++ */ + + cupsdRemoveSelect(BrowseSocket); + BrowseSocket = -1; +@@ -5693,11 +5704,14 @@ update_cups_browse(void) + strerror(errno)); + cupsdLogMessage(CUPSD_LOG_ERROR, "CUPS browsing turned off."); + ++ if (!BrowseSocketIsSystemd) ++ { + #ifdef WIN32 +- closesocket(BrowseSocket); ++ closesocket(BrowseSocket); + #else +- close(BrowseSocket); ++ close(BrowseSocket); + #endif /* WIN32 */ ++ } + + cupsdRemoveSelect(BrowseSocket); + BrowseSocket = -1; +diff -up cups-1.5.2/scheduler/dirsvc.h.systemd-socket cups-1.5.2/scheduler/dirsvc.h +--- cups-1.5.2/scheduler/dirsvc.h.systemd-socket 2012-03-16 14:50:57.113449769 +0000 ++++ cups-1.5.2/scheduler/dirsvc.h 2012-03-16 14:50:57.157449792 +0000 +@@ -100,6 +100,8 @@ VAR int Browsing VALUE(TRUE), + /* Short names for remote printers? */ + BrowseSocket VALUE(-1), + /* Socket for browsing */ ++ BrowseSocketIsSystemd VALUE(0), ++ /* BrowseSocket is systemd-provided? */ + BrowsePort VALUE(IPP_PORT), + /* Port number for broadcasts */ + BrowseInterval VALUE(DEFAULT_INTERVAL), +diff -up cups-1.5.2/scheduler/listen.c.systemd-socket cups-1.5.2/scheduler/listen.c +--- cups-1.5.2/scheduler/listen.c.systemd-socket 2011-04-16 00:38:13.000000000 +0100 ++++ cups-1.5.2/scheduler/listen.c 2012-03-16 14:50:57.158449792 +0000 +@@ -401,7 +401,11 @@ cupsdStopListening(void) + lis; + lis = (cupsd_listener_t *)cupsArrayNext(Listeners)) + { +- if (lis->fd != -1) ++ if (lis->fd != -1 ++#ifdef HAVE_SYSTEMD ++ && !lis->is_systemd ++#endif /* HAVE_SYSTEMD */ ++ ) + { + #ifdef WIN32 + closesocket(lis->fd); +diff -up cups-1.5.2/scheduler/main.c.systemd-socket cups-1.5.2/scheduler/main.c +--- cups-1.5.2/scheduler/main.c.systemd-socket 2012-03-16 14:50:57.121449773 +0000 ++++ cups-1.5.2/scheduler/main.c 2012-03-16 14:51:55.409483636 +0000 +@@ -26,6 +26,8 @@ + * launchd_checkin() - Check-in with launchd and collect the listening + * fds. + * launchd_checkout() - Update the launchd KeepAlive file as needed. ++ * systemd_checkin() - Check-in with systemd and collect the ++ * listening fds. + * parent_handler() - Catch USR1/CHLD signals... + * process_children() - Process all dead children... + * select_timeout() - Calculate the select timeout value. +@@ -62,6 +64,10 @@ + # endif /* !LAUNCH_JOBKEY_SERVICEIPC */ + #endif /* HAVE_LAUNCH_H */ + ++#ifdef HAVE_SYSTEMD ++#include <systemd/sd-daemon.h> ++#endif /* HAVE_SYSTEMD */ ++ + #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) + # include <malloc.h> + #endif /* HAVE_MALLOC_H && HAVE_MALLINFO */ +@@ -78,6 +84,9 @@ + static void launchd_checkin(void); + static void launchd_checkout(void); + #endif /* HAVE_LAUNCHD */ ++#ifdef HAVE_SYSTEMD ++static void systemd_checkin(void); ++#endif /* HAVE_SYSTEMD */ + static void parent_handler(int sig); + static void process_children(void); + static void sigchld_handler(int sig); +@@ -537,6 +546,13 @@ main(int argc, /* I - Number of comm + } + #endif /* HAVE_LAUNCHD */ + ++#ifdef HAVE_SYSTEMD ++ /* ++ * If we were started by systemd get the listen sockets file descriptors... ++ */ ++ systemd_checkin(); ++#endif /* HAVE_SYSTEMD */ ++ + /* + * Startup the server... + */ +@@ -759,6 +775,15 @@ main(int argc, /* I - Number of comm + } + #endif /* HAVE_LAUNCHD */ + ++#ifdef HAVE_SYSTEMD ++ /* ++ * If we were started by systemd get the listen sockets file ++ * descriptors... ++ */ ++ ++ systemd_checkin(); ++#endif /* HAVE_SYSTEMD */ ++ + /* + * Startup the server... + */ +@@ -1584,6 +1609,139 @@ launchd_checkout(void) + } + #endif /* HAVE_LAUNCHD */ + ++#ifdef HAVE_SYSTEMD ++static void ++systemd_checkin(void) ++{ ++ int n, fd; ++ ++ n = sd_listen_fds(0); ++ if (n < 0) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Failed to acquire sockets from systemd - %s", ++ strerror(-n)); ++ exit(EXIT_FAILURE); ++ return; ++ } ++ ++ if (n == 0) ++ return; ++ ++ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++) ++ { ++ http_addr_t addr; ++ socklen_t addrlen = sizeof (addr); ++ int r; ++ cupsd_listener_t *lis; ++ char s[256]; ++ ++ r = sd_is_socket(fd, AF_UNSPEC, SOCK_STREAM, 1); ++ if (r < 0) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to verify socket type - %s", ++ strerror(-r)); ++ continue; ++ } ++ ++ if (!r) ++ { ++ if (Browsing && ++ ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS)) ++ { ++ r = sd_is_socket(fd, AF_UNSPEC, SOCK_DGRAM, 0); ++ if (r < 0) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to verify socket type - %s", ++ strerror(-r)); ++ continue; ++ } ++ ++ if (r) ++ { ++ /* ++ * This is the browse socket. ++ */ ++ ++ char addrstr[256]; ++ if (getsockname(fd, (struct sockaddr*) &addr, &addrlen)) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to get local address - %s", ++ strerror(errno)); ++ continue; ++ } ++ ++ httpAddrString (&addr, addrstr, sizeof (addrstr)); ++ BrowseSocket = fd; ++ BrowseSocketIsSystemd = 1; ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "systemd_checkin: Matched browse (port %d) with fd %d:%s...", ++ BrowsePort, fd, addrstr); ++ continue; ++ } ++ ++ } ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Socket not of the right type"); ++ continue; ++ } ++ ++ if (getsockname(fd, (struct sockaddr*) &addr, &addrlen)) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to get local address - %s", ++ strerror(errno)); ++ continue; ++ } ++ ++ /* ++ * Try to match the systemd socket address to one of the listeners... ++ */ ++ ++ for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners); ++ lis; ++ lis = (cupsd_listener_t *)cupsArrayNext(Listeners)) ++ if (httpAddrEqual(&lis->address, &addr)) ++ break; ++ ++ if (lis) ++ { ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "systemd_checkin: Matched existing listener %s with fd %d...", ++ httpAddrString(&(lis->address), s, sizeof(s)), fd); ++ } ++ else ++ { ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "systemd_checkin: Adding new listener %s with fd %d...", ++ httpAddrString(&addr, s, sizeof(s)), fd); ++ ++ if ((lis = calloc(1, sizeof(cupsd_listener_t))) == NULL) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to allocate listener - " ++ "%s.", strerror(errno)); ++ exit(EXIT_FAILURE); ++ } ++ ++ cupsArrayAdd(Listeners, lis); ++ ++ memcpy(&lis->address, &addr, sizeof(lis->address)); ++ } ++ ++ lis->fd = fd; ++ lis->is_systemd = 1; ++ ++# ifdef HAVE_SSL ++ if (_httpAddrPort(&(lis->address)) == 443) ++ lis->encryption = HTTP_ENCRYPT_ALWAYS; ++# endif /* HAVE_SSL */ ++ } ++} ++#endif /* HAVE_SYSTEMD */ + + /* + * 'parent_handler()' - Catch USR1/CHLD signals... +diff -up cups-1.5.2/scheduler/Makefile.systemd-socket cups-1.5.2/scheduler/Makefile +--- cups-1.5.2/scheduler/Makefile.systemd-socket 2012-03-16 14:50:57.130449778 +0000 ++++ cups-1.5.2/scheduler/Makefile 2012-03-16 14:50:57.160449794 +0000 +@@ -382,7 +382,7 @@ cupsd: $(CUPSDOBJS) $(LIBCUPSMIME) ../cu + $(CC) $(LDFLAGS) -o cupsd $(CUPSDOBJS) -L. -lcupsmime \ + $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \ + $(LIBPAPER) $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBS) \ +- $(LIBGSSAPI) $(LIBWRAP) ++ $(LIBGSSAPI) $(LIBWRAP) $(SDLIBS) + + cupsd-static: $(CUPSDOBJS) libcupsmime.a ../cups/$(LIBCUPSSTATIC) + echo Linking $@... +@@ -390,7 +390,7 @@ cupsd-static: $(CUPSDOBJS) libcupsmime.a + $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \ + ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(LIBPAPER) \ + $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBGSSAPI) \ +- $(LIBWRAP) ++ $(LIBWRAP) $(SDLIBS) + + + # diff --git a/testing/cups/cups.install b/testing/cups/cups.install new file mode 100644 index 000000000..47c3d9b82 --- /dev/null +++ b/testing/cups/cups.install @@ -0,0 +1,26 @@ +post_install() { + if [ -x usr/bin/xdg-icon-resource ]; then + xdg-icon-resource forceupdate --theme hicolor 2> /dev/null + fi + 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() { + if [ -x usr/bin/xdg-icon-resource ]; then + xdg-icon-resource forceupdate --theme hicolor 2> /dev/null + fi + if [ "`vercmp $2 1.4.7-2`" -lt 0 ]; then + # important upgrade notice + echo "daemon script has been renamed to /etc/rc.d/cupsd" + echo "change your entry in /etc/rc.conf" + fi +} + +post_remove() { + if [ -x usr/bin/xdg-icon-resource ]; then + xdg-icon-resource forceupdate --theme hicolor 2> /dev/null + fi +} 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/gutenprint/PKGBUILD b/testing/gutenprint/PKGBUILD new file mode 100644 index 000000000..3924bec62 --- /dev/null +++ b/testing/gutenprint/PKGBUILD @@ -0,0 +1,40 @@ +# $Id: PKGBUILD 161638 2012-06-12 18:43:43Z andyrtr $ +# Maintainer: Andreas Radke <andyrtr@archlinux.org> + +pkgname=gutenprint +pkgver=5.2.8 +pkgrel=1 +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=(5ed64c0f994245852da8e9fa6a137060'') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + ./configure --prefix=/usr \ + --enable-samples \ + --enable-cups-ppds \ + --enable-cups-ppds-at-top-level \ + --disable-translated-cups-ppds \ + --disable-globalized-cups-ppds \ + --disable-static \ + --disable-static-genppd + 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/sysvinit/PKGBUILD b/testing/sysvinit/PKGBUILD new file mode 100644 index 000000000..bbf2a6972 --- /dev/null +++ b/testing/sysvinit/PKGBUILD @@ -0,0 +1,36 @@ +# $Id: PKGBUILD 161641 2012-06-12 20:53:23Z bluewind $ +# Maintainer: Eric Belanger <eric@archlinux.org> + +pkgname=sysvinit +pkgver=2.88 +pkgrel=4 +pkgdesc="Linux System V Init" +arch=('i686' 'x86_64') +url="http://savannah.nongnu.org/projects/sysvinit" +license=('GPL') +groups=('base') +depends=('util-linux' 'coreutils' 'glibc' 'awk') +install=sysvinit.install +source=(http://download.savannah.gnu.org/releases/sysvinit/${pkgname}-${pkgver}dsf.tar.bz2 + "Remove-handling-of-special-chars-fix-per-line-buffer.patch") +sha1sums=('f2ca149df1314a91f3007cccd7a0aa47d990de26' + 'cb1180009cc2ff3ba1bc4fa5609f3d279fed9d0e') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}dsf" + + # FS#30005 + patch -p1 -d "src" -i "${srcdir}/Remove-handling-of-special-chars-fix-per-line-buffer.patch" + + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}dsf" + make ROOT="${pkgdir}" install + + # mountpoint is now provided by util-linux instead + cd "${pkgdir}" + rm bin/mountpoint + rm usr/share/man/man1/mountpoint.1 +} diff --git a/testing/sysvinit/Remove-handling-of-special-chars-fix-per-line-buffer.patch b/testing/sysvinit/Remove-handling-of-special-chars-fix-per-line-buffer.patch new file mode 100644 index 000000000..b573b9a6d --- /dev/null +++ b/testing/sysvinit/Remove-handling-of-special-chars-fix-per-line-buffer.patch @@ -0,0 +1,216 @@ +From 4d2b17f47073e0491f9dfa62797cc727d4530f22 Mon Sep 17 00:00:00 2001 +From: Florian Pritz <bluewind@xinu.at> +Date: Tue, 22 May 2012 22:14:52 +0200 +Subject: [PATCH] Remove handling of special chars; fix per line buffer + problem + +The linebuffer was only 256 chars so longer lines were truncated. + +By removing the handling of special chars (for example: /n/r/t) and +simply writing everything we read as is to the logfile we fix this bug, +make the code much smaller and allow users to write userspace tools that +correctly handle rendering. + +Signed-off-by: Florian Pritz <bluewind@xinu.at> +--- + bootlogd.c | 139 +++++++++--------------------------------------------------- + 1 file changed, 19 insertions(+), 120 deletions(-) + +diff --git a/bootlogd.c b/bootlogd.c +index 570d382..5df8fb9 100644 +--- a/bootlogd.c ++++ b/bootlogd.c +@@ -58,21 +58,10 @@ char *Version = "@(#) bootlogd 2.86 03-Jun-2004 miquels@cistron.nl"; + + #define LOGFILE "/var/log/boot" + +-char ringbuf[32768]; +-char *endptr = ringbuf + sizeof(ringbuf); +-char *inptr = ringbuf; +-char *outptr = ringbuf; +- + int got_signal = 0; +-int didnl = 1; + int createlogfile = 0; + int syncalot = 0; + +-struct line { +- char buf[256]; +- int pos; +-} line; +- + /* + * Console devices as listed on the kernel command line and + * the mapping to actual devices in /dev +@@ -345,83 +334,6 @@ int consolename(char *res, int rlen) + return -1; + } + +- +-/* +- * Write data and make sure it's on disk. +- */ +-void writelog(FILE *fp, unsigned char *ptr, int len) +-{ +- time_t t; +- char *s; +- char tmp[8]; +- int olen = len; +- int dosync = 0; +- int tlen; +- +- while (len > 0) { +- tmp[0] = 0; +- if (didnl) { +- time(&t); +- s = ctime(&t); +- fprintf(fp, "%.24s: ", s); +- didnl = 0; +- } +- switch (*ptr) { +- case 27: /* ESC */ +- strcpy(tmp, "^["); +- break; +- case '\r': +- line.pos = 0; +- break; +- case 8: /* ^H */ +- if (line.pos > 0) line.pos--; +- break; +- case '\n': +- didnl = 1; +- dosync = 1; +- break; +- case '\t': +- line.pos += (line.pos / 8 + 1) * 8; +- if (line.pos >= (int)sizeof(line.buf)) +- line.pos = sizeof(line.buf) - 1; +- break; +- case 32 ... 127: +- case 161 ... 255: +- tmp[0] = *ptr; +- tmp[1] = 0; +- break; +- default: +- sprintf(tmp, "\\%03o", *ptr); +- break; +- } +- ptr++; +- len--; +- +- tlen = strlen(tmp); +- if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) { +- memcpy(line.buf + line.pos, tmp, tlen); +- line.pos += tlen; +- } +- if (didnl) { +- fprintf(fp, "%s\n", line.buf); +- memset(&line, 0, sizeof(line)); +- } +- } +- +- if (dosync) { +- fflush(fp); +- if (syncalot) { +- fdatasync(fileno(fp)); +- } +- } +- +- outptr += olen; +- if (outptr >= endptr) +- outptr = ringbuf; +- +-} +- +- + /* + * Print usage message and exit. + */ +@@ -481,7 +393,6 @@ int main(int argc, char **argv) + int ptm, pts; + int realfd; + int n, m, i; +- int todo; + + fp = NULL; + logfile = LOGFILE; +@@ -615,13 +526,13 @@ int main(int argc, char **argv) + /* + * See how much space there is left, read. + */ +- if ((n = read(ptm, inptr, endptr - inptr)) >= 0) { ++ if ((n = read(ptm, buf, sizeof(buf))) >= 0) { + /* + * Write data (in chunks if needed) + * to the real output device. + */ + m = n; +- p = inptr; ++ p = buf; + while (m > 0) { + i = write(realfd, p, m); + if (i >= 0) { +@@ -641,43 +552,31 @@ int main(int argc, char **argv) + } + + /* +- * Increment buffer position. Handle +- * wraps, and also drag output pointer +- * along if we cross it. ++ * Perhaps we need to open the logfile. + */ +- inptr += n; +- if (inptr - n < outptr && inptr > outptr) +- outptr = inptr; +- if (inptr >= endptr) +- inptr = ringbuf; +- if (outptr >= endptr) +- outptr = ringbuf; +- } +- } ++ if (fp == NULL && access(logfile, F_OK) == 0) { ++ if (rotate) { ++ snprintf(buf, sizeof(buf), "%s~", logfile); ++ rename(logfile, buf); ++ } ++ fp = fopen(logfile, "a"); ++ } ++ if (fp == NULL && createlogfile) ++ fp = fopen(logfile, "a"); + +- /* +- * Perhaps we need to open the logfile. +- */ +- if (fp == NULL && access(logfile, F_OK) == 0) { +- if (rotate) { +- snprintf(buf, sizeof(buf), "%s~", logfile); +- rename(logfile, buf); ++ if (fp) { ++ write(fileno(fp), buf, n); ++ } ++ ++ if (syncalot) { ++ fdatasync(fileno(fp)); ++ } + } +- fp = fopen(logfile, "a"); + } +- if (fp == NULL && createlogfile) +- fp = fopen(logfile, "a"); + +- if (inptr >= outptr) +- todo = inptr - outptr; +- else +- todo = endptr - outptr; +- if (fp && todo) +- writelog(fp, (unsigned char *)outptr, todo); + } + + if (fp) { +- if (!didnl) fputc('\n', fp); + fclose(fp); + } + +-- +1.7.10.2 + diff --git a/testing/sysvinit/sysvinit.install b/testing/sysvinit/sysvinit.install new file mode 100644 index 000000000..2f0e62e74 --- /dev/null +++ b/testing/sysvinit/sysvinit.install @@ -0,0 +1,3 @@ +post_upgrade() { + [ -x sbin/init ] && sbin/init u +} diff --git a/testing/xinetd/PKGBUILD b/testing/xinetd/PKGBUILD new file mode 100644 index 000000000..3f9dfa4f1 --- /dev/null +++ b/testing/xinetd/PKGBUILD @@ -0,0 +1,47 @@ +# $Id: PKGBUILD 161606 2012-06-12 07:21:42Z tpowa $ +# Maintainer: Tobias Powalowski <tpowa@archlinux.org> +# Contributor: Judd <jvinet@zeroflux.org> + +pkgname=xinetd +pkgver=2.3.15 +pkgrel=2 +pkgdesc="A secure replacement for inetd" +arch=('i686' 'x86_64') +url="http://www.xinetd.org/" +license=('custom') +optdepends=('perl: for xconv.pl script') +backup=('etc/xinetd.conf' 'etc/xinetd.d/servers' 'etc/xinetd.d/services') +source=(http://www.xinetd.org/xinetd-$pkgver.tar.gz + xinetd.conf + xinetd + servers + services + xinetd.service) +md5sums=('77358478fd58efa6366accae99b8b04c' + 'f109f699a07bc8cfb5791060f5e87f9e' + 'ea37a2794f202e6b953d9b6956dad16a' + '21f47b4aa20921cfaddddd9f9a407f81' + '9fa2061dc7dd738c8424251deb86f81e' + '08466ed714ea8ba42ad81f6fb3aa62e7') + +build() { + cd $srcdir/$pkgname-$pkgver + sed -i "s#${prefix}/man#${prefix}/share/man#" configure + ./configure --prefix=/usr --without-libwrap + make +} + +package() { + cd $srcdir/$pkgname-$pkgver + make prefix=$pkgdir/usr install + + install -Dm755 $srcdir/xinetd $pkgdir/etc/rc.d/xinetd + install -Dm644 $srcdir/xinetd.conf $pkgdir/etc/xinetd.conf + install -Dm644 $srcdir/servers $pkgdir/etc/xinetd.d/servers + install -Dm644 $srcdir/services $pkgdir/etc/xinetd.d/services + + # install systemd files + install -Dm644 $srcdir/xinetd.service $pkgdir/usr/lib/systemd/system/xinetd.service + # install license + install -Dm644 COPYRIGHT $pkgdir/usr/share/licenses/$pkgname/COPYRIGHT +} diff --git a/testing/xinetd/servers b/testing/xinetd/servers new file mode 100644 index 000000000..f064c8d7a --- /dev/null +++ b/testing/xinetd/servers @@ -0,0 +1,10 @@ +service servers +{ + type = INTERNAL UNLISTED + port = 9099 + socket_type = stream + protocol = tcp + wait = no + disable = yes + only_from = 127.0.0.1 +} diff --git a/testing/xinetd/services b/testing/xinetd/services new file mode 100644 index 000000000..4ea304c4f --- /dev/null +++ b/testing/xinetd/services @@ -0,0 +1,10 @@ +service services +{ + type = INTERNAL UNLISTED + port = 9098 + socket_type = stream + protocol = tcp + wait = no + disable = yes + only_from = 127.0.0.1 +} diff --git a/testing/xinetd/xinetd b/testing/xinetd/xinetd new file mode 100755 index 000000000..4b8fa369a --- /dev/null +++ b/testing/xinetd/xinetd @@ -0,0 +1,38 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /usr/sbin/xinetd` +case "$1" in + start) + stat_busy "Starting xinetd" + [ -z "$PID" ] && /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid + if [ $? -gt 0 ]; then + stat_fail + else + echo $PID > /var/run/xinetd.pid + add_daemon xinetd + stat_done + fi + ;; + stop) + stat_busy "Stopping xinetd" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm -f /var/run/xinetd.pid + rm_daemon xinetd + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/testing/xinetd/xinetd.conf b/testing/xinetd/xinetd.conf new file mode 100644 index 000000000..b15d9f649 --- /dev/null +++ b/testing/xinetd/xinetd.conf @@ -0,0 +1,14 @@ +# +# /etc/xinetd.conf +# + +defaults +{ + instances = 60 + log_type = SYSLOG authpriv + log_on_success = HOST PID + log_on_failure = HOST + cps = 25 30 +} + +includedir /etc/xinetd.d diff --git a/testing/xinetd/xinetd.service b/testing/xinetd/xinetd.service new file mode 100644 index 000000000..c6f6271fd --- /dev/null +++ b/testing/xinetd/xinetd.service @@ -0,0 +1,10 @@ +[Unit] +Description=A secure replacement for inetd +After=network.target + +[Service] +ExecStart=/usr/sbin/xinetd -dontfork +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target |