[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Fri Oct 1 03:47:01 MDT 2010


The branch, master has been updated
       via  0866e2d autobuild-remote: Support autobuild.py rather than land.py.
       via  1adece8 Remove land.py - it's been obsoleted by autobuild.py.
       via  ebf01a4 autobuild: Add --daemon option.
      from  072e310 autobuild: Remove autogen step for projects that have checked in configure.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0866e2dad23e86cb423665268bbd6235b2188869
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Oct 1 04:42:59 2010 +0200

    autobuild-remote: Support autobuild.py rather than land.py.
    
    Autobuild-User: Jelmer Vernooij <jelmer at samba.org>
    Autobuild-Date: Fri Oct  1 09:46:37 UTC 2010 on sn-devel-104

commit 1adece8c8d1b336941877e92fab76458204f26b3
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Oct 1 04:11:21 2010 +0200

    Remove land.py - it's been obsoleted by autobuild.py.

commit ebf01a4f89dcaf4f91c410eaf09d07ee5b081ff0
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Oct 1 02:53:38 2010 +0200

    autobuild: Add --daemon option.

-----------------------------------------------------------------------

Summary of changes:
 script/autobuild-remote.py    |   70 ++++++++++++++++++++++++
 script/autobuild.py           |   31 +++++++++++
 source4/script/land-remote.py |   50 -----------------
 source4/script/land.py        |  118 -----------------------------------------
 4 files changed, 101 insertions(+), 168 deletions(-)
 create mode 100755 script/autobuild-remote.py
 delete mode 100755 source4/script/land-remote.py
 delete mode 100755 source4/script/land.py


Changeset truncated at 500 lines:

diff --git a/script/autobuild-remote.py b/script/autobuild-remote.py
new file mode 100755
index 0000000..4abc874
--- /dev/null
+++ b/script/autobuild-remote.py
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+# Ship a local branch to a remote host (sn-104?) over ssh and run autobuild in it.
+# Copyright (C) 2010 Jelmer Vernooij <jelmer at samba.org>
+# Published under the GPL, v3 or later
+
+import optparse
+import subprocess
+import sys
+
+parser = optparse.OptionParser("autoland-remote [options]")
+parser.add_option("--remote-repo", help="Location of remote repository (default: temporary repository)", type=str, default=None)
+parser.add_option("--host", help="Host to land on (SSH connection string)", type=str, default="sn-devel-104.sn.samba.org")
+parser.add_option("--foreground", help="Don't daemonize", action="store_true", default=False)
+parser.add_option("--email", help="Email address to send build/test output to", type=str, default=None, metavar="EMAIL")
+parser.add_option("--rebase-master", help="rebase on master before testing", default=False, action='store_true')
+parser.add_option("--rebase", help="rebase on the given tree before testing", default=None, type='str')
+parser.add_option("--passcmd", help="command to run on success", default=None)
+parser.add_option("--tail", help="show output while running", default=False, action="store_true")
+parser.add_option("--keeplogs", help="keep logs", default=False, action="store_true")
+parser.add_option("--nocleanup", help="don't remove test tree", default=False, action="store_true")
+parser.add_option("", "--fix-whitespace", help="fix whitespace on rebase",
+                  default=False, action="store_true")
+
+(opts, args) = parser.parse_args()
+
+if not opts.foreground and not opts.email:
+    print "Not running in foreground and --email not specified."
+    sys.exit(1)
+
+if not opts.remote_repo:
+    print "%s$ mktemp -d" % opts.host
+    f = subprocess.Popen(["ssh", opts.host, "mktemp", "-d"], stdout=subprocess.PIPE)
+    (stdout, stderr) = f.communicate()
+    if f.returncode != 0:
+        sys.exit(1)
+    remote_repo = stdout.rstrip()
+    print "Remote tempdir: %s" % remote_repo
+    remote_args = ["git", "clone", "git://git.samba.org/samba.git", remote_repo]
+    #remote_args = ["git", "init", remote_repo]
+    print "%s$ %s" % (opts.host, " ".join(remote_args))
+    subprocess.check_call(["ssh", opts.host] + remote_args)
+else:
+    remote_repo = opts.remote_repo
+
+print "Pushing local branch"
+args = ["git", "push", "--force", "git+ssh://%s/%s" % (opts.host, remote_repo), "HEAD:HEAD"]
+print "$ " + " ".join(args)
+subprocess.check_call(args)
+remote_args = ["cd", remote_repo, "&&", "python", "./script/autobuild.py"]
+if opts.email:
+    remote_args.append("--email=%s" % opts.email)
+if not opts.foreground:
+    remote_args.append("--daemon")
+if opts.nocleanup:
+    remote_args.append("--nocleanup")
+if opts.fix_whitespace:
+    remote_args.append("--fix-whitespace")
+if opts.tail:
+    remote_args.append("--tail")
+if opts.keeplogs:
+    remote_args.append("--keeplogs")
+if opts.rebase_master:
+    remote_args.append("--rebase-master")
+if opts.rebase:
+    remote_args.append("--rebase=%s" % opts.rebase)
+if opts.passcmd:
+    remote_args.append("--passcmd=%s" % opts.passcmd)
+print "%s$ %s" % (opts.host, " ".join(remote_args))
+args = ["ssh", "-A", opts.host] + remote_args
+sys.exit(subprocess.call(args))
diff --git a/script/autobuild.py b/script/autobuild.py
index e7a2015..4063543 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -246,6 +246,30 @@ def find_git_root():
     return None
 
 
+def daemonize(logfile):
+    pid = os.fork()
+    if pid == 0: # Parent
+        os.setsid()
+        pid = os.fork()
+        if pid != 0: # Actual daemon
+            os._exit(0)
+    else: # Grandparent
+        os._exit(0)
+
+    import resource      # Resource usage information.
+    maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
+    if maxfd == resource.RLIM_INFINITY:
+        maxfd = 1024 # Rough guess at maximum number of open file descriptors.
+    for fd in range(0, maxfd):
+        try:
+            os.close(fd)
+        except OSError:
+            pass
+    os.open(logfile, os.O_RDWR | os.O_CREAT)
+    os.dup2(0, 1)
+    os.dup2(0, 2)
+
+
 def rebase_tree(url):
     print("Rebasing on %s" % url)
     run_cmd("git remote add -t master master %s" % url, show=True, dir=test_master)
@@ -295,6 +319,8 @@ parser.add_option("", "--retry", help="automatically retry if master changes",
                   default=False, action="store_true")
 parser.add_option("", "--email", help="send email to the given address on failure",
                   type='str', default=None)
+parser.add_option("", "--daemon", help="daemonize after initial setup",
+                  action="store_true")
 
 
 def email_failure(status, failed_task, failed_tag, errstr):
@@ -347,6 +373,11 @@ except Exception, reason:
     raise Exception("Unable to create %s : %s" % (testbase, reason))
 cleanup_list.append(testbase)
 
+if options.daemon:
+    logfile = os.path.join(testbase, "log")
+    print "Forking into the background, writing progress to %s" % logfile
+    daemonize(logfile)
+
 while True:
     try:
         run_cmd("rm -rf %s" % test_master)
diff --git a/source4/script/land-remote.py b/source4/script/land-remote.py
deleted file mode 100755
index 3635e1b..0000000
--- a/source4/script/land-remote.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Land a branch by building and testing it on sn-104 before landing it on master.
-# Copyright (C) 2010 Jelmer Vernooij <jelmer at samba.org>
-# Published under the GPL, v3 or later
-
-import os
-import optparse
-import subprocess
-import sys
-
-parser = optparse.OptionParser("land-remote [options]")
-parser.add_option("--host", help="Host to land on (SSH connection string)", type=str, default="sn-devel-104.sn.samba.org")
-parser.add_option("--dry-run", help="Dry run (don't actually land)", action="store_true", default=False)
-parser.add_option("--foreground", help="Don't daemonize", action="store_true", default=False)
-parser.add_option("--mail-to", help="Email address to send build/test output to", type=str, default=None, metavar="MAIL-TO")
-
-(opts, args) = parser.parse_args()
-
-if not opts.foreground and not opts.mail_to:
-    print "Not running in foreground and --mail-to not specified."
-    sys.exit(1)
-
-print "%s$ mktemp -d" % opts.host
-f = subprocess.Popen(["ssh", opts.host, "mktemp", "-d"], stdout=subprocess.PIPE)
-(stdout, stderr) = f.communicate()
-if f.returncode != 0:
-    sys.exit(1)
-remote_tmpdir = stdout.rstrip()
-
-print "Remote tempdir: %s" % remote_tmpdir
-
-remote_args = ["git", "clone", "git://git.samba.org/samba.git", "%s/repo" % remote_tmpdir]
-print "%s$ %s" % (opts.host, " ".join(remote_args))
-subprocess.check_call(["ssh", opts.host] + remote_args)
-
-print "Pushing local branch"
-print "$ " + " ".join(args)
-subprocess.check_call(["git", "push", "--force", "git+ssh://%s/%s/repo" % (opts.host, remote_tmpdir), "HEAD:refs/heads/land"])
-remote_args = ["python", "%s/repo/source4/script/land.py" % remote_tmpdir]
-if opts.mail_to:
-    remote_args.append("--mail-to=%s" % opts.mail_to)
-if not opts.foreground:
-    remote_args.append("--daemon")
-if opts.dry_run:
-    remote_args.append("--dry-run")
-remote_args.append("--branch=land")
-remote_args.append(os.path.join(remote_tmpdir, "repo"))
-print "%s$ %s" % (opts.host, " ".join(remote_args))
-args = ["ssh", "-A", opts.host] + remote_args
-sys.exit(subprocess.call(args))
diff --git a/source4/script/land.py b/source4/script/land.py
deleted file mode 100755
index 69f386b..0000000
--- a/source4/script/land.py
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/python
-# Compile a Samba 4 branch from scratch and land it onto master.
-# (C) 2010 Jelmer Vernooij <jelmer at samba.org>
-# Published under the GPL, v3 or later.
-
-from email.mime.text import MIMEText
-import optparse
-import os
-import shutil
-import smtplib
-import subprocess
-import sys
-import tempfile
-
-parser = optparse.OptionParser("land [options] <repo>")
-parser.add_option("--branch", help="Branch to land", type=str, default=None, metavar="BRANCH")
-parser.add_option("--dry-run", help="Dry run (don't actually land)", action="store_true", default=False)
-parser.add_option("--daemon", help="Daemonize", action="store_true", default=False)
-parser.add_option("--mail-to", help="Email address to send build/test output to", type=str, default=None, metavar="MAIL-TO")
-
-(opts, args) = parser.parse_args()
-
-if opts.mail_to:
-    from_addr = opts.mail_to
-    smtp = smtplib.SMTP()
-
-if len(args) != 1:
-    parser.print_usage()
-    sys.exit(1)
-
-[repo] = args
-tmpdir = tempfile.mkdtemp()
-rootpath = os.path.join(tmpdir, "repo")
-
-if subprocess.call(["git", "clone", repo, rootpath]) != 0:
-    print "Unable to clone repository at %s" % repo
-    sys.exit(1)
-
-if opts.branch:
-    if subprocess.call(["git", "checkout", opts.branch], cwd=rootpath) != 0:
-        sys.exit(1)
-if subprocess.call(["git", "remote", "add", "upstream", "git://git.samba.org/samba.git"], cwd=rootpath) != 0:
-    sys.exit(1)
-if subprocess.call(["git", "fetch", "upstream"], cwd=rootpath) != 0:
-    sys.exit(1)
-if subprocess.call(["git", "rebase", "upstream/master"], cwd=rootpath) != 0:
-    sys.exit(1)
-
-if opts.daemon:
-    pid = os.fork()
-    if pid == 0: # Parent
-        os.setsid()
-        pid = os.fork()
-        if pid != 0: # Actual daemon
-            os._exit(0)
-    else: # Grandparent
-        os._exit(0)
-
-    import resource      # Resource usage information.
-    maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
-    if maxfd == resource.RLIM_INFINITY:
-        maxfd = 1024 # Rough guess at maximum number of open file descriptors.
-    for fd in range(0, maxfd):
-        try:
-            os.close(fd)
-        except OSError:
-            pass
-    os.open(os.devnull, os.O_RDWR)
-    os.dup2(0, 1)
-    os.dup2(0, 2)
-
-if opts.mail_to:
-    (outfd, name) = tempfile.mkstemp()
-    outf = os.fdopen(outfd, 'w')
-else:
-    outf = sys.stdout
-
-def fail(stage):
-    if opts.mail_to:
-        outf.close()
-        f = open(name, 'r')
-        msg = MIMEText(f.read())
-        f.close()
-        msg["Subject"] = "Failure for %s during %s" % (repo, stage)
-        msg["To"] = opts.mail_to
-        msg["From"] = from_addr
-        smtp.connect()
-        smtp.sendmail(from_addr, [opts.mail_to], msg.as_string())
-        smtp.quit()
-    shutil.rmtree(tmpdir)
-    sys.exit(1)
-
-s4path = os.path.join(rootpath, "source4")
-
-if subprocess.call(["./autogen.sh"], cwd=s4path, stdout=outf, stderr=outf) != 0:
-    fail("Generating configure")
-if subprocess.call(["./configure.developer"], cwd=s4path, stdout=outf, stderr=outf) != 0:
-    fail("Running configure")
-if subprocess.call(["make"], cwd=s4path, stderr=outf, stdout=outf) != 0:
-    fail("Building")
-if subprocess.call(["make", "check"], cwd=s4path, stderr=outf, stdout=outf) != 0:
-    fail("Running testsuite")
-if not opts.dry_run:
-    if subprocess.call(["git", "push", "git+ssh://git.samba.org/data/git/samba.git", "HEAD:master"], cwd=rootpath, stderr=outf, stdout=outf) != 0:
-        fail("Pushing to master")
-shutil.rmtree(tmpdir)
-
-if opts.mail_to:
-    outf.close()
-    f = open(name, 'r')
-    msg = MIMEText(f.read())
-    f.close()
-    msg["Subject"] = "Success landing %s" % repo
-    msg["To"] = opts.mail_to
-    msg["From"] = from_addr
-    smtp.connect()
-    smtp.sendmail(from_addr, [opts.mail_to], msg.as_string())
-    smtp.quit()


-- 
Samba Shared Repository


More information about the samba-cvs mailing list