Difference between revisions of "User:Allan/Pacman Hooks - Version 2"

From ArchWiki
Jump to: navigation, search
(Created page with "This is a new draft, look at the old propsal for previous discussions.")
 
Line 1: Line 1:
 
This is a new draft, look at the [[User:Allan/Pacman Hooks (old version)|old propsal]] for previous discussions.
 
This is a new draft, look at the [[User:Allan/Pacman Hooks (old version)|old propsal]] for previous discussions.
 +
 +
=The Idea=
 +
 +
'''Short Version:'''
 +
Pacman should have hooks to perform common tasks.
 +
 +
'''Long Version:'''
 +
Many packages have install files that perform a common task; e.g. adding/removing info files in the info directory file, installing/uninstalling gconf schemas, updating the font/desktop/icon cache. It would be good if pacman was extendible through a hooks mechanism so that these could be handled automatically.
 +
 +
=Hook structure=
 +
 +
==Hook triggers==
 +
 +
Each hook would have a "trigger" file. This file should be in a well-known config file format, preferably an ini-file. For avoiding conflicts with {{ic|.pacorig}}, {{ic|.pacnew}} or {{ic|.pacsave}} files, all trigger files should end with {{ic|.trigger}}. These triggers can be either put int {{ic|/usr/lib/pacman/hooks/triggers/}} or {{ic|/etc/pacman.d/hooks/triggers/}}. Similar to udev or systemd, a file in {{ic|/etc/pacman.d/hooks/triggers/}} will override a file in {{ic|/usr/lib/pacman/hooks/triggers/}} of the same name - an empty file will disable the trigger.
 +
 +
===Pacman transactions===
 +
 +
All hook triggers are read at the beginning of the transaction. If a new trigger is added during the transaction, it is parsed and added, and will be valid for the current and all subsequent packages. Applicability to the current package may be limited.
 +
 +
===Trigger types===
 +
 +
==Hook actions==

Revision as of 15:58, 7 September 2012

This is a new draft, look at the old propsal for previous discussions.

The Idea

Short Version: Pacman should have hooks to perform common tasks.

Long Version: Many packages have install files that perform a common task; e.g. adding/removing info files in the info directory file, installing/uninstalling gconf schemas, updating the font/desktop/icon cache. It would be good if pacman was extendible through a hooks mechanism so that these could be handled automatically.

Hook structure

Hook triggers

Each hook would have a "trigger" file. This file should be in a well-known config file format, preferably an ini-file. For avoiding conflicts with .pacorig, .pacnew or .pacsave files, all trigger files should end with .trigger. These triggers can be either put int /usr/lib/pacman/hooks/triggers/ or /etc/pacman.d/hooks/triggers/. Similar to udev or systemd, a file in /etc/pacman.d/hooks/triggers/ will override a file in /usr/lib/pacman/hooks/triggers/ of the same name - an empty file will disable the trigger.

Pacman transactions

All hook triggers are read at the beginning of the transaction. If a new trigger is added during the transaction, it is parsed and added, and will be valid for the current and all subsequent packages. Applicability to the current package may be limited.

Trigger types

Hook actions