~apw/update-manager/cdromupgrade-avoid-links

« back to all changes in this revision

Viewing changes to DistUpgrade/DistUpgradeQuirks.py

  • Committer: Michael Vogt
  • Date: 2009-02-02 13:58:05 UTC
  • Revision ID: michael.vogt@ubuntu.com-20090202135805-fbjazgg88uub792d
* DistUpgrade/DistUpgradeQuirks.py:
  - run dpkg --forget-old-unvail after the upgrade finished
  - add "PostCleanup" hook 

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        self.uname = Popen(["uname","-r"],stdout=PIPE).communicate()[0].strip()
47
47
 
48
48
    # the quirk function have the name:
 
49
    #  $Name (e.g. PostUpgrade)
49
50
    #  $todist$Name (e.g. intrepidPostUpgrade)
50
51
    #  $from_$fromdist$Name (e.g. from_dapperPostUpgrade)
51
52
    def run(self, quirksName):
57
58
                                in the cache
58
59
        - PostUpgrade: run *after* the upgrade is finished successfully and 
59
60
                       packages got installed
 
61
        - PostCleanup: run *after* the cleanup (orphaned etc) is finished
60
62
        """
 
63
        # run the handler that is common to all dists
 
64
        funcname = "%s" % quirksName
 
65
        func = getattr(self, funcname, None)
 
66
        if func is not None:
 
67
            logging.debug("quirks: running %s" % funcname)
 
68
            func()
 
69
 
61
70
        # run the quirksHandler to-dist
62
71
        funcname = "%s%s" % (self.config.get("Sources","To"), quirksName)
63
72
        func = getattr(self, funcname, None)
105
114
                    
106
115
 
107
116
    # individual quirks handler when the dpkg run is finished ---------
 
117
    def PostCleanup(self):
 
118
        " run after cleanup " 
 
119
        logging.debug("running Quirks.PostCleanup")
 
120
        self.controller.cache.releaseLock()
 
121
        res = subprocess.call(["dpkg","--forget-old-unavail"])
 
122
        logging.debug("dpkg --forget-old-unavail returned %s" % res)
 
123
        self.controller.cache.getLock()
 
124
 
108
125
    def from_dapperPostUpgrade(self):
109
126
        " this works around quirks for dapper->hardy upgrades "
110
127
        logging.debug("running Controller.from_dapperQuirks handler")