diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-02-25 22:59:38 +0000 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-02-25 22:59:38 +0000 |
commit | 872b3d3983839d2d9f14268c5adf976a72ecc5ad (patch) | |
tree | 1219dbf629b31ea15c8f9f6569295b56d00d887c /apt-pkg | |
parent | 2aab5956ebcaec3aa6c71f069a202366c872bb87 (diff) |
* path scoring changed, the non-symlink path is scored highest
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/cdrom.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index a91fc7181..1b9e98519 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -169,6 +169,23 @@ int pkgCdrom::Score(string Path) Res += 10; if (Path.find("/debian/") != string::npos) Res -= 10; + + // check for symlinks in the patch leading to the actual file + // a symlink gets a big penalty + struct stat Buf; + string statPath = flNotFile(Path); + string cdromPath = _config->FindDir("Acquire::cdrom::mount","/cdrom/"); + while(statPath != cdromPath && statPath != "./") { + statPath.resize(statPath.size()-1); // remove the trailing '/' + if (lstat(statPath.c_str(),&Buf) == 0) { + if(S_ISLNK(Buf.st_mode)) { + Res -= 60; + break; + } + } + statPath = flNotFile(statPath); // descent + } + return Res; } |