Added reporting
[invirt/packages/invirt-dev.git] / python / invirt / builder.py
index 68d56c8..b3aa08f 100644 (file)
@@ -17,7 +17,7 @@ from invirt.config import structs as config
 _QUEUE_DIR = '/var/lib/invirt-dev/queue'
 _REPO_DIR = '/srv/git'
 _LOG_DIR = '/var/log/invirt/builds'
 _QUEUE_DIR = '/var/lib/invirt-dev/queue'
 _REPO_DIR = '/srv/git'
 _LOG_DIR = '/var/log/invirt/builds'
-_HOOKS_DIR = '/usr/share/invirt-dev/build.d'
+_HOOKS_DIR = '/usr/share/invirt-dev/build-hooks'
 
 
 class InvalidBuild(ValueError):
 
 
 class InvalidBuild(ValueError):
@@ -74,6 +74,13 @@ def getChangelog(package, ref):
     """
     return changelog.Changelog(getGitFile(package, ref, 'debian/changelog'))
 
     """
     return changelog.Changelog(getGitFile(package, ref, 'debian/changelog'))
 
+def runHook(hook, args=[], stdin_str=None):
+    """Run a named hook."""
+    hook = os.path.join(_HOOKS_DIR, hook)
+    try:
+        c.captureOutput([hook] + args, stdin_str=stdin_str)
+    except OSError:
+        pass
 
 def getVersion(package, ref):
     """Get the version of a given package at a particular ref."""
 
 def getVersion(package, ref):
     """Get the version of a given package at a particular ref."""