X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/a75c6a6e17c6602a71e03aca8bafa96477a68706..899d08fea9e10d617afaa42f51f4abda76fc508f:/apt-pkg/cdrom.cc diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index a91fc7181..ca74aa685 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; } @@ -518,7 +535,7 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) } if(log) { msg.str(""); - ioprintf(msg, _("Stored Label: %s \n"), + ioprintf(msg, _("Stored label: %s \n"), Database.Find("CD::"+ident).c_str()); log->Update(msg.str()); } @@ -586,7 +603,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) log->Update("["+ID+"]\n"); if(log) - log->Update(_("Scanning Disc for index files..\n"),STEP_SCAN); + log->Update(_("Scanning disc for index files..\n"),STEP_SCAN); // Get the CD structure vector List; @@ -697,7 +714,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) Database.Set("CD::" + ID,Name); if(log) { msg.str(""); - ioprintf(msg, _("This Disc is called: \n'%s'\n"), Name.c_str()); + ioprintf(msg, _("This disc is called: \n'%s'\n"), Name.c_str()); log->Update(msg.str()); } @@ -734,7 +751,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) // Print the sourcelist entries if(log) - log->Update(_("Source List entries for this Disc are:\n")); + log->Update(_("Source list entries for this disc are:\n")); for (vector::iterator I = List.begin(); I != List.end(); I++) {