Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2019-06-03 00:32:36 -0700
committerAllan McRae <allan@archlinux.org>2019-06-06 10:38:31 +1000
commit39c20ad4f1d5f6e915b5be8976b6a94885ca3b0c (patch)
tree74d38438facb45679fda9e22711186c3abac67bb
parent55a65aaf904a32bcf59c652cbc03fc510c265142 (diff)
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>
-rw-r--r--doc/alpm-hooks.5.asciidoc17
-rw-r--r--lib/libalpm/hook.c8
-rw-r--r--test/pacman/tests/hook-file-change-packages.py2
-rw-r--r--test/pacman/tests/hook-file-remove-trigger-match.py2
-rw-r--r--test/pacman/tests/hook-file-upgrade-nomatch.py2
-rw-r--r--test/pacman/tests/hook-target-list.py2
-rw-r--r--test/pacman/tests/hook-type-reused.py2
7 files changed, 20 insertions, 15 deletions
diff --git a/doc/alpm-hooks.5.asciidoc b/doc/alpm-hooks.5.asciidoc
index 0f6a1057..916d43bb 100644
--- a/doc/alpm-hooks.5.asciidoc
+++ b/doc/alpm-hooks.5.asciidoc
@@ -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
diff --git a/lib/libalpm/hook.c b/lib/libalpm/hook.c
index d90ed2da..6143ea0f 100644
--- a/lib/libalpm/hook.c
+++ b/lib/libalpm/hook.c
@@ -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);
}
diff --git a/test/pacman/tests/hook-file-change-packages.py b/test/pacman/tests/hook-file-change-packages.py
index ad96fc14..4671dbe8 100644
--- a/test/pacman/tests/hook-file-change-packages.py
+++ b/test/pacman/tests/hook-file-change-packages.py
@@ -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
diff --git a/test/pacman/tests/hook-file-remove-trigger-match.py b/test/pacman/tests/hook-file-remove-trigger-match.py
index 6c9375c0..ac50014c 100644
--- a/test/pacman/tests/hook-file-remove-trigger-match.py
+++ b/test/pacman/tests/hook-file-remove-trigger-match.py
@@ -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
diff --git a/test/pacman/tests/hook-file-upgrade-nomatch.py b/test/pacman/tests/hook-file-upgrade-nomatch.py
index e984d376..891b8164 100644
--- a/test/pacman/tests/hook-file-upgrade-nomatch.py
+++ b/test/pacman/tests/hook-file-upgrade-nomatch.py
@@ -4,7 +4,7 @@ self.add_script("hook-script", ": > hook-output")
self.add_hook("hook",
"""
[Trigger]
- Type = File
+ Type = Path
Operation = Upgrade
Target = bin/?*
diff --git a/test/pacman/tests/hook-target-list.py b/test/pacman/tests/hook-target-list.py
index 6dd6c4d8..b932c491 100644
--- a/test/pacman/tests/hook-target-list.py
+++ b/test/pacman/tests/hook-target-list.py
@@ -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/?*
diff --git a/test/pacman/tests/hook-type-reused.py b/test/pacman/tests/hook-type-reused.py
index 472c8caf..0ea1c0ba 100644
--- a/test/pacman/tests/hook-type-reused.py
+++ b/test/pacman/tests/hook-type-reused.py
@@ -4,7 +4,7 @@ self.add_hook("hook",
"""
[Trigger]
Type = Package
- Type = File
+ Type = Path
Operation = Install
Target = foo