summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md34
-rw-r--r--common.py10
-rwxr-xr-xgit-update25
-rw-r--r--meson.build5
-rwxr-xr-xsetup11
5 files changed, 65 insertions, 20 deletions
diff --git a/README.md b/README.md
index 13e67d0e88..55f508bad1 100644
--- a/README.md
+++ b/README.md
@@ -28,18 +28,40 @@ NOTE: on fedora (and maybe other distributions) replace `ninja` with `ninja-buil
# Development environment
+## Uninstalled environment
+
gst-build also contains a special `uninstalled` target that lets you enter an
-uninstalled development environment where you will be able to work on GStreamer easily.
-You can get into that environment running:
+uninstalled development environment where you will be able to work on GStreamer
+easily. You can get into that environment running:
```
ninja -C build/ uninstalled
```
-If your operating system handles symlinks, built modules source code will be available
-at the root of `gst-build/` for example GStreamer core will be in `gstreamer/`. Otherwise
-they will be present in `subprojects/`. You can simply hack in there and to rebuild you
-just need to rerun `ninja -C build/`.
+If your operating system handles symlinks, built modules source code will be
+available at the root of `gst-build/` for example GStreamer core will be in
+`gstreamer/`. Otherwise they will be present in `subprojects/`. You can simply
+hack in there and to rebuild you just need to rerun `ninja -C build/`.
+
+## Update git subprojects
+
+We added a special `update` target to update subprojects (it uses `git pull
+--rebase` meaning you should always make sure the branches you work on are
+following the right upstream branch, you can set it with `git branch
+--set-upstream-to origin/master` if you are working on `gst-build` master
+branch).
+
+Update all GStreamer modules and rebuild:
+
+```
+ninja -C build/ update
+```
+
+Update all GStreamer modules without rebuilding:
+
+```
+ninja -C build/ git-update
+```
## Add information about GStreamer development environment in your prompt line
diff --git a/common.py b/common.py
index 244b30ac2c..40f420eb20 100644
--- a/common.py
+++ b/common.py
@@ -1,4 +1,5 @@
import argparse
+import shutil
import subprocess
class Colors:
@@ -37,3 +38,12 @@ class Colors:
def git(*args, repository_path='.'):
return subprocess.check_output(["git"] + list(args), cwd=repository_path,
stderr=subprocess.STDOUT).decode()
+
+def accept_command(commands):
+ """Search @commands and returns the first found absolute path."""
+ for command in commands:
+ command = shutil.which(command)
+ if command:
+ return command
+
+ return None
diff --git a/git-update b/git-update
index 8ffc2af276..d86810e761 100755
--- a/git-update
+++ b/git-update
@@ -6,6 +6,7 @@ import xml.etree.ElementTree as ET
from common import git
from common import Colors
+from common import accept_command
SCRIPTDIR = os.path.dirname(__file__)
@@ -51,8 +52,8 @@ def update_repo(repo_name, repo_dir, revision, no_interaction, recurse_i=0):
out = getattr(e, "output", b"").decode()
if not no_interaction:
print("====================================="
- "\n%sEntering a shell in %s to fix that"
- " just `exit 0` once done` or `exit 255`"
+ "\n%s\nEntering a shell in %s to fix that"
+ " just `exit 0` once done, or `exit 255`"
" to skip update for that repository"
"\n=====================================" % (
out, repo_dir))
@@ -95,6 +96,10 @@ if __name__ == "__main__":
default=False,
action='store_true',
help="Do not output ansi colors.")
+ parser.add_argument("--builddir",
+ default=None,
+ help="Specifies the build directory where to"
+ " invoke ninja after updating.")
parser.add_argument("--no-interaction",
default=False,
action='store_true',
@@ -109,5 +114,17 @@ if __name__ == "__main__":
if not update_repo('gst-build', SCRIPTDIR, None, options.no_interaction):
exit(1)
- exit(not update_subprojects(options.manifest,
- options.no_interaction))
+ if not update_subprojects(options.manifest, options.no_interaction):
+ exit(1)
+
+ if options.builddir:
+ ninja = accept_command(["ninja", "ninja-build"])
+ if not ninja:
+ print("Can't find ninja, other backends are not supported for rebuilding")
+ exit(1)
+
+ if not os.path.exists(os.path.join (options.builddir, 'build.ninja')):
+ print("Can't rebuild in %s as no build.ninja file found." % options.builddir)
+
+ print("Rebuilding all GStreamer modules.")
+ exit(subprocess.call([ninja, '-C', options.builddir]))
diff --git a/meson.build b/meson.build
index 57cfde5d3d..0037b9e35b 100644
--- a/meson.build
+++ b/meson.build
@@ -84,3 +84,8 @@ endforeach
setenv = find_program('gst-uninstalled.py')
run_target('uninstalled', command : [setenv, '--builddir=@0@'.format(meson.current_build_dir()),
'--gst-version=@0@'.format(gst_branch)])
+
+update = find_program('git-update')
+run_target('git-update', command : [update])
+run_target('update', command : [update,
+ '--builddir=@0@'.format(meson.current_build_dir())])
diff --git a/setup b/setup
index 5cca3c730d..2c5d301506 100755
--- a/setup
+++ b/setup
@@ -9,6 +9,7 @@ import subprocess
from common import git
from common import Colors
+from common import accept_command
PROJECTNAME = "GStreamer build"
@@ -25,16 +26,6 @@ def get_meson():
return accept_command(["meson.py", "meson"]), accept_command(["mesonconf.py", "mesonconf"])
-def accept_command(commands):
- """Search @commands and returns the first found absolute path."""
- for command in commands:
- command = shutil.which(command)
- if command:
- return command
-
- return None
-
-
def get_configs(meson):
return ['-D', 'werror=true']