diff options
author | Michael Schroeder <mls@suse.de> | 2012-10-23 12:37:25 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-10-23 12:37:25 +0200 |
commit | 765ead528d2b791e43e2a90212b5e4a0c2ad1302 (patch) | |
tree | df895b663861fa3894c5a3d713626b9709dd9ed5 /src/pool.c | |
parent | dbd528c82312931703cef9c3f932ee5c8bd4c635 (diff) | |
download | libsolv-765ead528d2b791e43e2a90212b5e4a0c2ad1302.tar.gz libsolv-765ead528d2b791e43e2a90212b5e4a0c2ad1302.tar.bz2 libsolv-765ead528d2b791e43e2a90212b5e4a0c2ad1302.zip |
implement pool_set_rootdir/REPO_USE_ROOTDIR instead of passing a rootdir to various functions.
Breaks the interface a bit, sorry. The new way seems to be much cleaner, though.
Extra apologies to Nate Skulic for removing his add_rpmdb_root method one day
after adding it.
Diffstat (limited to 'src/pool.c')
-rw-r--r-- | src/pool.c | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -110,6 +110,7 @@ pool_free(Pool *pool) solv_free(pool->languages); solv_free(pool->languagecache); solv_free(pool->errstr); + solv_free(pool->rootdir); solv_free(pool); } @@ -2098,4 +2099,37 @@ pool_add_fileconflicts_deps(Pool *pool, Queue *conflicts) pool_freeidhashes(pool); } +char * +pool_prepend_rootdir(Pool *pool, const char *path) +{ + if (!path) + return 0; + if (!pool->rootdir) + return solv_strdup(path); + return solv_dupjoin(pool->rootdir, "/", *path == '/' ? path + 1 : path); +} + +const char * +pool_prepend_rootdir_tmp(Pool *pool, const char *path) +{ + if (!path) + return 0; + if (!pool->rootdir) + return path; + return pool_tmpjoin(pool, pool->rootdir, "/", *path == '/' ? path + 1 : path); +} + +void +pool_set_rootdir(Pool *pool, const char *rootdir) +{ + solv_free(pool->rootdir); + pool->rootdir = solv_strdup(rootdir); +} + +const char * +pool_get_rootdir(Pool *pool) +{ + return pool->rootdir; +} + /* EOF */ |