hooks: rename type File to Path
Make it clearer that the targets are matched against both directories and regular files and free up File to potentially refer specifically to regular files in the future. File is retained as a deprecated alias for Path for the time being to avoid breaking existing hooks and will be removed in a future release. See FS#53136. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
55a65aaf90
commit
39c20ad4f1
7 changed files with 20 additions and 15 deletions
|
@ -12,7 +12,7 @@ SYNOPSIS
|
|||
--------
|
||||
[Trigger] (Required, Repeatable)
|
||||
Operation = Install|Upgrade|Remove (Required, Repeatable)
|
||||
Type = File|Package (Required)
|
||||
Type = Path|Package (Required)
|
||||
Target = <Path|PkgName> (Required, Repeatable)
|
||||
|
||||
[Action] (Required)
|
||||
|
@ -49,19 +49,20 @@ defined the hook will run if the transaction matches *any* of the triggers.
|
|||
Select the type of operation to match targets against. May be specified
|
||||
multiple times. Installations are considered an upgrade if the package or
|
||||
file is already present on the system regardless of whether the new package
|
||||
version is actually greater than the currently installed version. For File
|
||||
version is actually greater than the currently installed version. For Path
|
||||
triggers, this is true even if the file changes ownership from one package
|
||||
to another. Required.
|
||||
|
||||
*Type =* File|Package::
|
||||
*Type =* Path|Package::
|
||||
Select whether targets are matched against transaction packages or files.
|
||||
See CAVEATS for special notes regarding File triggers. Required.
|
||||
See CAVEATS for special notes regarding Path triggers. 'File' is a deprecated
|
||||
alias for 'Path' and will be removed in a future release. Required.
|
||||
|
||||
*Target =* <path|package>::
|
||||
The file path or package name to match against the active transaction.
|
||||
File paths refer to the files in the package archive; the installation root
|
||||
The path or package name to match against the active transaction.
|
||||
Paths refer to the files in the package archive; the installation root
|
||||
should *not* be included in the path. Shell-style glob patterns are
|
||||
allowed. It is possible to invert matches by prepending a file with an
|
||||
allowed. It is possible to invert matches by prepending a target with an
|
||||
exclamation mark. May be specified multiple times. Required.
|
||||
|
||||
ACTIONS
|
||||
|
@ -119,7 +120,7 @@ Exec = /usr/bin/sync
|
|||
CAVEATS
|
||||
-------
|
||||
|
||||
There are situations when file triggers may act in unexpected ways. Hooks are
|
||||
There are situations when path triggers may act in unexpected ways. Hooks are
|
||||
triggered using the file list of the installed, upgraded, or removed package.
|
||||
When installing or upgrading a file that is extracted with a '.pacnew'
|
||||
extension, the original file name is used in triggering the hook. When
|
||||
|
|
|
@ -38,7 +38,7 @@ enum _alpm_hook_op_t {
|
|||
|
||||
enum _alpm_trigger_type_t {
|
||||
ALPM_HOOK_TYPE_PACKAGE = 1,
|
||||
ALPM_HOOK_TYPE_FILE,
|
||||
ALPM_HOOK_TYPE_PATH,
|
||||
};
|
||||
|
||||
struct _alpm_trigger_t {
|
||||
|
@ -303,7 +303,11 @@ static int _alpm_hook_parse_cb(const char *file, int line,
|
|||
if(strcmp(value, "Package") == 0) {
|
||||
t->type = ALPM_HOOK_TYPE_PACKAGE;
|
||||
} else if(strcmp(value, "File") == 0) {
|
||||
t->type = ALPM_HOOK_TYPE_FILE;
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||
"File targets are deprecated, use Path instead\n");
|
||||
t->type = ALPM_HOOK_TYPE_PATH;
|
||||
} else if(strcmp(value, "Path") == 0) {
|
||||
t->type = ALPM_HOOK_TYPE_PATH;
|
||||
} else {
|
||||
error(_("hook %s line %d: invalid value %s\n"), file, line, value);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ self.add_script("hook-script", ": > hook-output")
|
|||
self.add_hook("hook",
|
||||
"""
|
||||
[Trigger]
|
||||
Type = File
|
||||
Type = Path
|
||||
Operation = Upgrade
|
||||
Target = bin/foo
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ self.add_script("hook-script", ": > hook-output")
|
|||
self.add_hook("hook",
|
||||
"""
|
||||
[Trigger]
|
||||
Type = File
|
||||
Type = Path
|
||||
Operation = Remove
|
||||
Target = bin/foo
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ self.add_script("hook-script", ": > hook-output")
|
|||
self.add_hook("hook",
|
||||
"""
|
||||
[Trigger]
|
||||
Type = File
|
||||
Type = Path
|
||||
Operation = Upgrade
|
||||
Target = bin/?*
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ self.add_hook("hook",
|
|||
Target = foo
|
||||
|
||||
[Trigger]
|
||||
Type = File
|
||||
Type = Path
|
||||
Operation = Install
|
||||
# matches files in 'file/' but not 'file/' itself
|
||||
Target = file/?*
|
||||
|
|
|
@ -4,7 +4,7 @@ self.add_hook("hook",
|
|||
"""
|
||||
[Trigger]
|
||||
Type = Package
|
||||
Type = File
|
||||
Type = Path
|
||||
Operation = Install
|
||||
Target = foo
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue