summaryrefslogtreecommitdiff
path: root/src/pool.c
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-10-23 12:37:25 +0200
committerMichael Schroeder <mls@suse.de>2012-10-23 12:37:25 +0200
commit765ead528d2b791e43e2a90212b5e4a0c2ad1302 (patch)
treedf895b663861fa3894c5a3d713626b9709dd9ed5 /src/pool.c
parentdbd528c82312931703cef9c3f932ee5c8bd4c635 (diff)
downloadlibsolv-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.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/pool.c b/src/pool.c
index f8656b4..4d33e8b 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -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 */