forked from haskell/cabal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run a program (named "preBuildHook") before doing a package build and another program (named "postBuildHook") after the package is built. These programs are project local and need to be in the `cabalHooks` directory which is in the same directory as the `cabal.project` file. Co-authored: Moritz Angermann <[email protected]>
- Loading branch information
Showing
4 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
synopsis: Add pre and post build hooks | ||
packages: cabal-install | ||
prs: #9899 | ||
issues: #9892 | ||
significance: significant | ||
|
||
description: { | ||
|
||
- Run a program (named "preBuildHook") before doing a package build and another program | ||
(named "postBuildHook") after the package is built. | ||
- These programs are project local and need to be in the `cabalHooks` directory which is | ||
in the same directory as the `cabal.project` file. | ||
- The absence of these programs will be ignored. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Build Hooks | ||
=========== | ||
|
||
Build hooks are programs that are run before (pre-build hook) and | ||
after (post-build hook) a package (including package dependencies) | ||
is built. The hooks are completely generic and can even be absent | ||
(their absence is ignored). | ||
|
||
Build hooks are project local rather than global to the user | ||
because a single user may want to use one set of hooks in one | ||
project and another set of hoos (or even none at all) for another | ||
project. | ||
|
||
|
||
Possible Use Cases | ||
------------------ | ||
|
||
Possible use cases include: | ||
|
||
* Fine grained benchmarking of individual package build times. | ||
* Build product caching. | ||
|
||
|
||
Location of Hook Files | ||
---------------------- | ||
|
||
The two hook files are `cabalHooks/preBuildHook` and | ||
`cabalHooks/postBuildHook` where the `cabalHooks` directory is in | ||
the same directory as the `cabal.project` file. On UNIX style | ||
systems, these hooks need to be marked as user executable programs. | ||
|
||
|
||
Security Considerations | ||
----------------------- | ||
|
||
These build hooks are generic executable programs. They can potentially | ||
be malicious. For example, one might clone a Haskell project from | ||
say Github, that includes malicious build hooks so that when the user runs | ||
`cabal build all` these hooks will be run as the user. The most obvious | ||
malicious behaviour would be to delete all the user's files. | ||
|
||
For this reason, it is highly advisable to check for the existence | ||
of and the contents of any build hook files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters