mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
Implement IgnoreGroup.
This option acts as if IgnorePkg was set on each package in the group. This closes FS#1592. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
5c58b3d500
commit
3312de65e6
@ -462,7 +462,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
|
||||
if(strcmp(k->data, alpm_pkg_get_name(lpkg)) == 0) {
|
||||
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'\n",
|
||||
(char *)k->data, alpm_pkg_get_name(spkg));
|
||||
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(lpkg))) {
|
||||
if(_alpm_pkg_should_ignore(lpkg)) {
|
||||
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"),
|
||||
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
|
||||
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
|
||||
|
@ -730,7 +730,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
|
||||
* something we're not supposed to.
|
||||
*/
|
||||
int usedep = 1;
|
||||
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(sync))) {
|
||||
if(_alpm_pkg_should_ignore(sync)) {
|
||||
pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL);
|
||||
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep);
|
||||
_alpm_pkg_free(dummypkg);
|
||||
|
@ -755,7 +755,7 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
|
||||
/* compare versions and see if we need to upgrade */
|
||||
cmp = _alpm_versioncmp(alpm_pkg_get_version(pkg), alpm_pkg_get_version(local_pkg));
|
||||
|
||||
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(pkg))) {
|
||||
if(_alpm_pkg_should_ignore(pkg)) {
|
||||
/* package should be ignored (IgnorePkg) */
|
||||
if(cmp > 0) {
|
||||
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)\n"),
|
||||
@ -1117,4 +1117,34 @@ int _alpm_pkg_istoonew(pmpkg_t *pkg)
|
||||
time(&t);
|
||||
return((pkg->date + handle->upgradedelay) > t);
|
||||
}
|
||||
|
||||
/** Test if a package should be ignored.
|
||||
*
|
||||
* Checks if the package is ignored via IgnorePkg, or if the package is
|
||||
* in a group ignored via IgnoreGrp.
|
||||
*
|
||||
* @param pkg the package to test
|
||||
*
|
||||
* @return 1 if the package should be ignored, 0 otherwise
|
||||
*/
|
||||
int _alpm_pkg_should_ignore(pmpkg_t *pkg)
|
||||
{
|
||||
alpm_list_t *groups = NULL;
|
||||
|
||||
/* first see if the package is ignored */
|
||||
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(pkg))) {
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* next see if the package is in a group that is ignored */
|
||||
for(groups = handle->ignoregrp; groups; groups = alpm_list_next(groups)) {
|
||||
char *grp = (char *)alpm_list_getdata(groups);
|
||||
if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) {
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* vim: set ts=2 sw=2 noet: */
|
||||
|
@ -99,6 +99,7 @@ pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full);
|
||||
pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack);
|
||||
int _alpm_pkg_istoonew(pmpkg_t *pkg);
|
||||
void _alpm_pkg_update_requiredby(pmpkg_t *pkg);
|
||||
int _alpm_pkg_should_ignore(pmpkg_t *pkg);
|
||||
|
||||
#endif /* _ALPM_PACKAGE_H */
|
||||
|
||||
|
@ -118,8 +118,7 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
|
||||
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'\n",
|
||||
replacement, spkg->name);
|
||||
/* ignore if EITHER the local or replacement package are to be ignored */
|
||||
if(alpm_list_find_str(handle->ignorepkg, spkg->name)
|
||||
|| alpm_list_find_str(handle->ignorepkg, lpkg->name)) {
|
||||
if(_alpm_pkg_should_ignore(spkg) || _alpm_pkg_should_ignore(lpkg)) {
|
||||
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"),
|
||||
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
|
||||
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
|
||||
@ -217,7 +216,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
|
||||
if(!_alpm_sync_find(trans->packages, alpm_pkg_get_name(spkg))) {
|
||||
/* If package is in the ignorepkg list, ask before we add it to
|
||||
* the transaction */
|
||||
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(local))) {
|
||||
if(_alpm_pkg_should_ignore(local)) {
|
||||
int resp = 0;
|
||||
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp);
|
||||
if(!resp) {
|
||||
@ -322,7 +321,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
|
||||
if(alpm_pkg_compare_versions(local, spkg) == 0) {
|
||||
/* spkg is NOT an upgrade, get confirmation before adding */
|
||||
int resp = 0;
|
||||
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(local))) {
|
||||
if(_alpm_pkg_should_ignore(local)) {
|
||||
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp);
|
||||
if(!resp) {
|
||||
return(0);
|
||||
|
@ -274,12 +274,12 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
|
||||
case PM_TRANS_CONV_INSTALL_IGNOREPKG:
|
||||
if(data2) {
|
||||
/* TODO we take this route based on data2 being not null? WTF */
|
||||
snprintf(str, LOG_STR_LEN, _(":: %s requires installing %s from IgnorePkg. Install anyway? [Y/n] "),
|
||||
snprintf(str, LOG_STR_LEN, _(":: %s requires installing %s from IgnorePkg/IgnoreGroup. Install anyway? [Y/n] "),
|
||||
alpm_pkg_get_name(data1),
|
||||
alpm_pkg_get_name(data2));
|
||||
*response = yesno(str);
|
||||
} else {
|
||||
snprintf(str, LOG_STR_LEN, _(":: %s is in IgnorePkg. Install anyway? [Y/n] "),
|
||||
snprintf(str, LOG_STR_LEN, _(":: %s is in IgnorePkg/IgnoreGroup. Install anyway? [Y/n] "),
|
||||
alpm_pkg_get_name(data1));
|
||||
*response = yesno(str);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user