~mvo/update-manager/not-automatic

« back to all changes in this revision

Viewing changes to UpdateManager/Core/DistUpgradeFetcherCore.py

  • Committer: Michael Vogt
  • Date: 2009-01-27 10:01:17 UTC
  • Revision ID: michael.vogt@ubuntu.com-20090127100117-hdid4bfspg56z3q4
improve the debug output via the "DEBUG_UPDATE_MANAGER"
environment

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
    DEFAULT_MIRROR="http://archive.ubuntu.com/ubuntu"
43
43
    DEFAULT_COMPONENT="main"
44
 
    
 
44
    DEBUG = "DEBUG_UPDATE_MANAGER" in os.environ
 
45
 
45
46
    def __init__(self, new_dist, progress):
46
47
        self.new_dist = new_dist
47
48
        self.current_dist = get_dist()
49
50
        # options to pass to the release upgrader when it is run
50
51
        self.run_options = []
51
52
 
52
 
    def _debug(self, s):
 
53
    def _debug(self, msg):
53
54
        " helper to show debug information "
54
 
        print >> sys.stderr, s
 
55
        if self.DEBUG:
 
56
            sys.stderr.write(msg+"\n")
55
57
 
56
58
    def showReleaseNotes(self):
57
59
        return True
159
161
        elif (e.dist == self.current_dist and
160
162
              "main" in e.comps):
161
163
          mirror_uri = e.uri+uri[len(default_uri):]
162
 
          if url_downloadable(mirror_uri):
 
164
          if url_downloadable(mirror_uri, self._debug):
163
165
            return mirror_uri
164
166
          seen.add(e.uri)
165
167
      return ""
174
176
          new_uri = self.mirror_from_sources_list(uri, self.DEFAULT_MIRROR)
175
177
          if new_uri:
176
178
            return new_uri
177
 
 
178
179
        # if that fails, use old method
179
180
        uri_template = Template(uri)
180
181
        m = country_mirror()
185
186
              raise Exception("failed to download %s" % new_uri)
186
187
        except Exception,e:
187
188
            print >> sys.stderr, "url '%s' could not be downloaded" % e
 
189
            # else fallback to main server
188
190
            new_uri = uri_template.safe_substitute(countrymirror='')
189
191
        return new_uri
190
192