rpms/smart/F-10 856_839.diff, NONE, 1.1 smart.spec, 1.39, 1.40 839_856.diff, 1.1, NONE

Axel Thimm athimm at fedoraproject.org
Sat Feb 14 11:28:47 UTC 2009


Author: athimm

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

Modified Files:
	smart.spec 
Added Files:
	856_839.diff 
Removed Files:
	839_856.diff 
Log Message:
launchpad changed the from/to rev order in patches, patch now properly recreated.

856_839.diff:

--- NEW FILE 856_839.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-31 11:12:46 +0000
@@ -25,6 +25,7 @@
 import zlib
 
 from rpmver import checkdep, vercmp, splitarch, splitrelease
+from util import archscore
 from smart.util.strtools import isGlob
 from smart.cache import *
 from smart import *
@@ -41,15 +42,13 @@
         traceback.print_exc()
     raise Error, _("'rpm' python module is not available")
 
-archscore = rpm.archscore
-
 __all__ = ["RPMPackage", "RPMProvides", "RPMNameProvides", "RPMPreRequires",
            "RPMRequires", "RPMUpgrades", "RPMConflicts", "RPMObsoletes",
            "rpm", "getTS", "system_provides"]
 
 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 +101,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/header.py'
--- smart/backends/rpm/header.py	2008-07-22 10:37:20 +0000
+++ smart/backends/rpm/header.py	2008-12-31 11:12:46 +0000
@@ -21,6 +21,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 from smart.backends.rpm.rpmver import splitarch
+from smart.backends.rpm.util import filepaths, archscore
 from smart.util.strtools import globdistance
 from smart.cache import Loader, PackageInfo
 from smart.channel import FileChannel
@@ -120,9 +121,7 @@
 
     def getPathList(self):
         if self._path is None:
-            paths = self._h[rpm.RPMTAG_OLDFILENAMES]
-            if type(paths) != list:
-                paths = [paths]
+            paths = filepaths(self._h)
             modes = self._h[rpm.RPMTAG_FILEMODES]
             if modes:
                 if type(modes) != list:
@@ -196,7 +195,7 @@
             if h[1106]: # RPMTAG_SOURCEPACKAGE
                 continue
             arch = h[1022] # RPMTAG_ARCH
-            if rpm.archscore(arch) == 0:
+            if archscore(arch) == 0:
                 continue
 
             name = h[1000] # RPMTAG_NAME
@@ -323,10 +322,8 @@
                 searcher.addResult(pkg, ratio)
                 continue
             if searcher.path:
-                paths = h[rpm.RPMTAG_OLDFILENAMES]
+                paths = filepaths(h)
                 if paths:
-                    if type(paths) != list:
-                        paths = [paths]
                     for spath, cutoff in searcher.path:
                         for path in paths:
                             _, newratio = globdistance(spath, path, cutoff, ic)
@@ -474,9 +471,7 @@
         h, offset = rpm.readHeaderFromFD(file.fileno())
         bfp = self.buildFileProvides
         while h:
-            fnlst = h[1027] # RPMTAG_OLDFILENAMES
-            if type(fnlst) != list:
-                fnlst = [fnlst]
+            fnlst = filepaths(h)
             for fn in fnlst:
                 fn = fndict.get(fn)
                 if fn and offset in self._offsets:
@@ -487,9 +482,7 @@
     def loadFileProvidesHDL(self, fndict):
         bfp = self.buildFileProvides
         for offset, h in enumerate(self._hdl):
-            fnlst = h[1027] # RPMTAG_OLDFILENAMES
-            if type(fnlst) != list:
-                fnlst = [fnlst]
+            fnlst = filepaths(h)
             for fn in fnlst:
                 fn = fndict.get(fn)
                 if fn and offset in self._offsets:
@@ -677,9 +670,7 @@
                 iface.error("%s: %s" % (os.path.basename(filepath), e))
             else:
                 file.close()
-                fnlst = h[1027] # RPMTAG_OLDFILENAMES
-                if type(fnlst) != list:
-                    fnlst = [fnlst]
+                fnlst = filepaths(h)
                 for fn in fnlst:
                     fn = fndict.get(fn)
                     if fn:

=== modified file 'smart/backends/rpm/metadata.py'
--- smart/backends/rpm/metadata.py	2008-08-02 15:07:10 +0000
+++ smart/backends/rpm/metadata.py	2008-12-31 11:12:46 +0000
@@ -22,6 +22,7 @@
 #
 from smart.cache import PackageInfo, Loader
 from smart.backends.rpm.base import *
+from smart.backends.rpm.util import *
 
 try:
     from xml.etree import cElementTree        
@@ -172,7 +173,7 @@
                         skip = None
 
                 elif tag == ARCH:
-                    if rpm.archscore(elem.text) == 0:
+                    if archscore(elem.text) == 0:
                         skip = PACKAGE
                     else:
                         arch = elem.text

=== 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/backends/rpm/redcarpet.py'
--- smart/backends/rpm/redcarpet.py	2006-11-07 22:22:46 +0000
+++ smart/backends/rpm/redcarpet.py	2008-12-31 11:12:46 +0000
@@ -21,6 +21,7 @@
 #
 from smart.cache import PackageInfo, Loader
 from smart.backends.rpm.base import *
+from smart.backends.rpm.util import *
 from smart import *
 import posixpath
 import locale
@@ -191,7 +192,7 @@
         self._release = data
 
     def handleArchEnd(self, name, attrs, data):
-        if rpm.archscore(data) == 0:
+        if archscore(data) == 0:
             self._skip = self.PACKAGE
         else:
             self._arch = data

=== modified file 'smart/backends/rpm/synthesis.py'
--- smart/backends/rpm/synthesis.py	2006-11-07 22:22:46 +0000
+++ smart/backends/rpm/synthesis.py	2008-12-31 11:12:46 +0000
@@ -23,6 +23,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 from smart.backends.rpm.rpmver import splitarch
+from smart.backends.rpm.util import archscore
 from smart.cache import PackageInfo, Loader
 from smart.backends.rpm.base import *
 from smart import *
@@ -165,7 +166,7 @@
                     version, arch = version[:dot], version[dot+1:]
                 versionarch = "@".join((version, arch))
                 
-                if rpm.archscore(arch) == 0:
+                if archscore(arch) == 0:
                     continue
 
                 name = "-".join(rpmnameparts[0:-2])

=== added file 'smart/backends/rpm/util.py'
--- smart/backends/rpm/util.py	1970-01-01 00:00:00 +0000
+++ smart/backends/rpm/util.py	2008-12-31 11:12:46 +0000
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2005 Canonical
+#
+# Written by Anders F Bjorklund <afb at users.sourceforge.net>
+#
+# This file is part of Smart Package Manager.
+#
+# Smart Package Manager is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# Smart Package Manager is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# 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 rpm
+
+archscores = {}
+
+def archscore(arch):
+    if not arch in archscores:
+        try:
+            archscores[arch] = rpm.archscore(arch)
+        except AttributeError:
+            # rpm.archscore missing from RPM 4.4.7 and 5.0.0
+            # (but available from 4.4.9 and 5.0.3, and later,
+            #  using PlatformScore rather than MachineScore)
+            archscores[arch] = 1
+    return archscores[arch]
+
+def filepaths(h):
+    paths = h[rpm.RPMTAG_OLDFILENAMES]
+    if not paths:
+        dirs = h[rpm.RPMTAG_DIRNAMES]
+        base = h[rpm.RPMTAG_BASENAMES]
+        paths = []
+        for i in range(0,len(dirs)):
+           paths.append(dirs[i] + base[i])
+    elif type(paths) != list:
+        paths = [paths]
+    return paths
+
+# vim:ts=4:sw=4:et

=== modified file 'smart/backends/rpm/yast2.py'
--- smart/backends/rpm/yast2.py	2007-10-08 01:42:30 +0000
+++ smart/backends/rpm/yast2.py	2008-12-31 11:12:46 +0000
@@ -22,6 +22,7 @@
 from smart.backends.rpm.rpmver import splitarch
 from smart.cache import PackageInfo, Loader
 from smart.backends.rpm.base import *
+from smart.backends.rpm.util import *
 from smart import *
 import posixpath
 import locale
@@ -188,7 +189,7 @@
                     raise Error("Error loading YaST2 channel info. Possibly " \
                                 "corrupted file.\n%s" % self._pkginfofile)
                 
-                if rpm.archscore(arch) <= 0:
+                if archscore(arch) <= 0:
                     return
                 name = nameparts[0]
                 self.curpkgname = name

=== 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/channels/rpm_md.py'
--- smart/channels/rpm_md.py	2006-11-24 19:25:39 +0000
+++ smart/channels/rpm_md.py	2009-01-22 11:34:02 +0000
@@ -34,6 +34,7 @@
 from smart.channel import PackageChannel
 from smart import *
 import posixpath
+import os
 
 from xml.parsers import expat
 
@@ -55,33 +56,14 @@
     def getFetchSteps(self):
         return 3
 
-    def fetch(self, fetcher, progress):
-        
-        fetcher.reset()
-        repomd = posixpath.join(self._baseurl, "repodata/repomd.xml")
-        item = fetcher.enqueue(repomd)
-        fetcher.run(progress=progress)
-
-        if item.getStatus() is FAILED:
-            progress.add(self.getFetchSteps()-1)
-            if fetcher.getCaching() is NEVER:
-                lines = [_("Failed acquiring release file for '%s':") % self,
-                         u"%s: %s" % (item.getURL(), item.getFailedReason())]
-                raise Error, "\n".join(lines)
-            return False
-
-        digest = getFileDigest(item.getTargetPath())
-        if digest == self._digest:
-            progress.add(1)
-            return True
-        self.removeLoaders()
-
+    def loadMetadata(self, metadatafile):
         info = {}
+
         try:
-            root = ElementTree.parse(item.getTargetPath()).getroot()
+            root = ElementTree.parse(metadatafile).getroot()
         except expat.error, e:
             raise Error, _("Invalid XML file:\n  %s\n  %s\n  %s") % \
-                          (item.getTargetPath(), repomd, str(e))
+                          (metadatafile, repomd, str(e))
 
         for node in root.getchildren():
             if node.tag != DATA:
@@ -97,6 +79,46 @@
                 if subnode.tag == OPENCHECKSUM:
                     info[type]["uncomp_"+subnode.get("type")] = \
                         subnode.text
+        
+        return info
+        
+    def getLocalPath(self, fetcher, url):
+        from smart.fetcher import FetchItem
+        mirror = fetcher.getMirrorSystem().get(url)
+        item = FetchItem(fetcher, url, mirror)
+        return fetcher.getLocalPath(item)
+
+    def fetch(self, fetcher, progress):
+        
+        fetcher.reset()
+        repomd = posixpath.join(self._baseurl, "repodata/repomd.xml")
+
+        oldinfo = {}
+        path = self.getLocalPath(fetcher, repomd)
+        if os.path.exists(path):
+            try:
+                oldinfo = self.loadMetadata(path)
+            except Error:
+                pass
+        
+        item = fetcher.enqueue(repomd)
+        fetcher.run(progress=progress)
+
+        if item.getStatus() is FAILED:
+            progress.add(self.getFetchSteps()-1)
+            if fetcher.getCaching() is NEVER:
+                lines = [_("Failed acquiring release file for '%s':") % self,
+                         u"%s: %s" % (item.getURL(), item.getFailedReason())]
+                raise Error, "\n".join(lines)
+            return False
+
+        digest = getFileDigest(item.getTargetPath())
+        if digest == self._digest:
+            progress.add(1)
+            return True
+        self.removeLoaders()
+
+        info = self.loadMetadata(item.getTargetPath())
 
         if "primary" not in info:
             raise Error, _("Primary information not found in repository "
@@ -144,6 +166,21 @@
         else:
             return False
 
+        uncompressor = fetcher.getUncompressor()
+
+        # delete any old files, if the new ones have new names
+        for type in ["primary", "filelists", "other"]:
+            if type in oldinfo:
+                url = oldinfo[type]["url"]
+                if url and info[type]["url"] != oldinfo[type]["url"]:
+                    path = self.getLocalPath(fetcher, url)
+                    if os.path.exists(path):
+                       os.unlink(path)
+                    handler = uncompressor.getHandler(path)
+                    path = handler.getTargetPath(path)
+                    if os.path.exists(path):
+                       os.unlink(path)
+
         self._digest = digest
 
         return True

=== 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-10/smart.spec,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- smart.spec	14 Feb 2009 10:56:19 -0000	1.39
+++ smart.spec	14 Feb 2009 11:28:16 -0000	1.40
@@ -7,7 +7,7 @@
 Summary: Next generation package handling tool
 Name: smart
 Version: 1.1
-Release: 59%{?dist}
+Release: 59.0.1%{?dist}
 License: GPLv2+
 Group: Applications/System
 URL: http://labix.org/smart/
@@ -17,8 +17,8 @@
 Source3: smart.desktop
 Source4: distro.py
 Source5: ksmarttray.desktop
-# http://bazaar.launchpad.net/%7Esmartpm/smart/bugfix/diff/839/856
-Patch0: 839_856.diff
+# http://bazaar.launchpad.net/%7Esmartpm/smart/bugfix/diff/856/839
+Patch0: 856_839.diff
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: python-devel >= 2.3
 BuildRequires: desktop-file-utils
@@ -204,6 +204,10 @@
 %endif
 
 %changelog
+* Sat Feb 14 2009 Axel Thimm <Axel.Thimm at ATrpms.net> - 1.1-59.0.1
+- launchpad changed the from/to rev order in patches, patch now
+  properly recreated.
+
 * Sat Feb 14 2009 Axel Thimm <Axel.Thimm at ATrpms.net> - 1.1-59
 - Add some more fixes from the bugfix branch.
 - Fixes Fedora bug #476808 (getPathList on newer rpms not working


--- 839_856.diff DELETED ---




More information about the fedora-extras-commits mailing list