From c5c5f86db727831f68c93e7a388e4e2cb8491cb6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 18 Sep 2006 16:51:08 +0200 Subject: * typo fixes (thanks to Bruce Cowan) --- DistUpgrade/DistUpgradeControler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 800590cb..52670371 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -293,7 +293,7 @@ class DistUpgradeControler(object): if self.sources_disabled: self._view.information(_("Third party sources disabled"), - _("Some third party entries in your souces.list " + _("Some third party entries in your sources.list " "were disabled. You can re-enable them " "after the upgrade with the " "'software-properties' tool or with synaptic." -- cgit v1.2.3 From 040c4c726d15962c942f0b286299da2c48e9bccb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 12:07:36 +0200 Subject: * DistUpgrade/DistUpgradeControler.py: - start a initial backports feature --- DistUpgrade/DistUpgrade.cfg | 4 ++++ DistUpgrade/DistUpgradeControler.py | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgrade.cfg b/DistUpgrade/DistUpgrade.cfg index 7a8ebba9..03388b07 100644 --- a/DistUpgrade/DistUpgrade.cfg +++ b/DistUpgrade/DistUpgrade.cfg @@ -39,5 +39,9 @@ To=edgy ValidOrigin=Ubuntu ValidMirrors = mirrors.cfg +[Backports] +Packages=apt,dpkg,python-apt +DebLine=deb http://people.ubuntu.com/~mvo/backports/dapper/ / + [Network] MaxRetries=3 \ No newline at end of file diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 52670371..19babaa3 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -31,6 +31,7 @@ import logging import re import statvfs import shutil +import glob from DistUpgradeConfigParser import DistUpgradeConfig from aptsources import SourcesList, SourceEntry, Distribution, is_mirror @@ -270,6 +271,11 @@ class DistUpgradeControler(object): self.toDist+"-security", comps) 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) @@ -548,6 +554,42 @@ class DistUpgradeControler(object): self.openCache() sys.exit(1) + def getRequiredBackports(self): + " download the backports specified in DistUpgrade.cfg " + # save cachedir and setup new one + cachedir = apt_pkg.Config.Find("Dir::Cache::archives") + backportsdir = os.path.join(os.getcwd(),"backports") + if not os.path.exists(backportsdir): + os.mkdir(backportsdir) + if not os.path.exists(os.path.join(backportsdir,"partial")): + os.mkdir(os.path.join(backportsdir,"partial")) + apt_pkg.Config.Set("Dir::Cache::archives",backportsdir) + + # mark the backports for upgrade and get them + pm = apt_pkg.GetPackageManager(self.cache._depcache) + fetcher = apt_pkg.GetAcquire(self._view.getFetchProgress()) + + # FIXME: add a version line to the cfg file to make sure + # we get the right version file! + for pkgname in self.config.getlist("Backports","Packages"): + self.cache[pkgname].markInstall() + pm.GetArchives(fetcher,self.cache._list,self.cache._records) + + # reset the cache dir + apt_pkg.Config.Set("Dir::Cache::archives",cachedir) + + self.setupRequiredBackports(backportsdir) + + def setupRequiredBackports(self, backportsdir): + " setup the required backports in a evil way " + backportsdir = os.path.normpath(backportsdir) + # unpack it + for deb in glob.glob(backportsdir+"*.deb"): + os.system("dpkg-deb -x %s %s" % (deb, backportsdir)) + # setup some pathes to make sure the new stuff is used + 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"))) # this is the core def edgyUpgrade(self): @@ -602,6 +644,9 @@ class DistUpgradeControler(object): "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 self._view.setStep(3) -- cgit v1.2.3 From 9d4b2d3c59f133b79f25959a9e34a4255ab0447b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 12:29:11 +0200 Subject: * DistUpgrade/DistUpgradeControler.py: - do not mark the backports for install and use the PM interface but the apt_pkg.GetPkgAcqFile() so that we don't have to worry about dependencies --- DistUpgrade/DistUpgradeControler.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 19babaa3..0ae879dc 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -566,30 +566,41 @@ class DistUpgradeControler(object): apt_pkg.Config.Set("Dir::Cache::archives",backportsdir) # mark the backports for upgrade and get them - pm = apt_pkg.GetPackageManager(self.cache._depcache) fetcher = apt_pkg.GetAcquire(self._view.getFetchProgress()) - # FIXME: add a version line to the cfg file to make sure # we get the right version file! for pkgname in self.config.getlist("Backports","Packages"): - self.cache[pkgname].markInstall() - pm.GetArchives(fetcher,self.cache._list,self.cache._records) + pkg = self.cache[pkgname] + pkg._lookupRecord(True) + path = apt_pkg.ParseSection(pkg._records.Record)["Filename"] + cand = pkg._depcache.GetCandidateVer(pkg._pkg) + for (packagefile,i) in cand.FileList: + indexfile = self.cache._list.FindIndex(packagefile) + if indexfile: + uri = indexfile.ArchiveURI(path) + apt_pkg.GetPkgAcqFile(fetcher, uri=uri, + descr=_("Fetching backport of '%s'" % pkgname)) + res = fetcher.Run() + if res != fetcher.ResultContinue: + # ick! error ... + return False # reset the cache dir apt_pkg.Config.Set("Dir::Cache::archives",cachedir) - - self.setupRequiredBackports(backportsdir) + return self.setupRequiredBackports(backportsdir) def setupRequiredBackports(self, backportsdir): " setup the required backports in a evil way " backportsdir = os.path.normpath(backportsdir) # unpack it for deb in glob.glob(backportsdir+"*.deb"): - os.system("dpkg-deb -x %s %s" % (deb, backportsdir)) + ret = os.system("dpkg-deb -x %s %s" % (deb, backportsdir)) + # FIXME: do error checking # setup some pathes to make sure the new stuff is used 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 # this is the core def edgyUpgrade(self): -- cgit v1.2.3 From 2f0d800812e27c97be60a9e9da7d7b1645d0533d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 13:10:22 +0200 Subject: * DistUpgrade/DistUpgrade.cfg: - added version identifier to the config to ensure that we get the right version of backported packages (currently set to ~dapper) * DistUpgrade/DistUpgradeControler.py: - check the versionlist of the backported packages to find the one we need --- DistUpgrade/DistUpgrade.cfg | 2 ++ DistUpgrade/DistUpgradeControler.py | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgrade.cfg b/DistUpgrade/DistUpgrade.cfg index 03388b07..62a4bb8b 100644 --- a/DistUpgrade/DistUpgrade.cfg +++ b/DistUpgrade/DistUpgrade.cfg @@ -41,7 +41,9 @@ ValidMirrors = mirrors.cfg [Backports] Packages=apt,dpkg,python-apt +VersionIdent=~edgy DebLine=deb http://people.ubuntu.com/~mvo/backports/dapper/ / + [Network] MaxRetries=3 \ No newline at end of file diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 0ae879dc..4d8e9bf5 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -558,7 +558,9 @@ class DistUpgradeControler(object): " download the backports specified in DistUpgrade.cfg " # save cachedir and setup new one cachedir = apt_pkg.Config.Find("Dir::Cache::archives") + cwd = os.getcwd() backportsdir = os.path.join(os.getcwd(),"backports") + os.chdir(backportsdir) if not os.path.exists(backportsdir): os.mkdir(backportsdir) if not os.path.exists(os.path.join(backportsdir,"partial")): @@ -568,16 +570,33 @@ class DistUpgradeControler(object): # mark the backports for upgrade and get them fetcher = apt_pkg.GetAcquire(self._view.getFetchProgress()) # FIXME: add a version line to the cfg file to make sure - # we get the right version file! + # we get the right version file! and add sanity checking + # that we don't get (accidently) the edgy version for pkgname in self.config.getlist("Backports","Packages"): pkg = self.cache[pkgname] - pkg._lookupRecord(True) + # look for the right version (backport) + for ver in pkg._pkg.VersionList: + print ver.VerStr + if self.config.get("Backports","VersionIdent") in ver.VerStr: + break + else: + # FIXME: be more clever here (exception) + print "No backport found!?!" + return False + if ver.FileList == None: + print "No FileList for: %s " % self._pkg.Name() + return False + f, index = ver.FileList.pop(0) + pkg._records.Lookup((f,index)) path = apt_pkg.ParseSection(pkg._records.Record)["Filename"] cand = pkg._depcache.GetCandidateVer(pkg._pkg) for (packagefile,i) in cand.FileList: indexfile = self.cache._list.FindIndex(packagefile) if indexfile: - uri = indexfile.ArchiveURI(path) + match = re.match(r"<.*ArchiveURI='(.*)'>$", + str(indexfile)) + if match: + uri = match.group(1) + path apt_pkg.GetPkgAcqFile(fetcher, uri=uri, descr=_("Fetching backport of '%s'" % pkgname)) res = fetcher.Run() @@ -587,6 +606,7 @@ class DistUpgradeControler(object): # reset the cache dir apt_pkg.Config.Set("Dir::Cache::archives",cachedir) + os.chdir(cwd) return self.setupRequiredBackports(backportsdir) def setupRequiredBackports(self, backportsdir): -- cgit v1.2.3 From 34a9ff9157da1e60b0fc63b7cf583f8d38a0016e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 13:39:13 +0200 Subject: * 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 --- DistUpgrade/DistUpgrade.cfg | 4 +- DistUpgrade/DistUpgradeControler.py | 103 +++++++++++++++++++----------------- DistUpgrade/dist-upgrade.py | 4 +- 3 files changed, 59 insertions(+), 52 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') 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() -- cgit v1.2.3 From 4f1f29f6b9bcc92c10428dc4a3ce783e7ad1f5c5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 15:41:07 +0200 Subject: * DistUpgrade/DistUpgradeControler.py: - bugfixes in the new "use-backports" code --- DistUpgrade/DistUpgradeControler.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 1481769c..22039aae 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -591,8 +591,7 @@ class DistUpgradeControler(object): f, index = ver.FileList.pop(0) pkg._records.Lookup((f,index)) path = apt_pkg.ParseSection(pkg._records.Record)["Filename"] - cand = pkg._depcache.GetCandidateVer(pkg._pkg) - for (packagefile,i) in cand.FileList: + for (packagefile,i) in ver.FileList: indexfile = self.cache._list.FindIndex(packagefile) if indexfile: match = re.match(r"<.*ArchiveURI='(.*)'>$", @@ -615,7 +614,7 @@ class DistUpgradeControler(object): " setup the required backports in a evil way " backportsdir = os.path.normpath(backportsdir) # unpack it - for deb in glob.glob(backportsdir+"*.deb"): + for deb in glob.glob(backportsdir+"/*.deb"): ret = os.system("dpkg-deb -x %s %s" % (deb, backportsdir)) # FIXME: do error checking # setup some pathes to make sure the new stuff is used @@ -624,7 +623,7 @@ class DistUpgradeControler(object): os.putenv("PATH","%s:%s" % (os.path.join(backportsdir,"/usr/bin"),os.getenv("PATH"))) # now exec self again - os.execl(sys.argv[0],["--haveBackports"]) + os.execv(sys.argv[0],[sys.argv[0],"--haveBackports"]) # this is the core def edgyUpgrade(self): -- cgit v1.2.3 From b117e7ca7ed21fe11a3c9554b3848544822a55e2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 16:30:59 +0200 Subject: * DistUpgrade/backport-source.list: - the sources.list fragment for the backports * DistUpgrade/DistUpgradeControler.py: - run the backports fetching as early as possible --- DistUpgrade/DistUpgrade.cfg | 2 +- DistUpgrade/DistUpgradeControler.py | 107 ++++++++++++++++++------------------ DistUpgrade/backport-source.list | 2 + DistUpgrade/dist-upgrade.py | 2 +- 4 files changed, 58 insertions(+), 55 deletions(-) create mode 100644 DistUpgrade/backport-source.list (limited to 'DistUpgrade/DistUpgradeControler.py') 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"): -- cgit v1.2.3 From 16161a5d46af8b1440317958bfa64e7be5539677 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 16:45:39 +0200 Subject: * DistUpgrade/DistUpgradeControler.py: - bugfixes - use os.execve() when re-execing --- DistUpgrade/DistUpgradeControler.py | 12 ++++++------ DistUpgrade/dist-upgrade.py | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index fca2abaf..b443bf45 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -555,7 +555,7 @@ class DistUpgradeControler(object): " 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")) + apt_pkg.Config.FindDir("Dir::Etc::sourceparts")) # run update self.doUpdate() # save cachedir and setup new one @@ -606,7 +606,7 @@ class DistUpgradeControler(object): return False # reset the cache dir - os.unlink(apt_pkg.FindDir("Dir::Etc::sourceparts")+"/backport-source.list") + os.unlink(apt_pkg.Config.FindDir("Dir::Etc::sourceparts")+"/backport-source.list") apt_pkg.Config.Set("Dir::Cache::archives",cachedir) os.chdir(cwd) return self.setupRequiredBackports(backportsdir) @@ -619,12 +619,12 @@ class DistUpgradeControler(object): ret = os.system("dpkg-deb -x %s %s" % (deb, backportsdir)) # FIXME: do error checking # setup some pathes to make sure the new stuff is used - 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"))) + os.environ["LD_LIBRARY_PATH"] = os.path.join(backportsdir,"/usr/lib") + os.environ["PYTHONPATH"] = os.path.join(backportsdir,"/usr/lib/python2.4/") + os.environ["PATH"] = "%s:%s" % (os.path.join(backportsdir,"/usr/bin"),os.getenv("PATH")) # now exec self again - os.execv(sys.argv[0],[sys.argv[0],"--have-backports"]) + os.execve(sys.argv[0],[sys.argv[0],"--have-backports"], os.environ) # this is the core def edgyUpgrade(self): diff --git a/DistUpgrade/dist-upgrade.py b/DistUpgrade/dist-upgrade.py index 7174ce17..997297c2 100755 --- a/DistUpgrade/dist-upgrade.py +++ b/DistUpgrade/dist-upgrade.py @@ -9,6 +9,9 @@ from optparse import OptionParser if __name__ == "__main__": + # debug + print os.environ + parser = OptionParser() parser.add_option("-c", "--cdrom", dest="cdromPath", default=None, help="Use the given path to search for a cdrom with upgradable packages") -- cgit v1.2.3 From 1417e173a98b36e10d0e876f668caef090d7b4b7 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 17:09:05 +0200 Subject: * DistUpgrade/DistUpgrade.cfg: - use python2.4-apt * DistUpgrade/DistUpgradeControler.py: -fix pathes --- DistUpgrade/DistUpgrade.cfg | 2 +- DistUpgrade/DistUpgradeControler.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgrade.cfg b/DistUpgrade/DistUpgrade.cfg index 767f555e..60c3ca9f 100644 --- a/DistUpgrade/DistUpgrade.cfg +++ b/DistUpgrade/DistUpgrade.cfg @@ -40,7 +40,7 @@ ValidOrigin=Ubuntu ValidMirrors = mirrors.cfg [Backports] -Packages=apt,dpkg,python-apt +Packages=apt,dpkg,python2.4-apt VersionIdent=~dapper SourcesList=backport-source.list diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index b443bf45..7d48db69 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -126,9 +126,8 @@ 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.O_RDWR|os.O_CREAT|os.O_APPEND, 0644) os.dup2(fd,1) os.dup2(fd,2) @@ -583,7 +582,7 @@ class DistUpgradeControler(object): break else: # FIXME: be more clever here (exception) - print "No backport found!?!" + raise Exception, "No backport found!?!" return False if ver.FileList == None: print "No FileList for: %s " % self._pkg.Name() @@ -613,15 +612,15 @@ class DistUpgradeControler(object): def setupRequiredBackports(self, backportsdir): " setup the required backports in a evil way " - backportsdir = os.path.normpath(backportsdir) # unpack it for deb in glob.glob(backportsdir+"/*.deb"): ret = os.system("dpkg-deb -x %s %s" % (deb, backportsdir)) # FIXME: do error checking # setup some pathes to make sure the new stuff is used - os.environ["LD_LIBRARY_PATH"] = os.path.join(backportsdir,"/usr/lib") - os.environ["PYTHONPATH"] = os.path.join(backportsdir,"/usr/lib/python2.4/") - os.environ["PATH"] = "%s:%s" % (os.path.join(backportsdir,"/usr/bin"),os.getenv("PATH")) + os.environ["LD_LIBRARY_PATH"] = backportsdir+"/usr/lib" + os.environ["PYTHONPATH"] = backportsdir+"/usr/lib/python2.4/site-packages/" + os.environ["PATH"] = "%s:%s" % (backportsdir+"/usr/bin", + os.getenv("PATH")) # now exec self again os.execve(sys.argv[0],[sys.argv[0],"--have-backports"], os.environ) @@ -635,7 +634,7 @@ class DistUpgradeControler(object): if not self.prepare(): self.abort(1) - if not self.options.haveBackports: + if self.options.haveBackports == False: # get backported packages (if needed) self.getRequiredBackports() -- cgit v1.2.3 From 3c13b603ab6bb720861441a3992bff55831942bf Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 19:07:42 +0200 Subject: * DistUpgrade/DistUpgradeCache.py: - add clear() function that is autoMark friendly * DistUpgrade/DistUpgradeControler.py: - bugfixes - pass the old arguments to the new execed child * DistUpgrade/dist-upgrade.py: - remove debug output --- DistUpgrade/DistUpgradeCache.py | 6 ++++-- DistUpgrade/DistUpgradeControler.py | 6 ++++-- DistUpgrade/dist-upgrade.py | 3 --- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 4b6fd680..99f3b585 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -67,10 +67,12 @@ class MyCache(apt.Cache): if pkg.markedDelete: self.to_remove.append(pkg.name) + def clear(self): + self.depcache.Init() + def restore_snapshot(self): """ restore a snapshot """ - for pkg in self: - pkg.markKeep() + self.clear() for name in self.to_remove: pkg = self[name] pkg.markDelete() diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 7d48db69..441952b2 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -557,15 +557,17 @@ class DistUpgradeControler(object): apt_pkg.Config.FindDir("Dir::Etc::sourceparts")) # run update self.doUpdate() + self.openCache() + # save cachedir and setup new one cachedir = apt_pkg.Config.Find("Dir::Cache::archives") cwd = os.getcwd() backportsdir = os.path.join(os.getcwd(),"backports") - os.chdir(backportsdir) if not os.path.exists(backportsdir): os.mkdir(backportsdir) if not os.path.exists(os.path.join(backportsdir,"partial")): os.mkdir(os.path.join(backportsdir,"partial")) + os.chdir(backportsdir) apt_pkg.Config.Set("Dir::Cache::archives",backportsdir) # mark the backports for upgrade and get them @@ -623,7 +625,7 @@ class DistUpgradeControler(object): os.getenv("PATH")) # now exec self again - os.execve(sys.argv[0],[sys.argv[0],"--have-backports"], os.environ) + os.execve(sys.argv[0],sys.argv+["--have-backports"], os.environ) # this is the core def edgyUpgrade(self): diff --git a/DistUpgrade/dist-upgrade.py b/DistUpgrade/dist-upgrade.py index 997297c2..7174ce17 100755 --- a/DistUpgrade/dist-upgrade.py +++ b/DistUpgrade/dist-upgrade.py @@ -9,9 +9,6 @@ from optparse import OptionParser if __name__ == "__main__": - # debug - print os.environ - parser = OptionParser() parser.add_option("-c", "--cdrom", dest="cdromPath", default=None, help="Use the given path to search for a cdrom with upgradable packages") -- cgit v1.2.3 From 80be6d4dd486d6c920b63ae52ebe7797e96eb0ee Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 19:37:29 +0200 Subject: * DistUpgrade/DistUpgradeControler.py: - if we use backports, make sure apt uses the right dpkg --- DistUpgrade/DistUpgradeControler.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 441952b2..871d94d1 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -420,6 +420,9 @@ class DistUpgradeControler(object): return res def doDistUpgrade(self): + if self.options.haveBackports: + backportsdir = os.getcwd()+"/backports" + apt_pkg.Config.Set("Dir::Bin::dpkg",backportsdir+"/usr/bin/dpkg"); currentRetry = 0 fprogress = self._view.getFetchProgress() iprogress = self._view.getInstallProgress(self.cache) -- cgit v1.2.3 From 51f9893e8cee1285c0baa9c1b3344c80b1edbd42 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 23:50:38 +0200 Subject: * DistUpgrade/dist-upgrade.py: - added --with-network, --without-network to avoid asking the "do you want to use a network" question --- DistUpgrade/DistUpgradeControler.py | 19 +++++++++++++------ DistUpgrade/dist-upgrade.py | 4 +++- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 871d94d1..c45a7da0 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -107,8 +107,10 @@ class DistUpgradeControler(object): self._view.updateStatus(_("Reading cache")) self.cache = None - # specific for the CDROM based upgrade - self.useNetwork = True + try: + self.useNetwork = getattr(self.options,"withNetwork") + except AttributeError: + pass self.aptcdrom = AptCdrom(distUpgradeView, options.cdromPath) # the configuration @@ -139,9 +141,9 @@ class DistUpgradeControler(object): self.openCache() if not self.cache.sanityCheck(self._view): return False - # FIXME: we may try to find out a bit more about the network connection here and ask more - # inteligent questions - if self.aptcdrom: + # FIXME: we may try to find out a bit more about the network + # connection here and ask more inteligent questions + if self.aptcdrom and not hasattr(self,"useNetwork"): res = self._view.askYesNoQuestion(_("Fetch data from the network for the upgrade?"), _("The upgrade can use the network to check " "the latest updates and to fetch packages that are not on the " @@ -628,7 +630,12 @@ class DistUpgradeControler(object): os.getenv("PATH")) # now exec self again - os.execve(sys.argv[0],sys.argv+["--have-backports"], os.environ) + args = sys.argv+["--have-backports"] + if self.useNetwork: + args.append("--with-network") + else: + args.append("--without-network") + os.execve(sys.argv[0],args, os.environ) # this is the core def edgyUpgrade(self): diff --git a/DistUpgrade/dist-upgrade.py b/DistUpgrade/dist-upgrade.py index 7174ce17..289f0c2e 100755 --- a/DistUpgrade/dist-upgrade.py +++ b/DistUpgrade/dist-upgrade.py @@ -12,7 +12,9 @@ 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", + parser.add_option("--with-network", dest="withNetwork",action="store_true") + parser.add_option("--without-network", dest="withNetwork",action="store_false") + parser.add_option("--have-backports", dest="haveBackports", action="store_true",default=False) (options, args) = parser.parse_args() -- cgit v1.2.3 From bd5dc1971ab94c31d721d0df442b41e3eab2aca0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Sep 2006 23:59:23 +0200 Subject: * DistUpgrade/DistUpgradeControler.py: - bugfixing in the useNetwork code --- DistUpgrade/DistUpgradeControler.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index c45a7da0..2d36e9cc 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -107,10 +107,7 @@ class DistUpgradeControler(object): self._view.updateStatus(_("Reading cache")) self.cache = None - try: - self.useNetwork = getattr(self.options,"withNetwork") - except AttributeError: - pass + self.useNetwork = getattr(self.options,"withNetwork",True) self.aptcdrom = AptCdrom(distUpgradeView, options.cdromPath) # the configuration @@ -143,7 +140,7 @@ class DistUpgradeControler(object): return False # FIXME: we may try to find out a bit more about the network # connection here and ask more inteligent questions - if self.aptcdrom and not hasattr(self,"useNetwork"): + if self.aptcdrom and not hasattr(self.options, "witheNetwork"): res = self._view.askYesNoQuestion(_("Fetch data from the network for the upgrade?"), _("The upgrade can use the network to check " "the latest updates and to fetch packages that are not on the " -- cgit v1.2.3 From ba58baea53b70a3a6604c2671b7a97585d7dbd3d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 23 Sep 2006 00:12:57 +0200 Subject: * DistUpgrade/DistUpgradeControler.py: - get the with,without-network argument passing right --- DistUpgrade/DistUpgradeControler.py | 8 ++++++-- DistUpgrade/dist-upgrade.py | 5 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 2d36e9cc..bcb54553 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -107,7 +107,10 @@ class DistUpgradeControler(object): self._view.updateStatus(_("Reading cache")) self.cache = None - self.useNetwork = getattr(self.options,"withNetwork",True) + if self.options.withNetwork == None: + self.useNetwork = True + else: + self.useNetwork = self.options.withNetwork self.aptcdrom = AptCdrom(distUpgradeView, options.cdromPath) # the configuration @@ -140,7 +143,7 @@ class DistUpgradeControler(object): return False # FIXME: we may try to find out a bit more about the network # connection here and ask more inteligent questions - if self.aptcdrom and not hasattr(self.options, "witheNetwork"): + if self.aptcdrom and self.options.withNetwork == None: res = self._view.askYesNoQuestion(_("Fetch data from the network for the upgrade?"), _("The upgrade can use the network to check " "the latest updates and to fetch packages that are not on the " @@ -602,6 +605,7 @@ class DistUpgradeControler(object): if match: uri = match.group(1) + path apt_pkg.GetPkgAcqFile(fetcher, uri=uri, + size=ver.Size, descr=_("Fetching backport of '%s'" % pkgname)) res = fetcher.Run() if res != fetcher.ResultContinue: diff --git a/DistUpgrade/dist-upgrade.py b/DistUpgrade/dist-upgrade.py index 289f0c2e..918dff02 100755 --- a/DistUpgrade/dist-upgrade.py +++ b/DistUpgrade/dist-upgrade.py @@ -13,9 +13,8 @@ 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("--with-network", dest="withNetwork",action="store_true") - parser.add_option("--without-network", dest="withNetwork",action="store_false") - parser.add_option("--have-backports", dest="haveBackports", - action="store_true",default=False) + parser.add_option("--without-network", dest="withNetwork",action="store_false", default=True) + parser.add_option("--have-backports", dest="haveBackports", action="store_true") (options, args) = parser.parse_args() if not os.path.exists("/var/log/dist-upgrade"): -- cgit v1.2.3 From 3f8b06652b6bce05452cbbd7a6b916562a9762f1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 23 Sep 2006 09:55:29 +0200 Subject: * DistUpgrade/DistUpgradeCache.py: - fix in clear() * UpdateManager/UpdateManager.py: - fixes in the new DistUpgrader code --- DistUpgrade/DistUpgradeCache.py | 7 ++++++- DistUpgrade/DistUpgradeControler.py | 14 +++++++++----- UpdateManager/UpdateManager.py | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 99f3b585..8427bb3d 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -68,7 +68,7 @@ class MyCache(apt.Cache): self.to_remove.append(pkg.name) def clear(self): - self.depcache.Init() + self._depcache.Init() def restore_snapshot(self): """ restore a snapshot """ @@ -318,3 +318,8 @@ class MyCache(apt.Cache): if foreign: foreign_pkgs.add(pkg.name) return foreign_pkgs + +if __name__ == "__main__": + import DistUpgradeConfigParser + c = MyCache(DistUpgradeConfigParser.DistUpgradeConfig(".")) + c.clear() diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index bcb54553..5217a990 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -107,11 +107,15 @@ class DistUpgradeControler(object): self._view.updateStatus(_("Reading cache")) self.cache = None - if self.options.withNetwork == None: + if not self.options or self.options.withNetwork == None: self.useNetwork = True else: self.useNetwork = self.options.withNetwork - self.aptcdrom = AptCdrom(distUpgradeView, options.cdromPath) + if options: + cdrompath = options.cdromPath + else: + cdrompath = None + self.aptcdrom = AptCdrom(distUpgradeView, cdrompath) # the configuration self.config = DistUpgradeConfig(datadir) @@ -143,7 +147,7 @@ class DistUpgradeControler(object): return False # FIXME: we may try to find out a bit more about the network # connection here and ask more inteligent questions - if self.aptcdrom and self.options.withNetwork == None: + if self.aptcdrom and self.options and self.options.withNetwork == None: res = self._view.askYesNoQuestion(_("Fetch data from the network for the upgrade?"), _("The upgrade can use the network to check " "the latest updates and to fetch packages that are not on the " @@ -422,7 +426,7 @@ class DistUpgradeControler(object): return res def doDistUpgrade(self): - if self.options.haveBackports: + if self.options and self.options.haveBackports: backportsdir = os.getcwd()+"/backports" apt_pkg.Config.Set("Dir::Bin::dpkg",backportsdir+"/usr/bin/dpkg"); currentRetry = 0 @@ -647,7 +651,7 @@ class DistUpgradeControler(object): if not self.prepare(): self.abort(1) - if self.options.haveBackports == False: + if selfoptions and self.options.haveBackports == False: # get backported packages (if needed) self.getRequiredBackports() diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 0d70b56c..a609ab5e 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -33,7 +33,7 @@ try: except: import fakegconf as gconf import gobject -from warnings import warn +import warnings warnings.filterwarnings("ignore", "apt API not stable yet", FutureWarning) import apt import apt_pkg -- cgit v1.2.3 From 7047a71806f250371d4cef6947162aa44ed528b9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 23 Sep 2006 10:02:12 +0200 Subject: * DistUpgrade/DistUpgradeControler.py: - typo --- DistUpgrade/DistUpgradeControler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 5217a990..f9c4c0dd 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -651,7 +651,7 @@ class DistUpgradeControler(object): if not self.prepare(): self.abort(1) - if selfoptions and self.options.haveBackports == False: + if self.options and self.options.haveBackports == False: # get backported packages (if needed) self.getRequiredBackports() -- cgit v1.2.3 From d8c288d928da41fae20947b7dd2064740c2593b3 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 25 Sep 2006 12:45:53 +0200 Subject: * DistUpgrade/DistUpgradeControler.py: - check for self.sources,self.aptcdrom before using it --- DistUpgrade/DistUpgradeControler.py | 6 ++++-- debian/changelog | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'DistUpgrade/DistUpgradeControler.py') diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index f9c4c0dd..e32c0c5f 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -551,8 +551,10 @@ class DistUpgradeControler(object): def abort(self): """ abort the upgrade, cleanup (as much as possible) """ - self.sources.restoreBackup(self.sources_backup_ext) - self.aptcdrom.restoreBackup(self.sources_backup_ext) + if hasattr(self, sources): + self.sources.restoreBackup(self.sources_backup_ext) + if hasattr(self, aptcdrom): + self.aptcdrom.restoreBackup(self.sources_backup_ext) # generate a new cache self._view.updateStatus(_("Restoring original system state")) self._view.abort() diff --git a/debian/changelog b/debian/changelog index 6631a01b..d817dea3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +update-manager (0.44.14) edgy; urgency=low + + * UpdateManager/UpdateManager.py: + - put the cancel button inside the text-area to avoid flickering + * DistUprade/DistUpgradeControler.py: + - check for self.sources, self.aptcdrom before using it (lp: #61852) + + -- + update-manager (0.44.13) edgy; urgency=low * UpdateManager/UpdateManager.py: -- cgit v1.2.3