summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DistUpgrade/DistUpgrade.cfg2
-rw-r--r--DistUpgrade/DistUpgradeControler.py107
-rw-r--r--DistUpgrade/backport-source.list2
-rwxr-xr-xDistUpgrade/dist-upgrade.py2
4 files changed, 58 insertions, 55 deletions
diff --git a/DistUpgrade/DistUpgrade.cfg b/DistUpgrade/DistUpgrade.cfg
index b7bc5216..767f555e 100644
--- a/DistUpgrade/DistUpgrade.cfg
+++ b/DistUpgrade/DistUpgrade.cfg
@@ -42,7 +42,7 @@ ValidMirrors = mirrors.cfg
[Backports]
Packages=apt,dpkg,python-apt
VersionIdent=~dapper
-DebLine=deb http://people.ubuntu.com/~mvo/backports/dapper/ /
+SourcesList=backport-source.list
[Network]
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py
index 22039aae..fca2abaf 100644
--- a/DistUpgrade/DistUpgradeControler.py
+++ b/DistUpgrade/DistUpgradeControler.py
@@ -274,11 +274,6 @@ class DistUpgradeControler(object):
else:
self.abort()
- # add the backports URI (if we have it)
- line = self.config.get("Backports","DebLine")
- if line and (not SourceEntry(line) in self.sources.list):
- self.sources.list.append(SourceEntry(line))
-
# write (well, backup first ;) !
self.sources.backup(self.sources_backup_ext)
self.sources.save()
@@ -558,6 +553,11 @@ class DistUpgradeControler(object):
def getRequiredBackports(self):
" download the backports specified in DistUpgrade.cfg "
+ # add the backports sources.list fragment
+ shutil.copy(self.config.get("Backports","SourcesList"),
+ apt_pkg.FindDir("Dir::Etc::sourceparts"))
+ # run update
+ self.doUpdate()
# save cachedir and setup new one
cachedir = apt_pkg.Config.Find("Dir::Cache::archives")
cwd = os.getcwd()
@@ -606,6 +606,7 @@ class DistUpgradeControler(object):
return False
# reset the cache dir
+ os.unlink(apt_pkg.FindDir("Dir::Etc::sourceparts")+"/backport-source.list")
apt_pkg.Config.Set("Dir::Cache::archives",cachedir)
os.chdir(cwd)
return self.setupRequiredBackports(backportsdir)
@@ -623,64 +624,64 @@ class DistUpgradeControler(object):
os.putenv("PATH","%s:%s" % (os.path.join(backportsdir,"/usr/bin"),os.getenv("PATH")))
# now exec self again
- os.execv(sys.argv[0],[sys.argv[0],"--haveBackports"])
+ os.execv(sys.argv[0],[sys.argv[0],"--have-backports"])
# this is the core
def edgyUpgrade(self):
- 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)
+ # 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)
+ if not self.options.haveBackports:
+ # get backported packages (if needed)
+ self.getRequiredBackports()
- # do pre-upgrade stuff (calc list of obsolete pkgs etc)
- self.doPreUpgrade()
+ # run a "apt-get update" now
+ if not self.doUpdate():
+ sys.exit(1)
- # update sources.list
- self._view.setStep(2)
- self._view.updateStatus(_("Updating repository information"))
- if not self.updateSourcesList():
- self.abort()
+ # do pre-upgrade stuff (calc list of obsolete pkgs etc)
+ self.doPreUpgrade()
- # 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)
- self.abort()
+ # 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()
# calc the dist-upgrade and see if the removals are ok/expected
# do the dist-upgrade
diff --git a/DistUpgrade/backport-source.list b/DistUpgrade/backport-source.list
new file mode 100644
index 00000000..5945e218
--- /dev/null
+++ b/DistUpgrade/backport-source.list
@@ -0,0 +1,2 @@
+# sources.list fragment for backported apt/dpkg/python-apt
+deb http://people.ubuntu.com/~mvo/backports/dapper / \ No newline at end of file
diff --git a/DistUpgrade/dist-upgrade.py b/DistUpgrade/dist-upgrade.py
index 3f5bf61b..7174ce17 100755
--- a/DistUpgrade/dist-upgrade.py
+++ b/DistUpgrade/dist-upgrade.py
@@ -13,7 +13,7 @@ if __name__ == "__main__":
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)
+ action="store_true",default=False)
(options, args) = parser.parse_args()
if not os.path.exists("/var/log/dist-upgrade"):