return r;
}
-static int pakfire_repo_write_database(struct pakfire_repo* self,
- struct json_object* repomd, char* filename, size_t length) {
- char database[PATH_MAX];
+static int pakfire_repo_write_database(struct pakfire_repo* self, struct json_object* repomd) {
+ char filename[PATH_MAX];
+ char path[PATH_MAX];
char tmp[PATH_MAX];
int r;
f = NULL;
// Create a filename for the database file
- r = __pakfire_strftime_now(filename, length, "%Y-%m-%d-%H%M.%s.solv.zst");
+ r = pakfire_strftime_now(filename, "%Y-%m-%d-%H%M.%s.solv.zst");
if (r) {
ERROR(self->ctx, "Could not format database filename: %m\n");
goto ERROR;
}
// Make final database path
- r = pakfire_repo_path(self, database, "repodata/%s", filename);
+ r = pakfire_repo_path(self, path, "repodata/%s", filename);
if (r < 0) {
ERROR(self->ctx, "Could not join database path: %m\n");
goto ERROR;
}
// Link database to its destination
- r = link(tmp, database);
+ r = link(tmp, path);
if (r < 0) {
- ERROR(self->ctx, "Could not link database %s: %m\n", database);
+ ERROR(self->ctx, "Could not link database %s: %m\n", path);
r = -errno;
goto ERROR;
}
// Add the database to the filelist
- r = pakfire_repo_metadata_add_file(self, repomd, database);
+ r = pakfire_repo_metadata_add_file(self, repomd, path);
if (r < 0)
goto ERROR;
struct json_object* repomd = NULL;
char repomd_path[PATH_MAX];
char sigpath[PATH_MAX];
- char database[PATH_MAX];
FILE* f = NULL;
FILE* s = NULL;
int r = 1;
goto ERROR;
// Write the database
- r = pakfire_repo_write_database(self, repomd, database, sizeof(database));
+ r = pakfire_repo_write_database(self, repomd);
if (r < 0)
goto ERROR;
- // XXX database hash is missing
-
// Open repomd.json for writing
f = fopen(repomd_path, "w+");
if (!f) {