rpms/smart/devel smart-mdclean.patch, NONE, 1.1 smart-sha256.diff, NONE, 1.1 smart-unicode-provides.diff, NONE, 1.1 .cvsignore, 1.13, 1.14 smart.spec, 1.41, 1.42 sources, 1.16, 1.17

Axel Thimm athimm at fedoraproject.org
Wed Apr 15 15:41:21 UTC 2009


Author: athimm

Update of /cvs/extras/rpms/smart/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12756/devel

Modified Files:
	.cvsignore smart.spec sources 
Added Files:
	smart-mdclean.patch smart-sha256.diff 
	smart-unicode-provides.diff 
Log Message:
Update to 1.2 and add sha256 support. Also fix the unicode bug and remove unwanted metadata

smart-mdclean.patch:

--- NEW FILE smart-mdclean.patch ---
=== 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-03-22 12:11:38 +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


smart-sha256.diff:

--- NEW FILE smart-sha256.diff ---
=== modified file 'smart/backends/rpm/metadata.py'
--- smart/backends/rpm/metadata.py	2008-12-31 11:12:46 +0000
+++ smart/backends/rpm/metadata.py	2009-02-20 12:47:55 +0000
@@ -71,6 +71,9 @@
     def getSHA(self, url):
         return self._info.get("sha")
 
+    def getSHA256(self, url):
+        return self._info.get("sha256")
+
     def getDescription(self):
         return self._info.get("description", "")
 

=== modified file 'smart/cache.py'
--- smart/cache.py	2008-12-12 07:18:07 +0000
+++ smart/cache.py	2009-02-20 12:34:05 +0000
@@ -179,6 +179,9 @@
     def getSHA(self, url):
         return None
 
+    def getSHA256(self, url):
+        return None
+
     def validate(self, url, localpath, withreason=False):
         try:
             if not os.path.isfile(localpath):
@@ -208,6 +211,23 @@
                     raise Error, _("Invalid MD5 (expected %s, got %s)") % \
                                  (filemd5, lfilemd5)
             else:
+                filesha256 = item.getInfo(uncompprefix+"sha256")
+                if filesha256:
+                    try:
+                        from hashlib import sha256
+                        digest = sha256()
+                        file = open(localpath)
+                        data = file.read(BLOCKSIZE)
+                        while data:
+                            digest.update(data)
+                            data = file.read(BLOCKSIZE)
+                        lfilesha256 = digest.hexdigest()
+                        if lfilesha256 != filesha256:
+                           raise Error, _("Invalid SHA256 (expected %s, got %s)") % \
+                                         (filesha256, lfilesha256)
+                        return
+                    except ImportError:
+                        pass
                 filesha = self.getSHA(url)
                 if filesha:
                     try:

=== modified file 'smart/channels/rpm_md.py'
--- smart/channels/rpm_md.py	2009-01-22 11:34:02 +0000
+++ smart/channels/rpm_md.py	2009-02-20 12:46:14 +0000
@@ -130,12 +130,16 @@
                                uncomp_md5=info["primary"].get("uncomp_md5"),
                                sha=info["primary"].get("sha"),
                                uncomp_sha=info["primary"].get("uncomp_sha"),
+                               sha256=info["primary"].get("sha256"),
+                               uncomp_sha256=info["primary"].get("uncomp_sha256"),
                                uncomp=True)
         flitem = fetcher.enqueue(info["filelists"]["url"],
                                  md5=info["filelists"].get("md5"),
                                  uncomp_md5=info["filelists"].get("uncomp_md5"),
                                  sha=info["filelists"].get("sha"),
                                  uncomp_sha=info["filelists"].get("uncomp_sha"),
+                                 sha256=info["filelists"].get("sha256"),
+                                 uncomp_sha256=info["filelists"].get("uncomp_sha256"),
                                  uncomp=True)
         fetcher.run(progress=progress)
  

=== modified file 'smart/control.py'
--- smart/control.py	2008-12-12 07:17:44 +0000
+++ smart/control.py	2009-02-20 12:33:35 +0000
@@ -659,6 +659,7 @@
                 pkgitems[pkg].append(fetcher.enqueue(url, media=media,
                                                      md5=info.getMD5(url),
                                                      sha=info.getSHA(url),
+                                                     sha256=info.getSHA256(url),
                                                      size=info.getSize(url),
                                                      validate=info.validate))
         if targetdir:

=== modified file 'smart/fetcher.py'
--- smart/fetcher.py	2008-12-12 07:18:07 +0000
+++ smart/fetcher.py	2009-02-20 13:26:02 +0000
@@ -336,7 +336,9 @@
             prefix = "uncomp_"
         else:
             prefix = ""
-        return bool(item.getInfo(prefix+"md5") or item.getInfo(prefix+"sha"))
+        return bool(item.getInfo(prefix+"md5") or
+                    item.getInfo(prefix+"sha") or
+                    item.getInfo(prefix+"sha256"))
 
     def validate(self, item, localpath, withreason=False, uncomp=False):
         try:
@@ -382,6 +384,23 @@
                     raise Error, _("Invalid MD5 (expected %s, got %s)") % \
                                  (filemd5, lfilemd5)
             else:
+                filesha256 = item.getInfo(uncompprefix+"sha256")
+                if filesha256:
+                    try:
+                        from hashlib import sha256
+                        digest = sha256()
+                        file = open(localpath)
+                        data = file.read(BLOCKSIZE)
+                        while data:
+                            digest.update(data)
+                            data = file.read(BLOCKSIZE)
+                        lfilesha256 = digest.hexdigest()
+                        if lfilesha256 != filesha256:
+                           raise Error, _("Invalid SHA256 (expected %s, got %s)") % \
+                                         (filesha256, lfilesha256)
+                        return
+                    except ImportError:
+                        pass
                 filesha = item.getInfo(uncompprefix+"sha")
                 if filesha:
                     try:
@@ -489,12 +508,13 @@
         #             or just 'valid', depending on 'withreason'. 'valid'
         #             may be None, True, or False. If it's True or False,
         #             no other information will be checked.
-        # - md5, sha: file digest
+        # - md5, sha, sha256: file digest
         # - size: file size
         # - uncomp: whether to uncompress or not
-        # - uncomp_{md5,sha,size}: uncompressed equivalents
+        # - uncomp_{md5,sha,sha256,size}: uncompressed equivalents
         #
-        for kind in ("md5", "sha", "uncomp_md5", "uncomp_sha"):
+        for kind in ("md5", "sha", "sha256",
+                     "uncomp_md5", "uncomp_sha", "uncomp_sha256"):
             value = info.get(kind)
             if value:
                 info[kind] = value.lower()


smart-unicode-provides.diff:

--- NEW FILE smart-unicode-provides.diff ---
=== modified file 'smart/backends/rpm/metadata.py'
--- smart/backends/rpm/metadata.py	2008-08-02 15:07:10 +0000
+++ smart/backends/rpm/metadata.py	2009-03-10 10:11:36 +0000
@@ -261,7 +261,7 @@
                                 Prv = RPMNameProvides
                             else:
                                 Prv = RPMProvides
-                            prvdict[(Prv, ename, eversion)] = True
+                            prvdict[(Prv, ename.encode('utf-8'), eversion)] = True
 
                     elif lasttag == OBSOLETES:
                         tup = (RPMObsoletes, ename, erelation, eversion)



Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/smart/devel/.cvsignore,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- .cvsignore	5 Oct 2008 11:07:13 -0000	1.13
+++ .cvsignore	15 Apr 2009 15:41:20 -0000	1.14
@@ -1 +1 @@
-smart-1.1.tar.bz2
+smart-1.2.tar.bz2


Index: smart.spec
===================================================================
RCS file: /cvs/extras/rpms/smart/devel/smart.spec,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- smart.spec	26 Feb 2009 01:35:31 -0000	1.41
+++ smart.spec	15 Apr 2009 15:41:20 -0000	1.42
@@ -6,8 +6,8 @@
 
 Summary: Next generation package handling tool
 Name: smart
-Version: 1.1
-Release: 60.0.1%{?dist}
+Version: 1.2
+Release: 63%{?dist}
 License: GPLv2+
 Group: Applications/System
 URL: http://labix.org/smart/
@@ -17,8 +17,9 @@
 Source3: smart.desktop
 Source4: distro.py
 Source5: ksmarttray.desktop
-# http://bazaar.launchpad.net/%7Esmartpm/smart/bugfix/diff/856/839
-Patch0: 856_839.diff
+Patch0: http://launchpadlibrarian.net/22909615/smart-sha256.diff
+Patch1: http://launchpadlibrarian.net/25485185/smart-mdclean.patch
+Patch2: http://launchpadlibrarian.net/23697017/smart-unicode-provides.diff
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: python-devel >= 2.3
 BuildRequires: desktop-file-utils
@@ -73,7 +74,10 @@
 
 %prep
 %setup -q
-%patch0 -p0 -b .bugfixes
+%patch0 -p0 -b .sha256
+perl -pi -e's,filesha256 = item\.getInfo\(uncompprefix\+"sha256"\),filesha256 = self.getSHA256(url),' smart/cache.py
+%patch1 -p0 -b .mdclean
+%patch2 -p0 -b .unicode-provides
 # /usr/lib is hardcoded 
 perl -pi -e's,/usr/lib/,%{_libdir}/,' smart/const.py
 install -p -m 644 %{SOURCE2} .
@@ -204,8 +208,11 @@
 %endif
 
 %changelog
-* Wed Feb 25 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.1-60.0.1
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+* Wed Apr 15 2009 Axel Thimm <Axel.Thimm at ATrpms.net> - 1.2-62
+- Fix sha256 and mdclean patches.
+
+* Sun Mar 22 2009 Axel Thimm <Axel.Thimm at ATrpms.net> - 1.2-60
+- Update to 1.2.
 
 * 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


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/smart/devel/sources,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- sources	5 Oct 2008 11:07:13 -0000	1.16
+++ sources	15 Apr 2009 15:41:20 -0000	1.17
@@ -1 +1 @@
-44c1cf965206f2c2707fc7491151205b  smart-1.1.tar.bz2
+233ccbd1e666a9a7c5e1cc7900075d93  smart-1.2.tar.bz2




More information about the fedora-extras-commits mailing list