xbps_register_pkg: remove 'automatic' boolean argument.
It should be provided in the proplib dictionary with key 'automatic-install'. This fixes a regression not respecting the 'automatic-install' value stored in regpkgdb.
This commit is contained in:
parent
ad66fa2e3d
commit
ef28101203
@ -387,7 +387,7 @@ exec_transaction(struct transaction *trans)
|
||||
prop_object_t obj;
|
||||
const char *pkgname, *version, *pkgver, *instver, *filen, *tract;
|
||||
int rv = 0;
|
||||
bool update, preserve, autoinst;
|
||||
bool update, preserve;
|
||||
pkg_state_t state;
|
||||
|
||||
/*
|
||||
@ -484,12 +484,11 @@ exec_transaction(struct transaction *trans)
|
||||
if ((strcmp(tract, "remove") == 0) ||
|
||||
(strcmp(tract, "configure") == 0))
|
||||
continue;
|
||||
autoinst = preserve = false;
|
||||
preserve = false;
|
||||
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname);
|
||||
prop_dictionary_get_cstring_nocopy(obj, "version", &version);
|
||||
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
prop_dictionary_get_cstring_nocopy(obj, "filename", &filen);
|
||||
prop_dictionary_get_bool(obj, "automatic-install", &autoinst);
|
||||
prop_dictionary_get_bool(obj, "preserve", &preserve);
|
||||
/*
|
||||
* If dependency is already unpacked skip this phase.
|
||||
@ -537,7 +536,7 @@ exec_transaction(struct transaction *trans)
|
||||
/*
|
||||
* Register binary package.
|
||||
*/
|
||||
if ((rv = xbps_register_pkg(obj, autoinst)) != 0) {
|
||||
if ((rv = xbps_register_pkg(obj)) != 0) {
|
||||
xbps_error_printf("xbps-bin: error registering %s "
|
||||
"(%s)\n", pkgver, strerror(rv));
|
||||
return rv;
|
||||
|
@ -184,7 +184,7 @@ main(int argc, char **argv)
|
||||
if (rv != 0)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
rv = xbps_register_pkg(dict, false);
|
||||
rv = xbps_register_pkg(dict);
|
||||
if (rv == EEXIST) {
|
||||
printf("%s%s=> %s-%s already registered.%s\n", MSG_WARN,
|
||||
in_chroot ? "[chroot] " : "", argv[1], argv[2],
|
||||
|
@ -776,14 +776,12 @@ int xbps_purge_all_pkgs(void);
|
||||
* Register a package into the installed packages database.
|
||||
*
|
||||
* @param[in] pkg_dict A dictionary with the following objects:
|
||||
* \a pkgname, \a version, \a pkgver, \a short_desc (string)
|
||||
* and optionally \a provides (array of strings).
|
||||
* @param[in] automatic Set it to true to mark package that has been
|
||||
* installed by another package, and not explicitly.
|
||||
* \a pkgname, \a version, \a pkgver, \a short_desc (string),
|
||||
* \a automatic-install (bool) and optionally \a provides (array of strings).
|
||||
*
|
||||
* @return 0 on success, otherwise an errno value.
|
||||
*/
|
||||
int xbps_register_pkg(prop_dictionary_t pkg_dict, bool automatic);
|
||||
int xbps_register_pkg(prop_dictionary_t pkg_dict);
|
||||
|
||||
/**
|
||||
* Unregister a package from the package database.
|
||||
|
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
int
|
||||
xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic)
|
||||
xbps_register_pkg(prop_dictionary_t pkgrd)
|
||||
{
|
||||
const struct xbps_handle *xhp;
|
||||
prop_dictionary_t dict, pkgd;
|
||||
@ -49,6 +49,7 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic)
|
||||
const char *pkgname, *version, *desc, *pkgver;
|
||||
char *plist;
|
||||
int rv = 0;
|
||||
bool autoinst;
|
||||
|
||||
xhp = xbps_handle_get();
|
||||
plist = xbps_xasprintf("%s/%s/%s", xhp->rootdir,
|
||||
@ -60,6 +61,7 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic)
|
||||
prop_dictionary_get_cstring_nocopy(pkgrd, "version", &version);
|
||||
prop_dictionary_get_cstring_nocopy(pkgrd, "short_desc", &desc);
|
||||
prop_dictionary_get_cstring_nocopy(pkgrd, "pkgver", &pkgver);
|
||||
prop_dictionary_get_bool(pkgrd, "automatic-install", &autoinst);
|
||||
provides = prop_dictionary_get(pkgrd, "provides");
|
||||
|
||||
assert(pkgname != NULL);
|
||||
@ -92,12 +94,17 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic)
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
prop_dictionary_get_bool(pkgd, "automatic-install", &autoinst);
|
||||
if (xhp->install_reason_auto)
|
||||
automatic = true;
|
||||
autoinst = true;
|
||||
else if (xhp->install_reason_manual)
|
||||
automatic = false;
|
||||
if (!prop_dictionary_set_bool(pkgd, "automatic-install",
|
||||
automatic)) {
|
||||
autoinst = false;
|
||||
|
||||
xbps_dbg_printf("%s: autoinst %d reason_auto %d reason_manual %d\n",
|
||||
pkgver, autoinst, xhp->install_reason_auto, xhp->install_reason_manual);
|
||||
|
||||
if (!prop_dictionary_set_bool(pkgd,
|
||||
"automatic-install", autoinst)) {
|
||||
prop_object_release(pkgd);
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user