return 0;
}
- files = pkg_get_installed_files(pkg);
+ files = pkg_get_installed_files(conf, pkg);
pkg_version = pkg_version_str_alloc(pkg);
printf("Package %s (%s) is installed on %s and has the following files:\n",
for (i=0; i < installed->len; i++) {
pkg = installed->pkgs[i];
- installed_files = pkg_get_installed_files(pkg);
+ installed_files = pkg_get_installed_files(conf, pkg);
for (iter = str_list_first(installed_files); iter; iter = str_list_next(installed_files, iter)) {
installed_file = (char *)iter->data;
static int update_file_ownership(opkg_conf_t *conf, pkg_t *new_pkg, pkg_t *old_pkg)
{
- str_list_t *new_list = pkg_get_installed_files(new_pkg);
+ str_list_t *new_list = pkg_get_installed_files(conf, new_pkg);
str_list_elt_t *iter, *niter;
for (iter = str_list_first(new_list), niter = str_list_next(new_list, iter);
file_hash_set_file_owner(conf, new_file, new_pkg);
}
if (old_pkg) {
- str_list_t *old_list = pkg_get_installed_files(old_pkg);
+ str_list_t *old_list = pkg_get_installed_files(conf, old_pkg);
for (iter = str_list_first(old_list), niter = str_list_next(old_list, iter);
iter;
iter = niter, niter = str_list_next(old_list, niter)) {
int clashes = 0;
- files_list = pkg_get_installed_files(pkg);
+ files_list = pkg_get_installed_files(conf, pkg);
for (iter = str_list_first(files_list), niter = str_list_next(files_list, iter);
iter;
iter = niter, niter = str_list_next(files_list, iter)) {
int clashes = 0;
- files_list = pkg_get_installed_files(pkg);
+ files_list = pkg_get_installed_files(conf, pkg);
for (iter = str_list_first(files_list), niter = str_list_next(files_list, iter);
iter;
iter = niter, niter = str_list_next(files_list, niter)) {
return 0;
}
- old_files = pkg_get_installed_files(old_pkg);
- new_files = pkg_get_installed_files(pkg);
+ old_files = pkg_get_installed_files(conf, old_pkg);
+ new_files = pkg_get_installed_files(conf, pkg);
new_files_table.entries = NULL;
hash_table_init("new_files" , &new_files_table, 20);
conffile_t *conffile;
int removed_a_dir;
pkg_t *owner;
- int rootdirlen;
+ int rootdirlen = 0;
str_list_init(&installed_dirs);
- installed_files = pkg_get_installed_files(pkg);
+ installed_files = pkg_get_installed_files(conf, pkg);
/* don't include trailing slash */
- rootdirlen = strlen(pkg->dest->root_dir) -1;
+ if (conf->offline_root)
+ rootdirlen = strlen(conf->offline_root);
for (iter = str_list_first(installed_files); iter; iter = str_list_next(installed_files, iter)) {
file_name = (char *)iter->data;
return version;
}
-str_list_t *pkg_get_installed_files(pkg_t *pkg)
+str_list_t *pkg_get_installed_files(opkg_conf_t *conf, pkg_t *pkg)
{
int err;
char *list_file_name = NULL;
FILE *list_file = NULL;
char *line;
char *installed_file_name;
- int rootdirlen;
+ int rootdirlen = 0;
pkg->installed_files_ref_cnt++;
free(list_file_name);
}
- rootdirlen = strlen( pkg->dest->root_dir );
+ if (conf->offline_root)
+ rootdirlen = strlen(conf->offline_root);
+
while (1) {
char *file_name;
str_chomp(line);
file_name = line;
- /* Take pains to avoid uglies like "/./" in the middle of file_name. */
- if( strncmp( pkg->dest->root_dir,
- file_name,
- rootdirlen ) ) {
+ if (pkg->state_status == SS_NOT_INSTALLED) {
if (*file_name == '.') {
file_name++;
}
if (*file_name == '/') {
file_name++;
}
-
- /* Freed in pkg_free_installed_files */
- sprintf_alloc(&installed_file_name, "%s%s", pkg->dest->root_dir, file_name);
+ sprintf_alloc(&installed_file_name, "%s%s",
+ pkg->dest->root_dir, file_name);
} else {
- // already contains root_dir as header -> ABSOLUTE
- sprintf_alloc(&installed_file_name, "%s", file_name);
+ if (conf->offline_root &&
+ strncmp(conf->offline_root, file_name, rootdirlen)) {
+ sprintf_alloc(&installed_file_name, "%s%s",
+ conf->offline_root, file_name);
+ } else {
+ // already contains root_dir as header -> ABSOLUTE
+ sprintf_alloc(&installed_file_name, "%s", file_name);
+ }
}
str_list_append(pkg->installed_files, installed_file_name);
free(installed_file_name);
pkg_hash_fetch_all_installed(pkg_hash, installed_pkgs);
for (i = 0; i < installed_pkgs->len; i++) {
pkg_t *pkg = installed_pkgs->pkgs[i];
- str_list_t *installed_files = pkg_get_installed_files(pkg); /* this causes installed_files to be cached */
+ str_list_t *installed_files = pkg_get_installed_files(conf, pkg); /* this causes installed_files to be cached */
str_list_elt_t *iter, *niter;
if (installed_files == NULL) {
opkg_message(conf, OPKG_ERROR, "No installed files for pkg %s\n", pkg->name);
void set_flags_from_control(opkg_conf_t *conf, pkg_t *pkg);
void pkg_print_status(pkg_t * pkg, FILE * file);
-str_list_t *pkg_get_installed_files(pkg_t *pkg);
+str_list_t *pkg_get_installed_files(opkg_conf_t *conf, pkg_t *pkg);
int pkg_free_installed_files(pkg_t *pkg);
int pkg_remove_installed_files_list(opkg_conf_t *conf, pkg_t *pkg);
conffile_t *pkg_get_conffile(pkg_t *pkg, const char *file_name);
// opkg_message(conf, OPKG_DEBUG2, "owning_pkg=%s filename=%s\n", owning_pkg->name, file_name);
hash_table_insert(file_hash, file_name, owning_pkg);
if (old_owning_pkg) {
- pkg_get_installed_files(old_owning_pkg);
+ pkg_get_installed_files(conf, old_owning_pkg);
str_list_remove_elt(old_owning_pkg->installed_files, file_name);
pkg_free_installed_files(old_owning_pkg);
/* mark this package to have its filelist written */