summaryrefslogtreecommitdiff
path: root/DistUpgrade
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-09-22 13:39:13 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-09-22 13:39:13 +0200
commit34a9ff9157da1e60b0fc63b7cf583f8d38a0016e (patch)
treee3bd1751935a81850be2b60f54a2dacda068c189 /DistUpgrade
parent2f0d800812e27c97be60a9e9da7d7b1645d0533d (diff)
downloadpython-apt-34a9ff9157da1e60b0fc63b7cf583f8d38a0016e.tar.gz
* DistUpgrade/DistUpgrade.cfg:
use ~dapper as identifier * DistUpgrade/DistUpgradeControler.py, DistUpgrade/dist-upgrade.py: - add "--haveBackports" to skip parts of the procedure - re-exec itself when all the backports are in place
Diffstat (limited to 'DistUpgrade')
-rw-r--r--DistUpgrade/DistUpgrade.cfg4
-rw-r--r--DistUpgrade/DistUpgradeControler.py103
-rwxr-xr-xDistUpgrade/dist-upgrade.py4
3 files changed, 59 insertions, 52 deletions
diff --git a/DistUpgrade/DistUpgrade.cfg b/DistUpgrade/DistUpgrade.cfg
index 62a4bb8b..b7bc5216 100644
--- a/DistUpgrade/DistUpgrade.cfg
+++ b/DistUpgrade/DistUpgrade.cfg
@@ -41,9 +41,9 @@ ValidMirrors = mirrors.cfg
[Backports]
Packages=apt,dpkg,python-apt
-VersionIdent=~edgy
+VersionIdent=~dapper
DebLine=deb http://people.ubuntu.com/~mvo/backports/dapper/ /
[Network]
-MaxRetries=3 \ No newline at end of file
+MaxRetries=3
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py
index 4d8e9bf5..1481769c 100644
--- a/DistUpgrade/DistUpgradeControler.py
+++ b/DistUpgrade/DistUpgradeControler.py
@@ -87,7 +87,7 @@ class AptCdrom(object):
class DistUpgradeControler(object):
""" this is the controler that does most of the work """
- def __init__(self, distUpgradeView, cdromPath=None, datadir=None):
+ def __init__(self, distUpgradeView, options=None, datadir=None):
# setup the pathes
localedir = "/usr/share/locale/update-manager/"
if datadir == None:
@@ -96,6 +96,8 @@ class DistUpgradeControler(object):
gladedir = datadir
self.datadir = datadir
+ self.options = options
+
# init gettext
gettext.bindtextdomain("update-manager",localedir)
gettext.textdomain("update-manager")
@@ -106,8 +108,8 @@ class DistUpgradeControler(object):
self.cache = None
# specific for the CDROM based upgrade
- self.aptcdrom = AptCdrom(distUpgradeView, cdromPath)
self.useNetwork = True
+ self.aptcdrom = AptCdrom(distUpgradeView, options.cdromPath)
# the configuration
self.config = DistUpgradeConfig(datadir)
@@ -620,63 +622,66 @@ class DistUpgradeControler(object):
os.putenv("LD_LIBRARY_PATH",os.path.join(backportsdir,"/usr/lib"))
os.putenv("PYTHONPATH",os.path.join(backportsdir,"/usr/lib/python2.4/"))
os.putenv("PATH","%s:%s" % (os.path.join(backportsdir,"/usr/bin"),os.getenv("PATH")))
- return True
+
+ # now exec self again
+ os.execl(sys.argv[0],["--haveBackports"])
# this is the core
def edgyUpgrade(self):
- # sanity check (check for ubuntu-desktop, brokenCache etc)
- self._view.updateStatus(_("Checking package manager"))
- self._view.setStep(1)
-
- if not self.prepare():
- self.abort(1)
+ if not self.options.haveBackports:
+ # sanity check (check for ubuntu-desktop, brokenCache etc)
+ self._view.updateStatus(_("Checking package manager"))
+ self._view.setStep(1)
+
+ if not self.prepare():
+ self.abort(1)
- # run a "apt-get update" now
- if not self.doUpdate():
- sys.exit(1)
+ # run a "apt-get update" now
+ if not self.doUpdate():
+ sys.exit(1)
- # do pre-upgrade stuff (calc list of obsolete pkgs etc)
- self.doPreUpgrade()
+ # do pre-upgrade stuff (calc list of obsolete pkgs etc)
+ self.doPreUpgrade()
- # update sources.list
- self._view.setStep(2)
- self._view.updateStatus(_("Updating repository information"))
- if not self.updateSourcesList():
- self.abort()
-
- # add cdrom (if we have one)
- if (self.aptcdrom and
- not self.aptcdrom.add(self.sources_backup_ext)):
- sys.exit(1)
+ # update sources.list
+ self._view.setStep(2)
+ self._view.updateStatus(_("Updating repository information"))
+ if not self.updateSourcesList():
+ self.abort()
- # then update the package index files
- if not self.doUpdate():
- self.abort()
+ # add cdrom (if we have one)
+ if (self.aptcdrom and
+ not self.aptcdrom.add(self.sources_backup_ext)):
+ sys.exit(1)
- # then open the cache (again)
- self._view.updateStatus(_("Checking package manager"))
- self.openCache()
- # now check if we still have some key packages after the update
- # if not something went seriously wrong
- for pkg in self.config.getlist("Distro","BaseMetaPkgs"):
- if not self.cache.has_key(pkg):
- # FIXME: we could offer to add default source entries here,
- # but we need to be careful to not duplicate them
- # (i.e. the error here could be something else than
- # missing sources entires but network errors etc)
- logging.error("No '%s' after sources.list rewrite+update")
- self._view.error(_("Invalid package information"),
- _("After your package information was "
- "updated the essential package '%s' can "
- "not be found anymore.\n"
- "This indicates a serious error, please "
- "report this bug against the 'update-manager' "
- "package and include the files in /var/log/dist-upgrade/ "
- "in the bugreport.") % pkg)
+ # then update the package index files
+ if not self.doUpdate():
self.abort()
- # get backported packages (if needed)
- self.getRequiredBackports()
+ # then open the cache (again)
+ self._view.updateStatus(_("Checking package manager"))
+ self.openCache()
+ # now check if we still have some key packages after the update
+ # if not something went seriously wrong
+ for pkg in self.config.getlist("Distro","BaseMetaPkgs"):
+ if not self.cache.has_key(pkg):
+ # FIXME: we could offer to add default source entries here,
+ # but we need to be careful to not duplicate them
+ # (i.e. the error here could be something else than
+ # missing sources entires but network errors etc)
+ logging.error("No '%s' after sources.list rewrite+update")
+ self._view.error(_("Invalid package information"),
+ _("After your package information was "
+ "updated the essential package '%s' can "
+ "not be found anymore.\n"
+ "This indicates a serious error, please "
+ "report this bug against the 'update-manager' "
+ "package and include the files in /var/log/dist-upgrade/ "
+ "in the bugreport.") % pkg)
+ self.abort()
+
+ # get backported packages (if needed)
+ self.getRequiredBackports()
# calc the dist-upgrade and see if the removals are ok/expected
# do the dist-upgrade
diff --git a/DistUpgrade/dist-upgrade.py b/DistUpgrade/dist-upgrade.py
index 07320fb9..3f5bf61b 100755
--- a/DistUpgrade/dist-upgrade.py
+++ b/DistUpgrade/dist-upgrade.py
@@ -12,6 +12,8 @@ if __name__ == "__main__":
parser = OptionParser()
parser.add_option("-c", "--cdrom", dest="cdromPath", default=None,
help="Use the given path to search for a cdrom with upgradable packages")
+ parser.add_option("-b", "--have-backports", dest="haveBackports",
+ default=False)
(options, args) = parser.parse_args()
if not os.path.exists("/var/log/dist-upgrade"):
@@ -31,7 +33,7 @@ if __name__ == "__main__":
logging.error("can't import view '%s'" % requested_view)
print "can't find %s" % requested_view
sys.exit(1)
- app = DistUpgradeControler(view, cdromPath=options.cdromPath)
+ app = DistUpgradeControler(view, options)
app.run()