mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 04:22:27 +00:00
Add 'update' and git-update
targets to update git repos
This commit is contained in:
parent
ac383f6b68
commit
c843f48740
5 changed files with 65 additions and 20 deletions
34
README.md
34
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
|
||||
|
|
10
common.py
10
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
|
||||
|
|
25
git-update
25
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]))
|
||||
|
|
|
@ -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())])
|
||||
|
|
11
setup
11
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']
|
||||
|
||||
|
|
Loading…
Reference in a new issue