[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeadmin/kpackage
From:       Adriaan de Groot <adridg () cs ! kun ! nl>
Date:       2003-12-30 20:53:56
Message-ID: 20031230205356.08B599081 () office ! kde ! org
[Download RAW message or body]

CVS commit by adridg: 

If a package/port is installed, but the port has been updated
underneath it (so there is no corresponding entry in INDEX),
use pkg_info -o to find out the origin. Now both the dupe-category
bug and the too-large "OTHERS" category are gone.

CCMAIL: 54737-done@bugs.kde.org
CCMAIL: kde@freebsd.org


  M +42 -1     fbsdInterface.cpp   1.43


--- kdeadmin/kpackage/fbsdInterface.cpp  #1.42:1.43
@@ -97,4 +97,6 @@ packageInfo *fbsdInterface::getPackageIn
   kpackage->setStatus(i18n("Getting package info"));
 
+  kdDebug() << "Looking at package " << pname << endl;
+
   if (mode == 'i' && !version.isEmpty()) {
     name += "-" + version;
@@ -528,4 +530,8 @@ void fbsdInterface::listInstalledPackage
 
         insertGroups(a,inditem->cats);
+        if (!a->find("group"))
+        {
+          kdDebug() << "Line <" << buf << "> has no group?" << endl;
+        }
 
         a->insert("run depends", new QString(inditem->rdeps[0]? \
QString(inditem->rdeps) : i18n("none"))); @@ -536,4 +542,38 @@ void \
fbsdInterface::listInstalledPackage  a->insert("description", desc);
 
+      if (!a->find("group"))
+      {
+        QString s,*ps;
+        ps = a->find("name");
+        if (ps) s = *ps;
+        else s = "<anonymous>";
+
+        ps = a->find("version");
+        if (ps) s.append(QString("-")+(*ps));
+
+        kdDebug() << "Package " << (s) << " has no group." << endl;
+ 
+        /* This must be an installed package with no INDEX entry,
+        ** which usually means that the port has been updated.
+        */
+        reader.setup(PKG_INFO_BIN);
+        *reader.proc << "-o" << (s);
+        if (reader.start(QString::null,FALSE) && !reader.buf.isEmpty())
+        {
+          QStringList lines = QStringList::split('\n',reader.buf);
+          QString originName;
+          int originOffset = lines.findIndex(QString("Origin:"));
+          if (originOffset>=0) originName=lines[originOffset+1];
+          int slashOffset = -1;
+          if(!originName.isEmpty()) slashOffset=originName.find('/');
+          if(slashOffset>=0) originName.truncate(slashOffset);
+          if(!originName.isEmpty()) a->insert("group",new QString(originName));
+        }
+        else
+        {
+          kdDebug() << "Could not read package origin info." << endl;
+        }
+      }
+
       packageInfo *info = new packageInfo(a, this);
       info->packageState = packageInfo::INSTALLED;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic