summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/hook.c
AgeCommit message (Collapse)AuthorFilesLines
2019-06-06hooks: rename type File to PathAndrew Gregory1-2/+6
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>
2018-08-10libalpm: ignore .hook suffix when sorting hooksJouke Witteveen1-4/+12
It is desirable to have 'a-post.hook' ordered after 'a.hook'. For this, it is needed to ignore the suffix when sorting. Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-14Remove all modelines from the projectEli Schwartz1-2/+0
Many of these are pointless (e.g. there is no need to explicitly turn on spellchecking and language dictionaries for the manpages by default). The only useful modelines are the ones enforcing the project coding standards for indentation style (and "maybe" filetype/syntax, but everything except the asciidoc manpages and makepkg.conf is already autodetected), and indent style can be applied more easily with .editorconfig Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14Update coyrights for 2018Allan McRae1-1/+1
make update-copyright OLD=2017 NEW=201 Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14hooks: Complain if hook parameters are overwritten. Fixed 2 space leaks.Stefan Klinger1-0/+16
Signed-off-by: Stefan Klinger <git@stefan-klinger.de> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04Update copyright yearsAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30hook.c: replace fstatat with statAndrew Gregory1-1/+1
macOS < 10.10 do not provide fstatat. We were constructing the full path to the hook file for all other operations anyway, so there was no real benefit to using fstatat. Fixes FS#49771 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30hook.c: replace readdir_r with readdirAndrew Gregory1-14/+12
glibc 2.24 deprecates readdir_r. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23do not rely on localdb for hook matchingAndrew Gregory1-2/+2
Relying on localdb to determine which trigger operations should match is completely broken for PostTransaction hooks because the localdb has already been updated. Store a copy of the old version of any packages being updated to use instead. Fixes FS#47996 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20Log to file when running hooksOlivier Brunel1-1/+1
Useful if there's some output (to know where it comes from), or in case of failure. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20Add the missing limits.h include to hook.cAlastair Hughes1-0/+1
PATH_MAX is only defined in limits.h in musl libc, so ensure that it is included. Presumably this is also required on other platforms. Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-15Cast events to void* before passing to callbackAllan McRae1-2/+2
Silence warnings from clang about typecasting alignment. Reported-by: Rikard Falkeborn Original-patch-by: Olivier Brunel Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04Update copyright years for 2016Allan McRae1-1/+1
make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15alpm: Abort ASAP on failure in pre-transaction hooksOlivier Brunel1-0/+8
There is no need to run any/remaining pre-transaction hooks as soon as a failure has occured, which will lead to aborting the transaction. So if an error occured during the first phase (reading directories/parsing files), or as soon as a hook flagged abort_on_fail does fail, we stop processing them and return. (For post-transaction hooks, all hooks are run regardless since there's no aborting.) Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15alpm-hooks: add Description fieldAllan McRae1-0/+5
The "Description" field allows a hook to provide a some text for frontends to use in describing what the hook is doing. For example: Description = updating info page directory Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15Show progress processing hooksAllan McRae1-2/+15
Introduces the ALPM_EVENT_HOOK_RUN_{START,DONE} events that are triggered at the start and end of running an individual hook. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15Add events ALPM_EVENT_HOOK_{START,DONE}Olivier Brunel1-2/+9
Add events to let frontends know when hooks are being processed (and when it's done), as that might be useful to update the UI. Signed-off-by: Olivier Brunel <jjk@jjacky.com>
2015-12-15Collect all triggered hooks before running themAllan McRae1-1/+10
Having a first pass that checks which hooks are triggered followed by a second pass of the triggered hooks allows us to only provide output when a hook is actually triggered. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28hooks: pass matched targets to hooksAndrew Gregory1-17/+110
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28allow specifying input to scriptletsAndrew Gregory1-1/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28allow arguments in hook Exec fieldsAndrew Gregory1-5/+124
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28_alpm_hook_run: check path length before copyingAndrew Gregory1-8/+19
If a hook path equals or exceeds PATH_MAX characters the path will be left unterminated. Pre-calculating the path length also allows us to use the more efficient memcpy over strncpy. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27hook.c: print invalid option nameAndrew Gregory1-1/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27order hooks by file nameAndrew Gregory1-0/+8
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18validate hooks after parsingAndrew Gregory1-1/+64
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18run hooks during trans_commitAndrew Gregory1-0/+279
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18add hook data types and parserAndrew Gregory1-0/+156
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>