diff options
-rw-r--r-- | apt-pkg/acquire-item.cc | 20 | ||||
-rw-r--r-- | apt-pkg/aptconfiguration.cc | 2 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 2 | ||||
-rw-r--r-- | apt-pkg/indexcopy.cc | 10 | ||||
-rw-r--r-- | apt-pkg/policy.cc | 15 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 3 | ||||
-rw-r--r-- | debian/apt.cron.daily | 2 | ||||
-rw-r--r-- | debian/changelog | 29 | ||||
-rw-r--r-- | doc/apt_preferences.5.xml | 43 | ||||
-rw-r--r-- | methods/mirror.cc | 18 |
10 files changed, 131 insertions, 13 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 39b9feff2..1d651ba69 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1502,6 +1502,26 @@ void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) ReportMirrorFailure("GPGFailure"); } + /* Always move the meta index, even if gpgv failed. This ensures + * that PackageFile objects are correctly filled in */ + { + string FinalFile = _config->FindDir("Dir::State::lists"); + FinalFile += URItoFileName(RealURI); + /* InRelease files become Release files, otherwise + * they would be considered as trusted later on */ + if (SigFile == DestFile) { + RealURI = RealURI.replace(RealURI.rfind("InRelease"), 9, + "Release"); + FinalFile = FinalFile.replace(FinalFile.rfind("InRelease"), 9, + "Release"); + SigFile = FinalFile; + } + Rename(DestFile,FinalFile); + chmod(FinalFile.c_str(),0644); + + DestFile = FinalFile; + } + // No Release file was present, or verification failed, so fall // back to queueing Packages files without verification QueueIndexes(false); diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 14ee09e0d..ca602d4bf 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -337,7 +337,7 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache char* arch = strtok(buf, " "); while (arch != NULL) { for (; isspace(*arch) != 0; ++arch); - if (arch != '\0') { + if (arch[0] != '\0') { char const* archend = arch; for (; isspace(*archend) == 0 && *archend != '\0'; ++archend); archs.push_back(string(arch, (archend - arch))); diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 4be626741..b59ae8896 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -487,7 +487,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, // Parse off the package name const char *I = Start; for (;I != Stop && isspace(*I) == 0 && *I != '(' && *I != ')' && - *I != ',' && *I != '|'; I++); + *I != ',' && *I != '|' && *I != '[' && *I != ']'; I++); // Malformed, no '(' if (I != Stop && *I == ')') diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index c2ee1c347..064fb007c 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -75,7 +75,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List, // Open the package file FileFd Pkg; - if (FileExists(*I + GetFileName()) == true) + if (RealFileExists(*I + GetFileName()) == true) { Pkg.Open(*I + GetFileName(),FileFd::ReadOnly); FileSize = Pkg.Size(); @@ -532,7 +532,7 @@ bool SigVerify::Verify(string prefix, string file, indexRecords *MetaIndex) // we skip non-existing files in the verifcation to support a cdrom // with no Packages file (just a Package.gz), see LP: #255545 // (non-existing files are not considered a error) - if(!FileExists(prefix+file)) + if(!RealFileExists(prefix+file)) { _error->Warning(_("Skipping nonexistent file %s"), string(prefix+file).c_str()); return true; @@ -601,7 +601,7 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList, string const release = *I+"Release"; // a Release.gpg without a Release should never happen - if(FileExists(release) == false) + if(RealFileExists(release) == false) { delete MetaIndex; continue; @@ -681,7 +681,7 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileGPG, std::vector<string> keyrings; if (DirectoryExists(trustedPath)) keyrings = GetListOfFilesInDir(trustedPath, "gpg", false, true); - if (FileExists(trustedFile) == true) + if (RealFileExists(trustedFile) == true) keyrings.push_back(trustedFile); std::vector<const char *> Args; @@ -788,7 +788,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ // Open the package file FileFd Pkg; - if (FileExists(*I) == true) + if (RealFileExists(*I) == true) { Pkg.Open(*I,FileFd::ReadOnly); FileSize = Pkg.Size(); diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index 94c7fd4af..3d6ec1cdc 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -216,6 +216,21 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name, P->Data = Data; return; } + + // Allow pinning by wildcards + // TODO: Maybe we should always prefer specific pins over non- + // specific ones. + if (Name.find("*") != string::npos || Name.find("[") != string::npos + || Name.find("?") != string::npos || Name[0] == '/') { + pkgVersionMatch match(Data, Type); + for (pkgCache::PkgIterator P = Cache->PkgBegin(); + P != Cache->PkgEnd(); P++) { + if (match.ExpressionMatches(Name, P.Name())) { + CreatePin(Type, P.Name(), Data, Priority); + } + } + return; + } // Get a spot to put the pin pkgCache::GrpIterator Grp = Cache->FindGrp(Name); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 6ffecd777..e2d9bb7d4 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2638,6 +2638,9 @@ bool DoSource(CommandLine &CmdL) bool DoBuildDep(CommandLine &CmdL) { CacheFile Cache; + + _config->Set("APT::Install-Recommends", false); + if (Cache.Open(true) == false) return false; diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily index c61bfb9bb..75986f5f5 100644 --- a/debian/apt.cron.daily +++ b/debian/apt.cron.daily @@ -466,7 +466,7 @@ fi # auto upgrade all upgradeable packages UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp -if [ $UPDATED -eq 1 ] && which unattended-upgrade >/dev/null && check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then +if which unattended-upgrade >/dev/null && check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then if unattended-upgrade $XUUPOPT; then update_stamp $UPGRADE_STAMP debug_echo "unattended-upgrade (success)" diff --git a/debian/changelog b/debian/changelog index f3a867a9e..c312bb6d2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,35 @@ -apt (0.8.13.3) unstable; urgency=low +apt (0.8.14) UNRELEASED; urgency=low + [ Julian Andres Klode ] + * apt-pkg/indexcopy.cc: + - Use RealFileExists() instead of FileExists(), allows amongst other + things a directory named Sources to exist on a CD-ROM (LP: #750694). + * apt-pkg/acquire-item.cc: + - Use Release files even if they cannot be verified (LP: #704595) + * cmdline/apt-get.cc: + - Do not install recommends for build-dep (Closes: #454479) (LP: #245273) + * apt-pkg/deb/deblistparser.cc: + - Handle no space before "[" in build-dependencies (LP: #72344) + * apt-pkg/policy.cc: + - Allow pinning by glob() expressions, and regular expressions + surrounded by slashes (the "/" character) (LP: #399474) + (Closes: #121132) + + [ Michael Vogt ] + * mirror method: + - do not crash if the mirror file fails to download + * apt-pkg/aptconfiguration.cc: + - fix comparing for a empty string + * debian/apt.cron.daily: + - run unattended-upgrades even if there was a error during + the apt-get update (LP: #676295) + + [ David Kalnischkies ] * apt-pkg/pkgcache.cc: - use the native Architecture stored in the cache header instead of loading it from configuration as suggested by Julian Andres Klode - -- David Kalnischkies <kalnischkies@gmail.com> Wed, 06 Apr 2011 16:43:08 +0200 + -- Julian Andres Klode <jak@debian.org> Thu, 07 Apr 2011 11:48:46 +0200 apt (0.8.13.2) unstable; urgency=low diff --git a/doc/apt_preferences.5.xml b/doc/apt_preferences.5.xml index 219da7cd1..55504f3e5 100644 --- a/doc/apt_preferences.5.xml +++ b/doc/apt_preferences.5.xml @@ -259,6 +259,49 @@ Pin-Priority: 500 </refsect2> +<refsect2><title>Regular expressions and glob() syntax</title> +<para> +APT also supports pinning by glob() expressions and regular +expressions surrounded by /. For example, the following +example assigns the priority 500 to all packages from +experimental where the name starts with gnome (as a glob()-like +expression or contains the word kde (as a POSIX extended regular +expression surrounded by slashes). +</para> + +<programlisting> +Package: gnome* /kde/ +Pin: release n=experimental +Pin-Priority: 500 +</programlisting> + +<para> +The rule for those expressions is that they can occur anywhere +where a string can occur. Those, the following pin assigns the +priority 990 to all packages from a release starting with karmic. +</para> + +<programlisting> +Package: * +Pin: release n=karmic* +Pin-Priority: 990 +</programlisting> + +If a regular expression occurs in a <literal>Package</literal> field, +the behavior is the same as if this regular expression were replaced +with a list of all package names it matches. It is undecided whether +this will change in the future, thus you should always list wild-card +pins first, so later specific pins override it. + +The pattern "<literal>*</literal>" in a Package field is not considered +a glob() expression in itself. + +</refsect2> + + + + + <refsect2> <title>How APT Interprets Priorities</title> diff --git a/methods/mirror.cc b/methods/mirror.cc index e499b054b..2cf5c9ce1 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -141,8 +141,10 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) pkgAcquire Fetcher; new pkgAcqFile(&Fetcher, fetch, "", 0, "", "", "", MirrorFile); bool res = (Fetcher.Run() == pkgAcquire::Continue); - if(res) + if(res) { DownloadedMirrorFile = true; + chmod(MirrorFile.c_str(), 0644); + } Fetcher.Shutdown(); if(Debug) @@ -158,6 +160,9 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file) vector<string> content; string line; + if (!FileExists(mirror_file)) + return false; + // read ifstream in(mirror_file.c_str()); while ( !in.eof() ) { @@ -251,6 +256,13 @@ bool MirrorMethod::InitMirrors() return _error->Error(_("No mirror file '%s' found "), MirrorFile.c_str()); } + if (access(MirrorFile.c_str(), R_OK) != 0) + { + // FIXME: fallback to a default mirror here instead + // and provide a config option to define that default + return _error->Error(_("Can not read mirror file '%s'"), MirrorFile.c_str()); + } + // FIXME: make the mirror selection more clever, do not // just use the first one! // BUT: we can not make this random, the mirror has to be @@ -354,8 +366,8 @@ bool MirrorMethod::Fetch(FetchItem *Itm) if(Itm->IndexFile && !DownloadedMirrorFile) { Clean(_config->FindDir("Dir::State::mirrors")); - DownloadMirrorFile(Itm->Uri); - RandomizeMirrorFile(MirrorFile); + if (DownloadMirrorFile(Itm->Uri)) + RandomizeMirrorFile(MirrorFile); } if(AllMirrors.empty()) { |