diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 28 | ||||
-rw-r--r-- | apt-pkg/acquire.cc | 98 | ||||
-rw-r--r-- | apt-pkg/acquire.h | 31 | ||||
-rw-r--r-- | apt-pkg/algorithms.cc | 4 | ||||
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 2 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 57 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.h | 8 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 17 | ||||
-rw-r--r-- | apt-pkg/depcache.cc | 117 | ||||
-rw-r--r-- | apt-pkg/depcache.h | 3 | ||||
-rw-r--r-- | apt-pkg/packagemanager.cc | 14 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 15 | ||||
-rw-r--r-- | apt-pkg/sourcelist.cc | 7 |
13 files changed, 315 insertions, 86 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 6d4336425..1f253bb81 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1327,7 +1327,8 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources, the archive is already available in the cache and stashs the MD5 for checking later. */ bool pkgAcqArchive::QueueNext() -{ +{ + string const ForceHash = _config->Find("Acquire::ForceHash"); for (; Vf.end() == false; Vf++) { // Ignore not source sources @@ -1350,12 +1351,25 @@ bool pkgAcqArchive::QueueNext() return false; string PkgFile = Parse.FileName(); - if(Parse.SHA256Hash() != "") - ExpectedHash = HashString("SHA256", Parse.SHA256Hash()); - else if (Parse.SHA1Hash() != "") - ExpectedHash = HashString("SHA1", Parse.SHA1Hash()); - else - ExpectedHash = HashString("MD5Sum", Parse.MD5Hash()); + if (ForceHash.empty() == false) + { + if(stringcasecmp(ForceHash, "sha256") == 0) + ExpectedHash = HashString("SHA256", Parse.SHA256Hash()); + else if (stringcasecmp(ForceHash, "sha1") == 0) + ExpectedHash = HashString("SHA1", Parse.SHA1Hash()); + else + ExpectedHash = HashString("MD5Sum", Parse.MD5Hash()); + } + else + { + string Hash; + if ((Hash = Parse.SHA256Hash()).empty() == false) + ExpectedHash = HashString("SHA256", Hash); + else if ((Hash = Parse.SHA1Hash()).empty() == false) + ExpectedHash = HashString("SHA1", Hash); + else + ExpectedHash = HashString("MD5Sum", Parse.MD5Hash()); + } if (PkgFile.empty() == true) return _error->Error(_("The package index files are corrupted. No Filename: " "field for package %s."), diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 74510ae21..832eaa02c 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -19,6 +19,7 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/error.h> #include <apt-pkg/strutl.h> +#include <apt-pkg/fileutl.h> #include <apti18n.h> @@ -29,7 +30,6 @@ #include <dirent.h> #include <sys/time.h> #include <errno.h> -#include <sys/stat.h> /*}}}*/ using namespace std; @@ -37,32 +37,81 @@ using namespace std; // Acquire::pkgAcquire - Constructor /*{{{*/ // --------------------------------------------------------------------- /* We grab some runtime state from the configuration space */ -pkgAcquire::pkgAcquire(pkgAcquireStatus *Log) : Log(Log) +pkgAcquire::pkgAcquire() : Queues(0), Workers(0), Configs(0), Log(NULL), ToFetch(0), + Debug(_config->FindB("Debug::pkgAcquire",false)), + Running(false), LockFD(-1) { - Queues = 0; - Configs = 0; - Workers = 0; - ToFetch = 0; - Running = false; - - string Mode = _config->Find("Acquire::Queue-Mode","host"); + string const Mode = _config->Find("Acquire::Queue-Mode","host"); if (strcasecmp(Mode.c_str(),"host") == 0) QueueMode = QueueHost; if (strcasecmp(Mode.c_str(),"access") == 0) - QueueMode = QueueAccess; + QueueMode = QueueAccess; +} +pkgAcquire::pkgAcquire(pkgAcquireStatus *Progress) : Queues(0), Workers(0), + Configs(0), Log(Progress), ToFetch(0), + Debug(_config->FindB("Debug::pkgAcquire",false)), + Running(false), LockFD(-1) +{ + string const Mode = _config->Find("Acquire::Queue-Mode","host"); + if (strcasecmp(Mode.c_str(),"host") == 0) + QueueMode = QueueHost; + if (strcasecmp(Mode.c_str(),"access") == 0) + QueueMode = QueueAccess; + Setup(Progress, ""); +} + /*}}}*/ +// Acquire::Setup - Delayed Constructor /*{{{*/ +// --------------------------------------------------------------------- +/* Do everything needed to be a complete Acquire object and report the + success (or failure) back so the user knows that something is wrong… */ +bool pkgAcquire::Setup(pkgAcquireStatus *Progress, string const &Lock) +{ + Log = Progress; - Debug = _config->FindB("Debug::pkgAcquire",false); - - // This is really a stupid place for this - struct stat St; - if (stat((_config->FindDir("Dir::State::lists") + "partial/").c_str(),&St) != 0 || - S_ISDIR(St.st_mode) == 0) - _error->Error(_("Lists directory %spartial is missing."), - _config->FindDir("Dir::State::lists").c_str()); - if (stat((_config->FindDir("Dir::Cache::Archives") + "partial/").c_str(),&St) != 0 || - S_ISDIR(St.st_mode) == 0) - _error->Error(_("Archive directory %spartial is missing."), - _config->FindDir("Dir::Cache::Archives").c_str()); + // check for existence and possibly create auxiliary directories + string const listDir = _config->FindDir("Dir::State::lists"); + string const partialListDir = listDir + "partial/"; + string const archivesDir = _config->FindDir("Dir::Cache::Archives"); + string const partialArchivesDir = archivesDir + "partial/"; + + if (CheckDirectory(_config->FindDir("Dir::State"), partialListDir) == false && + CheckDirectory(listDir, partialListDir) == false) + return _error->Errno("Acquire", _("List directory %spartial is missing."), listDir.c_str()); + + if (CheckDirectory(_config->FindDir("Dir::Cache"), partialArchivesDir) == false && + CheckDirectory(archivesDir, partialArchivesDir) == false) + return _error->Errno("Acquire", _("Archives directory %spartial is missing."), archivesDir.c_str()); + + if (Lock.empty() == true || _config->FindB("Debug::NoLocking", false) == true) + return true; + + // Lock the directory this acquire object will work in + LockFD = GetLock(flCombine(Lock, "lock")); + if (LockFD == -1) + return _error->Error(_("Unable to lock directory %s"), Lock.c_str()); + + return true; +} + /*}}}*/ +// Acquire::CheckDirectory - ensure that the given directory exists /*{{{*/ +// --------------------------------------------------------------------- +/* a small wrapper around CreateDirectory to check if it exists and to + remove the trailing "/apt/" from the parent directory if needed */ +bool pkgAcquire::CheckDirectory(string const &Parent, string const &Path) const +{ + if (DirectoryExists(Path) == true) + return true; + + size_t const len = Parent.size(); + if (len > 5 && Parent.find("/apt/", len - 6, 5) == len - 5) + { + if (CreateDirectory(Parent.substr(0,len-5), Path) == true) + return true; + } + else if (CreateDirectory(Parent, Path) == true) + return true; + + return false; } /*}}}*/ // Acquire::~pkgAcquire - Destructor /*{{{*/ @@ -71,7 +120,10 @@ pkgAcquire::pkgAcquire(pkgAcquireStatus *Log) : Log(Log) pkgAcquire::~pkgAcquire() { Shutdown(); - + + if (LockFD != -1) + close(LockFD); + while (Configs != 0) { MethodConfig *Jnk = Configs; diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 6c130c1b3..9e91a9f67 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -66,6 +66,8 @@ #ifndef PKGLIB_ACQUIRE_H #define PKGLIB_ACQUIRE_H +#include <apt-pkg/macros.h> + #include <vector> #include <string> @@ -161,7 +163,7 @@ class pkgAcquire QueueAccess} QueueMode; /** \brief If \b true, debugging information will be dumped to std::clog. */ - bool Debug; + bool const Debug; /** \brief If \b true, a download is currently in progress. */ bool Running; @@ -332,15 +334,22 @@ class pkgAcquire */ double PartialPresent(); - /** \brief Construct a new pkgAcquire. + /** \brief Delayed constructor * - * \param Log The progress indicator associated with this - * download, or \b NULL for none. This object is not owned by the + * \param Progress indicator associated with this download or + * \b NULL for none. This object is not owned by the * download process and will not be deleted when the pkgAcquire * object is destroyed. Naturally, it should live for at least as * long as the pkgAcquire object does. + * \param Lock defines a lock file that should be acquired to ensure + * only one Acquire class is in action at the time or an empty string + * if no lock file should be used. */ - pkgAcquire(pkgAcquireStatus *Log = 0); + bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = ""); + + /** \brief Construct a new pkgAcquire. */ + pkgAcquire(pkgAcquireStatus *Log) __deprecated; + pkgAcquire(); /** \brief Destroy this pkgAcquire object. * @@ -348,6 +357,18 @@ class pkgAcquire * this download. */ virtual ~pkgAcquire(); + + private: + /** \brief FD of the Lock file we acquire in Setup (if any) */ + int LockFD; + + /** \brief Ensure the existence of the given Path + * + * \param Parent directory of the Path directory - a trailing + * /apt/ will be removed before CreateDirectory call. + * \param Path which should exist after (successful) call + */ + bool CheckDirectory(string const &Parent, string const &Path) const; }; /** \brief Represents a single download source from which an item diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index f8a9e210c..f1e51131a 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1398,7 +1398,9 @@ bool ListUpdate(pkgAcquireStatus &Stat, int PulseInterval) { pkgAcquire::RunResult res; - pkgAcquire Fetcher(&Stat); + pkgAcquire Fetcher; + if (Fetcher.Setup(&Stat, _config->FindDir("Dir::State::Lists")) == false) + return false; // Populate it with the source selection if (List.GetIndexes(&Fetcher) == false) diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 7588b041c..9129d92f0 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -773,6 +773,8 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool const &AsSectio else return _error->Error(_("Syntax error %s:%u: Unsupported directive '%s'"),FName.c_str(),CurLine,Tag.c_str()); } + else if (Tag.empty() == true && NoWord == false && Word == "#clear") + return _error->Error(_("Syntax error %s:%u: clear directive requires an option tree as argument"),FName.c_str(),CurLine); else { // Set the item in the configuration class diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index da32983f1..16f7ce929 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -18,6 +18,7 @@ /*}}}*/ // Include Files /*{{{*/ #include <apt-pkg/fileutl.h> +#include <apt-pkg/strutl.h> #include <apt-pkg/error.h> #include <apt-pkg/sptr.h> #include <apt-pkg/configuration.h> @@ -197,16 +198,62 @@ bool FileExists(string File) return true; } /*}}}*/ +// DirectoryExists - Check if a directory exists and is really one /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool DirectoryExists(string const &Path) +{ + struct stat Buf; + if (stat(Path.c_str(),&Buf) != 0) + return false; + return ((Buf.st_mode & S_IFDIR) != 0); +} + /*}}}*/ +// CreateDirectory - poor man's mkdir -p guarded by a parent directory /*{{{*/ +// --------------------------------------------------------------------- +/* This method will create all directories needed for path in good old + mkdir -p style but refuses to do this if Parent is not a prefix of + this Path. Example: /var/cache/ and /var/cache/apt/archives are given, + so it will create apt/archives if /var/cache exists - on the other + hand if the parent is /var/lib the creation will fail as this path + is not a parent of the path to be generated. */ +bool CreateDirectory(string const &Parent, string const &Path) +{ + if (Parent.empty() == true || Path.empty() == true) + return false; + + if (DirectoryExists(Path) == true) + return true; + + if (DirectoryExists(Parent) == false) + return false; + + // we are not going to create directories "into the blue" + if (Path.find(Parent, 0) != 0) + return false; + + vector<string> const dirs = VectorizeString(Path.substr(Parent.size()), '/'); + string progress = Parent; + for (vector<string>::const_iterator d = dirs.begin(); d != dirs.end(); ++d) + { + if (d->empty() == true) + continue; + + progress.append("/").append(*d); + if (DirectoryExists(progress) == true) + continue; + + if (mkdir(progress.c_str(), 0755) != 0) + return false; + } + return true; +} + /*}}}*/ // GetListOfFilesInDir - returns a vector of files in the given dir /*{{{*/ // --------------------------------------------------------------------- /* If an extension is given only files with this extension are included in the returned vector, otherwise every "normal" file is included. */ std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext, - bool const &SortList) -{ - return GetListOfFilesInDir(Dir, Ext, SortList, false); -} -std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext, bool const &SortList, bool const &AllowNoExt) { std::vector<string> ext; diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 85a94898c..003bd9b83 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -21,6 +21,7 @@ #ifndef PKGLIB_FILEUTL_H #define PKGLIB_FILEUTL_H +#include <apt-pkg/macros.h> #include <string> #include <vector> @@ -82,11 +83,10 @@ bool RunScripts(const char *Cnf); bool CopyFile(FileFd &From,FileFd &To); int GetLock(string File,bool Errors = true); bool FileExists(string File); -// FIXME: next ABI-Break: merge the two method-headers +bool DirectoryExists(string const &Path) __attrib_const; +bool CreateDirectory(string const &Parent, string const &Path); std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext, - bool const &SortList); -std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext, - bool const &SortList, bool const &AllowNoExt); + bool const &SortList, bool const &AllowNoExt=false); std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> const &Ext, bool const &SortList); string SafeGetCWD(); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index c0efa7b59..ca8faa8a5 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -105,7 +105,7 @@ ionice(int PID) /* */ pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) : pkgPackageManager(Cache), dpkgbuf_pos(0), - term_out(NULL), PackagesDone(0), PackagesTotal(0) + term_out(NULL), history_out(NULL), PackagesDone(0), PackagesTotal(0) { } /*}}}*/ @@ -124,7 +124,19 @@ bool pkgDPkgPM::Install(PkgIterator Pkg,string File) if (File.empty() == true || Pkg.end() == true) return _error->Error("Internal Error, No file name for %s",Pkg.Name()); - List.push_back(Item(Item::Install,Pkg,File)); + // If the filename string begins with DPkg::Chroot-Directory, return the + // substr that is within the chroot so dpkg can access it. + string const chrootdir = _config->FindDir("DPkg::Chroot-Directory","/"); + if (chrootdir != "/" && File.find(chrootdir) == 0) + { + size_t len = chrootdir.length(); + if (chrootdir.at(len - 1) == '/') + len--; + List.push_back(Item(Item::Install,Pkg,File.substr(len))); + } + else + List.push_back(Item(Item::Install,Pkg,File)); + return true; } /*}}}*/ @@ -651,6 +663,7 @@ bool pkgDPkgPM::CloseLog() fprintf(history_out, "End-Date: %s\n", timestr); fclose(history_out); } + history_out = NULL; return true; } diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 2c7cdd5c2..423161b13 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -841,42 +841,15 @@ void pkgDepCache::Update(OpProgress *Prog) if (installed == false) recheck.insert(G.Index()); } - std::vector<std::string> Archs = APT::Configuration::getArchitectures(); - bool checkChanged = false; - do { - for(std::set<unsigned long>::const_iterator g = recheck.begin(); - g != recheck.end(); ++g) { - GrpIterator G = GrpIterator(*Cache, Cache->GrpP + *g); - VerIterator allV = G.FindPkg("all").CurrentVer(); - for (std::vector<std::string>::const_iterator a = Archs.begin(); - a != Archs.end(); ++a) - { - PkgIterator P = G.FindPkg(*a); - if (P.end() == true) continue; - for (VerIterator V = P.VersionList(); V.end() != true; ++V) - { - // FIXME: String comparison isn't a save indicator! - if (strcmp(allV.VerStr(),V.VerStr()) != 0) - continue; - unsigned char const CurDepState = VersionState(V.DependsList(),DepInstall,DepInstMin,DepInstPolicy); - if ((CurDepState & DepInstMin) != DepInstMin) - break; // we found the correct version, but it is broken. Better try another arch or later again - P->CurrentVer = V.Index(); - AddStates(P); - Update(P); - AddSizes(P); - checkChanged = true; - break; - } - } - recheck.erase(g); - } - } while (checkChanged == true && recheck.empty() == false); - if (_config->FindB("Debug::MultiArchKiller", false) == true) - for(std::set<unsigned long>::const_iterator g = recheck.begin(); - g != recheck.end(); ++g) - std::cout << "No pseudo package for »" << GrpIterator(*Cache, Cache->GrpP + *g).Name() << "« installed" << std::endl; + while (recheck.empty() != true) + { + std::set<unsigned long>::const_iterator g = recheck.begin(); + unsigned long const G = *g; + recheck.erase(g); + if (unlikely(ReInstallPseudoForGroup(G, recheck) == false)) + _error->Warning(_("Internal error, group »%s« has no installable pseudo package"), GrpIterator(*Cache, Cache->GrpP + *g).Name()); + } } if (Prog != 0) @@ -885,6 +858,80 @@ void pkgDepCache::Update(OpProgress *Prog) readStateFile(Prog); } /*}}}*/ +// DepCache::ReInstallPseudoForGroup - MultiArch helper for Update() /*{{{*/ +// --------------------------------------------------------------------- +/* RemovePseudoInstalledPkg() is very successful. It even kills packages + to an amount that no pseudo package is left, but we need a pseudo package + for upgrading senarios so we need to reinstall one pseudopackage which + doesn't break everything. Thankfully we can't have architecture depending + negative dependencies so this problem is already eliminated */ +bool pkgDepCache::ReInstallPseudoForGroup(pkgCache::PkgIterator const &P, std::set<unsigned long> &recheck) +{ + if (P->CurrentVer != 0) + return true; + // recursive call for packages which provide this package + for (pkgCache::PrvIterator Prv = P.ProvidesList(); Prv.end() != true; ++Prv) + ReInstallPseudoForGroup(Prv.OwnerPkg(), recheck); + // check if we actually need to look at this group + unsigned long const G = P->Group; + std::set<unsigned long>::const_iterator Pi = recheck.find(G); + if (Pi == recheck.end()) + return true; + recheck.erase(Pi); // remove here, so we can't fall into an endless loop + if (unlikely(ReInstallPseudoForGroup(G, recheck) == false)) + { + recheck.insert(G); + return false; + } + return true; +} +bool pkgDepCache::ReInstallPseudoForGroup(unsigned long const &G, std::set<unsigned long> &recheck) +{ + std::vector<std::string> static const Archs = APT::Configuration::getArchitectures(); + pkgCache::GrpIterator Grp(*Cache, Cache->GrpP + G); + if (unlikely(Grp.end() == true)) + return false; + for (std::vector<std::string>::const_iterator a = Archs.begin(); + a != Archs.end(); ++a) + { + pkgCache::PkgIterator P = Grp.FindPkg(*a); + if (P.end() == true) + continue; + pkgCache::VerIterator allV = Grp.FindPkg("all").CurrentVer(); + for (VerIterator V = P.VersionList(); V.end() != true; ++V) + { + // search for the same version as the all package + if (allV->Hash != V->Hash || strcmp(allV.VerStr(),V.VerStr()) != 0) + continue; + unsigned char const CurDepState = VersionState(V.DependsList(),DepInstall,DepInstMin,DepInstPolicy); + // If it is broken, try to install dependencies first before retry + if ((CurDepState & DepInstMin) != DepInstMin) + { + for (pkgCache::DepIterator D = V.DependsList(); D.end() != true; ++D) + { + if (D->Type != pkgCache::Dep::PreDepends && D->Type != pkgCache::Dep::Depends) + continue; + ReInstallPseudoForGroup(D.TargetPkg(), recheck); + } + unsigned char const CurDepState = VersionState(V.DependsList(),DepInstall,DepInstMin,DepInstPolicy); + // if package ist still broken… try another arch + if ((CurDepState & DepInstMin) != DepInstMin) + break; + } + // dependencies satisfied: reinstall the package + RemoveSizes(P); + RemoveStates(P); + P->CurrentVer = V.Index(); + PkgState[P->ID].InstallVer = V; + AddStates(P); + Update(P); + AddSizes(P); + return true; + } + } + return false; +} + /*}}}*/ // DepCache::Update - Update the deps list of a package /*{{{*/ // --------------------------------------------------------------------- /* This is a helper for update that only does the dep portion of the scan. diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 6765d3e7c..3decc7a5f 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -331,6 +331,7 @@ class pkgDepCache : protected pkgCache::Namespace // Legacy.. We look like a pkgCache inline operator pkgCache &() {return *Cache;}; inline Header &Head() {return *Cache->HeaderP;}; + inline GrpIterator GrpBegin() {return Cache->GrpBegin();}; inline PkgIterator PkgBegin() {return Cache->PkgBegin();}; inline GrpIterator FindGrp(string const &Name) {return Cache->FindGrp(Name);}; inline PkgIterator FindPkg(string const &Name) {return Cache->FindPkg(Name);}; @@ -469,6 +470,8 @@ class pkgDepCache : protected pkgCache::Namespace private: // Helper for Update(OpProgress) to remove pseudoinstalled arch all packages bool RemovePseudoInstalledPkg(PkgIterator &Pkg, std::set<unsigned long> &recheck); + bool ReInstallPseudoForGroup(unsigned long const &Grp, std::set<unsigned long> &recheck); + bool ReInstallPseudoForGroup(pkgCache::PkgIterator const &P, std::set<unsigned long> &recheck); }; #endif diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 034cc8339..eef79cccd 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -596,9 +596,17 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) { if(Install(Pkg,FileNames[Pkg->ID]) == false) return false; - } else if (SmartUnPack(Pkg.Group().FindPkg("all")) == false) - return false; - + } else { + // Pseudo packages will not be unpacked - instead we will do this + // for the "real" package, but only once and if it is already + // configured we don't need to unpack it again… + PkgIterator const P = Pkg.Group().FindPkg("all"); + if (List->IsFlag(P,pkgOrderList::UnPacked) != true && + List->IsFlag(P,pkgOrderList::Configured) != true) { + if (SmartUnPack(P) == false) + return false; + } + } List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); // Perform immedate configuration of the package. diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 21240b951..114c9d5ed 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -1003,7 +1003,20 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, // Decide if we can write to the files.. string const CacheFile = _config->FindFile("Dir::Cache::pkgcache"); string const SrcCacheFile = _config->FindFile("Dir::Cache::srcpkgcache"); - + + // ensure the cache directory exists + if (CacheFile.empty() == false || SrcCacheFile.empty() == false) + { + string dir = _config->FindDir("Dir::Cache"); + size_t const len = dir.size(); + if (len > 5 && dir.find("/apt/", len - 6, 5) == len - 5) + dir = dir.substr(0, len - 5); + if (CacheFile.empty() == false) + CreateDirectory(dir, flNotFile(CacheFile)); + if (SrcCacheFile.empty() == false) + CreateDirectory(dir, flNotFile(SrcCacheFile)); + } + // Decide if we can write to the cache bool Writeable = false; if (CacheFile.empty() == false) diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index a860c7eac..e13472fa6 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -94,6 +94,13 @@ bool pkgSourceList::Type::ParseLine(vector<metaIndex *> &List, if (option.length() < 3) return _error->Error(_("Malformed line %lu in source list %s ([option] too short)"),CurLine,File.c_str()); + // accept options even if the last has no space before the ]-end marker + if (option.at(option.length()-1) == ']') + { + for (; *Buffer != ']'; --Buffer); + option.resize(option.length()-1); + } + size_t const needle = option.find('='); if (needle == string::npos) return _error->Error(_("Malformed line %lu in source list %s ([%s] is not an assignment)"),CurLine,File.c_str(), option.c_str()); |