Commit Graph

10 Commits

Author SHA1 Message Date
Yegor Timoshenko c2e4941367 treewide: use /usr/bin/env where appropriate
Some Unix systems (GuixSD, NixOS) do not install programs like
Bash and Python to /usr/bin, and /usr/bin/env has to be used to
locate these instead.

Change-Id: I7546bcb881c532adc984577ecb0ee2ec4f2efe00
Signed-off-by: Yegor Timoshenko <yegortimoshenko@riseup.net>
Reviewed-on: https://review.coreboot.org/28953
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2018-11-17 07:32:03 +00:00
Alex Thiessen 101485c73d util/gitconfig: Replace printf with heredoc
The `gitconfig.sh` script contains a call to `printf` with a lengthy
argument where no format string is used at all. Replace it with a
heredoc for better readability.

Change-Id: I42dbaa570ab9661991fa5d9b4577c9aed05c2981
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
Reviewed-on: https://review.coreboot.org/23251
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2018-01-23 05:22:40 +00:00
Alex Thiessen 7bcd6ecea6 util/gitconfig: Use `make` in git hooks
As the code was moved from the Makefile.inc to a separate file in
commit 9ab8ae6a (util/gitconfig: Make gitconfig a bash script),`$(MAKE)`
was replaced by `remake`, introducing dependency on this tool which is
basically a `make` with debugging capabilities. Many developers don't
have `remake` installed, leading to pre-commit hooks being not executed
properly. Apparently this was an unintentional change.

Furthermore, special treatment of `make` tool via the `%MAKE%`
substitution performed during hooks' deployment is still desired. Use
case is calling `remake gitconfig` to set `remake` as the `make` tool in
the hooks. To accomplish this, add a parameter that is passed from the
Makefile.inc to gitconfig.sh.

Change-Id: Ia78e06567b904b342dc9b7778569201fe02e6897
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
Reviewed-on: https://review.coreboot.org/23096
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Martin Roth <martinroth@google.com>
2018-01-23 05:18:14 +00:00
Alex Thiessen 7c7181fc96 util/gitconfig: Replace subshells with braces
The check for `user.name` and `user.email` being set is done in
`gitconfig.sh` and it uses two subshells where none is actually needed.
Stream redirection can be consolidated.

Change-Id: Ia1d19eb3c11f9d11f030dcc179bc175956cd7116
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
Reviewed-on: https://review.coreboot.org/23250
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2018-01-22 12:34:02 +00:00
Alex Thiessen 7459eeb18a util/gitconfig: Update `sup-destroy` git alias
The `git sup-destroy` alias uses a subshell in order to make `git
submodule deinit` deinitialize all submodules. This isn't necessary as
the `--all` switch does the same.

Furthermore, `git submodule init && git submodule update` equals to `git
submodule --init`.

Change-Id: Ib690d66795da4049bb0bb350a0609cf2e6b5c4c4
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
Reviewed-on: https://review.coreboot.org/23249
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2018-01-22 12:33:41 +00:00
Alex Thiessen 2ca4ca3f21 util/gitconfig: Fix too long lines in gitconfig.sh
Change-Id: Iaff0852259f0a91fb4c906e1a01d77b92f8a49f1
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
Reviewed-on: https://review.coreboot.org/23248
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2018-01-18 22:05:03 +00:00
Alex Thiessen fda071ca7a util/gitconfig: Make gitconfig.sh support gitfile
The `gitconfig.sh` script installs hooks to the according directories
(for coreboot and its submodules). It has the `hooks` directory
hard-coded to be `.git/hooks`, which makes the installation fail when
coreboot itself is a submodule because then `.git` becomes a gitfile.

Replace hard-coded path handling using the according `git rev-parse`
calls.

Change-Id: I778e20be24bb27d0081c9e1c12883117d6d50347
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
Reviewed-on: https://review.coreboot.org/23253
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2018-01-18 19:29:10 +00:00
Alex Thiessen d4a3d01932 util/gitconfig: Add missing license headers
License header for the `gitconfig.sh` was copied from the Makefile it
was extracted from in commit 9ab8ae6a (util/gitconfig: Make gitconfig
a bash script).

License header for the pre-commit hook names Patrick Georgi as the
copyright holder as he is the original author.

Change-Id: Ie051e5e6ae7571050ece383e6be8236ed7d1ddd9
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
Reviewed-on: https://review.coreboot.org/23097
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2018-01-10 09:50:16 +00:00
Alex Thiessen a71c66a52e util/gitconfig: Do not wait for user input
When running `make gitconfig` on a freshly cloned repository, the script
will wait for user input without a prompt in a call to `sed`, caused by
a spurious newline introduced in commit 9ab8ae6a (util/gitconfig: Make
gitconfig a bash script).

Change-Id: I2aa722c052d24dcffa9688df09bcf8dc767bd0b6
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
Reviewed-on: https://review.coreboot.org/23059
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2018-01-04 14:07:20 +00:00
Marc Jones 9ab8ae6a55 util/gitconfig: Make gitconfig a bash script
The gitconfig target has a few bashisms and would fail
silently on systems that use a POSIX standard sh (like Ubuntu dash).

Remove the code from the makefile and put it in a bash script that
is called by the gitconfig target.

Change-Id: I3bc8cf688a3ad211b57c8ca0e6b1e86c82dc6a37
Signed-off-by: Marc Jones <marcj303@gmail.com>
Reviewed-on: https://review.coreboot.org/22857
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2017-12-15 23:02:11 +00:00