FS#9173 - HoldPkg rework is needed
Attached to Project:
Pacman
Opened by Nagy Gabor (combo) - Saturday, 12 January 2008, 11:59 GMT
Last edited by Xavier (shining) - Wednesday, 14 January 2009, 13:45 GMT
Opened by Nagy Gabor (combo) - Saturday, 12 January 2008, 11:59 GMT
Last edited by Xavier (shining) - Wednesday, 14 January 2009, 13:45 GMT
|
Details
As I see HoldPkg is not very useful now.
1. It can be defined in pacman.conf only 2. It is used to filter explicit targets only (imho if user does a "pacman -R holdpkg" then he _really_ wants to remove it) 3. So holdpkg has no effect on implicit targets: see -Rc, -Rs and -S replaces(?) <- I think this is the place where holpkg would be useful. Ref.: http://www.archlinux.org/pipermail/pacman-dev/2007-November/010297.html |
This task depends upon
Closed by Xavier (shining)
Wednesday, 14 January 2009, 13:45 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented in git by commit a888f377a5c805f1da24b556e6a4a9e3678d8eb3
Wednesday, 14 January 2009, 13:45 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented in git by commit a888f377a5c805f1da24b556e6a4a9e3678d8eb3
Well, the patch is much simpler than expected. With -R it seems perfect.
1. If I understand correctly, this won't work with -S replaces, right? Because sync_commit doesn't pass callback functions to the created remove transaction. But this can be changed easily.
2. And maybe do a trans != REMOVEUPGRADE check for safety (now we skip the prepare part of REMOVEUPGRADE, so this is not a real problem).
3. My first thought was after reading your simple (=> nice) patch: Couldn't we implement this in front-end? (Do this check just before remove_commit in front-end). Of course after moving the whole holdpkg stuff there?
Pro:
+ simpler, cleaner back-end
Contras:
- in backend, we can do more sophisticated stuffs with holdpkg than in front-end, if needed (for example: ask confirmation before pulling -Rs selected holdpkg _dependency_)
- in front-end we should implement this twice: for -R and for -S %REPLACES% (if we want that)
2. Indeed, I saw it was skipped so I didn't add this check, but I agree it would be safer.
3. As you said, the current patch is very simple. Moving this to frontend would be a bit more work, and as you said, there are both advantages and inconvenient, so it is not clearly better. So I will propose this patch to Dan as it is. You are welcome to write a patch to move it to frontend if you like it better :)
To sum up, the only thing I am going to change to the patch is 2. (adding REMOVEUPGRADE check).
Thanks for the comments.
/* skip all checks if we are doing this removal as part of an upgrade */
if(trans->type == PM_TRANS_TYPE_REMOVEUPGRADE) {
return(0);
}
So checking this again as the end of the remove_prepare function looks weird, and it adds another level to the code, which I dislike :)
3. But this just gave me one more reason for implement HoldPkg in front-end, it eliminated my second contra. Probably I will write my front-end version based on your patch. I am pretty sure now, that holdpkg shouldn't belong to libalpm.
And if we prefer simplicity (ie. we don't implement sophisticated holdpkg stuffs, like in my first contra), the --holdpkg option (the 1. point in my request) is useless.
Indeed, I've missed that. Thx.
So no problem.
1. Well, during this discussion I convinced myself about the fact that _atm_ HoldPkg is just a spam in alpm. If the simple "just before trans_commit check" is enough, I vote for keeping my ML patch, and implement -S removes check later. (I suspect that with universal transaction we can share this holdpkg check codepart easily between -S and -R.)
2. On the other side, I always kept holdpkg analogous to ignorepkg, that's why I was suprised when you showed me your cool small patch. To be more concrete, I like ignorepkg because I can _affect_ some libalpm mechanisms, see resolvedeps for example. With (an "advanced") holdpkg user could affect -Rs, which would mean: select all unused dependencies except holdpkg (that's why I first thought about --holdpkg option). In this case holdpkg-stuff asks confirmation for "adding holdpkg to transaction" not confirmation for "continue" (so HoldPkg acts like a filter similar to ignorepkg). Ignorepkg and holdpkg represent some kind of "hidden" packages in this interpretation.
So the question is, whether it is worth thinking about 2 or no? (In future?) If no, ie. we choose the simple holdpkg (pre-commit check), I can confirm my ML-patch.
2. I see your point and it is interesting, but in my opinion it is not that useful. I never felt the need for that, and never saw any user requesting it.
The patch is applied in my git repo.