X-Git-Url: http://www.project-moonshot.org/gitweb/?p=moonshot.git;a=blobdiff_plain;f=admin%2Fgit_hooks%2Fgit_buildbot.py;fp=admin%2Fgit_hooks%2Fgit_buildbot.py;h=78f5238c7ac7c53629f92b240b964eb25bb6525c;hp=272748679e4414de81cb8439e0e3f1c440abdaa0;hb=9962adb8a46222f971a88148263207de775dda72;hpb=cdc73aaee2c91a88b40c1c11d01ec4ba1b73bcfb diff --git a/admin/git_hooks/git_buildbot.py b/admin/git_hooks/git_buildbot.py index 2727486..78f5238 100755 --- a/admin/git_hooks/git_buildbot.py +++ b/admin/git_hooks/git_buildbot.py @@ -26,6 +26,7 @@ import commands import logging import os +import exceptions import re import sys @@ -85,6 +86,26 @@ def addChange(remote, changei): def connected(remote): return addChange(remote, changes.__iter__()) +def add_package(c, files, rev): + packages_str = commands.getoutput("git show %s:source_packages" % rev) + packages = packages_str.split("\n") + packages_found = {} + class NoPackage(exceptions.Exception): pass + try: + for f in files: + found = False + for p in packages: + if f.startswith(p): + packages_found[p] = True + found = True + break + if not found: raise NoPackage() + except NoPackage: + return + c["properties"] = { + "package": " ".join(packages_found.keys()) + } + def grab_commit_info(c, rev): # Extract information about committer and files using git show @@ -115,7 +136,7 @@ def grab_commit_info(c, rev): status = f.close() if status: logging.warning("git show exited with status %d" % status) - + add_package(c, files, rev) def gen_changes(input, branch): while True: