[pacman-dev] So many HOOK puns could go here!

Allan McRae allan at archlinux.org
Fri Jul 5 17:50:26 EDT 2013


On 06/07/13 04:20, Andrew Gregory wrote:
> On 07/06/13 at 01:08am, Allan McRae wrote:
>>
>>
>> Looking at the ini parsing patch yesterday motivated me to get hooks
>> implemented.  But first we need to completely flesh out the details.
>> This is too complex of a change to make up as we go along.
>>
>> >From the mention of the previous patch, you should be able to figure out
>> the format I am pushing...
>>
>> Look here:
>> https://wiki.archlinux.org/index.php/User:Allan/Pacman_Hooks
>>
>>
>> Questions to answer:
>>
>> 1) Should hooks have a defined suffix.
>> PRO: Avoids .pac{save,new} conflicts
>> CON: There should be none (adjustments made in /etc)
>>
> 
> I would vote for a suffix just as a precaution.

OK.  Bikeshedding time!   I have added the requirement of a ".hook" suffix.

>>
>> 2) Complete list of when hooks can be run.  Current list:
>>
>> PreRemove
>> PostRemove
>> PreInstall
>> PostInstall
>> Transaction
>>
>> I guess we should add Pre/Post suffix to Transaction for generality.
>> Any more needed?
>>
>>
>> 3) Trigger.  In the wiki I have "File" and "Package" to specify
>> triggers, allowing wildcards.  These can be suffixed with
>> Install/Upgrade/Removal.  Note that any operation can be triggered by
>> using e.g "PackageInstall = *".   Does that seem general enough?
>>
> 
> There is some redundancy here.  Do we need Install/Remove/Upgrade in
> both the "when" and the trigger?

No we don't...  I was over thinking details without seeing the big
picture.  Removed.

>>
>> 4) Should File hooks run immediately after the file or at the end of the
>> package.   At the end of the package fits in with out current install
>> scripts ad so would be easier to implement.  Can anyone think of a
>> situation with directly after the file is preferable?
>>
> 
> I think all of the "when"s should mean the same thing whether the
> trigger is a file or a package.  If we discover we need hooks that run
> immediately after a file is modified we should add a separate "when"
> for that.

OK - I am doubting we will need that given no-one has mentioned the need
with only our install scriptlets available.

>>
>> 5) How should we handle packages installing a new hook?   e.g. In Arch,
>> texinfo will carry the install-info hook.  I think it will still need a
>> post_install script to add all the info files installed before texinfo
>> was to the info directory, but then the hook install should be
>> recognised and act on any packages installed after that.  Reasonable?
>>
> 
> I think hooks have to be immediately recognized as you describe.
> Otherwise, it seems like it would be difficult to ever transition from
> using an install script to a hook.
> 
>>
>> 6) Any other comments?
>>
> 
> Hooks have the potential to replace install scripts altogether; is
> that the intent or do you just want to supplement them?

They will not replace install scripts altogether, but should replace
those that appear multiple times.

Allan




More information about the pacman-dev mailing list