]> git.ipfire.org Git - pakfire.git/commitdiff
file: Rename "name" to "path"
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Mar 2021 21:51:01 +0000 (21:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Mar 2021 21:51:01 +0000 (21:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/package.c
src/libpakfire/db.c
src/libpakfire/file.c
src/libpakfire/filelist.c
src/libpakfire/include/pakfire/file.h
src/libpakfire/libpakfire.sym
src/libpakfire/package.c
src/libpakfire/packager.c

index 5476a1ddee9bd25290c848f345bad9986b623663..ddf4ba63b42cf3ec1d3efb4a94afcfc4cf4de201 100644 (file)
@@ -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);
index 2fa558f7429146a3b1a0dde7590614b5561530bf..21d886b7a7390d4f023e0c39d89c0383ea7937c7 100644 (file)
@@ -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 "
index 3348a6193c5af044a847cba1df38c22d00f72e5f..6aeb46e147fdcf612387f2454d6152920e09ee56 100644 (file)
@@ -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) {
index 3e8b96b893c9078c8719816b6ac521622e89da75..df2014bb6f36dd486da4efafa2ae9ef92f75cd76 100644 (file)
@@ -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
index b9cc973add731d56ca93b93162f019c102f2a7ea..6c25abe06930704be6159a5603c3731759a7a021 100644 (file)
@@ -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);
 
index 76640a60f25d9f3307cfb4476b48c2dc82a7853e..2534ae7c288f41c28fac93ea46fe32362e404c1d 100644 (file)
@@ -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;
index f75df80e2dd60c39c842b632f2db94ccc0838d18..861c836b747eea7e6ab8364640acf504a8367c24 100644 (file)
@@ -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;
index 0e04d0f3e32869be38ec796ef10b041770863cb0..d73b6c74236980a222d77f7538a99c0a2f825e53 100644 (file)
@@ -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);