apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

acquire-item.cc File Reference
#include <config.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
#include <apt-pkg/acquire.h>
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/gpgv.h>
#include <apt-pkg/hashes.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/metaindex.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/tagfile.h>
#include <algorithm>
#include <ctime>
#include <chrono>
#include <iostream>
#include <memory>
#include <numeric>
#include <random>
#include <sstream>
#include <string>
#include <unordered_set>
#include <vector>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <apti18n.h>
Include dependency graph for acquire-item.cc:

Go to the source code of this file.

Classes

class  Private
 
struct  Private::AlternateURI
 
class  NoActionItem
 
class  CleanupItem
 
class  pkgAcqChangelog::Private
 

Macros

#define APT_EMPTY_SERVER
 
#define APT_CHECK_SERVER(X, Y)
 

Enumerations

enum class  InsecureType { UNSIGNED , WEAK , NORELEASE }
 

Functions

static std::string GetPartialFileName (std::string const &file)
 
static std::string GetPartialFileNameFromURI (std::string const &uri)
 
static std::string GetFinalFileNameFromURI (std::string const &uri)
 
static std::string GetKeepCompressedFileName (std::string file, IndexTarget const &Target)
 
static std::string GetMergeDiffsPatchFileName (std::string const &Final, std::string const &Patch)
 
static std::string GetDiffsPatchFileName (std::string const &Final)
 
static std::string GetExistingFilename (std::string const &File)
 
static std::string GetDiffIndexFileName (std::string const &Name)
 
static std::string GetDiffIndexURI (IndexTarget const &Target)
 
static void ReportMirrorFailureToCentral (pkgAcquire::Item const &I, std::string const &FailCode, std::string const &Details)
 
static APT_NONNULL (2) bool MessageInsecureRepository(bool const isError
 
 strprintf (m, msg, repo.c_str())
 
 if (isError)
 
_error Notice ("%s", _("Data from such a repository can't be authenticated and is therefore potentially dangerous to use."))
 
_error Notice ("%s", _("See apt-secure(8) manpage for repository creation and user configuration details."))
 
static bool TargetIsAllowedToBe (IndexTarget const &Target, InsecureType const type)
 
static bool APT_NONNULL (3, 4, 5) AllowInsecureRepositories(InsecureType const msg
 
 switch (msg)
 
 if (TargetIsAllowedToBe(TransactionManager->Target, msg)==true)
 
 MessageInsecureRepository (true, msgstr, repo)
 
TransactionManager AbortTransaction ()
 
static HashStringList GetExpectedHashesFromFor (metaIndex *const Parser, std::string const &MetaKey)
 
static void formatHashsum (std::ostream &out, HashString const &hs)
 
static void LoadLastMetaIndexParser (pkgAcqMetaClearSig *const TransactionManager, std::string const &FinalRelease, std::string const &FinalInRelease)
 
static bool RemoveFileForBootstrapLinking (std::string &ErrorText, std::string const &For, std::string const &Boot)
 
static std::string GetAuxFileNameFromURIInLists (std::string const &uri)
 
static std::string GetAuxFileNameFromURI (std::string const &uri)
 

Variables

static char const *const msg
 
static char const *const std::string const & repo
 
 else
 
return false
 
static bool std::string const metaIndex const *const MetaIndexParser
 
static bool std::string const metaIndex const *const pkgAcqMetaClearSig *const TransactionManager
 
static bool std::string const metaIndex const *const pkgAcqMetaClearSig *const pkgAcquire::Item *const I
 
char const * msgstr = nullptr
 
I Status = pkgAcquire::Item::StatError
 

Macro Definition Documentation

◆ APT_CHECK_SERVER

#define APT_CHECK_SERVER (   X,
 
)
Value:
if (Rls->X != 0) \
{ \
std::string const specialServerConfig = serverConfig + "::" + Y + #X + "::" + Rls.X(); \
server = _config->Find(specialServerConfig); \
APT_EMPTY_SERVER \
}
Configuration * _config

◆ APT_EMPTY_SERVER

#define APT_EMPTY_SERVER
Value:
if (server.empty() == false) \
{ \
if (server != "no") \
return server; \
return ""; \
}

Enumeration Type Documentation

◆ InsecureType

enum class InsecureType
strong
Enumerator
UNSIGNED 
WEAK 
NORELEASE 

Definition at line 188 of file acquire-item.cc.

Function Documentation

◆ AbortTransaction()

TransactionManager AbortTransaction ( )

◆ APT_NONNULL() [1/2]

static APT_NONNULL ( ) const
static

◆ APT_NONNULL() [2/2]

static bool APT_NONNULL ( ,
,
 
) const
static

◆ formatHashsum()

static void formatHashsum ( std::ostream &  out,
HashString const &  hs 
)
static

◆ GetAuxFileNameFromURI()

◆ GetAuxFileNameFromURIInLists()

static std::string GetAuxFileNameFromURIInLists ( std::string const &  uri)
static

Definition at line 4000 of file acquire-item.cc.

References _config, flCombine(), RemoveFile(), and URItoFileName().

Referenced by GetAuxFileNameFromURI().

◆ GetDiffIndexFileName()

static std::string GetDiffIndexFileName ( std::string const &  Name)
static

◆ GetDiffIndexURI()

static std::string GetDiffIndexURI ( IndexTarget const &  Target)
static

◆ GetDiffsPatchFileName()

static std::string GetDiffsPatchFileName ( std::string const &  Final)
static

Definition at line 96 of file acquire-item.cc.

Referenced by pkgAcqIndexDiffs::Done(), and pkgAcqIndexDiffs::Failed().

◆ GetExistingFilename()

◆ GetExpectedHashesFromFor()

static HashStringList GetExpectedHashesFromFor ( metaIndex *const  Parser,
std::string const &  MetaKey 
)
static

◆ GetFinalFileNameFromURI()

◆ GetKeepCompressedFileName()

◆ GetMergeDiffsPatchFileName()

static std::string GetMergeDiffsPatchFileName ( std::string const &  Final,
std::string const &  Patch 
)
static

Definition at line 90 of file acquire-item.cc.

Referenced by pkgAcqIndexMergeDiffs::Done().

◆ GetPartialFileName()

static std::string GetPartialFileName ( std::string const &  file)
static

Definition at line 58 of file acquire-item.cc.

References _config.

Referenced by GetPartialFileNameFromURI().

◆ GetPartialFileNameFromURI()

◆ if() [1/2]

if ( isError  )

◆ if() [2/2]

if ( TargetIsAllowedToBe(TransactionManager->Target, msg = = true)

Definition at line 257 of file acquire-item.cc.

References MessageInsecureRepository(), msgstr, and repo.

◆ LoadLastMetaIndexParser()

static void LoadLastMetaIndexParser ( pkgAcqMetaClearSig *const  TransactionManager,
std::string const &  FinalRelease,
std::string const &  FinalInRelease 
)
static

◆ MessageInsecureRepository()

MessageInsecureRepository ( true  ,
msgstr  ,
repo   
)

Referenced by if().

◆ Notice() [1/2]

_error Notice ( "%s"  ,
_("Data from such a repository can't be authenticated and is therefore potentially dangerous to use.")   
)

◆ Notice() [2/2]

_error Notice ( "%s"  ,
_("See apt-secure(8) manpage for repository creation and user configuration details.")   
)

◆ RemoveFileForBootstrapLinking()

static bool RemoveFileForBootstrapLinking ( std::string &  ErrorText,
std::string const &  For,
std::string const &  Boot 
)
static

Definition at line 2327 of file acquire-item.cc.

References FileExists(), RemoveFile(), and strprintf().

Referenced by pkgAcqDiffIndex::ParseDiffIndex().

◆ ReportMirrorFailureToCentral()

static void ReportMirrorFailureToCentral ( pkgAcquire::Item const &  I,
std::string const &  FailCode,
std::string const &  Details 
)
static

Definition at line 126 of file acquire-item.cc.

References _config, ExecFork(), ExecWait(), FileExists(), and I.

Referenced by pkgAcqMetaBase::CheckStopAuthentication().

◆ strprintf()

◆ switch()

switch ( msg  )

Definition at line 250 of file acquire-item.cc.

References msgstr, NORELEASE, UNSIGNED, and WEAK.

◆ TargetIsAllowedToBe()

static bool TargetIsAllowedToBe ( IndexTarget const &  Target,
InsecureType const  type 
)
static

Variable Documentation

◆ else

else
Initial value:
{
_error->Warning("%s", m.c_str())

Definition at line 178 of file acquire-item.cc.

◆ false

return false

Definition at line 184 of file acquire-item.cc.

Referenced by pkgCache< Str, Itr >::Flagged(), and FTWScanner::SetExts().

◆ I

bool std::string const metaIndex const* const pkgAcqMetaClearSig* const pkgAcquire::Item* const I

Definition at line 211 of file acquire-item.cc.

Referenced by _strtabexpand(), pkgAcqMetaBase::AbortTransaction(), AcquireRun(), AcquireUpdate(), GenContents::Add(), ContentsExtract::Add(), pkgAcqMetaBase::Add(), pkgCdrom::Add(), AddIfVolatile(), pkgSourceList::AddVolatileFiles(), DynamicMMap::Allocate(), Base64Encode(), BuildCache(), debSrcRecordParser::BuildDepends(), pkgDPkgPM::BuildPackagesProgressMap(), pkgAcquire::Bump(), CheckAuth(), pkgDepCache::CheckConsistency(), pkgOrderList::CheckDep(), CacheFile::CheckDeps(), pkgAcqMetaBase::CheckDownloadDone(), CheckDropPrivsMustBeDisabled(), pkgAcqMetaBase::CheckStopAuthentication(), debSystem::CheckUpdates(), CheckValidity(), MultiCompress::Child(), IndexCopy::ChopDirs(), Clean(), pkgAcquire::Clean(), pkgAcqMetaBase::CommitTransaction(), pkgAcqMethod::Configuration(), pkgPackageManager::ConfigureAll(), RSHConn::Connect(), debListParser::ConvertRelation(), IndexCopy::ConvertToSourceList(), SigVerify::CopyAndVerify(), URI::CopyFrom(), IndexCopy::CopyPackages(), TranslationsCopy::CopyTranslations(), FTPConn::CreateDataFd(), pkgPackageManager::CreateOrderList(), pkgAcqIndexMergeDiffs::Custom600Headers(), DeleteAllButMostRecent(), pkgAcquire::Dequeue(), DeQuoteString(), CommandLine::DispatchArg(), DisplayRecordV2(), DoAuto(), DoBuildDep(), DoCacheManipulationFromCommandLine(), DoChangelog(), DoDownload(), DoDSelectUpgrade(), DoDump(), DoGenerateContents(), DoGeneratePackagesAndSources(), DoInstall(), DoIt(), DebFile::DoItem(), DoMarkAuto(), pkgAcqIndexMergeDiffs::Done(), PackagesWriter::DoPackage(), SourcesWriter::DoPackage(), GenContents::DoPrint(), pkgOrderList::DoRun(), DoShell(), DoSource(), DoSrvLookup(), Dotty(), DoUpdate(), pkgCdrom::DropBinaryArch(), pkgCdrom::DropRepeats(), pkgCdrom::DropTranslation(), pkgCacheGenerator::Dynamic< Iter >::Dynamic(), pkgAcquire::Enqueue(), pkgDPkgPM::ExpandPendingCalls(), FTPConn::ExtGoPasv(), pkgAcqIndexMergeDiffs::Failed(), BaseHttpMethod::Fetch(), pkgAcquire::FetchNeeded(), CommandLine::FileSize(), MultiCompress::Finalize(), pkgSrcRecords::Find(), pkgSourceList::FindIndex(), findMatchingCompressor(), BaseHttpMethod::FindMaximumObjectSizeInQueue(), pkgCdrom::FindPackages(), ReleaseWriter::Finish(), pkgPackageManager::FixMissing(), VersionContainerInterface::FromCommandLine(), FullTextSearch(), PackageMap::GenContents(), pkgTagSection::Get(), GetAllPackagesAsPseudo(), pkgPackageManager::GetArchives(), pkgDepCache::Policy::GetCandidateVer(), debSLTypeDebian::GetDebReleaseIndexBy(), pkgSourceList::GetIndexes(), Override::GetItem(), GetPseudoPackages(), MultiCompress::GetStat(), pkgSystem::GetSystem(), pkgIndexFile::Type::GetType(), pkgSourceList::Type::GetType(), pkgVersioningSystem::GetVS(), pkgDPkgPM::Go(), pkgSimulate::Go(), Go(), ExtractTar::Go(), pkgArchiveCleaner::Go(), GenContents::Grab(), IndexCopy::GrabFirst(), PackageContainer< Container >::GroupedFromCommandLine(), VersionContainer< Container >::GroupedFromCommandLine(), CommandLine::HandleOpt(), Hex2Num(), HexDigest(), pkgPackageManager::ImmediateAdd(), pkgDepCache::Init(), pkgPolicy::InitDefaults(), InstallPackages(), pkgProblemResolver::InstOrNewPolicyBroken(), ItemIsEssential(), ItemIsProtected(), SortedPackageUniverse::LazyInit(), ARArchive::LoadHeaders(), Configuration::Lookup(), BaseHttpMethod::Loop(), Madison(), main(), pkgProblemResolver::MakeScores(), metaIndex::MetaKeys(), MountCdrom(), MultiCompress::MultiCompress(), pkgDPkgPM::OpenLog(), MultiCompress::OpenOld(), pkgAcquire::QItem::operator=(), pkgCacheFile::operator[](), pkgDepCache::operator[](), pkgOrderList::OrderCritical(), pkgPackageManager::OrderInstall(), pkgOrderList::OrderUnpack(), CacheSetHelper::PackageFromCommandLine(), CommandLine::Parse(), debListParser::ParseDepends(), pkgAcqDiffIndex::ParseDiffIndex(), debStatusListParser::ParseStatus(), pkgAcquire::PartialPresent(), pkgDepCache::PerformDependencyPass(), pkgAllUpgradeNoNewPackages(), pkgAllUpgradeWithNewPackages(), pkgApplyStatus(), pkgDistUpgrade(), pkgFixBroken(), pkgInitSystem(), pkgMinimizeUpgrade(), pkgPolicy::pkgPolicy(), pkgPrioSortList(), pkgRecords::pkgRecords(), pkgSimulate::pkgSimulate(), pkgSrcRecords::pkgSrcRecords(), pkgVersionMatch::pkgVersionMatch(), Policy(), PopFromSrvRecs(), printChecksumTypeRecord(), pkgAcquireStatus::Pulse(), AcqTextStatus::Pulse(), pkgAcqMetaBase::QueueForSignatureVerify(), pkgAcquire::QueueName(), pkgAcqIndexDiffs::QueueNextDiff(), QuoteString(), ReadConfigFile(), Override::ReadExtraOverride(), FTPConn::ReadLine(), RSHConn::ReadLine(), Override::ReadOverride(), ReadPinDir(), pkgSourceList::ReadSourceDir(), pkgSimulate::RealInstall(), pkgCdrom::ReduceSourcelist(), RegexChoice(), ReleaseWriter::ReleaseWriter(), pkgAcquire::Remove(), RemoveDownloadNeedingItemsFromFetcher(), ReportMirrorFailureToCentral(), pkgSourceList::Reset(), pkgProblemResolver::ResolveByKeepInternal(), pkgProblemResolver::ResolveInternal(), pkgSrcRecords::Restart(), pkgAcqMethod::Run(), pkgAcquire::Run(), pkgAcquire::RunFds(), ServerState::RunHeaders(), pkgDPkgPM::RunScriptsWithPkgs(), Search(), pkgDPkgPM::SendPkgsInfo(), pkgAcquire::SetFds(), pkgCache< Str, Itr >::sHash(), pkgSimulate::ShortBreaks(), ShowAuto(), ShowDepends(), ShowEssential(), ShowHelp(), ShowPackage(), ShowPkgNames(), ShowSelection(), ShowSrcPackage(), CacheSetHelperAPTGet::showVirtualPackageErrors(), SizeToStr(), SkipUnavailableVersions(), pkgPackageManager::SmartConfigure(), pkgPackageManager::SmartUnPack(), MultiCompress::Start(), PackageManagerFancy::staticSIGWINCH(), Stats(), StrToNum(), pkgAcquire::TotalNeeded(), pkgAcqMetaBase::TransactionHasError(), pkgAcqMetaBase::TransactionStageCopy(), pkgAcqMetaBase::TransactionStageRemoval(), UnmountCdrom(), debVersioningSystem::UpstreamVersion(), RredMethod::URIAcquire(), debListParser::VersionHash(), pkgOrderList::VisitProvides(), pkgOrderList::WipeFlags(), pkgAcquire::WorkerStep(), OpTextProgress::Write(), pkgTagSection::Write(), pkgDPkgPM::WriteApportReport(), WriteScenarioEDSPVersion(), pkgCdrom::WriteSourceList(), CircleBuf::WriteTillEl(), XVcg(), metaIndex::~metaIndex(), pkgSourceList::~pkgSourceList(), and pkgSrcRecords::~pkgSrcRecords().

◆ MetaIndexParser

bool std::string const metaIndex const* const MetaIndexParser

Definition at line 211 of file acquire-item.cc.

◆ msg

◆ msgstr

char const* msgstr = nullptr

Definition at line 249 of file acquire-item.cc.

Referenced by if(), and switch().

◆ repo

static bool std::string const & repo
Initial value:
{
std::string m

Definition at line 169 of file acquire-item.cc.

Referenced by if().

◆ Status

◆ TransactionManager

bool std::string const metaIndex const* const pkgAcqMetaClearSig* const TransactionManager