diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 387: Merging in temporary workaround for bug #816015.

Message ID 20110726130545.21230.54750.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

James Tunnicliffe July 26, 2011, 1:05 p.m. UTC
Merge authors:
  James Tunnicliffe (dooferlad)
Related merge proposals:
  https://code.launchpad.net/~dooferlad/linaro-image-tools/restrict_fetch_image_indexer/+merge/69252
  proposed by: James Tunnicliffe (dooferlad)
  review: Approve - James Westby (james-w)
------------------------------------------------------------
revno: 387 [merge]
committer: James Tunnicliffe <james.tunnicliffe@linaro.org>
branch nick: linaro-image-tools
timestamp: Tue 2011-07-26 14:04:10 +0100
message:
  Merging in temporary workaround for bug #816015.
  
  Prevent the indexing of any snapshots that aren't in http://snapshots.linaro.org/11.05-daily/ so the current logic for hwpack and OS selection will not result in finding an OS binary without a hardware pack to go with it.
  
  When testing I noticed that I hadn't changed the name of the library FetchImage to fetch_image (without this change the indexer wouldn't work). I also moved the BeautifulSoup import in fetch_image.py to the single function where it is used, so BeautifulSoup is not needed to be installed on the server that is creating the index.
modified:
  linaro-image-indexer
  linaro_image_tools/fetch_image.py


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk

You are subscribed to branch lp:linaro-image-tools.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'linaro-image-indexer'
--- linaro-image-indexer	2011-07-07 14:15:23 +0000
+++ linaro-image-indexer	2011-07-26 10:56:17 +0000
@@ -25,7 +25,7 @@ 
 import urlparse
 import logging
 import bz2
-import linaro_image_tools.FetchImage
+import linaro_image_tools.fetch_image
 
 RELEASES_WWW_DOCUMENT_ROOT  = "/srv/releases.linaro.org/www/platform/"
 RELEASE_URL                 = "http://releases.linaro.org/platform/"
@@ -41,7 +41,7 @@ 
     def __init__(self):
         self.reset()
         self.db_file_name = "server_index"
-        self.db = linaro_image_tools.FetchImage.DB(self.db_file_name)
+        self.db = linaro_image_tools.fetch_image.DB(self.db_file_name)
 
     def crawl(self):
         self.db.set_url_parse_info(self.url_parse)
@@ -55,17 +55,23 @@ 
 
     def go(self, root_dir_, root_url_, table_):
         for root, subFolders, files in os.walk( root_dir_ ):
-            for file in files:
-                if(re.search('\.gz$', file)):
-                    # Construct a URL to the file and save in the database
-                    relative_location = re.sub(root_dir_, "", 
-                                               os.path.join(root, file))
-                    url = urlparse.urljoin(root_url_, relative_location)
-                    url = urlparse.urljoin(url, file)
-                   
-                    if not re.search('/leb-panda/', url):
-                        logging.info(url)
-                        self.db.record_url(url, table_)
+
+            # --- Temporary hack to work around bug:
+            # https://bugs.launchpad.net/linaro-image-tools/+bug/816015
+            # For the moment we just index platform == 11.05-daily when
+            # indexing the snapshots server.
+            if re.search("11.05-daily", root) or re.search("release", table_):
+                for file in files:
+                    if(re.search('\.gz$', file)):
+                        # Construct a URL to the file and save in the database
+                        relative_location = re.sub(root_dir_, "", 
+                                                   os.path.join(root, file))
+                        url = urlparse.urljoin(root_url_, relative_location)
+                        url = urlparse.urljoin(url, file)
+                       
+                        if not re.search('/leb-panda/', url):
+                            logging.info(url)
+                            self.db.record_url(url, table_)
                     
         self.dump() 
 

=== modified file 'linaro_image_tools/fetch_image.py'
--- linaro_image_tools/fetch_image.py	2011-07-22 21:09:29 +0000
+++ linaro_image_tools/fetch_image.py	2011-07-26 10:56:17 +0000
@@ -35,7 +35,6 @@ 
 import datetime
 import threading
 import subprocess
-import BeautifulSoup
 import utils
 
 
@@ -96,6 +95,8 @@ 
         return a directory listing of the directory that url sits in
         """
 
+        import BeautifulSoup
+
         url = os.path.dirname(url)
         response = self.urllib2_open(url)
         page = response.read()