[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: RPM root and db dir



On Fri, Jan 24, 2003 at 01:01:19AM -0500, Adam H. Pendleton wrote:
> I am installing RPM packages under a custom root directory (ala. rpm 
> --root).  I have figured out how to change to rootdir, but when I try 
> to install a package, I get:
> 
> error: no dbpath has been set
> error: cannot open Packages database in /dir/dir1/%{_dbpath}
> 
> I looked through the docs, but I didn't come across anything that 
> looked correct, so I thought I would drop a message to the list.  It 
> might be faster.  :)

Presumably you're not installing with rpm from the command line, please
make that clear in the future.

The quickest fix is to do
	addMacro(NULL, "_dbpath", NULL, "/your/db/path", -1);

The traditional fix is to read rpmrc/macro config files
	rpmReadConfigFiles(NULL, NULL);

Alternatively, initialize everything by doing something like
tools/rpmgraph.c does using the rpmcli API:

int
main(int argc, char *const argv[])
{
    rpmts ts = NULL;
    struct rpmInstallArguments_s * ia = &rpmIArgs;
    poptContext optCon;
    int ec = 0;

    optCon = rpmcliInit(argc, argv, optionsTable);
    if (optCon == NULL)
        exit(EXIT_FAILURE);

    ts = rpmtsCreate();

    /* extraneous gook deleted here for clarity. */

    ec = rpmGraph(ts, ia, poptGetArgs(optCon));

    ts = rpmtsFree(ts);

    optCon = rpmcliFini(optCon);

    return ec;
}

73 de Jeff

-- 
Jeff Johnson	ARS N3NPQ
jbj@redhat.com (jbj@jbj.org)
Chapel Hill, NC





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []