Re: [pacman-dev] Hooks for pacman, more ideas
----- "Mårten Olsson" <marten.olsson@purplescout.se> wrote:
----- "Allan McRae" <allan@archlinux.org> skrev:
<snip>
I'm sure it would be possible to have a package set off a hook such as you are suggesting, although I think most packages would have a file that would be the obvious choice to use (e.g. /boot/vmlinuz26 for kernel26). Please add a comment to the wiki page about this.
Yep, I don't see that as a major problem. From what I have seen of the code it might however be easier to start with Package matching (I might be wrong about this but it is my personal opinion). In the end both options would be good, we have at least seen that between us that both variants are desirable.
From my understanding, there should be a list of files involved in a transaction created during conflict checking. So we can hopefully use that to test which hooks need to be run. However, I am not very familiar with that part of the pacman code...
Ah that seems resonable.
I have done some looking around and the as far as I understand it it would be possible to use "alpm_pkg_get_files" whenever a package is installed/ upgraded/removed to find files to match. Do you know if that is possible? Also it seems like good places to check the hooks would be around the same places where it is currently checked if a package has a scriptlet (where "alpm_pkg_has_scriptlet" is called in the "commit_single_pkg" and "_alpm_remove_commit" functions). The hooks should probably be run after the package scriptlets, rigth? Your ideas? I also have tried to find good places for the "Transaction" hooks but have really found a really good place, maybe in "_alpm_trans_free" but I don't understand enought about the transation part of the code to determine if that is a good place... I also have one question about the config syntax: Currently the syntax is something like: [<script to run>] Files = <file to match> (or Package = <packagename> if that idea is added) Run = <time to run the script> [<script to run2>] Files = <file to match2> (or Package = <packagename2> if that idea is added) Run = <time to run the script> What about lay it out like this instead: [time to run the script] File = <file to match> (or package) Run = <script> File = <file to match2> (or package2) Run = <script2> [time to run the script2] File = <file to match3> (or package) Run = <script3> My personal opinion is that it gives a cleaner seperation as the "section header" determines at which point "in time" to run the hook and it would be more static thing to search/compare with when parsing the config. What do you think?
Allan
//Mårten
Mårten Olsson wrote:
----- "Mårten Olsson" <marten.olsson@purplescout.se> wrote:
----- "Allan McRae" <allan@archlinux.org> skrev:
<snip>
I'm sure it would be possible to have a package set off a hook
such
as
you are suggesting, although I think most packages would have a
file
that would be the obvious choice to use (e.g. /boot/vmlinuz26 for kernel26). Please add a comment to the wiki page about this.
Yep, I don't see that as a major problem. From what I have seen of the code it might however be easier to
start
with Package matching (I might be wrong about this but it is my
personal
opinion). In the end both options would be good, we have at least seen that between us that both variants are desirable.
From my understanding, there should be a list of files involved in
a
transaction created during conflict checking. So we can hopefully
use
that to test which hooks need to be run. However, I am not very familiar with that part of the pacman code...
Ah that seems resonable.
I have done some looking around and the as far as I understand it it would be possible to use "alpm_pkg_get_files" whenever a package is installed/ upgraded/removed to find files to match.
Do you know if that is possible?
No idea... I haven't looked to far into the implementation issues yet.
Also it seems like good places to check the hooks would be around the same places where it is currently checked if a package has a scriptlet (where "alpm_pkg_has_scriptlet" is called in the "commit_single_pkg" and "_alpm_remove_commit" functions).
The hooks should probably be run after the package scriptlets, rigth?
Your ideas?
I thought that they could all be run at the end of the transaction. Some hooks are once per transaction hooks so will need to run then anyway. Again, no ideas about the actual implementation.
I also have tried to find good places for the "Transaction" hooks but have really found a really good place, maybe in "_alpm_trans_free" but I don't understand enought about the transation part of the code to determine if that is a good place...
I also have one question about the config syntax: Currently the syntax is something like: [<script to run>] Files = <file to match> (or Package = <packagename> if that idea is added) Run = <time to run the script>
[<script to run2>] Files = <file to match2> (or Package = <packagename2> if that idea is added) Run = <time to run the script>
What about lay it out like this instead: [time to run the script] File = <file to match> (or package) Run = <script> File = <file to match2> (or package2) Run = <script2>
[time to run the script2] File = <file to match3> (or package) Run = <script3>
My personal opinion is that it gives a cleaner seperation as the "section header" determines at which point "in time" to run the hook and it would be more static thing to search/compare with when parsing the config.
What do you think
That is a possibility. Add it to the wiki page. This is going to be quite a big change and we need to get configuration files right so any comments in that area are very useful. Cheers, Allan
On 03/02/2009, at 7:53 AM, Mårten Olsson wrote:
I also have tried to find good places for the "Transaction" hooks but have really found a really good place, maybe in "_alpm_trans_free" but I don't understand enought about the transation part of the code to determine if that is a good place...
_alpm_trans_free() is actually called a couple times in a transaction, so I wouldn't use that. As far as I can see the same issue applies to _alpm_trans_commit(), so the best place I can see is in alpm_trans_commit().
participants (3)
-
Allan McRae
-
Mårten Olsson
-
Sebastian Nowicki