r106 - in /debtorrent/trunk: DebTorrent/BT1/AptListener.py DebTorrent/launchmanycore.py DebTorrent/zurllib.py btlaunchmany.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Wed Jun 13 22:55:12 UTC 2007


Author: camrdale-guest
Date: Wed Jun 13 22:55:12 2007
New Revision: 106

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=106
Log:
Make URL downloads specify whether gzip files should be decompressed.
Add some TODO notices for things to be done before the next release.

Modified:
    debtorrent/trunk/DebTorrent/BT1/AptListener.py
    debtorrent/trunk/DebTorrent/launchmanycore.py
    debtorrent/trunk/DebTorrent/zurllib.py
    debtorrent/trunk/btlaunchmany.py

Modified: debtorrent/trunk/DebTorrent/BT1/AptListener.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/AptListener.py?rev=106&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/AptListener.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/AptListener.py Wed Jun 13 22:55:12 2007
@@ -332,6 +332,7 @@
     def process_queue(self):
         """Process the queue of waiting requests."""
         
+        # TODO: check for and remove/rerequest old connections
         # Schedule it again
         self.rawserver.add_task(self.process_queue, 1)
         
@@ -362,6 +363,7 @@
         
         """
         
+        # TODO: add simple status reporting
         try:
             if not self.config['show_infopage']:
                 return (404, 'Not Found', {'Server': VERSION, 'Content-Type': 'text/plain', 'Pragma': 'no-cache'}, alas)
@@ -468,12 +470,16 @@
         
         """
         
+        # TODO: Add caching and cache-checking before downloading
         try:
+            ungzip = True
+            if path[-1].endswith('.gz'):
+                ungzip = False
             url = 'http://'
             url += '/'.join(path)
             if DEBUG:
                 print 'fetching:', url
-            f = urlopen(url)
+            f = urlopen(url, ungzip)
             headers = {}
             for k,v in f.response.getheaders():
                 if k.lower() != 'content-length':
@@ -503,6 +509,7 @@
         
         """
 
+        # TODO: try and find the file in the directory structure too
         # Find the file in one of the torrent downloads
         d, f = self.handler.find_file(path[0], path[1:])
         
@@ -610,6 +617,7 @@
                 print 'ERROR: Packages file could not be converted to a torrent'
             return r
 
+        # TODO: use routines from BT1.makemetafile instead
         pieces = []
         lengths = []
         fs = []
@@ -645,6 +653,7 @@
         
         infohash = sha(bencode(response['info'])).digest()
         
+        # TODO: add mirror data and start deb_mirror downloader to running torrent
         if self.handler.has_torrent(infohash):
             return r
         

Modified: debtorrent/trunk/DebTorrent/launchmanycore.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/launchmanycore.py?rev=106&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/launchmanycore.py (original)
+++ debtorrent/trunk/DebTorrent/launchmanycore.py Wed Jun 13 22:55:12 2007
@@ -396,6 +396,7 @@
                 self.Output.message('dropped "'+self.torrent_cache[hash]['path']+'"')
                 self.downloads[hash].shutdown()
             self.rawserver.shutdown()
+            # TODO: save (cache/pickle) the status of torrents for quick restart
 
         except:
             data = StringIO()
@@ -405,6 +406,7 @@
 
     def scan(self):
         """Scan the torrent directory for changes."""
+        # TODO: on startup scan the torrentcache for old torrents
         self.rawserver.add_task(self.scan, self.scan_period)
                                 
         r = parsedir(self.torrent_dir, self.torrent_cache,
@@ -510,6 +512,7 @@
         
         """
         
+        # TODO: save the torrent file to the torrent cache
         self.torrent_cache.setdefault(hash, data)
         c = self.counter
         self.counter += 1

Modified: debtorrent/trunk/DebTorrent/zurllib.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/zurllib.py?rev=106&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/zurllib.py (original)
+++ debtorrent/trunk/DebTorrent/zurllib.py Wed Jun 13 22:55:12 2007
@@ -59,6 +59,8 @@
     @ivar connection: the connection to the server
     @type response: C{httplib.HTTPResponse}
     @ivar response: the response from the server
+    @type ungzip: C{boolean}
+    @ivar ungzip: whether to ungzip any gzipped data that is received
     
     """
     
@@ -67,6 +69,9 @@
         
         @type url: C{string}
         @param url: the URL to open
+        @type ungzip: C{boolean}
+        @param ungzip: whether to ungzip any gzipped data that is received
+            (optional, defaults to True)
         
         """
         

Modified: debtorrent/trunk/btlaunchmany.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/btlaunchmany.py?rev=106&op=diff
==============================================================================
--- debtorrent/trunk/btlaunchmany.py (original)
+++ debtorrent/trunk/btlaunchmany.py Wed Jun 13 22:55:12 2007
@@ -156,6 +156,7 @@
             print "<directory> - directory to look for .dtorrent files (semi-recursive)"
             print get_usage(defaults, 80, configdefaults)
             exit(1)
+        # TODO: remove the need for a directory to parse (and options)
         config, args = parseargs(params, defaults, 1, 1, configdefaults)
         if config['save_options']:
             configdir.saveConfig(config)




More information about the Debtorrent-commits mailing list