[pitivi] Update the git hook to support GNOME Builder
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Update the git hook to support GNOME Builder
- Date: Mon, 30 Dec 2019 05:53:40 +0000 (UTC)
commit 3ddc6ed6ccf372c71e2ad89a656746593da4d5e1
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sun Dec 29 22:22:53 2019 +0100
Update the git hook to support GNOME Builder
docs/HACKING.md | 28 +++++++++++++++++++++++++---
pre-commit.hook | 43 ++++++++++++++++++++++++++++++-------------
2 files changed, 55 insertions(+), 16 deletions(-)
---
diff --git a/docs/HACKING.md b/docs/HACKING.md
index 355b7175..c258d08f 100644
--- a/docs/HACKING.md
+++ b/docs/HACKING.md
@@ -4,21 +4,43 @@ short-description: Using the Pitivi development environment
# Hacking on Pitivi
+There are two ways to set up a flatpak sandbox with all the
+dependencies required to run and develop Pitivi. We recommend
+the advanced way, but if you want something quick, go ahead with
+the easy way.
+
## The easy way
The easy way to setup the development environment is to follow the
[GNOME Newcomers guide](https://wiki.gnome.org/Newcomers/).
-Make sure to use the right git repository:
+This implies using GNOME Builder to manage the dependencies sandbox.
+
+Clone the `https://gitlab.gnome.org/GNOME/pitivi.git` git repository
+in GNOME Builder.
+
+To run the unittests, click in Builder: Unittests > pitivi > Pitivi unit tests.
+Make sure they all pass, or tell us about any failures.
+
+To be able to use our pre-commit git hook, run:
+
+```
+$ cd ~/Projects/pitivi
+$ ln -s ../../pre-commit.hook .git/hooks/pre-commit
+```
-> **https://gitlab.gnome.org/GNOME/pitivi.git**
+When creating commits, for the pre-commit git hook to work properly
+it has to run in the sandbox. This is possible only by running `git`
+in a Build Terminal in GNOME Builder. You might want to
+`export EDITOR=nano` if you get "error: unable to start editor 'vi'"
+when you have to enter a commit message.
## Setting up the advanced development environment
NOTE: This way of setting the development environment is sensibly more complex
but also more flexible than the one for newcomers. If you are a beginner
-> or if you usually use [gnome-builder](https://wiki.gnome.org/Apps/Builder)
+> or if you usually use [GNOME Builder](https://wiki.gnome.org/Apps/Builder)
as your main IDE, follow, as previously advised, the
[GNOME Newcomers guide](https://wiki.gnome.org/Newcomers/)
diff --git a/pre-commit.hook b/pre-commit.hook
index 71da257d..5def5e7c 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -1,20 +1,37 @@
#!/usr/bin/env bash
# This is symlinked from .git/hooks/pre-commit when entering
-# the dev env with `source bin/pitivi-env`.
-
-if [ -z "${PITIVI_REPO_DIR}" ]; then
- echo "ERROR: You're not in the Pitivi development environment."
- echo
- echo " Enter the development environment by running:"
- echo " $ . bin/pitivi/env"
- echo
- echo " See http://developer.pitivi.org/HACKING.html for details."
- echo
- exit 1
-fi
+# the dev env with `. bin/pitivi-env`, or manually.
TOPLEVEL=$(git rev-parse --show-toplevel)
export PYTHONPATH=$TOPLEVEL/pitivi/coptimizations/.libs:$PYTHONPATH
-$TOPLEVEL/build/flatpak/pitivi-flatpak pre-commit run --config .pre-commit-config.yaml || exit 1
+PRECOMMIT=""
+if test -n "${PITIVI_REPO_DIR}"
+then
+ PRECOMMIT="$TOPLEVEL/build/flatpak/pitivi-flatpak pre-commit"
+elif test -n "${INSIDE_GNOME_BUILDER}"
+then
+ PRECOMMIT=$(which /app/bin/pre-commit)
+fi
+
+if test -z "$PRECOMMIT"
+then
+ cat <<EOF
+ERROR: Cannot find the flatpak sandbox.
+
+ If you are using GNOME Builder, you can commit only
+ from a Build Terminal.
+
+ If you are using the Pitivi development environment,
+ enter it by running:
+ $ . bin/pitivi-env
+
+ See http://developer.pitivi.org/HACKING.html for details.
+
+EOF
+ exit 1
+fi
+
+
+$PRECOMMIT run --config .pre-commit-config.yaml || exit 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]