diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-05 13:18:47 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-05 13:18:47 +0200 |
| commit | 0704ed7155433750011e128550a8fb55d94121c0 (patch) | |
| tree | 1b84dd739467e8329988140486ccb8d5528525a7 /DistUpgrade | |
| parent | 6d41b5e07b5b58a0d14e4ef12f4c39c658e6da5c (diff) | |
| download | python-apt-0704ed7155433750011e128550a8fb55d94121c0.tar.gz | |
* DistUpgrade/forced_obsoletes.txt:
- no longer needed, part of DistUpgrade.cfg now
* DistUpgrade/mirrors.txt, DistUpgrade/removal_blacklist.txt:
- renamed for consitency
* DistUpgrade/DistUpgrade.cfg, DistUpgrade/DistUpgradeCache.py:
- added "RemovalBlacklistFile" instead of hardcoding it
* DistUpgrade/DistUpgradeConfigParser.py:
- added "datadir" to constructor
* DistUpgrade/DistUpgradeControler.py:
- added datadir
* DistUpgrade/DistUpgradeView.py:
- added "hideStep()" method
- added STEP_PREPARE, STEP_MODIFY_SOURCES, STEP_FETCH_INSTALL, STEP_CLEANUP, STEP_REBOOT
* DistUpgrade/DistUpgradeViewGtk.py:
- implemendted hideStep()
- added datadir arguemnt for constructor
* dist-upgrade.py
- run it with the "." as arguemnt for the config
* UpdateManager/UpdateManager.py:
- if it can't be updated, ask about a dist-upgrade instead
* update-manager.
- added --dist-upgrade
* po/*.po
- make update-po
Diffstat (limited to 'DistUpgrade')
| -rw-r--r-- | DistUpgrade/DistUpgrade.cfg | 3 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeCache.py | 10 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeConfigParser.py | 7 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeControler.py | 21 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeView.py | 11 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeViewGtk.py | 18 | ||||
| -rwxr-xr-x | DistUpgrade/dist-upgrade.py | 2 | ||||
| -rw-r--r-- | DistUpgrade/forced_obsoletes.txt | 1 | ||||
| -rw-r--r-- | DistUpgrade/mirrors.cfg (renamed from DistUpgrade/mirrors.txt) | 0 | ||||
| -rw-r--r-- | DistUpgrade/removal_blacklist.cfg (renamed from DistUpgrade/removal_blacklist.txt) | 0 |
10 files changed, 51 insertions, 22 deletions
diff --git a/DistUpgrade/DistUpgrade.cfg b/DistUpgrade/DistUpgrade.cfg index 02a77564..7a8ebba9 100644 --- a/DistUpgrade/DistUpgrade.cfg +++ b/DistUpgrade/DistUpgrade.cfg @@ -10,6 +10,7 @@ BaseMetaPkgs=ubuntu-minimal PostUpgradePurge=xorg-common, libgl1-mesa Demotions=demoted.cfg RemoveEssentialOk=sysvinit +RemovalBlacklistFile=removal_blacklist.cfg # information about the individual meta-pkgs [ubuntu-desktop] @@ -36,7 +37,7 @@ BackupExt=distUpgrade From=dapper To=edgy ValidOrigin=Ubuntu -ValidMirrors = mirrors.txt +ValidMirrors = mirrors.cfg [Network] MaxRetries=3
\ No newline at end of file diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 1f53b6be..680e7d9e 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -12,20 +12,16 @@ from DistUpgradeView import FuzzyTimeToStr class MyCache(apt.Cache): # init - def __init__(self, progress=None): + def __init__(self, config, progress=None): apt.Cache.__init__(self, progress) self.to_install = [] self.to_remove = [] - self.config = DistUpgradeConfig() + self.config = config self.metapkgs = self.config.getlist("Distro","MetaPkgs") # a list of regexp that are not allowed to be removed - self.removal_blacklist = [] - for line in open("removal_blacklist.txt").readlines(): - line = line.strip() - if not line == "" or line.startswith("#"): - self.removal_blacklist.append(line) + self.removal_blacklist = config.getListFromFile("Distro","RemovalBlacklistFile") # properties @property diff --git a/DistUpgrade/DistUpgradeConfigParser.py b/DistUpgrade/DistUpgradeConfigParser.py index a4c55080..6879dfda 100644 --- a/DistUpgrade/DistUpgradeConfigParser.py +++ b/DistUpgrade/DistUpgradeConfigParser.py @@ -2,9 +2,10 @@ from ConfigParser import ConfigParser, NoOptionError class DistUpgradeConfig(ConfigParser): - def __init__(self): + def __init__(self, datadir): ConfigParser.__init__(self) - self.read(['DistUpgrade.cfg']) + self.datadir=datadir + self.read([datadir+'/DistUpgrade.cfg']) def getlist(self, section, option): try: tmp = self.get(section, option) @@ -17,7 +18,7 @@ class DistUpgradeConfig(ConfigParser): filename = self.get(section, option) except NoOptionError: return [] - items = [x.strip() for x in open(filename)] + items = [x.strip() for x in open(self.datadir+"/"+filename)] return filter(lambda s: not s.startswith("#") and not s == "", items) diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 13050f49..a51fa485 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -86,10 +86,20 @@ class AptCdrom(object): class DistUpgradeControler(object): """ this is the controler that does most of the work """ - def __init__(self, distUpgradeView, cdromPath=None): - gettext.bindtextdomain("update-manager",os.path.join(os.getcwd(),"mo")) + def __init__(self, distUpgradeView, cdromPath=None, datadir=None): + # setup the pathes + localedir = "/usr/share/locale/update-manager/" + if datadir == None: + datadir = os.getcwd() + localedir = os.path.join(datadir,"mo") + gladedir = datadir + self.datadir = datadir + + # init gettext + gettext.bindtextdomain("update-manager",localedir) gettext.textdomain("update-manager") + # setup the view self._view = distUpgradeView self._view.updateStatus(_("Reading cache")) self.cache = None @@ -98,8 +108,8 @@ class DistUpgradeControler(object): self.aptcdrom = AptCdrom(distUpgradeView, cdromPath) self.useNetwork = True - # the configuration - self.config = DistUpgradeConfig() + # the configuration + self.config = DistUpgradeConfig(datadir) self.sources_backup_ext = "."+self.config.get("Files","BackupExt") # some constants here @@ -113,13 +123,14 @@ class DistUpgradeControler(object): # turn on debuging in the cache apt_pkg.Config.Set("Debug::pkgProblemResolver","true") apt_pkg.Config.Set("Debug::pkgDepCache::AutoInstall","true") + # FIXME: make this "append"? fd = os.open("/var/log/dist-upgrade/apt.log", os.O_RDWR|os.O_CREAT|os.O_TRUNC, 0644) os.dup2(fd,1) os.dup2(fd,2) def openCache(self): - self.cache = MyCache(self._view.getOpCacheProgress()) + self.cache = MyCache(self.config, self._view.getOpCacheProgress()) def prepare(self): """ initial cache opening, sanity checking, network checking """ diff --git a/DistUpgrade/DistUpgradeView.py b/DistUpgrade/DistUpgradeView.py index 27817b13..9fda83d4 100644 --- a/DistUpgrade/DistUpgradeView.py +++ b/DistUpgrade/DistUpgradeView.py @@ -44,7 +44,13 @@ class DumbTerminal(object): def call(self, cmd): " expects a command in the subprocess style (as a list) " subprocess.call(cmd) - + + +(STEP_PREPARE, + STEP_MODIFY_SOURCES, + STEP_FETCH_INSTALL, + STEP_CLEANUP, + STEP_REBOOT) = range(1,6) class DistUpgradeView(object): " abstraction for the upgrade view " @@ -75,6 +81,9 @@ class DistUpgradeView(object): 5. Complete """ pass + def hideStep(self, step): + " hide a certain step from the GUI " + pass def confirmChanges(self, summary, changes, downloadSize, actions=None): """ display the list of changed packages (apt.Package) and return if the user confirms them diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py index c58c1fcc..73440f3e 100644 --- a/DistUpgrade/DistUpgradeViewGtk.py +++ b/DistUpgrade/DistUpgradeViewGtk.py @@ -303,17 +303,24 @@ class DistUpgradeVteTerminal(object): class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): " gtk frontend of the distUpgrade tool " - def __init__(self): + def __init__(self, datadir=None): + if not datadir: + localedir=os.path.join(os.getcwd(),"mo") + gladedir=os.getcwd() + else: + localedir="/usr/share/locale/update-manager" + gladedir=os.path.join(datadir, "glade") + # FIXME: i18n must be somewhere relative do this dir try: - bindtextdomain("update-manager",os.path.join(os.getcwd(),"mo")) + bindtextdomain("update-manager", localedir) gettext.textdomain("update-manager") except Exception, e: logging.warning("Error setting locales (%s)" % e) icons = gtk.icon_theme_get_default() gtk.window_set_default_icon(icons.load_icon("update-manager", 32, 0)) - SimpleGladeApp.__init__(self, "DistUpgrade.glade", + SimpleGladeApp.__init__(self, gladedir+"/DistUpgrade.glade", None, domain="update-manager") # we dont use this currently #self.window_main.set_keep_above(True) @@ -398,6 +405,11 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): return self._cdromProgress def updateStatus(self, msg): self.label_status.set_text("%s" % msg) + def hideStep(self, step): + image = getattr(self,"image_step%i" % step) + label = getattr(self,"label_step%i" % step) + image.hide() + label.hide() def setStep(self, step): # first update the "last" step as completed size = gtk.ICON_SIZE_MENU diff --git a/DistUpgrade/dist-upgrade.py b/DistUpgrade/dist-upgrade.py index c7a2a7b7..07320fb9 100755 --- a/DistUpgrade/dist-upgrade.py +++ b/DistUpgrade/dist-upgrade.py @@ -21,7 +21,7 @@ if __name__ == "__main__": format='%(asctime)s %(levelname)s %(message)s', filemode='w') - config = DistUpgradeConfig() + config = DistUpgradeConfig(".") requested_view= config.get("View","View") try: view_modul = __import__(requested_view) diff --git a/DistUpgrade/forced_obsoletes.txt b/DistUpgrade/forced_obsoletes.txt deleted file mode 100644 index 1941b867..00000000 --- a/DistUpgrade/forced_obsoletes.txt +++ /dev/null @@ -1 +0,0 @@ -xscreensaver diff --git a/DistUpgrade/mirrors.txt b/DistUpgrade/mirrors.cfg index 7ab0826c..7ab0826c 100644 --- a/DistUpgrade/mirrors.txt +++ b/DistUpgrade/mirrors.cfg diff --git a/DistUpgrade/removal_blacklist.txt b/DistUpgrade/removal_blacklist.cfg index 773395be..773395be 100644 --- a/DistUpgrade/removal_blacklist.txt +++ b/DistUpgrade/removal_blacklist.cfg |
