xbps_find_new_pkg: always set pkg state.

--HG--
extra : convert_revision : e259f424344c9aa618e9ba515a4d39a8b9a11655
This commit is contained in:
Juan RP 2009-08-09 23:34:07 +02:00
parent 9b7a658e44
commit 350566818c

View File

@ -205,6 +205,7 @@ xbps_find_new_pkg(const char *pkgname, prop_dictionary_t instpkg)
struct repository_data *rdata;
const char *repoloc, *repover, *instver;
int rv = 0;
pkg_state_t state = 0;
assert(pkgname != NULL);
assert(instpkg != NULL);
@ -266,6 +267,24 @@ xbps_find_new_pkg(const char *pkgname, prop_dictionary_t instpkg)
goto out;
}
/*
* Always set "not-installed" package state. Will be overwritten
* to its correct state later.
*/
rv = xbps_set_pkg_state_dictionary(pkgrd, XBPS_PKG_STATE_NOT_INSTALLED);
if (rv != 0)
goto out;
/*
* Overwrite package state in dictionary if it was unpacked
* previously.
*/
rv = xbps_get_pkg_state_installed(pkgname, &state);
if (rv == 0) {
if ((rv = xbps_set_pkg_state_dictionary(pkgrd, state)) != 0)
goto out;
}
if (!prop_array_add(unsorted, pkgrd))
rv = errno;