From fda837941179fc384489883a8492aaf15c4ab609 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 12 Nov 2018 20:23:14 -0300 Subject: [PATCH] scripts: Add a script to check that all repos are clean This is useful to check that a build didn't result in changes in the code/generated files This will be used to check that the plugins documentation cache file is properly commited, and that necessary workaround for particular case are adopted. --- checkout-branch-worktree | 8 ++++---- git-update | 6 +++--- gst-uninstalled.py | 6 +++--- meson.build | 9 +++++++-- msys2_setup.py | 2 +- scripts/__init__.py | 0 scripts/check-clean-repos.py | 27 +++++++++++++++++++++++++++ common.py => scripts/common.py | 0 setup.py | 4 ++-- 9 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 scripts/__init__.py create mode 100755 scripts/check-clean-repos.py rename common.py => scripts/common.py (100%) diff --git a/checkout-branch-worktree b/checkout-branch-worktree index 7f2dbd5185..8afb39333f 100755 --- a/checkout-branch-worktree +++ b/checkout-branch-worktree @@ -7,10 +7,10 @@ import subprocess import xml.etree.ElementTree as ET import sys -from common import git -from common import Colors -from common import get_meson -from common import accept_command +from scripts.common import git +from scripts.common import Colors +from scripts.common import get_meson +from scripts.common import accept_command SCRIPTDIR = os.path.normpath(os.path.dirname(__file__)) diff --git a/git-update b/git-update index 71c6d038a1..ae90567d45 100755 --- a/git-update +++ b/git-update @@ -5,9 +5,9 @@ import subprocess import xml.etree.ElementTree as ET import sys -from common import git -from common import Colors -from common import accept_command +from scripts.common import git +from scripts.common import Colors +from scripts.common import accept_command SCRIPTDIR = os.path.normpath(os.path.dirname(__file__)) diff --git a/gst-uninstalled.py b/gst-uninstalled.py index bb9143da3a..59fecaecd2 100755 --- a/gst-uninstalled.py +++ b/gst-uninstalled.py @@ -16,9 +16,9 @@ import pathlib from distutils.sysconfig import get_python_lib from distutils.util import strtobool -from common import get_meson -from common import git -from common import win32_get_short_path_name +from scripts.common import get_meson +from scripts.common import git +from scripts.common import win32_get_short_path_name SCRIPTDIR = os.path.dirname(os.path.realpath(__file__)) PREFIX_DIR = os.path.join(SCRIPTDIR, 'prefix') diff --git a/meson.build b/meson.build index c007e42341..a2156b4c24 100644 --- a/meson.build +++ b/meson.build @@ -105,8 +105,13 @@ foreach custom_subproj: get_option('custom_subprojects').split(',') endif endforeach -if build_machine.system() == 'windows' - message('Disabling hotdoc while building on Windows') +if meson.is_cross_build() or build_machine.system() == 'windows' + if get_option('doc').enabled() + error('Documentation enabled but building the doc while cross building or building on windows is not supported yet.') + endif + + message('Documentation not built as building the docmentation while cross building or building on windows is not supported yet.') + subdir_done() else hotdoc_p = find_program('hotdoc', required : get_option('doc')) if hotdoc_p.found() diff --git a/msys2_setup.py b/msys2_setup.py index 8153f07724..0ea17e5a37 100644 --- a/msys2_setup.py +++ b/msys2_setup.py @@ -11,7 +11,7 @@ import shutil import subprocess import tempfile -from common import git +from scripts.common import git from setup import GstBuildConfigurer diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/check-clean-repos.py b/scripts/check-clean-repos.py new file mode 100755 index 0000000000..2b50fd938b --- /dev/null +++ b/scripts/check-clean-repos.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +import os +import subprocess +import sys +from common import git + + +SCRIPTDIR = os.path.realpath(os.path.dirname(__file__)) + + +if __name__ == "__main__": + subprojects_dir = os.path.join(SCRIPTDIR, "..", "subprojects") + exitcode = 0 + for repo_name in os.listdir(subprojects_dir): + repo_dir = os.path.normpath(os.path.join(SCRIPTDIR, subprojects_dir, repo_name)) + if not os.path.exists(os.path.join(repo_dir, '.git')): + continue + + diff = git('diff', repository_path=repo_dir).strip('\n') + if diff: + print('ERROR: Repository %s is not clean' % repo_dir) + print('NOTE: Make sure to commit necessary changes in the gst_plugins_cache.json files') + print(diff) + exitcode += 1 + + sys.exit(exitcode) \ No newline at end of file diff --git a/common.py b/scripts/common.py similarity index 100% rename from common.py rename to scripts/common.py diff --git a/setup.py b/setup.py index fccf416f5c..27766781db 100755 --- a/setup.py +++ b/setup.py @@ -7,8 +7,8 @@ import sys import shutil import subprocess -from common import get_meson -from common import accept_command +from scripts.common import get_meson +from scripts.common import accept_command PROJECTNAME = "GStreamer build"