From 7fc9b3b1705f104eb66510d771994fb46b01d1e6 Mon Sep 17 00:00:00 2001 From: graham.gower Date: Mon, 21 Jun 2010 19:34:25 -0400 Subject: Fix --force-reinstall by removing special case code. Just remove the pkg first. This should fix Issue #51. git-svn-id: http://opkg.googlecode.com/svn/trunk@538 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'libopkg/pkg_hash.c') diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c index f72ed26..67c1781 100644 --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c @@ -619,17 +619,31 @@ hash_insert_pkg(pkg_t *pkg, int set_status) pkg->parent = ab_pkg; } - -pkg_t * -file_hash_get_file_owner(const char *file_name) +static const char * +strip_offline_root(const char *file_name) { + unsigned int len; + if (conf->offline_root) { - unsigned int len = strlen(conf->offline_root); - if (strncmp(file_name, conf->offline_root, len) == 0) { + len = strlen(conf->offline_root); + if (strncmp(file_name, conf->offline_root, len) == 0) file_name += len; - } } + return file_name; +} + +void +file_hash_remove(const char *file_name) +{ + file_name = strip_offline_root(file_name); + hash_table_remove(&conf->file_hash, file_name); +} + +pkg_t * +file_hash_get_file_owner(const char *file_name) +{ + file_name = strip_offline_root(file_name); return hash_table_get(&conf->file_hash, file_name); } @@ -642,12 +656,7 @@ file_hash_set_file_owner(const char *file_name, pkg_t *owning_pkg) if (file_name[file_name_len -1] == '/') return; - if (conf->offline_root) { - unsigned int len = strlen(conf->offline_root); - if (strncmp(file_name, conf->offline_root, len) == 0) { - file_name += len; - } - } + file_name = strip_offline_root(file_name); hash_table_insert(&conf->file_hash, file_name, owning_pkg); -- cgit v0.9.1