r376 - in /debtorrent/trunk: DebTorrent/HTTPHandler.py debian/changelog test.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Mon May 5 01:33:30 UTC 2008


Author: camrdale-guest
Date: Mon May  5 01:33:30 2008
New Revision: 376

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=376
Log:
Add support for the new No Content message to apt-transport-debtorrent
so that apt treats debtorrent sources as local

Modified:
    debtorrent/trunk/DebTorrent/HTTPHandler.py
    debtorrent/trunk/debian/changelog
    debtorrent/trunk/test.py

Modified: debtorrent/trunk/DebTorrent/HTTPHandler.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/HTTPHandler.py?rev=376&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/HTTPHandler.py (original)
+++ debtorrent/trunk/DebTorrent/HTTPHandler.py Mon May  5 01:33:30 2008
@@ -462,18 +462,31 @@
         else:
             size = os.fstat(data.fileno())[6] - data.tell()
 
+        # Check for a local header and other qualifications
+        if (req_headers.get('if-local-nocache', '').lower() == 'true' and
+            self.protocol == "DEBTORRENT" and type(data) == file and
+            responsecode == 200 and self.connection.get_ip().startswith('127.')):
+            # Send the No Content response with the file name as header
+            responsecode = 204
+            responsestring = "No Content"
+            headers['NoCache-File'] = data.name
+            data.close()
+            data = None
+        
         # i'm abusing the identd field here, but this should be ok
         if encoding == 'identity':
             ident = '-'
         else:
             ident = self.encoding
-        self.handler.write_log( self.connection.get_ip(), ident, '-',
-                                header, responsecode, size,
-                                req_headers.get('referer', '-'),
-                                req_headers.get('user-agent', '-') )
-
-        logger.info('sending response: '+self.protocol+' '+str(responsecode)+' '+responsestring+
-                    ' ('+str(size)+' bytes)' + repr(headers))
+            
+        if responsecode >= 200:
+            self.handler.write_log( self.connection.get_ip(), ident, '-',
+                                    header, responsecode, size,
+                                    req_headers.get('referer', '-'),
+                                    req_headers.get('user-agent', '-') )
+    
+            logger.info('sending response: '+self.protocol+' '+str(responsecode)+' '+responsestring+
+                        ' ('+str(size)+' bytes)' + repr(headers))
         
         r = StringIO()
         

Modified: debtorrent/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/debian/changelog?rev=376&op=diff
==============================================================================
--- debtorrent/trunk/debian/changelog (original)
+++ debtorrent/trunk/debian/changelog Mon May  5 01:33:30 2008
@@ -1,9 +1,11 @@
-debtorrent (0.1.6.1) unstable; urgency=low
+debtorrent (0.1.7) unstable; urgency=low
 
   * Display the torrent identifier on the local status page
     rather than the info hash (Closes: #465339)
+  * Add support for the new No Content message to apt-transport-debtorrent
+    so that apt treats debtorrent sources as local
 
- -- Cameron Dale <camrdale at gmail.com>  Tue, 12 Feb 2008 23:13:24 -0800
+ -- Cameron Dale <camrdale at gmail.com>  Sun, 04 May 2008 18:28:53 -0700
 
 debtorrent (0.1.6) experimental; urgency=low
 

Modified: debtorrent/trunk/test.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/test.py?rev=376&op=diff
==============================================================================
--- debtorrent/trunk/test.py (original)
+++ debtorrent/trunk/test.py Mon May  5 01:33:30 2008
@@ -55,7 +55,6 @@
               (1, ['install', 'asis-doc']),
               (1, ['install', 'bison-doc']),
               (1, ['install', 'crash-whitepaper']),
-              (1, ['install', 'doc-iana']),
               (1, ['install', 'aboot-base']),
               (1, ['install', 'aap-doc']),
               (1, ['install', 'ada-reference-manual']),
@@ -93,32 +92,26 @@
                 6: (1, [], {})},
                [(1, ['update']),
                 (1, ['install', 'fop-doc']),
-                (1, ['install', 'doc-iana']),
                 (1, ['install', 'aboot-base']),
                 (1, ['install', 'ada-reference-manual']),
                 (2, ['update']),
                 (2, ['install', 'fop-doc']),
-                (2, ['install', 'doc-iana']),
                 (2, ['install', 'aboot-base']),
                 (2, ['install', 'ada-reference-manual']),
                 (3, ['update']),
                 (3, ['install', 'fop-doc']),
-                (3, ['install', 'doc-iana']),
                 (3, ['install', 'aboot-base']),
                 (3, ['install', 'ada-reference-manual']),
                 (4, ['update']),
                 (4, ['install', 'fop-doc']),
-                (4, ['install', 'doc-iana']),
                 (4, ['install', 'aboot-base']),
                 (4, ['install', 'ada-reference-manual']),
                 (5, ['update']),
                 (5, ['install', 'fop-doc']),
-                (5, ['install', 'doc-iana']),
                 (5, ['install', 'aboot-base']),
                 (5, ['install', 'ada-reference-manual']),
                 (6, ['update']),
                 (6, ['install', 'fop-doc']),
-                (6, ['install', 'doc-iana']),
                 (6, ['install', 'aboot-base']),
                 (6, ['install', 'ada-reference-manual']),
                 ]),
@@ -129,17 +122,14 @@
                {1: (1, [], {})},
                [(1, ['update']),
                 (1, ['install', 'fop-doc']),
-                (1, ['install', 'doc-iana']),
                 (1, ['install', 'aboot-base']),
                 (1, ['install', 'ada-reference-manual']),
                 (1, ['update']),
                 (1, ['install', 'fop-doc']),
-                (1, ['install', 'doc-iana']),
                 (1, ['install', 'aboot-base']),
                 (1, ['install', 'ada-reference-manual']),
                 (1, ['update']),
                 (1, ['install', 'fop-doc']),
-                (1, ['install', 'doc-iana']),
                 (1, ['install', 'aboot-base']),
                 (1, ['install', 'ada-reference-manual']),
                 ]),
@@ -176,10 +166,10 @@
              [(1, ['update']), 
               (1, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
                    'aspectj-doc', 'fop-doc', 'asis-doc',
-                   'bison-doc', 'crash-whitepaper', 'doc-iana',
+                   'bison-doc', 'crash-whitepaper',
                    'bash-doc', 'apt-howto-common', 'autotools-dev',
                    'aptitude-doc-en', 'asr-manpages',
-                   'atomix-data', 'alcovebook-sgml-doc', 'alamin-doc',
+                   'atomix-data', 'alcovebook-sgml-doc',
                    'aegis-doc', 'afbackup-common', 'airstrike-common',
                    ]),
               ]),
@@ -195,55 +185,55 @@
              [(1, ['update']), 
               (1, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
                    'aspectj-doc', 'fop-doc', 'asis-doc',
-                   'bison-doc', 'crash-whitepaper', 'doc-iana',
+                   'bison-doc', 'crash-whitepaper',
                    'bash-doc', 'apt-howto-common', 'autotools-dev',
                    'aptitude-doc-en', 'asr-manpages',
-                   'atomix-data', 'alcovebook-sgml-doc', 'alamin-doc',
+                   'atomix-data', 'alcovebook-sgml-doc',
                    'aegis-doc', 'afbackup-common', 'airstrike-common',
                    ]),
               (2, ['update']), 
               (2, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
                    'aspectj-doc', 'fop-doc', 'asis-doc',
-                   'bison-doc', 'crash-whitepaper', 'doc-iana',
+                   'bison-doc', 'crash-whitepaper',
                    'bash-doc', 'apt-howto-common', 'autotools-dev',
                    'aptitude-doc-en', 'asr-manpages',
-                   'atomix-data', 'alcovebook-sgml-doc', 'alamin-doc',
+                   'atomix-data', 'alcovebook-sgml-doc',
                    'aegis-doc', 'afbackup-common', 'airstrike-common',
                    ]),
               (3, ['update']), 
               (3, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
                    'aspectj-doc', 'fop-doc', 'asis-doc',
-                   'bison-doc', 'crash-whitepaper', 'doc-iana',
+                   'bison-doc', 'crash-whitepaper',
                    'bash-doc', 'apt-howto-common', 'autotools-dev',
                    'aptitude-doc-en', 'asr-manpages',
-                   'atomix-data', 'alcovebook-sgml-doc', 'alamin-doc',
+                   'atomix-data', 'alcovebook-sgml-doc',
                    'aegis-doc', 'afbackup-common', 'airstrike-common',
                    ]),
               (4, ['update']), 
               (4, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
                    'aspectj-doc', 'fop-doc', 'asis-doc',
-                   'bison-doc', 'crash-whitepaper', 'doc-iana',
+                   'bison-doc', 'crash-whitepaper',
                    'bash-doc', 'apt-howto-common', 'autotools-dev',
                    'aptitude-doc-en', 'asr-manpages',
-                   'atomix-data', 'alcovebook-sgml-doc', 'alamin-doc',
+                   'atomix-data', 'alcovebook-sgml-doc',
                    'aegis-doc', 'afbackup-common', 'airstrike-common',
                    ]),
               (5, ['update']), 
               (5, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
                    'aspectj-doc', 'fop-doc', 'asis-doc',
-                   'bison-doc', 'crash-whitepaper', 'doc-iana',
+                   'bison-doc', 'crash-whitepaper',
                    'bash-doc', 'apt-howto-common', 'autotools-dev',
                    'aptitude-doc-en', 'asr-manpages',
-                   'atomix-data', 'alcovebook-sgml-doc', 'alamin-doc',
+                   'atomix-data', 'alcovebook-sgml-doc',
                    'aegis-doc', 'afbackup-common', 'airstrike-common',
                    ]),
               (6, ['update']), 
               (6, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
                    'aspectj-doc', 'fop-doc', 'asis-doc',
-                   'bison-doc', 'crash-whitepaper', 'doc-iana',
+                   'bison-doc', 'crash-whitepaper',
                    'bash-doc', 'apt-howto-common', 'autotools-dev',
                    'aptitude-doc-en', 'asr-manpages',
-                   'atomix-data', 'alcovebook-sgml-doc', 'alamin-doc',
+                   'atomix-data', 'alcovebook-sgml-doc',
                    'aegis-doc', 'afbackup-common', 'airstrike-common',
                    ]),
               ]),
@@ -257,7 +247,6 @@
               (1, ['install', 'asis-doc']),
               (1, ['install', 'bison-doc']),
               (1, ['install', 'crash-whitepaper']),
-              (1, ['install', 'doc-iana']),
               (1, ['install', 'libhypre1.6.0c2']),
               (1, ['install', 'rar']),
               (1, ['install', 'aboot-base']),
@@ -310,6 +299,19 @@
      dpkg-buildpackage "/usr/bin/dpkg-buildpackage";
      apt-get "/usr/bin/apt-get";
      apt-cache "/usr/bin/apt-cache";
+  };
+};
+
+// Options for the downloading routines
+Acquire
+{
+  // DEBTORRENT method configuration
+  debtorrent
+  {
+    // The timeout delay before the method will close the connection
+    Timeout "300";
+    // Don't keep copies of the downloaded files in apt's cache
+    NoCache "true";
   };
 };
 
@@ -571,11 +573,11 @@
         # Create apt's config files
         f = open(join([downloader_dir, 'etc', 'apt', 'sources.list']), 'w')
         if exists('/usr/lib/apt/methods/newdebtorrent'):
-            f.write('deb newdebtorrent://localhost:' + str(num_down) + '988/' + mirror + '/ unstable ' + suites + '\n')
+            f.write('deb newdebtorrent://localhost:' + str(num_down) + '988/' + mirror + '/ stable ' + suites + '\n')
         elif exists('/usr/lib/apt/methods/debtorrent'):
-            f.write('deb debtorrent://localhost:' + str(num_down) + '988/' + mirror + '/ unstable ' + suites + '\n')
+            f.write('deb debtorrent://localhost:' + str(num_down) + '988/' + mirror + '/ stable ' + suites + '\n')
         else:
-            f.write('deb http://localhost:' + str(num_down) + '988/' + mirror + '/ unstable ' + suites + '\n')
+            f.write('deb http://localhost:' + str(num_down) + '988/' + mirror + '/ stable ' + suites + '\n')
         f.close()
 
     if not exists(join([downloader_dir, 'etc', 'apt', 'apt.conf'])):
@@ -683,7 +685,9 @@
             else:
                 print '********************** apt-get finished with status ' + str(r_value) + ' in ' +  str(elapsed) + ' sec. **************************'
         
-            sleep(15)
+            sleep(5)
+            if 'update' in cmd:
+                sleep(25)
             
     except:
         print '************************** Exception occurred **************************'




More information about the Debtorrent-commits mailing list