pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/consolekit * Improves a lot FreeBSD and Drago...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/245bc99088ca
branches:  trunk
changeset: 552098:245bc99088ca
user:      hasso <hasso%pkgsrc.org@localhost>
date:      Fri Dec 26 20:05:56 2008 +0000

description:
* Improves a lot FreeBSD and DragonFly support (from FreeBSD ports)
* Fixes two leak problems (from upstream bugzilla)
* Bump PKGREVISION

diffstat:

 sysutils/consolekit/Makefile                                |   15 +-
 sysutils/consolekit/distinfo                                |    8 +-
 sysutils/consolekit/files/ck-get-x11-display-device.FreeBSD |   35 ++
 sysutils/consolekit/files/ck-get-x11-server-pid.FreeBSD     |   17 +
 sysutils/consolekit/patches/patch-ae                        |   24 +-
 sysutils/consolekit/patches/patch-af                        |  152 +++++++++++-
 sysutils/consolekit/patches/patch-ag                        |   15 +
 sysutils/consolekit/patches/patch-ah                        |   14 +
 8 files changed, 264 insertions(+), 16 deletions(-)

diffs (truncated from 371 to 300 lines):

diff -r 15e3bb1a7725 -r 245bc99088ca sysutils/consolekit/Makefile
--- a/sysutils/consolekit/Makefile      Fri Dec 26 19:53:09 2008 +0000
+++ b/sysutils/consolekit/Makefile      Fri Dec 26 20:05:56 2008 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.6 2008/12/10 11:43:20 dsainty Exp $
+# $NetBSD: Makefile,v 1.7 2008/12/26 20:05:56 hasso Exp $
 #
 
 CONSOLEKIT_VER=                0.3.0
 DISTNAME=              ConsoleKit-${CONSOLEKIT_VER}
 PKGNAME=               consolekit-${CONSOLEKIT_VER}
-PKGREVISION=           2
+PKGREVISION=           3
 CATEGORIES=            sysutils
 MASTER_SITES=          http://people.freedesktop.org/~mccann/dist/
 EXTRACT_SUFX=          .tar.bz2
@@ -40,11 +40,20 @@
 #.include "../../mk/pam.buildlink3.mk"
 
 post-extract:
-       cp ${FILESDIR}/ck-sysdeps-netbsd.c ${WRKSRC}/src/
+       ${CP} ${FILESDIR}/ck-sysdeps-netbsd.c ${WRKSRC}/src/
 
 pre-configure:
        cd ${WRKSRC} && autoreconf -vi
 
+.include "../../mk/bsd.prefs.mk"
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+post-install:
+       ${CP} ${FILESDIR}/ck-get-x11-display-device.FreeBSD \
+               ${DESTDIR}${PREFIX}/libexec/ck-get-x11-display-device
+       ${CP} ${FILESDIR}/ck-get-x11-server-pid.FreeBSD \
+               ${DESTDIR}${PREFIX}/libexec/ck-get-x11-server-pid
+.endif
+
 .include "../../devel/zlib/buildlink3.mk"
 .include "../../security/policykit/buildlink3.mk"
 .include "../../sysutils/dbus/buildlink3.mk"
diff -r 15e3bb1a7725 -r 245bc99088ca sysutils/consolekit/distinfo
--- a/sysutils/consolekit/distinfo      Fri Dec 26 19:53:09 2008 +0000
+++ b/sysutils/consolekit/distinfo      Fri Dec 26 20:05:56 2008 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.5 2008/12/23 21:46:14 jmcneill Exp $
+$NetBSD: distinfo,v 1.6 2008/12/26 20:05:56 hasso Exp $
 
 SHA1 (ConsoleKit-0.3.0.tar.bz2) = e3b6156622cc14ebca7382a55b8ed15f2f2bad98
 RMD160 (ConsoleKit-0.3.0.tar.bz2) = 7a1ebd2f4bfb65690e70138c9923c3fd2fcaf671
@@ -7,5 +7,7 @@
 SHA1 (patch-ab) = 2e9fe9de1f27c635a4eefa77af8322cb8a02ab35
 SHA1 (patch-ac) = 0595a9cd1c4013eb4761e044b4b4b01b613f7d2b
 SHA1 (patch-ad) = a1c1a1d0452945550065da3eac2390318c1eb7be
-SHA1 (patch-ae) = 0b5bea5260b8595fc9dfef6340ff47b1545b0bec
-SHA1 (patch-af) = ad854bcde3f8defefb476ccec3f68e64d4c055ec
+SHA1 (patch-ae) = 8a9612cd35d1ec86240fd17dfa6963c20edc0ad0
+SHA1 (patch-af) = e86c63147798d61f7560cfe7547b0d06d18d5583
+SHA1 (patch-ag) = 724e2eb95f7ca78c5659fde1eec2f2c5c6bc5002
+SHA1 (patch-ah) = f62d8c661732a4ea47e29b99f883b539fb5c7468
diff -r 15e3bb1a7725 -r 245bc99088ca sysutils/consolekit/files/ck-get-x11-display-device.FreeBSD
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/consolekit/files/ck-get-x11-display-device.FreeBSD       Fri Dec 26 20:05:56 2008 +0000
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+FSTAT="/usr/bin/fstat"
+GREP="/usr/bin/grep"
+AWK="/usr/bin/awk"
+SED="/usr/bin/sed"
+CAT="/bin/cat"
+HEAD="/usr/bin/head"
+
+dispnum=0
+if [ x"$1" = x"--display" ]; then
+    if [ $# != 2 ]; then
+       echo "usage: $0 [--display DISPLAY]"
+       exit 1
+    fi
+    DISPLAY=$2
+fi
+if [ ! -z "${DISPLAY}" ]; then
+    dispnum=$(echo ${DISPLAY} | ${SED} -E -e 's|:([0-9]+).*|\1|')
+fi
+
+if [ ! -f "/tmp/.X${dispnum}-lock" ]; then
+    echo "ERROR: Failed to find X lock file for display ${dispnum}"
+    exit 1
+fi
+pid=$(${CAT} "/tmp/.X${dispnum}-lock")
+
+device=$(${FSTAT} -p ${pid} | ${GREP} ttyv | ${HEAD} -1 | ${AWK} '{print $8}')
+
+if [ -z "${device}" ]; then
+    echo "ERROR: Failed to find TTY device for X server on display ${dispnum}"
+    exit 1
+fi
+
+echo "/dev/${device}"
diff -r 15e3bb1a7725 -r 245bc99088ca sysutils/consolekit/files/ck-get-x11-server-pid.FreeBSD
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/consolekit/files/ck-get-x11-server-pid.FreeBSD   Fri Dec 26 20:05:56 2008 +0000
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+SED="/usr/bin/sed"
+CAT="/bin/cat"
+
+dispnum=0
+if [ ! -z "${DISPLAY}" ]; then
+    dispnum=$(echo ${DISPLAY} | ${SED} -E -e 's|:([0-9]+).*|\1|')
+fi
+
+if [ ! -f "/tmp/.X${dispnum}-lock" ]; then
+    echo "ERROR: Failed to find X lock file for display ${dispnum}"
+    exit 1
+fi
+pid=$(${CAT} "/tmp/.X${dispnum}-lock")
+
+echo ${pid}
diff -r 15e3bb1a7725 -r 245bc99088ca sysutils/consolekit/patches/patch-ae
--- a/sysutils/consolekit/patches/patch-ae      Fri Dec 26 19:53:09 2008 +0000
+++ b/sysutils/consolekit/patches/patch-ae      Fri Dec 26 20:05:56 2008 +0000
@@ -1,7 +1,7 @@
-$NetBSD: patch-ae,v 1.4 2008/11/25 13:40:05 hasso Exp $
+$NetBSD: patch-ae,v 1.5 2008/12/26 20:05:56 hasso Exp $
 
---- src/ck-sysdeps-unix.c.orig 2008-01-23 16:30:44 +0200
-+++ src/ck-sysdeps-unix.c      2008-11-25 12:34:32 +0200
+--- src/ck-sysdeps-unix.c.orig 2008-11-27 05:10:25 +0200
++++ src/ck-sysdeps-unix.c      2008-11-27 05:09:59 +0200
 @@ -35,6 +35,11 @@
  #include <linux/kd.h>
  #endif
@@ -80,7 +80,23 @@
          kb_ok = (ioctl (fd, CONS_GETVERS, &vers) == 0);
  #else
          kb_ok = 1;
-@@ -184,6 +217,14 @@ ck_get_a_console_fd (void)
+@@ -172,6 +205,15 @@ ck_get_a_console_fd (void)
+ 
+         fd = -1;
+ 
++#if defined(__FreeBSD__) || defined(__DragonFly__)
++      /* On FreeBSD, try /dev/consolectl first as this will survive
++       * /etc/ttys initialization. */
++      fd = open_a_console ("/dev/consolectl");
++      if (fd >= 0) {
++              goto done;
++      }
++#endif
++
+ #ifdef __sun
+         /* On Solaris, first try Sun VT device. */
+         fd = open_a_console ("/dev/vt/active");
+@@ -184,6 +226,14 @@ ck_get_a_console_fd (void)
          }
  #endif
  
diff -r 15e3bb1a7725 -r 245bc99088ca sysutils/consolekit/patches/patch-af
--- a/sysutils/consolekit/patches/patch-af      Fri Dec 26 19:53:09 2008 +0000
+++ b/sysutils/consolekit/patches/patch-af      Fri Dec 26 20:05:56 2008 +0000
@@ -1,8 +1,16 @@
-$NetBSD: patch-af,v 1.1 2008/11/25 13:40:05 hasso Exp $
+$NetBSD: patch-af,v 1.2 2008/12/26 20:05:56 hasso Exp $
 
---- src/ck-sysdeps-freebsd.c.orig      2008-11-25 14:43:51 +0200
-+++ src/ck-sysdeps-freebsd.c   2008-11-25 14:50:24 +0200
-@@ -151,14 +151,38 @@ stat2proc (pid_t        pid,
+--- src/ck-sysdeps-freebsd.c.orig      2008-11-27 05:12:41 +0200
++++ src/ck-sysdeps-freebsd.c   2008-11-27 05:08:28 +0200
+@@ -27,6 +27,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <errno.h>
++#include <glob.h>
+ #include <paths.h>
+ #include <ttyent.h>
+ #include <kvm.h>
+@@ -151,14 +152,38 @@ stat2proc (pid_t        pid,
                  return FALSE;
          }
  
@@ -41,7 +49,7 @@
          P->pid        = p.ki_pid;
          P->ppid       = p.ki_ppid;
          P->pgrp       = p.ki_pgid;
-@@ -173,19 +197,33 @@ stat2proc (pid_t        pid,
+@@ -173,19 +198,33 @@ stat2proc (pid_t        pid,
          P->tpgid      = p.ki_tpgid;
          P->processor  = p.ki_oncpu;
          P->nlwp       = p.ki_numthreads;
@@ -75,7 +83,23 @@
                  memcpy (P->tty_text, "   ?   ", sizeof P->tty_text);
          }
  
-@@ -308,7 +346,11 @@ ck_unix_pid_get_uid (pid_t pid)
+@@ -202,7 +241,6 @@ ck_process_stat_new_for_unix_pid (pid_t 
+                                   GError        **error)
+ {
+         gboolean       res;
+-        GError        *local_error;
+         CkProcessStat *proc;
+ 
+         g_return_val_if_fail (pid > 1, FALSE);
+@@ -217,7 +255,6 @@ ck_process_stat_new_for_unix_pid (pid_t 
+         if (res) {
+                 *stat = proc;
+         } else {
+-                g_propagate_error (error, local_error);
+                 *stat = NULL;
+         }
+ 
+@@ -308,7 +345,11 @@ ck_unix_pid_get_uid (pid_t pid)
          res = get_kinfo_proc (pid, &p);
  
          if (res) {
@@ -87,3 +111,119 @@
          }
  
          return uid;
+@@ -327,38 +368,40 @@ gboolean
+ ck_get_max_num_consoles (guint *num)
+ {
+         int      max_consoles;
+-        int      res;
+-        gboolean ret;
+-        struct ttyent *t;
++        int      i;
++        glob_t   g;
+ 
+-        ret = FALSE;
+         max_consoles = 0;
+ 
+-        res = setttyent ();
+-        if (res == 0) {
+-                goto done;
+-        }
+-
+-        while ((t = getttyent ()) != NULL) {
+-                if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0)
++        g.gl_offs = 0;
++        glob ("/dev/ttyv*", GLOB_DOOFFS, NULL, &g);
++        for (i = 0; i < g.gl_pathc && g.gl_pathv[i] != NULL; i++) {
++                int fd;
++                char *cdev;
++
++                cdev = g.gl_pathv[i];
++                fd = open (cdev, O_RDONLY | O_NOCTTY);
++                if (fd > -1) {
++                        close (fd);
+                         max_consoles++;
++                } else {
++                        break;
++                }
+         }
+ 
+-        /* Increment one more so that all consoles are properly counted
++        globfree (&g);
++
++        /*
++         * Increment one more so that all consoles are properly counted
+          * this is arguable a bug in vt_add_watches().
+          */
+         max_consoles++;
+ 
+-        ret = TRUE;
+-
+-        endttyent ();
+-
+-done:
+         if (num != NULL) {
+                 *num = max_consoles;
+         }
+ 
+-        return ret;
++        return TRUE;
+ }
+ 
+ char *
+@@ -369,7 +412,12 @@ ck_get_console_device_for_num (guint num
+         /* The device number is always one less than the VT number. */
+         num--;
+ 
+-        device = g_strdup_printf ("/dev/ttyv%u", num);
++        if (num < 10)
++                device = g_strdup_printf ("/dev/ttyv%i", num);
++        else if (num < 32)
++                device = g_strdup_printf ("/dev/ttyv%c", num - 10 + 'a');
++        else
++                device = NULL;
+ 
+         return device;
+ }
+@@ -379,6 +427,7 @@ ck_get_console_num_from_device (const ch
+                                 guint      *num)
+ {
+         guint    n;
++        char     c;
+         gboolean ret;
+ 
+         n = 0;
+@@ -388,7 +437,11 @@ ck_get_console_num_from_device (const ch



Home | Main Index | Thread Index | Old Index