When removing pkg files, remove only dangling symlinks after regular files.
This is required for the upcoming eglibc package.
This commit is contained in:
parent
a14886ab48
commit
d075f7182a
9
NEWS
9
NEWS
@ -1,5 +1,14 @@
|
|||||||
xbps-0.16 (???):
|
xbps-0.16 (???):
|
||||||
|
|
||||||
|
* libxbps: change the order in which package files are removed:
|
||||||
|
|
||||||
|
current: files, conf_files, links, directories.
|
||||||
|
previous: links, files, conf_files, directories.
|
||||||
|
|
||||||
|
This is required to avoid removing working symlinks, which could be
|
||||||
|
owned by another installed package. Now only dangling symlinks are now
|
||||||
|
removed.
|
||||||
|
|
||||||
* libxbps: when removing package files and if metadata files.plist wasn't
|
* 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
|
found, do not error out and rather just continue until the package is
|
||||||
fully removed.
|
fully removed.
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
*/
|
*/
|
||||||
#define XBPS_PKGINDEX_VERSION "1.4"
|
#define XBPS_PKGINDEX_VERSION "1.4"
|
||||||
|
|
||||||
#define XBPS_API_VERSION "20120521"
|
#define XBPS_API_VERSION "20120525"
|
||||||
#define XBPS_VERSION "0.16"
|
#define XBPS_VERSION "0.16"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,11 +131,13 @@ xbps_remove_pkg_files(prop_dictionary_t dict,
|
|||||||
const char *pkgver)
|
const char *pkgver)
|
||||||
{
|
{
|
||||||
struct xbps_handle *xhp;
|
struct xbps_handle *xhp;
|
||||||
|
struct stat st;
|
||||||
prop_array_t array;
|
prop_array_t array;
|
||||||
prop_object_iterator_t iter;
|
prop_object_iterator_t iter;
|
||||||
prop_object_t obj;
|
prop_object_t obj;
|
||||||
const char *file, *sha256, *version, *curobj = NULL;
|
const char *file, *sha256, *version, *curobj = NULL;
|
||||||
char *path = NULL, *pkgname = NULL;
|
char *path = NULL, *pkgname = NULL;
|
||||||
|
char buf[PATH_MAX];
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
assert(prop_object_type(dict) == PROP_TYPE_DICTIONARY);
|
assert(prop_object_type(dict) == PROP_TYPE_DICTIONARY);
|
||||||
@ -220,6 +222,22 @@ xbps_remove_pkg_files(prop_dictionary_t dict,
|
|||||||
free(path);
|
free(path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(key, "links") == 0) {
|
||||||
|
/*
|
||||||
|
* All regular files from package were removed at this
|
||||||
|
* point, so we will only remove dangling symlinks.
|
||||||
|
*/
|
||||||
|
if (realpath(path, buf) == NULL) {
|
||||||
|
if (errno != ENOENT) {
|
||||||
|
free(path);
|
||||||
|
rv = errno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stat(buf, &st) == 0) {
|
||||||
|
free(path);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Remove the object if possible.
|
* Remove the object if possible.
|
||||||
@ -329,15 +347,15 @@ 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) {
|
if (pkgd) {
|
||||||
/* Remove links */
|
|
||||||
if ((rv = xbps_remove_pkg_files(pkgd, "links", pkgver)) != 0)
|
|
||||||
goto out;
|
|
||||||
/* Remove regular files */
|
/* Remove regular files */
|
||||||
if ((rv = xbps_remove_pkg_files(pkgd, "files", pkgver)) != 0)
|
if ((rv = xbps_remove_pkg_files(pkgd, "files", pkgver)) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
/* Remove configuration files */
|
/* Remove configuration files */
|
||||||
if ((rv = xbps_remove_pkg_files(pkgd, "conf_files", pkgver)) != 0)
|
if ((rv = xbps_remove_pkg_files(pkgd, "conf_files", pkgver)) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
/* Remove links */
|
||||||
|
if ((rv = xbps_remove_pkg_files(pkgd, "links", pkgver)) != 0)
|
||||||
|
goto out;
|
||||||
/* Remove dirs */
|
/* Remove dirs */
|
||||||
if ((rv = xbps_remove_pkg_files(pkgd, "dirs", pkgver)) != 0)
|
if ((rv = xbps_remove_pkg_files(pkgd, "dirs", pkgver)) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
Loading…
Reference in New Issue
Block a user