Claim ownership of a file if the previous owner has obsoleted it.
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Fri, 11 Jun 2010 02:07:58 +0000 (02:07 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Fri, 11 Jun 2010 02:07:58 +0000 (02:07 +0000)
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

libopkg/opkg_install.c

index 88fed59..16b5be9 100644 (file)
@@ -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);
      }