From db2cca1129fa2d88eae80e1c4a17e263236a95a3 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Sun, 16 Dec 2007 18:53:32 -0200 Subject: * apt-pkg/contrib/configuration.cc: - if RootDir is set, then FindFile and FindDir will return paths relative to the directory stored in RootDir, closes: #456457. --- apt-pkg/contrib/configuration.cc | 7 ++++++- debian/changelog | 5 +++++ doc/apt.conf.5.xml | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 3109fd7a5..e8301d918 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -173,6 +173,11 @@ string Configuration::Find(const char *Name,const char *Default) const */ string Configuration::FindFile(const char *Name,const char *Default) const { + const Item *RootItem = Lookup("RootDir"); + std::string rootDir = (RootItem == 0) ? "" : RootItem->Value; + if(rootDir.size() > 0 && rootDir[rootDir.size() - 1] != '/') + rootDir.push_back('/'); + const Item *Itm = Lookup(Name); if (Itm == 0 || Itm->Value.empty() == true) { @@ -204,7 +209,7 @@ string Configuration::FindFile(const char *Name,const char *Default) const Itm = Itm->Parent; } - return val; + return rootDir + val; } /*}}}*/ // Configuration::FindDir - Find a directory name /*{{{*/ diff --git a/debian/changelog b/debian/changelog index 9ae68c770..d8ce744d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -47,6 +47,11 @@ apt (0.7.10) UNRELEASED; urgency=low - support lzma data members * ftparchive/multicompress.cc: - support lzma output + + [ Daniel Burrows ] + * apt-pkg/contrib/configuration.cc: + - if RootDir is set, then FindFile and FindDir will return paths + relative to the directory stored in RootDir, closes: #456457. -- Otavio Salvador Sun, 16 Dec 2007 18:46:29 -0200 diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index 43f33681f..5bc6c55db 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -295,6 +295,19 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";}; dpkg, apt-get dpkg-source dpkg-buildpackage and apt-cache specify the location of the respective programs. + + + The configuration item RootDir has a special + meaning. If set, all paths in Dir:: will be + relative to RootDir, even paths that + are specified absolutely. So, for instance, if + RootDir is set to + /tmp/staging and + Dir::State::status is set to + /var/lib/dpkg/status, then the status file + will be looked up in + /tmp/staging/var/lib/dpkg/status. + APT in DSelect -- cgit v1.2.3