Add function to retrieve rpm config base directory
- one-shot to determine configuration base directory path from RPM_CONFIGDIR environement or build-time default - rpmfileutil is a bit strange place, this would really belong to librpm but Lua initialization needs the path so...
This commit is contained in:
parent
86645ffd4f
commit
da83a562e1
|
@ -1630,4 +1630,3 @@ rpmExpandNumeric(const char *arg)
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
static const char *rpm_config_dir = NULL;
|
||||||
|
|
||||||
static int open_dso(const char * path, pid_t * pidp, rpm_loff_t *fsizep)
|
static int open_dso(const char * path, pid_t * pidp, rpm_loff_t *fsizep)
|
||||||
{
|
{
|
||||||
static const char * cmd = NULL;
|
static const char * cmd = NULL;
|
||||||
|
@ -727,3 +729,12 @@ int rpmMkdirs(const char *root, const char *pathstr)
|
||||||
argvFree(dirs);
|
argvFree(dirs);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *rpmConfigDir(void)
|
||||||
|
{
|
||||||
|
if (rpm_config_dir == NULL) {
|
||||||
|
char *rpmenv = getenv("RPM_CONFIGDIR");
|
||||||
|
rpm_config_dir = rpmenv ? xstrdup(rpmenv) : RPMCONFIGDIR;
|
||||||
|
}
|
||||||
|
return rpm_config_dir;
|
||||||
|
}
|
||||||
|
|
|
@ -137,6 +137,17 @@ char * rpmExpand (const char * arg, ...) RPM_GNUC_NULL_TERMINATED;
|
||||||
*/
|
*/
|
||||||
int rpmExpandNumeric (const char * arg);
|
int rpmExpandNumeric (const char * arg);
|
||||||
|
|
||||||
|
/** \ingroup rpmmacro
|
||||||
|
* Return rpm configuration base directory.
|
||||||
|
* If RPM_CONFIGDIR environment variable is set, it's value will be used.
|
||||||
|
* Otherwise the configuration directory is the one set at build time,
|
||||||
|
* typically /usr/lib/rpm. The value of rpmConfigDir() is determined
|
||||||
|
* on first call to this function and is guaranteed to remain the same
|
||||||
|
* on subsequent calls.
|
||||||
|
* @return rpm configuration directory name
|
||||||
|
*/
|
||||||
|
const char *rpmConfigDir(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue