[websites/build-kde-org/production] /: Add support for invoking special 'SCM Correction' commands, such as git submodule updates in the case of qt5.

Ben Cooksley bcooksley at kde.org
Sun Mar 17 07:47:45 UTC 2013


Git commit 47684f2138d93b7dcf4d22ceb8ef4314942f9698 by Ben Cooksley.
Committed on 17/03/2013 at 08:47.
Pushed by bcooksley into branch 'production'.

Add support for invoking special 'SCM Correction' commands, such as git submodule updates in the case of qt5.
This means that qt5 builds on build.kde.org will now build the latest available code for each submodule, irrespective of the state of qt5.git itself.
Hopefully no other module ever needs this.
CCMAIL: kde-frameworks-devel at kde.org

M  +1    -0    config/build/global.cfg
M  +4    -0    config/build/qt5/project.cfg
M  +12   -0    tools/kdecilib.py
M  +4    -1    tools/perform-build.py

http://commits.kde.org/websites/build-kde-org/47684f2138d93b7dcf4d22ceb8ef4314942f9698

diff --git a/config/build/global.cfg b/config/build/global.cfg
index c6d4faf..7f3eb2b 100644
--- a/config/build/global.cfg
+++ b/config/build/global.cfg
@@ -33,6 +33,7 @@ gitSetBranchCommand=%(gitExecutable)s branch --set-upstream --force jenkins orig
 gitCleanCommand=%(gitExecutable)s reset --hard && %(gitExecutable)s clean -dfx
 svnRevertCommand=%(svnExecutable)s revert -R .
 bzrCleanCommand=%(bzrExecutable)s revert --no-backup && %(bzrExecutable)s clean-tree --force
+useLatestGitSubmodules=False
 patchCommand=%(patchExecutable)s -p0 -i
 
 [Build]
diff --git a/config/build/qt5/project.cfg b/config/build/qt5/project.cfg
index 571d624..df54a93 100644
--- a/config/build/qt5/project.cfg
+++ b/config/build/qt5/project.cfg
@@ -2,6 +2,10 @@
 systemBase=qt5
 configureExecutable={sources}/configure
 
+[Source]
+useLatestGitSubmodules=True
+gitSubmoduleLatestCommand=%(gitExecutable)s submodule foreach 'git fetch; git reset --hard origin/dev || git reset --hard origin/master || true'
+
 [Build]
 inSourceBuild=True
 configureCommand=%(configureExecutable)s -confirm-license -opensource -dbus -xcb -nomake examples -nomake tests -nomake demos -prefix {instPrefix}
\ No newline at end of file
diff --git a/tools/kdecilib.py b/tools/kdecilib.py
index 31af1cf..f82678e 100644
--- a/tools/kdecilib.py
+++ b/tools/kdecilib.py
@@ -518,6 +518,18 @@ class BuildManager(object):
 
 		return
 
+	def apply_scm_corrections(self):
+		# Maybe we are correcting out of date Git submodules?
+		if self.config.getboolean('Source', 'useLatestGitSubmodules'):
+			# Execute the command to update the submodules
+			command = self.config.get('Source', 'gitSubmoduleLatestCommand')
+			try:
+				subprocess.check_call( shlex.split(command), cwd=self.projectSources )
+			except subprocess.CalledProcessError:
+				return False
+
+		return True
+
 	def apply_patches(self):
 		# Do we have anything to apply?
 		patchesDir = os.path.join( self.config.get('General', 'scriptsLocation'), 'patches', self.project.identifier, self.projectBranch )
diff --git a/tools/perform-build.py b/tools/perform-build.py
index b7b84ac..82b8c8d 100644
--- a/tools/perform-build.py
+++ b/tools/perform-build.py
@@ -73,9 +73,12 @@ print "== Build Dependencies:"
 for dependency, dependencyBranch in manager.dependencies:
 	print "==== %s - Branch %s" %(dependency.identifier, dependencyBranch)
 
-# Cleanup the source tree and apply any necessary patches if we have them
+# Cleanup the source tree, apply any scm corrections, then apply any necessary patches if we have them
 print "\n== Cleaning Source Tree\n"
 manager.cleanup_sources()
+print "\n== Applying SCM Corrections\n"
+if not manager.apply_scm_corrections():
+	sys.exit("Applying SCM corrections to project %s failed." % project.identifier)
 print "\n== Applying Patches\n"
 if not manager.apply_patches():
 	sys.exit("Applying patches to project %s failed." % project.identifier)


More information about the Kde-frameworks-devel mailing list