xbps_remove_pkg: do not error out if files.plist not found, just continue.

This commit is contained in:
Juan RP 2012-05-21 23:03:29 +02:00
parent 30932b3c55
commit 9acec7883b
3 changed files with 26 additions and 30 deletions

4
NEWS
View File

@ -1,5 +1,9 @@
xbps-0.16 (???): xbps-0.16 (???):
* libxbps: when removing package files and if metadata files.plist wasn't
found, do not error out and rather just continue until the package is
fully removed.
* xbps-bin(8): renamed "autoupdate" target to "dist-upgrade" and * xbps-bin(8): renamed "autoupdate" target to "dist-upgrade" and
"autoremove" to "remove-orphans". For compatibility with previous "autoremove" to "remove-orphans". For compatibility with previous
versions the old targets are still kept, but will be removed in future versions the old targets are still kept, but will be removed in future

View File

@ -56,7 +56,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.4" #define XBPS_PKGINDEX_VERSION "1.4"
#define XBPS_API_VERSION "20120508" #define XBPS_API_VERSION "20120521"
#define XBPS_VERSION "0.16" #define XBPS_VERSION "0.16"
/** /**

View File

@ -328,38 +328,31 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
} }
pkgd = xbps_dictionary_from_metadata_plist(pkgname, XBPS_PKGFILES); pkgd = xbps_dictionary_from_metadata_plist(pkgname, XBPS_PKGFILES);
if (pkgd == NULL) { if (pkgd) {
rv = errno; /* Remove links */
goto out; if ((rv = xbps_remove_pkg_files(pkgd, "links", pkgver)) != 0)
goto out;
/* Remove regular files */
if ((rv = xbps_remove_pkg_files(pkgd, "files", pkgver)) != 0)
goto out;
/* Remove configuration files */
if ((rv = xbps_remove_pkg_files(pkgd, "conf_files", pkgver)) != 0)
goto out;
/* Remove dirs */
if ((rv = xbps_remove_pkg_files(pkgd, "dirs", pkgver)) != 0)
goto out;
} }
/* Remove links */
if ((rv = xbps_remove_pkg_files(pkgd, "links", pkgver)) != 0)
goto out;
/* Remove regular files */
if ((rv = xbps_remove_pkg_files(pkgd, "files", pkgver)) != 0)
goto out;
/* Remove configuration files */
if ((rv = xbps_remove_pkg_files(pkgd, "conf_files", pkgver)) != 0)
goto out;
/* Remove dirs */
if ((rv = xbps_remove_pkg_files(pkgd, "dirs", pkgver)) != 0)
goto out;
/* /*
* Execute the post REMOVE action if file exists and we aren't * Execute the post REMOVE action if file exists and we aren't
* updating the package. * updating the package.
*/ */
if (rmfile_exists && if (rmfile_exists &&
(xbps_file_exec(buf, "post", pkgname, version, "no", ((rv = xbps_file_exec(buf, "post", pkgname, version, "no",
xhp->conffile, NULL) != 0)) { xhp->conffile, NULL)) != 0)) {
xbps_set_cb_state(XBPS_STATE_REMOVE_FAIL, xbps_set_cb_state(XBPS_STATE_REMOVE_FAIL,
errno, pkgname, version, rv, pkgname, version,
"%s: [remove] REMOVE script failed to execute " "%s: [remove] REMOVE script failed to execute "
"post ACTION: %s", pkgver, strerror(errno)); "post ACTION: %s", pkgver, strerror(rv));
rv = errno;
goto out; goto out;
} }
/* /*
@ -390,13 +383,12 @@ purge:
* Execute the purge REMOVE action if file exists. * Execute the purge REMOVE action if file exists.
*/ */
if (access(buf, X_OK) == 0) { if (access(buf, X_OK) == 0) {
if (xbps_file_exec(buf, "purge", pkgname, version, "no", if ((rv = xbps_file_exec(buf, "purge", pkgname, version, "no",
xhp->conffile, NULL) != 0) { xhp->conffile, NULL)) != 0) {
rv = errno;
xbps_set_cb_state(XBPS_STATE_REMOVE_FAIL, xbps_set_cb_state(XBPS_STATE_REMOVE_FAIL,
errno, pkgname, version, rv, pkgname, version,
"%s: REMOVE script failed to execute " "%s: REMOVE script failed to execute "
"purge ACTION: %s", pkgver, strerror(errno)); "purge ACTION: %s", pkgver, strerror(rv));
goto out; goto out;
} }
} }