[pacman-dev] IgnorePkg handling
I just found another thing I overlooked in a patch I submitted a while ago : "Let IgnorePkg superceed the FORCE package flag" , commit 5de03497c3f. I didn't see a change Dan made one month before : "* --ignore was being ignored (haha) on sysupgrade when a package was listed as being a force upgrade. This adds a prompt to the user in this case asking what to do." , commit 4a0aac3862 . So the change I made in alpm_pkg_compare_versions made this fix from Dan in _alpm_sync_sysupgrade obsolete. This code can't be run anymore. So I don't know, maybe this commit could be reverted now?
On Nov 15, 2007 4:27 PM, Xavier <shiningxc@gmail.com> wrote:
I just found another thing I overlooked in a patch I submitted a while ago : "Let IgnorePkg superceed the FORCE package flag" , commit 5de03497c3f.
I didn't see a change Dan made one month before : "* --ignore was being ignored (haha) on sysupgrade when a package was listed as being a force upgrade. This adds a prompt to the user in this case asking what to do." , commit 4a0aac3862 .
So the change I made in alpm_pkg_compare_versions made this fix from Dan in _alpm_sync_sysupgrade obsolete. This code can't be run anymore. So I don't know, maybe this commit could be reverted now?
Something like this? lib/libalpm/sync.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-) diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index e5748e6..16ea5c2 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -213,15 +213,6 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s alpm_pkg_get_name(local), alpm_pkg_get_version(local), alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg)); 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_pkg_should_ignore(local)) { - int resp = 0; - QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp); - if(!resp) { - continue; - } - } pmpkg_t *tmp = _alpm_pkg_dup(local); if(tmp == NULL) { goto error;
On Thu, Nov 15, 2007 at 04:41:59PM -0600, Dan McGee wrote:
On Nov 15, 2007 4:27 PM, Xavier <shiningxc@gmail.com> wrote:
I just found another thing I overlooked in a patch I submitted a while ago : "Let IgnorePkg superceed the FORCE package flag" , commit 5de03497c3f.
I didn't see a change Dan made one month before : "* --ignore was being ignored (haha) on sysupgrade when a package was listed as being a force upgrade. This adds a prompt to the user in this case asking what to do." , commit 4a0aac3862 .
So the change I made in alpm_pkg_compare_versions made this fix from Dan in _alpm_sync_sysupgrade obsolete. This code can't be run anymore. So I don't know, maybe this commit could be reverted now?
Something like this?
lib/libalpm/sync.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index e5748e6..16ea5c2 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -213,15 +213,6 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
alpm_pkg_get_name(local), alpm_pkg_get_version(local),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg)); 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_pkg_should_ignore(local)) { - int resp = 0; - QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp); - if(!resp) { - continue; - } - } pmpkg_t *tmp = _alpm_pkg_dup(local); if(tmp == NULL) { goto error;
Yes, that looks fine. I should probably check the other places where should_ignore is used though.
On Fri, Nov 16, 2007 at 12:39:47PM +0100, Xavier wrote:
Yes, that looks fine. I should probably check the other places where should_ignore is used though.
I rather looked at where compare_versions was used. Only three times, two in sync.c (sysupgrade and addtarget) and one in db.c (get_upgrades duplicated from sysupgrade). In sysupgrade, there was, as I mentioned, an additional ignore check that was no longer used. In get_upgrades, there wasn't anything. And finally, in addtarget, there was a special ignore handling. So based on that, I thought the ignorepkg handling could be as well removed from compare_versions, and handled manually by the callers. By the way, isn't it rather strange that the ignorepkg handling in addtarget is made only when the package is locally installed? For example :
sudo pacman -S bash --ignore bash :: bash is in IgnorePkg/IgnoreGroup. Install anyway? [Y/n] n sudo pacman -S arts --ignore arts resolving dependencies... done. looking for inter-conflicts... done.
Targets: xdg-utils-1.0.2-1 archlinux-menus-1.2-1 kde-common-3.5.8-1 audiofile-0.2.6-3 esd-0.2.38-3 arts-1.5.8-2 Total Download Size: 1.74 MB Proceed with installation? [Y/n]
On Fri, Nov 16, 2007 at 03:54:51PM +0100, Xavier wrote:
By the way, isn't it rather strange that the ignorepkg handling in addtarget is made only when the package is locally installed?
For example :
sudo pacman -S bash --ignore bash :: bash is in IgnorePkg/IgnoreGroup. Install anyway? [Y/n] n sudo pacman -S arts --ignore arts resolving dependencies... done. looking for inter-conflicts... done.
Targets: xdg-utils-1.0.2-1 archlinux-menus-1.2-1 kde-common-3.5.8-1 audiofile-0.2.6-3 esd-0.2.38-3 arts-1.5.8-2
Total Download Size: 1.74 MB
Proceed with installation? [Y/n]
Thinking about it again, it seems alright to ignore IgnorePkg on -S operations. If someone has IgnorePkg = arts in pacman.conf, but explictly does a pacman -S arts, he probably wants to install it. And no one would ever do pacman -S arts --ignore arts, because that doesn't make any sense :)
And check the IgnorePkg handling is done correctly in the other places. For example, -Qu and -Su will automatically skip the ignored packages (-Su will print a warning), but -S will install ignored packages anyway, because it was asked explicitly. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> --- lib/libalpm/db.c | 6 +++++- lib/libalpm/package.c | 10 ---------- lib/libalpm/sync.c | 29 +++++++++++------------------ 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 150b365..e6f8d97 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -463,7 +463,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_pkg_should_ignore(lpkg)) { + 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)); @@ -544,6 +544,10 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void) syncpkg = _alpm_sync_find(syncpkgs, alpm_pkg_get_name(local)); if(!syncpkg) { + /* If package is in the ignorepkg list, skip it */ + if(_alpm_pkg_should_ignore(spkg)) { + continue; + } pmpkg_t *dummy = _alpm_pkg_new(alpm_pkg_get_name(local), alpm_pkg_get_version(local)); if(dummy == NULL) { diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index d992766..b9e2f94 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -732,16 +732,6 @@ 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_pkg_should_ignore(pkg)) { - /* package should be ignored (IgnorePkg) */ - if(cmp > 0) { - _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)\n"), - alpm_pkg_get_name(local_pkg), alpm_pkg_get_version(local_pkg), - alpm_pkg_get_version(pkg)); - } - return(0); - } - if(cmp != 0 && pkg->force) { cmp = 1; _alpm_log(PM_LOG_WARNING, _("%s: forcing upgrade to version %s\n"), diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index e5748e6..f6d8688 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -209,18 +209,16 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s /* compare versions and see if we need to upgrade */ if(alpm_pkg_compare_versions(local, spkg)) { - _alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (%s => %s)\n", + _alpm_log(PM_LOG_DEBUG, "%s elected for upgrade (%s => %s)\n", alpm_pkg_get_name(local), alpm_pkg_get_version(local), - alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg)); + alpm_pkg_get_version(spkg)); 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_pkg_should_ignore(local)) { - int resp = 0; - QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp); - if(!resp) { - continue; - } + /* If package is in the ignorepkg list, skip it */ + if(_alpm_pkg_should_ignore(spkg)) { + _alpm_log(PM_LOG_WARNING, _("%s: ignoring package upgrade (%s => %s)\n"), + alpm_pkg_get_name(local), alpm_pkg_get_version(local), + alpm_pkg_get_version(spkg)); + continue; } pmpkg_t *tmp = _alpm_pkg_dup(local); if(tmp == NULL) { @@ -319,17 +317,12 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy if(local) { if(alpm_pkg_compare_versions(local, spkg) == 0) { /* spkg is NOT an upgrade, get confirmation before adding */ - int resp = 0; - if(_alpm_pkg_should_ignore(local)) { - QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp); - if(!resp) { - return(0); - } - } else if(!(trans->flags & PM_TRANS_FLAG_PRINTURIS)) { + if(!(trans->flags & PM_TRANS_FLAG_PRINTURIS)) { + int resp = 0; QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp); if(!resp) { _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"), - alpm_pkg_get_name(local), alpm_pkg_get_version(local)); + alpm_pkg_get_name(local), alpm_pkg_get_version(local)); return(0); } } -- 1.5.3.5
participants (3)
-
Chantry Xavier
-
Dan McGee
-
Xavier