~ubuntu-core-dev/update-manager/main

« back to all changes in this revision

Viewing changes to DistUpgrade/DistUpgradeFetcherSelf.py

  • Committer: Michael Terry
  • Date: 2012-06-07 15:06:56 UTC
  • mto: This revision was merged to the branch mainline in revision 2509.
  • Revision ID: michael.terry@canonical.com-20120607150656-7qv9c4fg7o3qk7ab
first pass at splitting out release code

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from __future__ import absolute_import
2
 
 
3
 
import logging
4
 
import shutil
5
 
 
6
 
from .DistUpgradeFetcherCore import DistUpgradeFetcherCore
7
 
 
8
 
class DistUpgradeFetcherSelf(DistUpgradeFetcherCore):
9
 
    def __init__(self, new_dist, progress, options, view):
10
 
        DistUpgradeFetcherCore.__init__(self,new_dist,progress)
11
 
        self.view = view
12
 
        # user chose to use the network, otherwise it would not be
13
 
        # possible to download self
14
 
        self.run_options += ["--with-network"]
15
 
        # make sure to run self with proper options
16
 
        if options.cdromPath is not None:
17
 
            self.run_options += ["--cdrom=%s" % options.cdromPath]
18
 
        if options.frontend is not None:
19
 
            self.run_options += ["--frontend=%s" % options.frontend]
20
 
 
21
 
    def error(self, summary, message):
22
 
        return self.view.error(summary, message)
23
 
 
24
 
    def runDistUpgrader(self):
25
 
        " overwrite to ensure that the log is copied "
26
 
        # copy log so it isn't overwritten
27
 
        logging.info("runDistUpgrader() called, re-exec self")
28
 
        logging.shutdown()
29
 
        shutil.copy("/var/log/dist-upgrade/main.log",
30
 
                    "/var/log/dist-upgrade/main_update_self.log")
31
 
        # re-exec self
32
 
        DistUpgradeFetcherCore.runDistUpgrader(self)