xbps-repo: fix the 'genindex' target with missing directories.

This fixes issue #3 in github.com/vanilla/xbps.
This commit is contained in:
Juan RP
2011-07-09 11:21:17 +02:00
parent 0a2abb3f3d
commit 81d5bdd79a
2 changed files with 17 additions and 1 deletions

View File

@@ -281,6 +281,18 @@ xbps_repo_genindex(const char *pkgdir)
rv = errno;
goto out;
}
/*
* If repo/<noarch|un.machine> does not exist,
* create it.
*/
if ((access(path, X_OK) == -1) && errno == ENOENT) {
if (xbps_mkpath(path, 0755) == -1) {
xbps_error_printf("xbps-repo: cannot "
"create %s directory: %s\n",
path, strerror(errno));
return -1;
}
}
dirp = opendir(path);
if (dirp == NULL) {