From: Michael Tremer Date: Mon, 8 Mar 2021 21:51:01 +0000 (+0000) Subject: file: Rename "name" to "path" X-Git-Tag: 0.9.28~1285^2~602 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32485f6c5e647ea52d7eef308dbdee4aad6f4b03;p=pakfire.git file: Rename "name" to "path" Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/package.c b/src/_pakfire/package.c index 5476a1dde..ddf4ba63b 100644 --- a/src/_pakfire/package.c +++ b/src/_pakfire/package.c @@ -730,10 +730,10 @@ static PyObject* Package_get_filelist(PackageObject* self, PyObject* args) { PakfireFilelist filelist = pakfire_package_get_filelist(self->package); for (unsigned int i = 0; i < pakfire_filelist_size(filelist); i++) { PakfireFile file = pakfire_filelist_get(filelist, i); - const char* name = pakfire_file_get_name(file); + const char* path = pakfire_file_get_path(file); pakfire_file_unref(file); - PyObject* obj = PyUnicode_FromString(name); + PyObject* obj = PyUnicode_FromString(path); int ret = PyList_Append(list, obj); Py_DECREF(obj); @@ -784,7 +784,7 @@ static int Package_set_filelist(PackageObject* self, PyObject* value) { return -1; } - const char* name = PyUnicode_AsUTF8(item); + const char* path = PyUnicode_AsUTF8(item); Py_DECREF(item); // Create a new file @@ -799,8 +799,8 @@ static int Package_set_filelist(PackageObject* self, PyObject* value) { return -1; } - // Set the name - pakfire_file_set_name(file, name); + // Set the path + pakfire_file_set_path(file, path); // Append the file to the filelist pakfire_filelist_append(filelist, file); diff --git a/src/libpakfire/db.c b/src/libpakfire/db.c index 2fa558f74..21d886b7a 100644 --- a/src/libpakfire/db.c +++ b/src/libpakfire/db.c @@ -292,7 +292,7 @@ static int pakfire_db_create_schema(struct pakfire_db* db) { r = pakfire_db_execute(db, "CREATE TABLE IF NOT EXISTS files(" "id INTEGER PRIMARY KEY, " - "name TEXT, " + "path TEXT, " "pkg INTEGER, " "size INTEGER, " "type INTEGER, " @@ -774,7 +774,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire goto END; } - const char* sql = "INSERT INTO files(pkg, name, size, type, config, datafile, mode, " + const char* sql = "INSERT INTO files(pkg, path, size, type, config, datafile, mode, " "user, 'group', hash1, mtime, capabilities) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; // Prepare the statement @@ -797,11 +797,11 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire } // Bind name - const char* name = pakfire_file_get_name(file); + const char* path = pakfire_file_get_path(file); - r = sqlite3_bind_text(stmt, 2, name, -1, NULL); + r = sqlite3_bind_text(stmt, 2, path, -1, NULL); if (r) { - ERROR(db->pakfire, "Could not bind name: %s\n", sqlite3_errmsg(db->handle)); + ERROR(db->pakfire, "Could not bind path: %s\n", sqlite3_errmsg(db->handle)); pakfire_file_unref(file); goto END; } @@ -1570,7 +1570,7 @@ int pakfire_db_load(struct pakfire_db* db, PakfireRepo repo) { "hash1, license, summary, description, uuid, vendor, build_host, build_time, " "strftime('%s', installed) AS installed, " "(" - "SELECT group_concat(name, '\n') FROM files WHERE files.pkg = packages.id" + "SELECT group_concat(path, '\n') FROM files WHERE files.pkg = packages.id" ") AS files, " "(" "SELECT group_concat(dependency, '\n') FROM dependencies d " diff --git a/src/libpakfire/file.c b/src/libpakfire/file.c index 3348a6193..6aeb46e14 100644 --- a/src/libpakfire/file.c +++ b/src/libpakfire/file.c @@ -41,7 +41,7 @@ struct _PakfireFile { Pakfire pakfire; int nrefs; - char name[PATH_MAX]; + char path[PATH_MAX]; char type; ssize_t size; @@ -120,8 +120,8 @@ PAKFIRE_EXPORT int pakfire_file_copy_stat(PakfireFile file, struct stat* stat) { } int pakfire_file_copy_archive_entry(PakfireFile file, struct archive_entry* entry) { - // Set name - pakfire_file_set_name(file, archive_entry_pathname(entry)); + // Set path + pakfire_file_set_path(file, archive_entry_pathname(entry)); // Set size pakfire_file_set_size(file, archive_entry_size(entry)); @@ -165,10 +165,10 @@ PAKFIRE_EXPORT PakfireFile pakfire_file_unref(PakfireFile file) { } PAKFIRE_EXPORT int pakfire_file_cmp(PakfireFile file1, PakfireFile file2) { - const char* name1 = pakfire_file_get_name(file1); - const char* name2 = pakfire_file_get_name(file2); + const char* path1 = pakfire_file_get_path(file1); + const char* path2 = pakfire_file_get_path(file2); - return strcmp(name1, name2); + return strcmp(path1, path2); } static char pakfire_file_sprintf_type(PakfireFile file) { @@ -216,7 +216,7 @@ static char* pakfire_file_format_mtime(PakfireFile file) { } PAKFIRE_EXPORT void pakfire_file_sprintf(PakfireFile file, char* str, size_t len) { - const char* name = pakfire_file_get_name(file); + const char* path = pakfire_file_get_path(file); ssize_t size = pakfire_file_get_size(file); const char* user = pakfire_file_get_user(file); @@ -226,26 +226,26 @@ PAKFIRE_EXPORT void pakfire_file_sprintf(PakfireFile file, char* str, size_t len char* mtime = pakfire_file_format_mtime(file); snprintf(str, len, "%s %-8s %-8s %8d %s %s", perms, user, group, - (int)size, mtime, name); + (int)size, mtime, path); free(perms); free(mtime); } -PAKFIRE_EXPORT const char* pakfire_file_get_name(PakfireFile file) { - return file->name; +PAKFIRE_EXPORT const char* pakfire_file_get_path(PakfireFile file) { + return file->path; } -PAKFIRE_EXPORT void pakfire_file_set_name(PakfireFile file, const char* name) { - snprintf(file->name, sizeof(file->name) - 1, "%s", name); +PAKFIRE_EXPORT void pakfire_file_set_path(PakfireFile file, const char* path) { + snprintf(file->path, sizeof(file->path) - 1, "%s", path); } PAKFIRE_EXPORT char* pakfire_file_get_dirname(PakfireFile file) { - return pakfire_dirname(file->name); + return pakfire_dirname(file->path); } PAKFIRE_EXPORT char* pakfire_file_get_basename(PakfireFile file) { - return pakfire_basename(file->name); + return pakfire_basename(file->path); } PAKFIRE_EXPORT char pakfire_file_get_type(PakfireFile file) { diff --git a/src/libpakfire/filelist.c b/src/libpakfire/filelist.c index 3e8b96b89..df2014bb6 100644 --- a/src/libpakfire/filelist.c +++ b/src/libpakfire/filelist.c @@ -199,18 +199,18 @@ static int pakfire_filelist_parse_line(PakfireFile* file, Pakfire pakfire, pakfire_file_set_chksum(*file, word); break; - // name + // path #warning handle filenames with spaces case 8: - pakfire_file_set_name(*file, line + bytes_read); + pakfire_file_set_path(*file, line + bytes_read); break; } } else if (format >= 3) { switch (i) { - // name + // path case 0: - pakfire_file_set_name(*file, word); + pakfire_file_set_path(*file, word); break; // type diff --git a/src/libpakfire/include/pakfire/file.h b/src/libpakfire/include/pakfire/file.h index b9cc973ad..6c25abe06 100644 --- a/src/libpakfire/include/pakfire/file.h +++ b/src/libpakfire/include/pakfire/file.h @@ -38,8 +38,8 @@ void pakfire_file_sprintf(PakfireFile file, char* str, size_t len); int pakfire_file_copy_stat(PakfireFile file, struct stat* stat); -const char* pakfire_file_get_name(PakfireFile file); -void pakfire_file_set_name(PakfireFile file, const char* name); +const char* pakfire_file_get_path(PakfireFile file); +void pakfire_file_set_path(PakfireFile file, const char* path); char* pakfire_file_get_dirname(PakfireFile file); char* pakfire_file_get_basename(PakfireFile file); diff --git a/src/libpakfire/libpakfire.sym b/src/libpakfire/libpakfire.sym index 76640a60f..2534ae7c2 100644 --- a/src/libpakfire/libpakfire.sym +++ b/src/libpakfire/libpakfire.sym @@ -96,7 +96,7 @@ global: pakfire_file_create; pakfire_file_get_group; pakfire_file_get_mode; - pakfire_file_get_name; + pakfire_file_get_path; pakfire_file_get_time; pakfire_file_get_user; pakfire_file_is_file; @@ -107,7 +107,7 @@ global: pakfire_file_is_dir; pakfire_file_set_group; pakfire_file_set_mode; - pakfire_file_set_name; + pakfire_file_set_path; pakfire_file_set_time; pakfire_file_set_user; pakfire_file_sprintf; diff --git a/src/libpakfire/package.c b/src/libpakfire/package.c index f75df80e2..861c836b7 100644 --- a/src/libpakfire/package.c +++ b/src/libpakfire/package.c @@ -888,8 +888,8 @@ PAKFIRE_EXPORT char* pakfire_package_dump(PakfirePackage pkg, int flags) { for (unsigned int i = 0; i < pakfire_filelist_size(filelist); i++) { PakfireFile file = pakfire_filelist_get(filelist, i); - const char* name = pakfire_file_get_name(file); - pakfire_package_dump_add_line(&string, prefix, name); + const char* path = pakfire_file_get_path(file); + pakfire_package_dump_add_line(&string, prefix, path); pakfire_file_unref(file); @@ -955,7 +955,7 @@ static int pakfire_package_fetch_legacy_filelist(PakfirePackage pkg, PakfireFile Id id, *ids; ids = r->idarraydata + s->provides; while((id = *ids++) != 0) { - const char* filename = pool_dep2str(p, id); + const char* path = pool_dep2str(p, id); if (found_marker) { PakfireFile file; @@ -964,8 +964,8 @@ static int pakfire_package_fetch_legacy_filelist(PakfirePackage pkg, PakfireFile if (r) return r; - // Set name - pakfire_file_set_name(file, filename); + // Set path + pakfire_file_set_path(file, path); r = pakfire_filelist_append(filelist, file); if (r) @@ -975,7 +975,7 @@ static int pakfire_package_fetch_legacy_filelist(PakfirePackage pkg, PakfireFile continue; } - if (strcmp(filename, PAKFIRE_SOLVABLE_FILEMARKER) == 0) + if (strcmp(path, PAKFIRE_SOLVABLE_FILEMARKER) == 0) ++found_marker; } @@ -1002,7 +1002,7 @@ static int pakfire_package_fetch_filelist(PakfirePackage pkg, PakfireFilelist fi if (r) return r; - pakfire_file_set_name(file, di.kv.str); + pakfire_file_set_path(file, di.kv.str); // Append to filelist pakfire_filelist_append(filelist, file); @@ -1072,9 +1072,9 @@ PAKFIRE_EXPORT int pakfire_package_set_filelist(PakfirePackage pkg, PakfireFilel for (unsigned int i = 0; i < pakfire_filelist_size(filelist); i++) { PakfireFile file = pakfire_filelist_get(filelist, i); - const char* name = pakfire_file_get_name(file); - if (name) { - r = pakfire_package_append_file(pkg, name); + const char* path = pakfire_file_get_path(file); + if (path) { + r = pakfire_package_append_file(pkg, path); if (r) { pakfire_file_unref(file); return r; diff --git a/src/libpakfire/packager.c b/src/libpakfire/packager.c index 0e04d0f3e..d73b6c742 100644 --- a/src/libpakfire/packager.c +++ b/src/libpakfire/packager.c @@ -277,7 +277,7 @@ static int pakfire_packager_write_filelist(struct pakfire_packager* packager, pakfire_file_get_time(file), (chksum) ? chksum : "-", "-", // XXX capabilities - pakfire_file_get_name(file) + pakfire_file_get_path(file) ); pakfire_file_unref(file);