Skip removing obsolete files in some cases.

This commit is contained in:
Juan RP 2012-02-20 20:23:33 +01:00
parent fd5d8b9f51
commit c965c27dfb
4 changed files with 18 additions and 8 deletions

7
NEWS
View File

@ -1,4 +1,9 @@
xbps-0.12.1 (2012-02-14):
xbps-0.13.0 (???):
* libxbps: skip checking for obsolete files if a package in a transaction
replaces another one that is going to be updated. In such cases that means
new package now owns some files previously owned by the package to be
updated, therefore the updated package must not check for obsolete files.
* xbps-repo(8): the `show', `show-deps' and `show-files' targets now accept
package patterns, i.e "xbps-repo show 'foo>=2.0'". If only a `pkgname`

View File

@ -56,8 +56,8 @@
*/
#define XBPS_PKGINDEX_VERSION "1.4"
#define XBPS_API_VERSION "20120214-1"
#define XBPS_VERSION "0.12"
#define XBPS_API_VERSION "20120220"
#define XBPS_VERSION "0.13"
/**
* @def XBPS_RELVER

View File

@ -164,13 +164,14 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
const char *entry_pname, *transact, *pkgname, *version, *pkgver, *fname;
char *buf = NULL, *pkgfilesd = NULL;
int rv, flags;
bool preserve, update, conf_file, file_exists;
bool preserve, update, conf_file, file_exists, skip_obsoletes;
assert(prop_object_type(pkg_repod) == PROP_TYPE_DICTIONARY);
assert(ar != NULL);
preserve = update = conf_file = file_exists = false;
preserve = update = conf_file = file_exists = skip_obsoletes = false;
prop_dictionary_get_bool(pkg_repod, "preserve", &preserve);
prop_dictionary_get_bool(pkg_repod, "skip-obsoletes", &skip_obsoletes);
prop_dictionary_get_cstring_nocopy(pkg_repod,
"transaction", &transact);
prop_dictionary_get_cstring_nocopy(pkg_repod, "pkgname", &pkgname);
@ -474,8 +475,10 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
goto out;
}
/*
* On pkgs that set the preserve keyword or while installing
* new packages, do not check for obsolete files.
* Skip checking for obsolete files on:
* - New package installation.
* - Package with "preserve" keyword.
* - Package with "skip-obsoletes" keyword.
*/
pkgfilesd = xbps_xasprintf("%s/metadata/%s/%s",
XBPS_META_PATH, pkgname, XBPS_PKGFILES);
@ -483,7 +486,7 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
rv = ENOMEM;
goto out;
}
if (preserve || !update)
if (skip_obsoletes || preserve || !update)
goto out1;
/*
* Check for obsolete files.

View File

@ -118,6 +118,8 @@ xbps_transaction_package_replace(prop_dictionary_t transd)
}
prop_dictionary_set_bool(reppkgd,
"automatic-install", instd_auto);
prop_dictionary_set_bool(reppkgd,
"skip-obsoletes", true);
xbps_array_replace_dict_by_name(transd_unsorted,
reppkgd, curpkgname);
}