]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/contrib/configuration.cc:
authorOtavio Salvador <otavio@ossystems.com.br>
Sun, 16 Dec 2007 20:53:32 +0000 (18:53 -0200)
committerOtavio Salvador <otavio@ossystems.com.br>
Sun, 16 Dec 2007 20:53:32 +0000 (18:53 -0200)
  - 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
debian/changelog
doc/apt.conf.5.xml

index 3109fd7a58649b1775ec97d01d8807df5d40cb14..e8301d918a6c192df14800bc7f6c8acddb40de7b 100644 (file)
@@ -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                      /*{{{*/
index 9ae68c770295d3d386c541fe4842b6dc64f3f4c5..d8ce744d6dc50f11a96b988b96e2d036205acd45 100644 (file)
@@ -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 <otavio@ossystems.com.br>  Sun, 16 Dec 2007 18:46:29 -0200
 
index 43f33681f3190eea466f3b395d7d914e94ac4423..5bc6c55db15e5e72393c9ebcdb1fbb86d97a129f 100644 (file)
@@ -295,6 +295,19 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
    <literal>dpkg</literal>, <literal>apt-get</literal> <literal>dpkg-source</literal> 
    <literal>dpkg-buildpackage</literal> and <literal>apt-cache</literal> specify the location
    of the respective programs.</para>
+
+   <para>
+     The configuration item <literal>RootDir</literal> has a special
+     meaning.  If set, all paths in <literal>Dir::</literal> will be
+     relative to <literal>RootDir</literal>, <emphasis>even paths that
+     are specified absolutely</emphasis>.  So, for instance, if
+     <literal>RootDir</literal> is set to
+     <filename>/tmp/staging</filename> and
+     <literal>Dir::State::status</literal> is set to
+     <filename>/var/lib/dpkg/status</filename>, then the status file
+     will be looked up in
+     <filename>/tmp/staging/var/lib/dpkg/status</filename>.
+   </para>
  </refsect1>
  
  <refsect1><title>APT in DSelect</title>