[Buildbot-commits] buildbot/buildbot/scripts runner.py,1.15,1.16

Brian Warner warner at users.sourceforge.net
Wed May 4 02:09:40 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31343/buildbot/scripts

Modified Files:
	runner.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-119
Creator:  Brian Warner <warner at monolith.lothar.com>

add 'buildbot sendchange' command

	* buildbot/scripts/runner.py (sendchange): new command to send a
	change to a buildbot.changes.pb.PBChangeSource receiver.
	* buildbot/test/test_changes.py (Sender): test it

	* buildbot/master.py (BuildMaster.startService): mark .readConfig
	after any reading of the config file, not just when we do it in
	startService. This makes some tests a bit cleaner.

	* buildbot/changes/pb.py: add some log messages


Index: runner.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scripts/runner.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- runner.py	3 May 2005 04:31:20 -0000	1.15
+++ runner.py	4 May 2005 02:09:37 -0000	1.16
@@ -323,6 +323,60 @@
     c = gtkPanes.GtkClient(master)
     c.run()
 
+class SendChangeOptions(usage.Options):
+    optParameters = [
+        ["master", "m", None,
+         "Location of the buildmaster's PBListener (host:port)"],
+        ["username", "u", None, "Username performing the commit"],
+        ["revision", "r", None, "Revision specifier (string)"],
+        ["revision_number", "n", None, "Revision specifier (integer)"],
+        ["comments", "m", None, "log message"],
+        ["logfile", "F", None,
+         "Read the log messages from this file (- for stdin)"],
+        ]
+    def getSynopsis(self):
+        return "Usage:    buildbot sendchange [options] filenames.."
+    def parseArgs(self, *args):
+        self['files'] = args
+
+
+def sendchange(config):
+    from buildbot.clients.sendchange import Sender
+
+    opts = loadOptions()
+    user = config.get('username', opts.get('username'))
+    master = config.get('master', opts.get('master'))
+    revision = config.get('revision')
+    # SVN and P4 use numeric revisions
+    if config.get("revision_number"):
+        revision = int(config['revision_number'])
+
+    comments = config.get('comments')
+    if not comments and config.get('logfile'):
+        if config['logfile'] == "-":
+            f = sys.stdin
+        else:
+            f = open(config['logfile'], "rt")
+        comments = f.read()
+    if comments is None:
+        comments = ""
+
+    files = config.get('files', [])
+
+    assert user, "you must provide a username"
+    assert master, "you must provide the master location"
+
+    s = Sender(master, user)
+    d = s.send(revision, comments, files)
+    return d
+
+def do_sendchange(config):
+    d = sendchange(config)
+    d.addCallbacks(s.printSuccess, s.printFailure)
+    d.addCallback(s.stop)
+    s.run()
+
+
 class Options(usage.Options):
     synopsis = "Usage:    buildbot <command> [command options]"
 
@@ -337,6 +391,9 @@
         ['sighup', None, StopOptions,
          "SIGHUP a buildmaster to make it re-read the config file"],
 
+        ['sendchange', None, SendChangeOptions,
+         "Send a change to the buildmaster"],
+
         ['debugclient', None, DebugClientOptions,
          "Launch a small debug panel GUI"],
 
@@ -377,6 +434,8 @@
         stop(so)
     elif command == "sighup":
         stop(so, "-HUP")
+    elif command == "sendchange":
+        do_sendchange(so)
     elif command == "debugclient":
         debugclient(so)
     elif command == "statuslog":





More information about the Commits mailing list