From 5a23a432b0a45ff4774a9968895ee87d60e70f03 Mon Sep 17 00:00:00 2001
From: graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Date: Thu, 10 Jun 2010 22:07:58 -0400
Subject: Claim ownership of a file if the previous owner has obsoleted it.

This commit, along with the last few, should fix Issue #50.

git-svn-id: http://opkg.googlecode.com/svn/trunk@536 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
---
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index 88fed59..16b5be9 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -156,9 +156,12 @@ update_file_ownership(pkg_t *new_pkg, pkg_t *old_pkg)
              iter = niter, niter = str_list_next(new_list, niter)) {
 	  char *new_file = (char *)iter->data;
 	  pkg_t *owner = file_hash_get_file_owner(new_file);
-	  if (!new_file)
-	       opkg_msg(ERROR, "Null new_file for new_pkg=%s\n", new_pkg->name);
-	  if (!owner || (owner == old_pkg))
+	  pkg_t *obs = hash_table_get(&conf->obs_file_hash, new_file);
+
+	  opkg_msg(DEBUG2, "%s: new_pkg=%s wants file %s, from owner=%s\n",
+		__func__, new_pkg->name, new_file, owner?owner->name:"<NULL>");
+
+	  if (!owner || (owner == old_pkg) || obs)
 	       file_hash_set_file_owner(new_file, new_pkg);
      }
 
--
cgit v0.9.1