~mvo/update-manager/not-automatic

« back to all changes in this revision

Viewing changes to DistUpgrade/DistUpgradeQuirks.py

  • Committer: Michael Vogt
  • Date: 2009-02-16 10:30:51 UTC
  • mfrom: (1256.1.14 main)
  • Revision ID: michael.vogt@ubuntu.com-20090216103051-m2aa2cgx0s2facxh
merge from the mainline

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
        # FIXME: we should call --clear-avail as well? 
 
124
        self.controller.cache.getLock()
 
125
 
108
126
    def from_dapperPostUpgrade(self):
109
127
        " this works around quirks for dapper->hardy upgrades "
110
128
        logging.debug("running Controller.from_dapperQuirks handler")