rpms/smart/F-9 839_854.diff, NONE, 1.1 smart.spec, 1.36, 1.37 smart-1.0-autofs5fix.patch, 1.1, NONE

Axel Thimm athimm at fedoraproject.org
Sun Dec 21 20:55:59 UTC 2008


Author: athimm

Update of /cvs/extras/rpms/smart/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26800/F-9

Modified Files:
	smart.spec 
Added Files:
	839_854.diff 
Removed Files:
	smart-1.0-autofs5fix.patch 
Log Message:
Use stable bugfix branch

839_854.diff:

--- NEW FILE 839_854.diff ---
=== modified file 'MANIFEST.in'
--- MANIFEST.in	2006-06-16 18:41:10 +0000
+++ MANIFEST.in	2008-10-08 15:59:14 +0000
@@ -4,7 +4,7 @@
 
 recursive-include tests *.py *.txt
 recursive-include tests/data *
-include test.py
+include test
 
 recursive-include contrib/ksmarttray *.png *.cc *.h *.am *.in.in
 recursive-include contrib/ksmarttray LICENSE eventsrc

=== modified file 'Makefile'
--- Makefile	2006-12-03 16:42:10 +0000
+++ Makefile	2008-10-06 20:03:37 +0000
@@ -46,7 +46,7 @@
 
 test:
 	./setup.py build_ext -i
-	LANG=C ./test.py $(TEST)
+	LANG=C ./test $(TEST)
 
 .PHONY: clean smart.pot update-po check-po test
 

=== modified file 'contrib/ksmarttray/src/ksmarttray.cc'
--- contrib/ksmarttray/src/ksmarttray.cc	2005-03-04 22:21:46 +0000
+++ contrib/ksmarttray/src/ksmarttray.cc	2008-11-16 00:37:11 +0000
@@ -48,6 +48,7 @@
 {
     hasActions = false;
     checkAction.setText("Check");
+    startSmartAction.setText("Start Smart...");
     stopAction.setText("Stop");
     stopAction.setIcon("stop");
     stopAction.setEnabled(false);
@@ -58,6 +59,7 @@
     if (!hasActions) {
         hasActions = true;
         checkAction.plug(menu, 1);
+        startSmartAction.plug(menu, 2);
         //stopAction.plug(menu, 2);
     }
 }
@@ -94,6 +96,8 @@
 
     connect(&sysTray.checkAction, SIGNAL(activated()),
             this, SLOT(manualCheckUpgrades()));
+    connect(&sysTray.startSmartAction, SIGNAL(activated()),
+            this, SLOT(startSmart()));
     connect(&sysTray.stopAction, SIGNAL(activated()),
             this, SLOT(stopChecking()));
     connect(&sysTray, SIGNAL(quitSelected()),
@@ -112,6 +116,7 @@
         return;
     if (state == StateWaiting) {
         sysTray.checkAction.setEnabled(false);
+        sysTray.startSmartAction.setEnabled(false);
         sysTray.stopAction.setEnabled(true);
         process.resetAll();
         if (manual)
@@ -145,6 +150,7 @@
                              "There is a running process.");
     } else {
         sysTray.checkAction.setEnabled(false);
+        sysTray.startSmartAction.setEnabled(false);
         sysTray.stopAction.setEnabled(false);
         process.resetAll();
         process << "kdesu" << "-d" << "-c" << "smart --gui upgrade";
@@ -159,6 +165,28 @@
     }
 }
 
+void KSmartTray::startSmart()
+{
+    if (state != StateWaiting) {
+        KNotifyClient::event(sysTray.winId(), "fatalerror",
+                             "There is a running process.");
+    } else {
+        sysTray.checkAction.setEnabled(false);
+        sysTray.startSmartAction.setEnabled(false);
+        sysTray.stopAction.setEnabled(false);
+        process.resetAll();
+        process << "kdesu" << "-d" << "-c" << "smart --gui";
+        if (!process.start()) {
+            KNotifyClient::event(sysTray.winId(), "fatalerror",
+                                 "Couldn't run 'smart'.");
+        } else {
+            state = StateRunningSmart;
+            QToolTip::remove(&sysTray);
+            QToolTip::add(&sysTray, "Running Smart Package Manager...");
+        }
+    }
+}
+
 void KSmartTray::stopChecking()
 {
     process.kill();
@@ -223,6 +251,11 @@
             lastKnownStatus = "";
             break;
 
+        case StateRunningSmart:
+            state = StateWaiting;
+            lastKnownStatus = "";
+            break;
+
         default:
             /* Error! */
             break;
@@ -231,6 +264,7 @@
     if (state == StateWaiting) {
         updateFailed = false;
         sysTray.checkAction.setEnabled(true);
+        sysTray.startSmartAction.setEnabled(true);
         sysTray.stopAction.setEnabled(false);
         if (!lastKnownStatus.isEmpty())
         {

=== modified file 'contrib/ksmarttray/src/ksmarttray.h'
--- contrib/ksmarttray/src/ksmarttray.h	2006-06-13 16:24:24 +0000
+++ contrib/ksmarttray/src/ksmarttray.h	2008-11-16 00:37:11 +0000
@@ -43,6 +43,7 @@
 
     KAction checkAction;
     KAction stopAction;
+    KAction startSmartAction;
 
     protected:
 
@@ -69,6 +70,7 @@
         StateUpdating,
         StateChecking,
         StateUpgrading,
+        StateRunningSmart,
     };
     
     State state;
@@ -105,6 +107,7 @@
     void checkUpgrades();
     void manualCheckUpgrades();
     void runUpgrades();
+    void startSmart();
 
     public:
     

=== modified file 'smart/__init__.py'
--- smart/__init__.py	2007-08-14 22:44:45 +0000
+++ smart/__init__.py	2008-11-26 17:10:15 +0000
@@ -180,9 +180,6 @@
     from smart import plugins
     from smart import backends
     pluginsdir = os.path.dirname(plugins.__file__)
-    entries = os.listdir(pluginsdir)
-    if os.path.isdir(PLUGINSDIR):
-        entries.extend(os.listdir(PLUGINSDIR))
     for entry in os.listdir(pluginsdir):
         if entry != "__init__.py" and entry.endswith(".py"):
             __import__("smart.plugins."+entry[:-3])
@@ -192,6 +189,10 @@
                 initpath = os.path.join(entrypath, "__init__.py")
                 if os.path.isfile(initpath):
                     __import__("smart.plugins."+entry)
+    if os.path.isdir(PLUGINSDIR):
+        for entry in os.listdir(PLUGINSDIR):
+            entrypath = os.path.join(PLUGINSDIR, entry)
+            execfile(entrypath)
     backendsdir = os.path.dirname(backends.__file__)
     for entry in os.listdir(backendsdir):
         entrypath = os.path.join(backendsdir, entry)

=== modified file 'smart/backends/deb/base.py'
--- smart/backends/deb/base.py	2008-09-04 22:32:15 +0000
+++ smart/backends/deb/base.py	2008-11-16 00:06:42 +0000
@@ -20,13 +20,16 @@
 # along with Smart Package Manager; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
+import fnmatch
+import string
+import sys
+import os
+import re
+
 from smart.backends.deb.debver import vercmp, checkdep, splitrelease
 from smart.backends.deb.pm import DebPackageManager
 from smart.util.strtools import isGlob
 from smart.cache import *
-import fnmatch
-import string
-import os, re
 
 __all__ = ["DebPackage", "DebProvides", "DebNameProvides", "DebPreRequires",
            "DebRequires", "DebUpgrades", "DebConflicts", "DebBreaks",
@@ -44,17 +47,20 @@
               "shel": "sh",
               "x86_64": "amd64"}.get(arch)
     if result:
-        return result
+        arch = result
     elif len(arch) == 4 and arch[0] == "i" and arch.endswith("86"):
-        return "i386"
+        arch = "i386"
     elif arch.startswith("arm"):
-        return "arm"
+        arch = "arm"
     elif arch.startswith("hppa"):
-        return "hppa"
+        arch = "hppa"
     elif arch.startswith("alpha"):
-        return "alpha"
+        arch = "alpha"
+    
+    if sys.platform == "linux2":
+        return arch
     else:
-        return arch
+        return "%s-%s" % (sys.platform, arch)
 
 DEBARCH = getArchitecture()
 

=== modified file 'smart/backends/deb/pm.py'
--- smart/backends/deb/pm.py	2008-07-03 22:58:43 +0000
+++ smart/backends/deb/pm.py	2008-10-08 15:35:32 +0000
@@ -26,7 +26,7 @@
 import errno
 import shlex
 
-from smart.const import INSTALL, REMOVE, OPTIONAL, ENFORCE
+from smart.const import Enum, INSTALL, REMOVE, OPTIONAL, ENFORCE
 from smart.pm import PackageManager
 from smart.sorter import *
 from smart import *
@@ -34,8 +34,8 @@
 
 # Part of the logic in this file was based on information found in APT.
 
-UNPACK = 10
-CONFIG = 11
+UNPACK = Enum("UNPACK")
+CONFIG = Enum("CONFIG")
 
 DEBIAN_FRONTEND = "DEBIAN_FRONTEND"
 APT_LISTCHANGES_FRONTEND = "APT_LISTCHANGES_FRONTEND"
@@ -71,6 +71,7 @@
                         if changeset.get(prvpkg) is INSTALL:
                             if op is INSTALL:
                                 group.addSuccessor((prvpkg, CONFIG), unpack)
+                                group.addSuccessor((prvpkg, CONFIG), config)
                             else:
                                 group.addSuccessor((prvpkg, CONFIG), remove)
                         elif prvpkg.installed:
@@ -107,7 +108,7 @@
                                        for prvpkg in prv.packages])
                 for upgpkg in upgpkgs:
                     if changeset.get(upgpkg) is REMOVE:
-                        self.addSuccessor(config, (upgpkg, REMOVE), OPTIONAL)
+                        self.addSuccessor(unpack, (upgpkg, REMOVE), OPTIONAL)
 
                 # Conflicted packages being removed must go in
                 # before this package's installation.
@@ -202,6 +203,7 @@
             old_apt_lc_frontend = os.environ.get(APT_LISTCHANGES_FRONTEND)
             os.environ[DEBIAN_FRONTEND] = "noninteractive"
             os.environ[APT_LISTCHANGES_FRONTEND] = "none"
+            baseargs.append("--force-confold")
 
         if sysconf.get("pm-iface-output"):
             output = tempfile.TemporaryFile()

=== modified file 'smart/backends/rpm/base.py'
--- smart/backends/rpm/base.py	2007-11-25 22:07:53 +0000
+++ smart/backends/rpm/base.py	2008-12-12 09:02:49 +0000
@@ -49,7 +49,7 @@
 
 def getTS(new=False):
     if not hasattr(getTS, "ts"):
-        getTS.root = sysconf.get("rpm-root", "/")
+        getTS.root = os.path.abspath(sysconf.get("rpm-root", "/"))
         getTS.ts = rpm.ts(getTS.root)
         if not sysconf.get("rpm-check-signatures", False):
             getTS.ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
@@ -102,8 +102,8 @@
             len(self.conflicts) != len(other.conflicts) or
             fk(self.upgrades) != fk(other.upgrades) or
             fk(self.conflicts) != fk(other.conflicts) or
-            fk([x for x in self.provides if x.name[0] != "/"]) !=
-            fk([x for x in other.provides if x.name[0] != "/"])):
+            fk([x for x in self.provides if x.name and x.name[0] != "/"]) !=
+            fk([x for x in other.provides if x.name and x.name[0] != "/"])):
             return False
         sreqs = fk(self.requires)
         oreqs = fk(other.requires)

=== modified file 'smart/backends/rpm/pm.py'
--- smart/backends/rpm/pm.py	2007-05-22 16:32:57 +0000
+++ smart/backends/rpm/pm.py	2008-12-12 07:25:46 +0000
@@ -138,7 +138,10 @@
                 lines.append("    "+" -> ".join(path))
             lines.append(_("Will ask RPM to order it."))
             iface.error("\n".join(lines))
-            sys.exit(1)
+            sorted = []
+            for pkg in changeset:
+                op = changeset[pkg]
+                sorted.append((pkg, op))
             forcerpmorder = True
         del sorter
 

=== modified file 'smart/cache.py'
--- smart/cache.py	2007-05-20 22:42:11 +0000
+++ smart/cache.py	2008-12-12 07:18:07 +0000
@@ -193,8 +193,11 @@
 
             filemd5 = self.getMD5(url)
             if filemd5:
-                import md5
-                digest = md5.md5()
+                try:
+                    from hashlib import md5
+                except ImportError:
+                    from md5 import md5
+                digest = md5()
                 file = open(localpath)
                 data = file.read(BLOCKSIZE)
                 while data:
@@ -207,8 +210,11 @@
             else:
                 filesha = self.getSHA(url)
                 if filesha:
-                    import sha
-                    digest = sha.sha()
+                    try:
+                        from hashlib import sha1 as sha
+                    except ImportError:
+                        from sha import sha
+                    digest = sha()
                     file = open(localpath)
                     data = file.read(BLOCKSIZE)
                     while data:

=== modified file 'smart/channels/apt_deb.py'
--- smart/channels/apt_deb.py	2008-09-05 21:59:43 +0000
+++ smart/channels/apt_deb.py	2008-10-08 15:51:01 +0000
@@ -217,7 +217,7 @@
                     packages_items.append(item)
                 else:
                     iface.warning(_("Component '%s' is not in Release file "
-                                    "for channel '%s'") % (comp, self))
+                                    "for channel '%s'") % (component, self))
 
         fetcher.run(progress=progress)
 

=== modified file 'smart/const.py'
--- smart/const.py	2008-09-08 20:27:13 +0000
+++ smart/const.py	2008-12-12 07:26:36 +0000
@@ -21,7 +21,7 @@
 #
 import sys
 
-VERSION = "1.1"
+VERSION = "1.1.1"
 
 RECURSIONLIMIT = sys.getrecursionlimit()
 
@@ -36,7 +36,7 @@
     def __new__(klass, name):
         instance = klass._registry.get(name)
         if not instance:
-            instance = klass._registry[name] = object.__new__(klass, name)
+            instance = klass._registry[name] = object.__new__(klass)
         return instance
 
 INSTALL   = Enum("INSTALL")

=== modified file 'smart/control.py'
--- smart/control.py	2008-02-19 00:12:08 +0000
+++ smart/control.py	2008-12-12 07:17:44 +0000
@@ -19,6 +19,11 @@
 # along with Smart Package Manager; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
+import cPickle
+import sys, os
+import copy
+import time
+
 from smart.transaction import ChangeSet, ChangeSetSplitter, INSTALL, REMOVE
 from smart.util.filetools import compareFiles, setCloseOnExecAll
 from smart.util.objdigest import getObjectDigest
@@ -33,11 +38,11 @@
 from smart.cache import *
 from smart.const import *
 from smart import *
-import cPickle
-import sys, os
-import copy
-import time
-import md5
+
+
+if sys.version_info < (2, 4):
+    from sets import Set as set
+
 
 class Control(object):
 

=== modified file 'smart/fetcher.py'
--- smart/fetcher.py	2008-09-05 15:10:59 +0000
+++ smart/fetcher.py	2008-12-12 07:18:07 +0000
@@ -367,8 +367,11 @@
 
             filemd5 = item.getInfo(uncompprefix+"md5")
             if filemd5:
-                import md5
-                digest = md5.md5()
+                try:
+                    from hashlib import md5
+                except ImportError:
+                    from md5 import md5
+                digest = md5()
                 file = open(localpath)
                 data = file.read(BLOCKSIZE)
                 while data:
@@ -381,8 +384,11 @@
             else:
                 filesha = item.getInfo(uncompprefix+"sha")
                 if filesha:
-                    import sha
-                    digest = sha.sha()
+                    try:
+                        from hashlib import sha1 as sha
+                    except ImportError:
+                        from sha import sha
+                    digest = sha()
                     file = open(localpath)
                     data = file.read(BLOCKSIZE)
                     while data:
@@ -1109,7 +1115,7 @@
         return bool(self._queue or self._active)
 
     def fetch(self):
-        import urllib, rfc822
+        import urllib, rfc822, calendar
 
         class Opener(urllib.FancyURLopener):
             user = None
@@ -1253,12 +1259,15 @@
                         mtimes = info["last-modified"]
                         mtimet = rfc822.parsedate(mtimes)
                         if mtimet:
-                            mtime = time.mktime(mtimet)
+                            mtime = calendar.timegm(mtimet)
                             os.utime(localpath, (mtime, mtime))
 
             except urllib.addinfourl, remote:
                 if remote.errcode == 304: # Not modified
                     item.setSucceeded(localpath)
+                elif remote.errcode == 404:
+                    # Use a standard translatable error message.
+                    item.setFailed(_("File not found"))
                 else:
                     item.setFailed(remote.errmsg)
 

=== modified file 'smart/interface.py'
--- smart/interface.py	2007-03-29 01:31:11 +0000
+++ smart/interface.py	2008-12-12 07:36:12 +0000
@@ -148,7 +148,11 @@
         x = fcntl.ioctl(1, termios.TIOCGWINSZ, s)
     except IOError:
         return 80
-    return struct.unpack('HHHH', x)[1]
+    width = struct.unpack('HHHH', x)[1]
+    if width > 0:
+        return width
+    else:
+        return 80
 
 def createInterface(name, ctrl, command=None, argv=None):
     try:

=== modified file 'smart/interfaces/gtk/__init__.py'
--- smart/interfaces/gtk/__init__.py	2008-07-22 21:01:43 +0000
+++ smart/interfaces/gtk/__init__.py	2008-12-12 07:21:09 +0000
@@ -49,7 +49,10 @@
     if name not in _pixbuf:
         filename = getImagePath(name)
         if os.path.isfile(filename):
-            icon_size = sysconf.get("gtk-icon-size")
+            try:
+                icon_size = sysconf.get("gtk-icon-size")
+            except AttributeError:
+                icon_size = None
             if icon_size:
                 pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename,
                                                               icon_size,

=== modified file 'smart/interfaces/gtk/progress.py'
--- smart/interfaces/gtk/progress.py	2006-10-27 16:49:22 +0000
+++ smart/interfaces/gtk/progress.py	2008-12-12 07:20:49 +0000
@@ -299,11 +299,11 @@
 def test():
     import sys, time
 
-    prog = GtkProgress()
+    prog = GtkProgress(True)
 
     data = {"item-number": 0}
     total, subtotal = 100, 100
-    prog.start(True)
+    prog.start()
     prog.setTopic("Installing packages...")
     for n in range(1,total+1):
         data["item-number"] = n

=== modified file 'smart/media.py'
--- smart/media.py	2008-06-11 16:28:24 +0000
+++ smart/media.py	2008-12-12 07:23:24 +0000
@@ -328,7 +328,7 @@
     if os.access(filename, os.R_OK):
         for line in open(filename):
             line = line.strip()
-            if not line or line[0] == "#":
+            if not line or line[0] == "#" or line[0] == "+":
                 continue
             tokens = line.split()
             if len(tokens) < 2:

=== modified file 'smart/plugins/aptchannelsync.py'
--- smart/plugins/aptchannelsync.py	2008-09-04 21:24:31 +0000
+++ smart/plugins/aptchannelsync.py	2008-12-12 07:17:44 +0000
@@ -20,7 +20,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 import posixpath
-import md5
+try:
+    from hashlib import md5
+except ImportError:
+    from md5 import md5
 import os
 
 # be compatible with 2.3
@@ -69,7 +72,7 @@
             continue # We don't deal with these yet.
 
         # Build a unique alias.
-        m = md5.new("%s|%s|%s|%s" % (type, uri, distro, comps))
+        m = md5("%s|%s|%s|%s" % (type, uri, distro, comps))
         alias = "aptsync-%s" % m.hexdigest()
         seen.add(alias)
 

=== modified file 'smart/util/cdistance.c'
--- smart/util/cdistance.c	2005-06-08 20:41:27 +0000
+++ smart/util/cdistance.c	2008-11-26 17:30:06 +0000
@@ -117,6 +117,11 @@
             *ratio = 1.0;
         return 0;
     }
+    if (bl == 0) {
+        if (ratio)
+            *ratio = 0.0;
+        return al;
+    }
     for (; *a == '*'; a++, al--)
         wildstart = 1;
     maxl = al>bl?al:bl;

=== modified file 'smart/util/distance.py'
--- smart/util/distance.py	2008-07-22 10:37:20 +0000
+++ smart/util/distance.py	2008-11-26 17:30:06 +0000
@@ -62,6 +62,8 @@
         a = a.lstrip("*")
     al = len(a)
     bl = len(b)
+    if bl == 0:
+        return al, 0.0
     maxl = al > bl and al or bl
     if cutoff and type(cutoff) is float:
         cutoff = int(maxl-cutoff*maxl)

=== modified file 'smart/util/filetools.py'
--- smart/util/filetools.py	2008-06-29 20:50:22 +0000
+++ smart/util/filetools.py	2008-12-12 07:17:44 +0000
@@ -22,12 +22,15 @@
 from smart.const import BLOCKSIZE
 import resource
 import fcntl
-import md5
+try:
+    from hashlib import md5
+except ImportError:
+    from md5 import md5
 import os
 
 def getFileDigest(path, digest=None):
     if not digest:
-        digest = md5.md5()
+        digest = md5()
     file = open(path)
     while True:
         data = file.read(BLOCKSIZE)
@@ -42,8 +45,8 @@
         return False
     if os.path.getsize(path1) != os.path.getsize(path2):
         return False
-    path1sum = md5.md5()
-    path2sum = md5.md5()
+    path1sum = md5()
+    path2sum = md5()
     for path, sum in [(path1, path1sum), (path2, path2sum)]:
         file = open(path)
         while True:

=== modified file 'smart/util/objdigest.py'
--- smart/util/objdigest.py	2004-11-04 23:34:52 +0000
+++ smart/util/objdigest.py	2008-12-12 07:17:44 +0000
@@ -20,7 +20,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 import cPickle
-import md5
+try:
+    from hashlib import md5
+except ImportError:
+    from md5 import md5
 
 def getObjectDigest(obj):
     return ObjectDigest(obj).getDigest()
@@ -31,7 +34,7 @@
 class ObjectDigest(object):
 
     def __init__(self, obj=None):
-        self._digest = md5.md5()
+        self._digest = md5()
         if obj:
             self.addObject(obj)
 

=== modified file 'smart/util/strtools.py'
--- smart/util/strtools.py	2007-11-03 06:35:46 +0000
+++ smart/util/strtools.py	2008-12-12 07:17:44 +0000
@@ -25,7 +25,6 @@
 
 import posixpath
 import string
-import md5
 import sys
 
 class ShortURL(object):

=== renamed file 'test.py' => 'test'
--- test.py	2008-09-04 22:32:15 +0000
+++ test	2008-10-08 15:59:14 +0000
@@ -34,7 +34,7 @@
 import tests
 
 
-USAGE=_("test.py [options] [<test filename>, ...]")
+USAGE=_("test [options] [<test filename>, ...]")
 
 
 def find_tests(testpaths=()):

=== modified file 'tests/aptdeb.py'
--- tests/aptdeb.py	2008-09-05 19:55:23 +0000
+++ tests/aptdeb.py	2008-10-08 15:51:01 +0000
@@ -8,7 +8,7 @@
 from smart.fetcher import Fetcher
 from smart.const import NEVER
 from smart.cache import Cache
-from smart import Error, sysconf
+from smart import Error, sysconf, iface
 
 from tests.mocker import MockerTestCase
 from tests import TESTDATADIR
@@ -341,3 +341,17 @@
             self.assertTrue(str(error).endswith(error_message), str(error))
         else:
             self.fail("Fetch worked with a bad signature! :-(")
+
+    def test_fetch_with_component_missing_in_release_file(self):
+        iface_mock = self.mocker.patch(iface.object)
+        iface_mock.warning("Component 'non-existent' is not in Release file "
+                           "for channel 'alias'")
+        self.mocker.replay()
+
+        channel = createChannel("alias",
+                                {"type": "apt-deb",
+                                 "baseurl": "file://%s/aptdeb" % TESTDATADIR,
+                                 "distribution": "./",
+                                 "components": "non-existent"})
+
+        self.assertEquals(channel.fetch(self.fetcher, self.progress), True)

=== added file 'tests/debbase.py'
--- tests/debbase.py	1970-01-01 00:00:00 +0000
+++ tests/debbase.py	2008-11-16 00:06:42 +0000
@@ -0,0 +1,36 @@
+import sys
+
+from tests.mocker import MockerTestCase
+
+from smart.backends.deb.base import getArchitecture
+
+
+class GetArchitectureTest(MockerTestCase):
+
+    def fake_uname(self):
+        return ('Linux', 'burma', '2.6.24-19-generic',
+                '#1 SMP Wed Aug 20 22:56:21 UTC 2008', self.fake_arch)
+
+    def set_arch_and_platform(self, arch, platform):
+        self.fake_arch = arch
+        sys.platform = platform
+
+    def setUp(self):
+        self.fake_architecture = "i686"
+        self.real_platform = sys.platform
+
+        uname_mock = self.mocker.replace("os.uname")
+        uname_mock()
+        self.mocker.call(self.fake_uname)
+        self.mocker.replay()
+
+    def tearDown(self):
+        sys.platform = self.real_platform
+
+    def test_get_architecture_with_i686_linux2(self):
+        self.set_arch_and_platform("i686", "linux2")
+        self.assertEquals(getArchitecture(), "i386")
+
+    def test_get_architecture_with_i686_anything(self):
+        self.set_arch_and_platform("i686", "anything")
+        self.assertEquals(getArchitecture(), "anything-i386")

=== modified file 'tests/debpm.py'
--- tests/debpm.py	2008-09-04 22:32:15 +0000
+++ tests/debpm.py	2008-10-08 15:35:32 +0000
@@ -1,16 +1,18 @@
 import unittest
-import copy
 import os
 
-from smart.backends.deb.pm import DebPackageManager
+from smart.backends.deb.base import (
+    DebPackage, DebProvides, DebNameProvides, DebPreRequires, DebRequires,
+    DebOrRequires, DebUpgrades, DebConflicts, DebBreaks)
+from smart.backends.deb.pm import DebPackageManager, DebSorter, UNPACK, CONFIG
 from smart.channel import createChannel
 from smart.sysconfig import SysConfig
 from smart.interface import Interface
 from smart.progress import Progress
 from smart.fetcher import Fetcher
-from smart.cache import Cache
+from smart.cache import Cache, Loader
 from smart.const import INSTALL, REMOVE
-from smart import iface, sysconf
+from smart import iface, sysconf, cache
 
 from tests import TESTDATADIR, ctrl
 
@@ -115,13 +117,14 @@
         self.assertEquals(file_url[:7], "file://")
         file_path = file_url[7:]
 
-        environ = []
-        def check_environ(argv, output):
-            environ.append(os.environ.get("DEBIAN_FRONTEND"))
-            environ.append(os.environ.get("APT_LISTCHANGES_FRONTEND"))
+        check_results = []
+        def check(argv, output):
+            check_results.append(os.environ.get("DEBIAN_FRONTEND"))
+            check_results.append(os.environ.get("APT_LISTCHANGES_FRONTEND"))
+            check_results.append("--force-confold" in argv)
             return 0
 
-        self.pm.dpkg = check_environ
+        self.pm.dpkg = check
 
         sysconf.set("pm-iface-output", True, soft=True)
         sysconf.set("deb-non-interactive", True, soft=True)
@@ -129,5 +132,99 @@
         self.pm.commit({pkg: INSTALL}, {pkg: [file_path]})
 
         # One time for --unpack, one time for --configure.
-        self.assertEquals(environ,
-                          ["noninteractive", "none", "noninteractive", "none"])
+        self.assertEquals(check_results,
+                          ["noninteractive", "none", True,
+                           "noninteractive", "none", True])
+
+    def test_deb_non_interactive_false(self):
+        pkg = self.cache.getPackages()[0]
+        info = self.loader.getInfo(pkg)
+
+        file_url = info.getURLs()[0]
+        self.assertEquals(file_url[:7], "file://")
+        file_path = file_url[7:]
+
+        check_results = []
+        def check(argv, output):
+            check_results.append(os.environ.get("DEBIAN_FRONTEND"))
+            check_results.append(os.environ.get("APT_LISTCHANGES_FRONTEND"))
+            check_results.append("--force-confold" in argv)
+            return 0
+
+        self.pm.dpkg = check
+
+        sysconf.set("pm-iface-output", False, soft=True)
+        sysconf.set("deb-non-interactive", False, soft=True)
+
+        self.pm.commit({pkg: INSTALL}, {pkg: [file_path]})
+
+        # One time for --unpack, one time for --configure.
+        self.assertEquals(check_results,
+                          [None, None, False,
+                           None, None, False])
+
+
+class DebSorterTest(unittest.TestCase):
+    
+    def setUp(self):
+        self.packages_to_build = []
+        class MyLoader(Loader):
+            def load(loader):
+                for args in self.packages_to_build:
+                    loader.buildPackage(*args)
+        self.loader = MyLoader()
+        self.cache = Cache()
+        self.cache.addLoader(self.loader)
+
+    def build(self, *args):
+        map = {cache.Package: [],
+               cache.Provides: [],
+               cache.Requires: [],
+               cache.Upgrades: [],
+               cache.Conflicts: []}
+        for arg in args:
+            for cls, lst in map.iteritems():
+                if issubclass(arg[0], cls):
+                    lst.append(arg)
+                    break
+            else:
+                raise RuntimeError("%r is unknown" % type(arg[0]))
+        self.packages_to_build.append(
+                (map[cache.Package][0], map[cache.Provides],
+                 map[cache.Requires], map[cache.Upgrades],
+                 map[cache.Conflicts]))
+
+    def test_conflicts_order_remove_after_unpack_whenever_possible(self):
+        self.build((DebPackage, "a", "1"),
+                   (DebNameProvides, "a", "1"))
+        self.build((DebPackage, "a", "2"),
+                   (DebNameProvides, "a", "2"),
+                   (DebUpgrades, "a", "<", "2"),
+                   (DebRequires, "b", "=", "1"))
+        self.build((DebPackage, "b", "1"),
+                   (DebNameProvides, "b", "1"),
+                   (DebConflicts, "a", "<", "2"))
+        self.cache.load()
+        changeset = {}
+        for pkg in self.cache.getPackages():
+            if pkg.name == "a" and pkg.version == "1":
+                a_1 = pkg
+            elif pkg.name == "a":
+                a_2 = pkg
+            else:
+                b_1 = pkg
+
+        a_1.installed = True
+
+        changeset[a_1] = REMOVE
+        changeset[a_2] = INSTALL
+        changeset[b_1] = INSTALL
+
+        sorter = DebSorter(changeset)
+        sorted = sorter.getSorted()
+
+        # XXX That's not yet stable.  The deb-ordering-fix branch
+        #     should bring it to stability.
+        #self.assertEquals(sorted,
+        #                  [(a_2, UNPACK), (a_1, REMOVE), (b_1, UNPACK),
+        #                   (b_1, CONFIG), (a_2, CONFIG)])

=== added file 'tests/initialization.py'
--- tests/initialization.py	1970-01-01 00:00:00 +0000
+++ tests/initialization.py	2008-11-26 17:10:15 +0000
@@ -0,0 +1,26 @@
+import sys
+
+from tests.mocker import MockerTestCase
+
+from smart import initPlugins
+
+
+class InitPluginsTest(MockerTestCase):
+
+    def setUp(self):
+        from smart import const
+        self.old_plugins_dir = const.PLUGINSDIR
+        self.plugins_dir = self.makeDir()
+        const.PLUGINSDIR = self.plugins_dir
+
+    def tearDown(self):
+        from smart import const
+        const.PLUGINSDIR = self.old_plugins_dir
+
+    def test_plugins_dir_is_used(self):
+        self.makeFile("import sys; sys.test_worked = True",
+                      basename="plugin.py", dirname=self.plugins_dir)
+        initPlugins()
+        self.assertEquals(getattr(sys, "test_worked", False), True)
+        del sys.test_worked
+

=== added directory 'tests/util'
=== added file 'tests/util/__init__.py'
=== added file 'tests/util/distance.py'
--- tests/util/distance.py	1970-01-01 00:00:00 +0000
+++ tests/util/distance.py	2008-11-26 17:30:06 +0000
@@ -0,0 +1,11 @@
+from tests.mocker import MockerTestCase
+
+from smart.util.distance import globdistance
+
+
+class DistanceTestBase(MockerTestCase):
+
+    def test_globdistance_with_empty_values(self):
+        self.assertEquals(globdistance("", ""), (0, 1.0))
+        self.assertEquals(globdistance("", "a"), (1, 0.0))
+        self.assertEquals(globdistance("a", ""), (1, 0.0))



Index: smart.spec
===================================================================
RCS file: /cvs/extras/rpms/smart/F-9/smart.spec,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- smart.spec	5 Oct 2008 11:13:06 -0000	1.36
+++ smart.spec	21 Dec 2008 20:55:28 -0000	1.37
@@ -7,7 +7,7 @@
 Summary: Next generation package handling tool
 Name: smart
 Version: 1.1
-Release: 56%{?dist}
+Release: 58%{?dist}
 License: GPLv2+
 Group: Applications/System
 URL: http://labix.org/smart/
@@ -17,7 +17,8 @@
 Source3: smart.desktop
 Source4: distro.py
 Source5: ksmarttray.desktop
-Patch0: smart-1.0-autofs5fix.patch
+# http://bazaar.launchpad.net/%7Esmartpm/smart/bugfix/diff/839/854
+Patch0: 839_854.diff
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: python-devel >= 2.3
 BuildRequires: desktop-file-utils
@@ -72,7 +73,7 @@
 
 %prep
 %setup -q
-%patch0 -p1 -b .autofs5
+%patch0 -p0 -b .bugfixes
 # /usr/lib is hardcoded 
 perl -pi -e's,/usr/lib/,%{_libdir}/,' smart/const.py
 install -p -m 644 %{SOURCE2} .
@@ -203,6 +204,12 @@
 %endif
 
 %changelog
+* Sun Dec 21 2008 Axel Thimm <Axel.Thimm at ATrpms.net> - 1.1-58
+- Use bugfix branch, remove already included patches.
+
+* Sat Dec 13 2008 Axel Thimm <Axel.Thimm at ATrpms.net> - 1.1-57
+- Fix rpm loop reordering.
+
 * Sun Oct  5 2008 Axel Thimm <Axel.Thimm at ATrpms.net> - 1.1-56
 - Update to 1.1.
 


--- smart-1.0-autofs5fix.patch DELETED ---




More information about the fedora-extras-commits mailing list