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);
return -1;
}
- const char* name = PyUnicode_AsUTF8(item);
+ const char* path = PyUnicode_AsUTF8(item);
Py_DECREF(item);
// Create a new file
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);
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, "
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
}
// 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;
}
"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 "
Pakfire pakfire;
int nrefs;
- char name[PATH_MAX];
+ char path[PATH_MAX];
char type;
ssize_t size;
}
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));
}
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) {
}
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);
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) {
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
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);
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;
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;
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);
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;
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)
continue;
}
- if (strcmp(filename, PAKFIRE_SOLVABLE_FILEMARKER) == 0)
+ if (strcmp(path, PAKFIRE_SOLVABLE_FILEMARKER) == 0)
++found_marker;
}
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);
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;
pakfire_file_get_time(file),
(chksum) ? chksum : "-",
"-", // XXX capabilities
- pakfire_file_get_name(file)
+ pakfire_file_get_path(file)
);
pakfire_file_unref(file);