Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/douglatornell/buildbot
Browse files Browse the repository at this point in the history
* 'master' of git://github.com/douglatornell/buildbot:
  Update try docs with cleaned up commandline options.
  Clean up try commandline options & their options file counterparts.
  • Loading branch information
djmitche committed Apr 15, 2011
2 parents 6b6bf23 + c17e425 commit 118ce95
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 62 deletions.
13 changes: 7 additions & 6 deletions master/buildbot/clients/tryclient.py
Expand Up @@ -467,11 +467,12 @@ def createJob(self):
vc = self.getopt("vc")
if vc in ("cvs", "svn"):
# we need to find the tree-top
topdir = self.getopt("try-topdir")
topdir = self.getopt("topdir") or self.getopt("try-topdir")
if topdir:
treedir = os.path.expanduser(topdir)
else:
topfile = self.getopt("try-topfile")
topfile = (self.getopt("topfile")
or self.getopt("try-topfile"))
treedir = getTopdir(topfile)
else:
treedir = os.getcwd()
Expand Down Expand Up @@ -508,9 +509,9 @@ def deliverJob(self):
# returns a Deferred that fires when the job has been delivered

if self.connect == "ssh":
tryhost = self.getopt("tryhost")
tryhost = self.getopt("host") or self.getopt("tryhost")
tryuser = self.getopt("username")
trydir = self.getopt("trydir")
trydir = self.getopt("jobdir") or self.getopt("trydir")

argv = ["ssh", "-l", tryuser, tryhost,
"buildbot", "tryserver", "--jobdir", trydir]
Expand All @@ -523,7 +524,7 @@ def deliverJob(self):
if self.connect == "pb":
user = self.getopt("username")
passwd = self.getopt("passwd")
master = self.getopt("master")
master = self.getopt("masterstatus") or self.getopt("master")
tryhost, tryport = master.split(":")
tryport = int(tryport)
f = pb.PBClientFactory()
Expand Down Expand Up @@ -569,7 +570,7 @@ def getStatus(self):
return self.running
# contact the status port
# we're probably using the ssh style
master = self.getopt("master")
master = self.getopt("masterstatus") or self.getopt("master")
host, port = master.split(":")
port = int(port)
self.announce("contacting the status port at %s:%d" % (host, port))
Expand Down
78 changes: 47 additions & 31 deletions master/buildbot/scripts/runner.py
Expand Up @@ -938,70 +938,86 @@ def parseArgs(self, *args):
class TryOptions(OptionsWithOptionsFile):
optParameters = [
["connect", "c", None,
"how to reach the buildmaster, either 'ssh' or 'pb'"],
# for ssh, use --tryhost, --username, and --trydir
["tryhost", None, None,
"the hostname (used by ssh) for the buildmaster"],
["trydir", None, None,
"the directory (on the tryhost) where tryjobs are deposited"],
["username", "u", None, "Username performing the trial build"],
"How to reach the buildmaster, either 'ssh' or 'pb'"],
# for ssh, use --host, --username, and --jobdir
["host", None, None,
"Hostname (used by ssh) for the buildmaster"],
["jobdir", None, None,
"Directory (on the buildmaster host) where try jobs are deposited"],
["username", "u", None,
"Username performing the try build"],
# for PB, use --master, --username, and --passwd
["master", "m", None,
"Location of the buildmaster's PBListener (host:port)"],
["passwd", None, None, "password for PB authentication"],
["passwd", None, None,
"Password for PB authentication"],

["diff", None, None,
"Filename of a patch to use instead of scanning a local tree. Use '-' for stdin."],
"Filename of a patch to use instead of scanning a local tree. "
"Use '-' for stdin."],
["patchlevel", "p", 0,
"Number of slashes to remove from patch pathnames, like the -p option to 'patch'"],
"Number of slashes to remove from patch pathnames, "
"like the -p option to 'patch'"],

["baserev", None, None,
"Base revision to use instead of scanning a local tree."],

["vc", None, None,
"The VC system in use, one of: cvs,svn,bzr,darcs,p4"],
"The VC system in use, one of: bzr, cvs, darcs, git, hg, "
"mtn, p4, svn"],
["branch", None, None,
"The branch in use, for VC systems that can't figure it out"
" themselves"],
"The branch in use, for VC systems that can't figure it out "
"themselves"],
["repository", None, None,
"Repository to use, instead of path to working directory."],

["builder", "b", None,
"Run the trial build on this Builder. Can be used multiple times."],
["properties", None, None,
"A set of properties made available in the build environment, format:prop1=value1,prop2=value2..."],
"A set of properties made available in the build environment, "
"format:prop1=value1,prop2=value2..."],

["try-topfile", None, None,
"Name of a file at the top of the tree, used to find the top. Only needed for SVN and CVS."],
["try-topdir", None, None,
["topfile", None, None,
"Name of a file at the top of the tree, used to find the top. "
"Only needed for SVN and CVS."],
["topdir", None, None,
"Path to the top of the working copy. Only needed for SVN and CVS."],

]
]

optFlags = [
["wait", None, "wait until the builds have finished"],
["dryrun", 'n', "Gather info, but don't actually submit."],
["get-builder-names", None, "Get the names of available builders. Doesn't submit anything. Only supported for 'pb' connections."],
["quiet", "q", "Don't print status of current builds while waiting."],
]
["wait", None,
"wait until the builds have finished"],
["dryrun", 'n',
"Gather info, but don't actually submit."],
["get-builder-names", None,
"Get the names of available builders. Doesn't submit anything. "
"Only supported for 'pb' connections."],
["quiet", "q",
"Don't print status of current builds while waiting."],
]

# here it is, the definitive, quirky mapping of .buildbot/options names to
# command-line options. Design by committee, anyone?
# Mapping of .buildbot/options names to command-line options
buildbotOptions = [
[ 'try_connect', 'connect' ],
#[ 'try_builders', 'builders' ], <-- handled in postOptions
[ 'try_vc', 'vc' ],
[ 'try_branch', 'branch' ],
[ 'try_repository', 'repository' ],
[ 'try_topdir', 'try-topdir' ],
[ 'try_topfile', 'try-topfile' ],
[ 'try_host', 'tryhost' ],
[ 'try_topdir', 'topdir' ],
[ 'try_topfile', 'topfile' ],
[ 'try_host', 'host' ],
[ 'try_username', 'username' ],
[ 'try_dir', 'trydir' ],
[ 'try_jobdir', 'jobdir' ],
[ 'try_password', 'passwd' ],
[ 'try_master', 'master' ],
#[ 'try_wait', 'wait' ], <-- handled in postOptions
[ 'masterstatus', 'master' ],
[ 'try_masterstatus', 'masterstatus' ],
# Deprecated command mappings from the quirky old days:
[ 'try_topdir', 'try-topdir' ],
[ 'try_topfile', 'try-topfile' ],
[ 'try_host', 'tryhost' ],
[ 'try_dir', 'trydir' ], # replaced by try_jobdir/jobdir
[ 'masterstatus', 'master' ], # replaced by try_masterstatus/masterstatus
]

def __init__(self):
Expand Down
78 changes: 53 additions & 25 deletions master/docs/cmdline.texinfo
Expand Up @@ -207,31 +207,52 @@ the approach by using @option{--connect=ssh} or @option{--connect=pb}
@file{.buildbot/options}).

For the PB approach, the command must be given a @option{--master}
argument (in the form HOST:PORT) that points to TCP port that you
picked in the @code{Try_Userpass} scheduler. It also takes a
argument (in the form HOST:PORT) that points to TCP port that you picked
in the @code{Try_Userpass} scheduler. It also takes a
@option{--username} and @option{--passwd} pair of arguments that match
one of the entries in the buildmaster's @code{userpass} list. These
arguments can also be provided as @code{try_master},
@code{try_username}, and @code{try_password} entries in the
@file{.buildbot/options} file.

For the SSH approach, the command must be given @option{--tryhost},
@option{--username}, and optionally @option{--password} (TODO:
really?) to get to the buildmaster host. It must also be given
@option{--trydir}, which points to the inlet directory configured
above. The trydir can be relative to the user's home directory, but
most of the time you will use an explicit path like
@file{~buildbot/project/trydir}. These arguments can be provided in
@file{.buildbot/options} as @code{try_host}, @code{try_username},
@code{try_password}, and @code{try_dir}.
For the SSH approach, the command must be given @option{--host} and
@option{--username} to get to the buildmaster host. It must also be
given @option{--jobdir}, which points to the inlet directory configured
above. The jobdir can be relative to the user's home directory, but most
of the time you will use an explicit path like
@file{~buildbot/project/jobdir}. These arguments can be provided in
@file{.buildbot/options} as @code{try_host}, @code{try_username}, and
@code{try_jobdir}.

In addition, the SSH approach needs to connect to a PBListener status
port, so it can retrieve and report the results of the build (the PB
approach uses the existing connection to retrieve status information,
so this step is not necessary). This requires a @option{--master}
argument, or a @code{masterstatus} entry in @file{.buildbot/options},
so this step is not necessary). This requires a @option{--masterstatus}
argument, or a @code{try_masterstatus} entry in @file{.buildbot/options},
in the form of a HOSTNAME:PORT string.

The following command line arguments are deprecated, but retained for
backward compatibility:

@itemize @bullet
@item
@option{--tryhost} is replaced by @option{--host}
@item
@option{--trydir} is replaced by @option{--jobdir}
@item
@option{--master} is replaced by @option{--masterstatus}
@end itemize

Likewise, the following @file{.buildbot/options} file entries are
deprecated, but retained for backward compatibility:

@itemize @bullet
@item
@code{try_dir} is replaced by @code{try_jobdir}
@item
@code{masterstatus} is replaced by @code{try_masterstatus}
@end itemize


@heading choosing the Builders

Expand Down Expand Up @@ -273,10 +294,8 @@ using, with an argument like @option{--vc=cvs} or @option{--vc=git}.
This can also be provided as @code{try_vc} in
@file{.buildbot/options}.

@c The order of this list comes from the end of scripts/tryclient.py

The following names are recognized: @code{cvs} @code{svn}
@code{bzr} @code{hg} @code{darcs} @code{git} @code{p4} @code{mtn}
The following names are recognized: @code{bzr} @code{cvs}
@code{darcs} @code{git} @code{hg} @code{mtn} @code{p4} @code{svn}


@heading finding the top of the tree
Expand All @@ -292,24 +311,33 @@ until it finds a marker file. The default name for this marker file is
@command{buildbot try}. Alternatively, you can use a filename like
@file{ChangeLog} or @file{README}, since many projects put one of
these files in their top-most directory (and nowhere else). To set
this filename, use @option{--try-topfile=ChangeLog}, or set it in the
this filename, use @option{--topfile=ChangeLog}, or set it in the
options file with @code{try_topfile = 'ChangeLog'}.

You can also manually set the top of the tree with
@option{--try-topdir=~/trees/mytree}, or @code{try_topdir =
@option{--topdir=~/trees/mytree}, or @code{try_topdir =
'~/trees/mytree'}. If you use @code{try_topdir}, in a
@file{.buildbot/options} file, you will need a separate options file
for each tree you use, so it may be more convenient to use the
@code{try_topfile} approach instead.

Other VC systems which work on full projects instead of individual
directories (darcs, mercurial, git, monotone) do not require
@command{try} to know the top directory, so the @option{--try-topfile}
and @option{--try-topdir} arguments will be ignored.
@c is this true? I think I currently require topdirs all the time.
@command{try} to know the top directory, so the @option{--topfile}
and @option{--topdir} arguments will be ignored.

If the @command{try} command cannot find the top directory, it will
abort with an error message.
abort with an error message.

The following command line arguments are deprecated, but retained for
backward compatibility:

@itemize @bullet
@item
@option{--try-topdir} is replaced by @option{--topdir}
@item
@option{--try-topfile} is replaced by @option{--topfile}
@end itemize

@heading determining the branch name

Expand Down Expand Up @@ -443,9 +471,9 @@ can override this with the @option{-p} argument.

When you use @option{--diff}, you do not need to use any of the other
options that relate to a local tree, specifically @option{--vc},
@option{--try-topfile}, or @option{--try-topdir}. These options will
@option{--topfile}, or @option{--topdir}. These options will
be ignored. Of course you must still specify how to get to the
buildmaster (with @option{--connect}, @option{--tryhost}, etc).
buildmaster (with @option{--connect}, @option{--host}, etc).


@node Other Tools
Expand Down

0 comments on commit 118ce95

Please sign in to comment.