summaryrefslogtreecommitdiff
path: root/ext/repo_arch.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 /ext/repo_arch.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 'ext/repo_arch.c')
-rw-r--r--ext/repo_arch.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/repo_arch.c b/ext/repo_arch.c
index 5151803..6caa487 100644
--- a/ext/repo_arch.c
+++ b/ext/repo_arch.c
@@ -342,7 +342,7 @@ repo_add_arch_pkg(Repo *repo, const char *fn, int flags)
void *pkgidhandle = 0;
data = repo_add_repodata(repo, flags);
- if ((fd = open(fn, O_RDONLY, 0)) < 0)
+ if ((fd = open(flags & REPO_USE_ROOTDIR ? pool_prepend_rootdir_tmp(pool, fn) : fn, O_RDONLY, 0)) < 0)
{
pool_error(pool, -1, "%s: %s", fn, strerror(errno));
return 0;
@@ -816,6 +816,8 @@ repo_add_arch_local(Repo *repo, const char *dir, int flags)
data = repo_add_repodata(repo, flags);
+ if (flags & REPO_USE_ROOTDIR)
+ dir = pool_prepend_rootdir(pool, dir);
dp = opendir(dir);
if (dp)
{
@@ -849,6 +851,8 @@ repo_add_arch_local(Repo *repo, const char *dir, int flags)
}
if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
+ if (flags & REPO_USE_ROOTDIR)
+ solv_free(dir);
return 0;
}