pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/x11/kdebase4 Teach konsole's ProcessInfo about NetBSD....



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2689e34e9388
branches:  trunk
changeset: 567384:2689e34e9388
user:      markd <markd%pkgsrc.org@localhost>
date:      Mon Nov 16 08:55:06 2009 +0000

description:
Teach konsole's ProcessInfo about NetBSD.  Bump PKGREVISION.

diffstat:

 x11/kdebase4/Makefile         |    3 +-
 x11/kdebase4/distinfo         |    3 +-
 x11/kdebase4/patches/patch-aa |  185 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 189 insertions(+), 2 deletions(-)

diffs (212 lines):

diff -r 02b4be28bf9d -r 2689e34e9388 x11/kdebase4/Makefile
--- a/x11/kdebase4/Makefile     Sun Nov 15 22:31:51 2009 +0000
+++ b/x11/kdebase4/Makefile     Mon Nov 16 08:55:06 2009 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.2 2009/10/11 08:13:40 markd Exp $
+# $NetBSD: Makefile,v 1.3 2009/11/16 08:55:06 markd Exp $
 
 DISTNAME=      kdebase-${_KDE_VERSION}
+PKGREVISION=   1
 CATEGORIES=    x11
 COMMENT=       Base modules for the KDE 4 integrated X11 desktop
 
diff -r 02b4be28bf9d -r 2689e34e9388 x11/kdebase4/distinfo
--- a/x11/kdebase4/distinfo     Sun Nov 15 22:31:51 2009 +0000
+++ b/x11/kdebase4/distinfo     Mon Nov 16 08:55:06 2009 +0000
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.3 2009/11/04 11:05:52 markd Exp $
+$NetBSD: distinfo,v 1.4 2009/11/16 08:55:06 markd Exp $
 
 SHA1 (kdebase-4.3.3.tar.bz2) = 7459ea75312961b4802626edd22dc291370be329
 RMD160 (kdebase-4.3.3.tar.bz2) = 7fdc0f5cb3574b6707ae8f005eb887126ca2339e
 Size (kdebase-4.3.3.tar.bz2) = 4275500 bytes
+SHA1 (patch-aa) = 8ab0c0a6f79e871cf869d9aae2331f9ed3f8d366
diff -r 02b4be28bf9d -r 2689e34e9388 x11/kdebase4/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/kdebase4/patches/patch-aa     Mon Nov 16 08:55:06 2009 +0000
@@ -0,0 +1,185 @@
+$NetBSD: patch-aa,v 1.3 2009/11/16 08:55:06 markd Exp $
+
+--- apps/konsole/src/ProcessInfo.cpp.orig      2009-10-31 01:28:19.000000000 +1300
++++ apps/konsole/src/ProcessInfo.cpp
+@@ -685,6 +685,171 @@ private:
+     }
+ } ;
+ 
++class NetBSDProcessInfo : public UnixProcessInfo
++{
++public:
++    NetBSDProcessInfo(int pid, bool env) :
++        UnixProcessInfo(pid,env)
++    {
++    }
++
++private:
++    virtual bool readProcInfo(int pid)
++    {
++        // indicies of various fields within the process status file which
++        // contain various information about the process
++        const int PARENT_PID_FIELD = 2;
++        const int PROCESS_NAME_FIELD = 0;
++        const int GROUP_PROCESS_FIELD = 3;
++        const int UID_PROCESS_FIELD = 11;
++
++        QString parentPidString;
++        QString processNameString;
++        QString foregroundPidString;
++        QString uidString;
++
++        // read process status file ( /proc/<pid/status )
++        //
++        // the expected file format is a list of fields separated by spaces, using
++        // parenthesies to escape fields such as the process name which may itself contain
++        // spaces:
++        //
++        // FIELD FIELD (FIELD WITH SPACES) FIELD FIELD
++        //
++        QFile processInfo( QString("/proc/%1/status").arg(pid) );
++        if ( processInfo.open(QIODevice::ReadOnly) )
++        {
++            QTextStream stream(&processInfo);
++            QString data = stream.readAll();
++
++            int stack = 0;
++            int field = 0;
++            int pos = 0;
++
++            while (pos < data.count())
++            {
++                QChar c = data[pos];
++
++                if ( c == '(' )
++                    stack++;
++                else if ( c == ')' )
++                    stack--;
++                else if ( stack == 0 && c == ' ' )
++                    field++;
++                else
++                {
++                    switch ( field )
++                    {
++                        case PARENT_PID_FIELD:
++                            parentPidString.append(c);
++                            break;
++                        case PROCESS_NAME_FIELD:
++                            processNameString.append(c);
++                            break;
++                        case GROUP_PROCESS_FIELD:
++                            foregroundPidString.append(c);
++                            break;
++                        case UID_PROCESS_FIELD:
++                            uidString.append(c);
++                            break;
++                    }
++                }
++
++                pos++;
++            }
++        }
++        else
++        {
++            setFileError( processInfo.error() );
++            return false;
++        }
++
++        // check that data was read successfully
++        bool ok = false;
++
++        // uid string must be less than 5 chars (uint)
++        if (uidString.size() > 5)
++            uidString.clear();
++
++        int uid = uidString.toInt(&ok);
++        if (ok)
++            setUserId(uid);
++        readUserName();
++
++        int foregroundPid = foregroundPidString.toInt(&ok);
++        if (ok)
++            setForegroundPid(foregroundPid);
++
++        int parentPid = parentPidString.toInt(&ok);
++        if (ok)
++            setParentPid(parentPid);
++
++        if (!processNameString.isEmpty())
++            setName(processNameString);
++
++        // update object state
++        setPid(pid);
++
++        return ok;
++    }
++
++    virtual bool readArguments(int pid)
++    {
++        // read command-line arguments file found at /proc/<pid>/cmdline
++        // the expected format is a list of strings delimited by null characters,
++        // and ending in a double null character pair.
++
++        QFile argumentsFile( QString("/proc/%1/cmdline").arg(pid) );
++        if ( argumentsFile.open(QIODevice::ReadOnly) )
++        {
++            QTextStream stream(&argumentsFile);
++            QString data = stream.readAll();
++
++            QStringList argList = data.split( QChar('\0') );
++
++            foreach ( const QString &entry , argList )
++            {
++                if (!entry.isEmpty())
++                    addArgument(entry);
++            }
++        }
++        else
++        {
++            setFileError( argumentsFile.error() );
++        }
++
++        return true;
++    }
++
++    virtual bool readCurrentDir(int pid)
++    {
++        QFileInfo info( QString("/proc/%1/cwd").arg(pid) );
++
++        const bool readable = info.isReadable();
++
++        if ( readable && info.isSymLink() )
++        {
++            setCurrentDir( info.symLinkTarget() );
++            return true;
++        }
++        else
++        {
++            if ( !readable )
++                setError( PermissionsError );
++            else
++                setError( UnknownError );
++
++            return false;
++        }
++    }
++
++    virtual bool readEnvironment(int pid)
++    {
++        // Not supported in NetBSD
++        return true;
++    }
++} ;
++
+ SSHProcessInfo::SSHProcessInfo(const ProcessInfo& process)
+  : _process(process)
+ {
+@@ -830,6 +995,8 @@ ProcessInfo* ProcessInfo::newInstance(in
+     return new LinuxProcessInfo(pid,enableEnvironmentRead);
+ #elif defined(Q_OS_SOLARIS)
+     return new SolarisProcessInfo(pid,enableEnvironmentRead);
++#elif defined(Q_OS_NETBSD)
++    return new NetBSDProcessInfo(pid,enableEnvironmentRead);
+ #else
+     return new NullProcessInfo(pid,enableEnvironmentRead);
+ #endif



Home | Main Index | Thread Index | Old Index