diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-22 13:10:22 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-22 13:10:22 +0200 |
| commit | 2f0d800812e27c97be60a9e9da7d7b1645d0533d (patch) | |
| tree | 02bed6a5b24e64732b432fc07b88fc389e024e57 /DistUpgrade | |
| parent | 9d4b2d3c59f133b79f25959a9e34a4255ab0447b (diff) | |
| download | python-apt-2f0d800812e27c97be60a9e9da7d7b1645d0533d.tar.gz | |
* 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
Diffstat (limited to 'DistUpgrade')
| -rw-r--r-- | DistUpgrade/DistUpgrade.cfg | 2 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeControler.py | 26 |
2 files changed, 25 insertions, 3 deletions
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): |
