Repair upgrades of preserve packages, i.e kernel.
--HG-- extra : convert_revision : xtraeme%40gmail.com-20100125052754-6xri8lfmykhof5dz
This commit is contained in:
parent
7f343b8dbe
commit
17d87b3559
@ -474,7 +474,8 @@ replace_packages(prop_object_iterator_t iter, const char *pkgver)
|
|||||||
prop_object_release(instd);
|
prop_object_release(instd);
|
||||||
|
|
||||||
version = xbps_get_pkg_version(pkgver);
|
version = xbps_get_pkg_version(pkgver);
|
||||||
if ((rv = xbps_remove_pkg(reppkgn, version, false)) != 0) {
|
rv = xbps_remove_pkg(reppkgn, version, false, false);
|
||||||
|
if (rv != 0) {
|
||||||
fprintf(stderr, "xbps-bin: couldn't remove %s (%s)\n",
|
fprintf(stderr, "xbps-bin: couldn't remove %s (%s)\n",
|
||||||
reppkgn, strerror(rv));
|
reppkgn, strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
@ -607,7 +608,7 @@ exec_transaction(struct transaction *trans)
|
|||||||
printf("Removing %s-%s before installing new "
|
printf("Removing %s-%s before installing new "
|
||||||
"version ...\n", pkgname, instver);
|
"version ...\n", pkgname, instver);
|
||||||
|
|
||||||
rv = xbps_remove_pkg(pkgname, version, true);
|
rv = xbps_remove_pkg(pkgname, version, true, essential);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
fprintf(stderr, "xbps-bin: error "
|
fprintf(stderr, "xbps-bin: error "
|
||||||
"%s %s-%s (%s)\n", essential ?
|
"%s %s-%s (%s)\n", essential ?
|
||||||
|
@ -105,7 +105,7 @@ xbps_autoremove_pkgs(bool force)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
printf("Removing package %s-%s ...\n", pkgname, version);
|
printf("Removing package %s-%s ...\n", pkgname, version);
|
||||||
if ((rv = xbps_remove_pkg(pkgname, version, false)) != 0)
|
if ((rv = xbps_remove_pkg(pkgname, version, false, false)) != 0)
|
||||||
goto out2;
|
goto out2;
|
||||||
}
|
}
|
||||||
out2:
|
out2:
|
||||||
@ -185,7 +185,8 @@ xbps_remove_installed_pkgs(int argc, char **argv, bool force)
|
|||||||
continue;
|
continue;
|
||||||
prop_dictionary_get_cstring_nocopy(dict, "version", &version);
|
prop_dictionary_get_cstring_nocopy(dict, "version", &version);
|
||||||
printf("Removing package %s-%s ...\n", argv[i], version);
|
printf("Removing package %s-%s ...\n", argv[i], version);
|
||||||
if ((rv = xbps_remove_pkg(argv[i], version, false)) != 0) {
|
rv = xbps_remove_pkg(argv[i], version, false, false);
|
||||||
|
if (rv != 0) {
|
||||||
fprintf(stderr, "E: unable to remove %s-%s (%s).\n",
|
fprintf(stderr, "E: unable to remove %s-%s (%s).\n",
|
||||||
argv[i], version, strerror(errno));
|
argv[i], version, strerror(errno));
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -640,10 +640,12 @@ void xbps_regpkgs_dictionary_release(void);
|
|||||||
* @param[in] update If true, and depending if \a pkgname is an
|
* @param[in] update If true, and depending if \a pkgname is an
|
||||||
* <em>essential</em> package, some steps will be skipped. See in the
|
* <em>essential</em> package, some steps will be skipped. See in the
|
||||||
* detailed description section for more information.
|
* detailed description section for more information.
|
||||||
|
* @param[in] essential Set it to true if \a pkgname is essential.
|
||||||
*
|
*
|
||||||
* @return 0 on success, or an errno value otherwise.
|
* @return 0 on success, or an errno value otherwise.
|
||||||
*/
|
*/
|
||||||
int xbps_remove_pkg(const char *pkgname, const char *version, bool update);
|
int xbps_remove_pkg(const char *pkgname, const char *version,
|
||||||
|
bool update, bool essential);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove files defined in a proplib array as specified by \a key
|
* Remove files defined in a proplib array as specified by \a key
|
||||||
|
16
lib/remove.c
16
lib/remove.c
@ -174,13 +174,14 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xbps_remove_pkg(const char *pkgname, const char *version, bool update)
|
xbps_remove_pkg(const char *pkgname, const char *version,
|
||||||
|
bool update, bool essential)
|
||||||
{
|
{
|
||||||
prop_dictionary_t dict, pkgd;
|
prop_dictionary_t dict;
|
||||||
const char *rootdir = xbps_get_rootdir();
|
const char *rootdir = xbps_get_rootdir();
|
||||||
char *path, *buf;
|
char *path, *buf;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
bool essential = false, prepostf = false;
|
bool prepostf = false;
|
||||||
|
|
||||||
assert(pkgname != NULL);
|
assert(pkgname != NULL);
|
||||||
assert(version != NULL);
|
assert(version != NULL);
|
||||||
@ -188,12 +189,9 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
|
|||||||
/*
|
/*
|
||||||
* Check if pkg is installed before anything else.
|
* Check if pkg is installed before anything else.
|
||||||
*/
|
*/
|
||||||
if ((pkgd = xbps_find_pkg_dict_installed(pkgname, false)) == NULL)
|
if (!xbps_check_is_installed_pkgname(pkgname))
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|
||||||
prop_dictionary_get_bool(pkgd, "essential", &essential);
|
|
||||||
prop_object_release(pkgd);
|
|
||||||
|
|
||||||
if (strcmp(rootdir, "") == 0)
|
if (strcmp(rootdir, "") == 0)
|
||||||
rootdir = "/";
|
rootdir = "/";
|
||||||
|
|
||||||
@ -230,8 +228,10 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
|
|||||||
* entries and continue. Its files will be overwritten later in
|
* entries and continue. Its files will be overwritten later in
|
||||||
* the unpack phase.
|
* the unpack phase.
|
||||||
*/
|
*/
|
||||||
if (essential && update)
|
if (essential && update) {
|
||||||
|
free(buf);
|
||||||
return xbps_requiredby_pkg_remove(pkgname);
|
return xbps_requiredby_pkg_remove(pkgname);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove links, files and dirs.
|
* Remove links, files and dirs.
|
||||||
|
Loading…
Reference in New Issue
Block a user