From 872b3d3983839d2d9f14268c5adf976a72ecc5ad Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 25 Feb 2005 22:59:38 +0000 Subject: * path scoring changed, the non-symlink path is scored highest --- apt-pkg/cdrom.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'apt-pkg/cdrom.cc') 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; } -- cgit v1.2.3