summaryrefslogtreecommitdiff
path: root/apt-pkg/cdrom.cc
diff options
context:
space:
mode:
authorMatt Zimmerman <matt.zimmerman@canonical.com>2005-02-26 23:22:32 +0000
committerMatt Zimmerman <matt.zimmerman@canonical.com>2005-02-26 23:22:32 +0000
commitf827a9e553ac84e70cba573b071e6a1891ec40d5 (patch)
treef90f98f49affd55d635d9ea729f6dbc3aaa7e754 /apt-pkg/cdrom.cc
parentaf45f087e2a08534d1df8ec481d2688d0fbafe7b (diff)
parent872b3d3983839d2d9f14268c5adf976a72ecc5ad (diff)
Merge apt--mvo--0
Patches applied: * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-2 * merge with matts tree, added documentation for the gpgv stuff * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-3 * added gpgv::Options to configure-index * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-4 * PulseIntervall can be configured now to make frontends like synaptic hayppy. it's done in a way that does not break binary compatibility * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-5 * fix for apt-get update removing the cdroms Release.gpg files * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-6 * path scoring changed, the non-symlink path is scored highest
Diffstat (limited to 'apt-pkg/cdrom.cc')
-rw-r--r--apt-pkg/cdrom.cc17
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;
}