]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Update for python-apt 0.8 API transition (Closes: #572078)
authorCameron Dale <camrdale@gmail.com>
Sun, 21 Mar 2010 07:40:41 +0000 (00:40 -0700)
committerCameron Dale <camrdale@gmail.com>
Sun, 21 Mar 2010 07:40:41 +0000 (00:40 -0700)
apt_p2p/AptPackages.py
debian/changelog
debian/control

index f7681a7380c1c53050a8b77c19f0aeb503b5b3f9..1238c65c46338066867e97e422bc985c8f8c6b37 100644 (file)
@@ -282,7 +282,7 @@ class AptPackages:
         if self.loaded: return True
         
         # Modify the default configuration to create the fake one.
-        apt_pkg.InitSystem()
+        apt_pkg.init_system()
         self.cache_dir.preauthChild(self.apt_config['Dir::State']
                      ).preauthChild(self.apt_config['Dir::State::Lists']).remove()
         self.cache_dir.preauthChild(self.apt_config['Dir::State']
@@ -312,7 +312,7 @@ class AptPackages:
                 source_line='deb '+fake_dirname+'/ /'
             listpath = self.cache_dir.preauthChild(self.apt_config['Dir::State']
                                     ).preauthChild(self.apt_config['Dir::State::Lists']
-                                    ).child(apt_pkg.URItoFileName(fake_uri))
+                                    ).child(apt_pkg.uri_to_filename(fake_uri))
             sources.write(source_line+'\n')
             log.msg("Sources line: " + source_line)
             sources_count = sources_count + 1
@@ -329,12 +329,12 @@ class AptPackages:
 
         log.msg("Loading Packages database for "+self.cache_dir.path)
         for key, value in self.apt_config.items():
-            apt_pkg.Config[key] = value
+            apt_pkg.config[key] = value
 
-        self.cache = apt_pkg.GetCache(OpProgress())
-        self.records = apt_pkg.GetPkgRecords(self.cache)
+        self.cache = apt_pkg.Cache(OpProgress())
+        self.records = apt_pkg.PackageRecords(self.cache)
         if deb_src_added:
-            self.srcrecords = apt_pkg.GetPkgSrcRecords()
+            self.srcrecords = apt_pkg.SourceRecords()
         else:
             self.srcrecords = None
 
@@ -416,11 +416,11 @@ class AptPackages:
 
         # Check the binary packages
         try:
-            for version in self.cache[package].VersionList:
-                size = version.Size
-                for verFile in version.FileList:
-                    if self.records.Lookup(verFile):
-                        if '/' + self.records.FileName == path:
+            for version in self.cache[package].version_list:
+                size = version.size
+                for verFile in version.file_list:
+                    if self.records.lookup(verFile):
+                        if '/' + self.records.filename == path:
                             h.setFromPkgRecord(self.records, size)
                             d.callback(h)
                             return loadResult
@@ -429,9 +429,9 @@ class AptPackages:
 
         # Check the source packages' files
         if self.srcrecords:
-            self.srcrecords.Restart()
-            if self.srcrecords.Lookup(package):
-                for f in self.srcrecords.Files:
+            self.srcrecords.restart()
+            if self.srcrecords.lookup(package):
+                for f in self.srcrecords.files:
                     if path == '/' + f[2]:
                         h.setFromSrcRecord(f)
                         d.callback(h)
@@ -478,28 +478,28 @@ class TestAptPackages(unittest.TestCase):
         """Tests loading the binary package records cache."""
         self.client._load()
 
-        self.client.records.Lookup(self.client.cache['dpkg'].VersionList[0].FileList[0])
+        self.client.records.lookup(self.client.cache['dpkg'].version_list[0].file_list[0])
         
         pkg_hash = os.popen('grep -A 30 -E "^Package: dpkg$" ' + 
                             '/var/lib/apt/lists/' + self.packagesFile + 
                             ' | grep -E "^SHA1:" | head -n 1' + 
                             ' | cut -d\  -f 2').read().rstrip('\n')
 
-        self.failUnless(self.client.records.SHA1Hash == pkg_hash, 
-                        "Hashes don't match: %s != %s" % (self.client.records.SHA1Hash, pkg_hash))
+        self.failUnless(self.client.records.sha1_hash == pkg_hash, 
+                        "Hashes don't match: %s != %s" % (self.client.records.sha1_hash, pkg_hash))
 
     def test_src_hash(self):
         """Tests loading the source package records cache."""
         self.client._load()
 
-        self.client.srcrecords.Lookup('dpkg')
+        self.client.srcrecords.lookup('dpkg')
 
         src_hashes = os.popen('grep -A 20 -E "^Package: dpkg$" ' + 
                             '/var/lib/apt/lists/' + self.sourcesFile + 
                             ' | grep -A 4 -E "^Files:" | grep -E "^ " ' + 
                             ' | cut -d\  -f 2').read().split('\n')[:-1]
 
-        for f in self.client.srcrecords.Files:
+        for f in self.client.srcrecords.files:
             self.failUnless(f[0] in src_hashes, "Couldn't find %s in: %r" % (f[0], src_hashes))
 
     def test_index_hash(self):
index 0987ab53cd227ad325a16f47a2354fc2d12f4d94..9ab8f99404fff332062f3f354f3301470e09f210 100644 (file)
@@ -1,12 +1,13 @@
 apt-p2p (0.1.6) unstable; urgency=low
 
+  * Update for python-apt 0.8 API transition (Closes: #572078)
   * Fix a lot of lintian warnings and errors
     - Update standards version to 3.8.4 (no changes)
   * Fix various documentation issues
     (Closes: #518590, #518549, #518548, 518550)
   * Add an enable variable to the /etc/default file (Closes: #518594)
 
- -- Cameron Dale <camrdale@gmail.com>  Sun, 21 Mar 2010 00:15:20 -0700
+ -- Cameron Dale <camrdale@gmail.com>  Sun, 21 Mar 2010 00:25:08 -0700
 
 apt-p2p (0.1.5) unstable; urgency=low
 
index 3e1b1de6eb590be2eff1106d27a305f2c7c6e6eb..b047a9c80b2a5bc83d28e8a338ff0b14f4f2d8bf 100644 (file)
@@ -12,7 +12,7 @@ XS-Dm-Upload-Allowed: yes
 
 Package: apt-p2p
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, python-twisted-web2 (>= 8.0), adduser, python-debian (>= 0.1.4), python-apt (>= 0.6.20), python-pysqlite2 (>= 2.1)
+Depends: ${misc:Depends}, ${python:Depends}, python-twisted-web2 (>= 8.0), adduser, python-debian (>= 0.1.4), python-apt (>= 0.7.93), python-pysqlite2 (>= 2.1)
 Provides: python-apt-p2p, python-apt-p2p-khashmir
 Description: apt helper for peer-to-peer downloads of Debian packages
  Apt-P2P is a helper for downloading Debian packages files with APT.