problems passing --prefix to rpm::options to apt-get

rybkine at pp.rhul.ac.uk rybkine at pp.rhul.ac.uk
Mon Jun 26 04:47:02 PDT 2006


Panu,

On Wed, 21 Jun 2006, Panu Matilainen wrote:

> On Wed, 2006-06-21 at 21:26 +0200, Andrei Kazarov wrote:
> > 
> > I want to use apt-get to install my *relocatable* packages as 
> > *non-root*. With plain RPM i do this like
> > rpm -i --prefix=/myarea --dbpath /myarea/.rpmdb packageA-1.0.0-0.rpm
> > 
> > However, I did not manage to pass those options to apt-get utility, 
> > neither using command-line options like
> > apt-get -o rpm::options::="--dbpath /myarea/.rpmdb" install 
> > ackageA-1.0.0-0.rpm
> > 
> > nor via local apt.config file passed via -c option.
> > 
> > What am I doing wrong?
> 
> Relocation, among some other relatively rare options simply aren't
> implemented for the "internal package manager" which calls rpmlib
> directly for install/remove etc operations. 
> 
> You can try using additional "-o rpm::pm=external" option which causes
> apt to call the actual rpm binary for installs so the options passed in
> rpm::options will get interpreted by rpm itself instead of apt. But ..
> this is the first time I remember hearing anybody trying to use package
> relocations with apt so it might not work quite as expected, I certainly
> haven't tested it ever.
> 
I implemented the capability for apt to use
the --dbpath option of the external package manager
(and thus allowing operations as non-root)
more than a year ago and have now tested the patch
with apt-0.5.15lorg3.2.
Can you please consider applying?

Many thanks,
Grigori

> 	- Panu -
> 
> _______________________________________________
> apt-rpm mailing list
> apt-rpm at lists.laiskiainen.org
> http://lists.laiskiainen.org/listinfo.cgi/apt-rpm-laiskiainen.org
> 
-------------- next part --------------
diff -Naur apt-0.5.15lorg3.2-orig/apt-pkg/rpm/rpmhandler.cc apt-0.5.15lorg3.2/apt-pkg/rpm/rpmhandler.cc
--- apt-0.5.15lorg3.2-orig/apt-pkg/rpm/rpmhandler.cc	2006-06-21 23:16:14.000000000 +0100
+++ apt-0.5.15lorg3.2/apt-pkg/rpm/rpmhandler.cc	2006-06-25 13:15:36.000000000 +0100
@@ -713,6 +713,12 @@
 #endif
    string Dir = _config->Find("RPM::RootDir");
    
+   /********************** To allow operations as non-root *********************
+    **********************    Grigori.Rybkine at rhul.ac.uk   *********************
+    **********************         Thu May 05 2005         *********************/
+   if (Dir.empty() && _config->Find("RPM::PM") == "external")
+      Dir = _config->Find("RPM::DbRoot");
+
    rpmReadConfigFiles(NULL, NULL);
    ID = DataPath(false);
 
@@ -807,8 +813,16 @@
 string RPMDBHandler::DataPath(bool DirectoryOnly)
 {
    string File = "packages.rpm";
+
+   /********************** To allow operations as non-root *********************
+    **********************    Grigori.Rybkine at rhul.ac.uk   *********************
+    **********************         Thu May 05 2005         *********************/
+   string Dir = _config->Find("RPM::RootDir");
+   if (Dir.empty() && _config->Find("RPM::PM") == "external")
+      Dir = _config->Find("RPM::DbRoot");
+
    char *tmp = (char *) rpmExpand("%{_dbpath}", NULL);
-   string DBPath(_config->Find("RPM::RootDir")+tmp);
+   string DBPath(Dir + tmp);
    free(tmp);
 
 #if RPM_VERSION >= 0x040000
diff -Naur apt-0.5.15lorg3.2-orig/apt-pkg/rpm/rpmpm.cc apt-0.5.15lorg3.2/apt-pkg/rpm/rpmpm.cc
--- apt-0.5.15lorg3.2-orig/apt-pkg/rpm/rpmpm.cc	2006-06-21 23:16:14.000000000 +0100
+++ apt-0.5.15lorg3.2/apt-pkg/rpm/rpmpm.cc	2006-06-25 13:36:46.000000000 +0100
@@ -436,6 +436,18 @@
        Args[n++] = rootdir.c_str();
    }
 
+   /********************** To allow operations as non-root *********************
+    **********************    Grigori.Rybkine at rhul.ac.uk   *********************
+    **********************         Thu May 05 2005         *********************/
+   string dbroot = _config->Find("RPM::DbRoot");
+   if (rootdir.empty() && !dbroot.empty())
+   {
+      char *tmp = (char *) rpmExpand("%{_dbpath}", NULL);
+      Args[n++] = "--dbpath";
+      Args[n++] = (dbroot + tmp).c_str();
+      free(tmp);
+   }
+
    Configuration::Item const *Opts;
    if (op == Item::RPMErase)
    {
@@ -534,7 +546,7 @@
 	 Args[n++] = *I;
    }
    
-   Args[n++] = 0;
+   Args[n] = 0;
 
    if (_config->FindB("Debug::pkgRPMPM",false) == true)
    {


More information about the Apt-Rpm mailing list