From 3d21d491e024cda848aa57841e7e01d53e1937ab Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Thu, 7 Jul 2016 17:20:02 +0000 Subject: [PATCH] The submodule post-update hooks are now specified via environment variables. --- setup.env | 3 +++ tools/scripts/submodule-updated.sh | 2 +- tools/submodules.py | 15 +++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/setup.env b/setup.env index 56d0ad37..7e6f7f33 100755 --- a/setup.env +++ b/setup.env @@ -44,3 +44,6 @@ export ONL_DEBIAN_SUITE=$(lsb_release -c -s) if [ ! -f $ONL/.git/hooks/post-merge ] && [ -d $ONL/.git ]; then cp $ONL/tools/scripts/post-merge.hook $ONL/.git/hooks/post-merge fi + +# submodule post update scripts. +export ONL_SUBMODULE_UPDATED_SCRIPTS="$ONL/tools/scripts/submodule-updated.sh" \ No newline at end of file diff --git a/tools/scripts/submodule-updated.sh b/tools/scripts/submodule-updated.sh index f1e166ce..c3ff4608 100755 --- a/tools/scripts/submodule-updated.sh +++ b/tools/scripts/submodule-updated.sh @@ -13,7 +13,7 @@ ############################################################ # Removing the manifest causes it to be regenerated. -rm -rf $ONL/.manifest.mk +rm -rf $ONL/make/module-manifest.mk # Rebuild pkg cache onlpm.py --rebuild-pkg-cache diff --git a/tools/submodules.py b/tools/submodules.py index 991178c4..9e8deba4 100755 --- a/tools/submodules.py +++ b/tools/submodules.py @@ -101,14 +101,13 @@ class OnlSubmoduleManager(object): # # Run any repository-specific post-submodule-init scripts. # - script = os.path.join(self.root, 'tools', 'scripts', 'submodule-updated.sh') - if os.path.exists(script): - try: - check_call([script, path], cwd=self.root) - except subprocess.CalledProcessError: - # Target doesn't exists - raise OnlSubmoduleError("The repository post-init script %s failed." % script) - + for script in os.getenv("ONL_SUBMODULE_UPDATED_SCRIPTS", "").split(':'): + if os.path.exists(script): + try: + print "Calling %s..." % script + check_call([script, path], cwd=self.root) + except subprocess.CalledProcessError: + raise OnlSubmoduleError("The repository post-init script %s failed." % script) def require(self, path, depth=None, recursive=False): self.get_status()