Introduce xbps_repo_{un,}lock() to serialize write access to repodata.
We use a simple file lock that is created with O_CREAT|O_EXCL. This should fix the concurrency issues with multiple processes running xbps-rindex -a/-c on the same repository/arch combo.
This commit is contained in:
@@ -92,7 +92,7 @@ xbps_regget_repo(struct xbps_handle *xhp, const char *url)
|
||||
if (strcmp(repouri, url))
|
||||
continue;
|
||||
|
||||
repo = xbps_repo_open(xhp, repouri, false);
|
||||
repo = xbps_repo_open(xhp, repouri);
|
||||
if (!repo)
|
||||
return NULL;
|
||||
|
||||
@@ -148,7 +148,7 @@ xbps_rpool_foreach(struct xbps_handle *xhp,
|
||||
for (unsigned int i = 0; i < xbps_array_count(xhp->repositories); i++) {
|
||||
xbps_array_get_cstring_nocopy(xhp->repositories, i, &repouri);
|
||||
if ((repo = xbps_rpool_get_repo(repouri)) == NULL) {
|
||||
repo = xbps_repo_open(xhp, repouri, false);
|
||||
repo = xbps_repo_open(xhp, repouri);
|
||||
if (!repo)
|
||||
continue;
|
||||
SIMPLEQ_INSERT_TAIL(&rpool_queue, repo, entries);
|
||||
|
Reference in New Issue
Block a user