[csw-devel] SF.net SVN: opencsw:[304] utilities/build_all_architectures.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Feb 21 02:13:11 CET 2011


Revision: 304
          http://opencsw.svn.sourceforge.net/opencsw/?rev=304&view=rev
Author:   wahwah
Date:     2011-02-21 01:13:11 +0000 (Mon, 21 Feb 2011)

Log Message:
-----------
build_all_architectures.py: Removing an obsolete script.

Removed Paths:
-------------
    utilities/build_all_architectures.py

Deleted: utilities/build_all_architectures.py
===================================================================
--- utilities/build_all_architectures.py	2011-02-21 00:50:19 UTC (rev 303)
+++ utilities/build_all_architectures.py	2011-02-21 01:13:11 UTC (rev 304)
@@ -1,177 +0,0 @@
-#!/opt/csw/bin/python2.6
-# coding=utf-8
-# Copyright (c) 2009 OpenCSW
-# Distributed under the terms of GNU GPL v2.
-# vim:set sw=2 ts=2 sts=2 expandtab:
-# $Id$
-#
-# This script allows to build a set of packages with one keypress. For
-# instance, build packages for both sparc and x86 in one go. Or build a
-# modulated package with both 32- and 64-bit binaries. It's only workaround
-# until Dago releases GAR with parallel builds.
-
-import copy
-import logging
-import subprocess
-import optparse
-import os
-import os.path
-
-logging.basicConfig(level=logging.DEBUG)
-DEFAULT_GARPATH_TMPL = "/home/%s/src/opencsw/pkg"
-DEFAULT_GARPATH = DEFAULT_GARPATH_TMPL % os.environ["LOGNAME"]
-DEFAULT_BRANCH = "trunk"
-
-class Error(Exception):
-  pass
-
-class BuildError(Error):
-  pass
-
-class SolarisBuilder(object):
-
-  def __init__(self, software, versions_to_build, build_64_bit=False,
-               garpath=DEFAULT_GARPATH,
-               branch=DEFAULT_BRANCH,
-               checkpkg=True,
-               debug_flavor=False,
-               checkout=False):
-    self.software = software
-    self.versions_to_build = versions_to_build
-    self.build_64_bit = build_64_bit
-    self.garpath = garpath
-    self.branch = branch
-    self.checkpkg = checkpkg
-    self.debug_flavor = debug_flavor
-    self.checkout = checkout
-
-  def GetBuildPath(self):
-    return os.path.join(self.garpath,
-                        self.software,
-                        self.branch)
-
-  def BuildOne(self, sol_ver, arch, job_id,
-               targets=["clean", "package"],
-               fail_on_errors=True):
-    build_env = copy.copy(os.environ)
-    build_env["PARALLELMFLAGS"] = "-l -j 2"
-    host = "build%s%s" % (sol_ver, arch)
-    buildpath = self.GetBuildPath()
-    args = ["ssh", host, "gmake",
-            "-C", buildpath]
-    if not self.checkpkg:
-      args.append("ENABLE_CHECK=0")
-      build_env["ENABLE_CHECK"] = "0"
-
-    if self.debug_flavor:
-      args.append("GARFLAVOR=DBG")
-      build_env["GARFLAVOR"] = "DBG"
-    
-    args.extend(targets)
-    build_proc = subprocess.Popen(args,
-                                  stdin=subprocess.PIPE,
-                                  stdout=subprocess.PIPE,
-                                  stderr=subprocess.PIPE,
-                                  env=build_env)
-    logging.info("Running %s", repr(args))
-    (out_stdout, out_stderr) = build_proc.communicate()
-    ret = build_proc.wait()
-    if ret:
-      base_file_name = "%s-%s" % (job_id, host)
-      fd = open("%s.stdout" % base_file_name, "w")
-      fd.write(out_stdout)
-      fd.close()
-      fd = open("%s.stderr" % base_file_name, "w")
-      fd.write(out_stderr)
-      fd.close()
-      if fail_on_errors:
-        raise BuildError("Build %s failed" % repr(args))
-      else:
-        logging.info("Build %s has failed", repr(args))
-    else:
-      logging.info("The run of %s was successful", repr(args))
-
-  def Build(self):
-    if self.checkout:
-      args = ["svn", "update", os.path.join(self.garpath, self.software)]
-      ret = subprocess.call(args)
-      if ret:
-        logging.error("Couldn't update %s", self.GetBuildPath())
-    if self.build_64_bit and "10" not in self.versions_to_build:
-      self.BuildOne("8", "s", self.software,
-                    targets=["clean", "package"])
-      self.BuildOne("8", "x", self.software,
-                    targets=["clean", "merge"],
-                    fail_on_errors=False)
-      logging.info("It's okay if build8x merge has failed.")
-      self.BuildOne("10", "x", self.software,
-                    targets=["merge"])
-      self.BuildOne("8", "x", self.software,
-                    targets=["package"],
-                    fail_on_errors=False)
-    elif not self.build_64_bit:
-      for sol_ver in self.versions_to_build:
-        for arch in ("s", "x"):
-          self.BuildOne(sol_ver, arch, self.software)
-
-
-def main():
-  parser = optparse.OptionParser()
-  parser.add_option("-s", "--software",
-                    dest="software",
-                    help="Software name, e.g. 'cups'")
-  parser.add_option("", "--64bit", dest="build_64_bit",
-                    action="store_true", default=False,
-                    help="Build a 64-bit binary. Implies building"
-                    " a Solaris 8 binary for sparc, and a modulated"
-                    " binary for x86, compiled on Solaris 8 and 10.")
-  parser.add_option("", "--no-build-for-8", dest="build_sol_8",
-                    action="store_false", default=True,
-                    help="Skip building Solaris 8 binary")
-  parser.add_option("", "--build-for-9", dest="build_sol_9",
-                    action="store_true", default=False,
-                    help="Build a separate Solaris 9 binary")
-  parser.add_option("", "--build-for-10", dest="build_sol_10",
-                    action="store_true", default=False,
-                    help="Build a separate Solaris 10 binary")
-  parser.add_option("-b", "--branch", dest="branch",
-                    default="trunk",
-                    help="A branch to build, default: 'trunk'."
-                    "To build from a subversion branch: "
-                    "'branches/branch-name'")
-  parser.add_option("", "--no-check", dest="checkpkg",
-                    action="store_false", default=True,
-                    help="Equivalent to ENABLE_CHECK=0")
-  parser.add_option("", "--debug-flavor", dest="debug_flavor",
-                    action="store_true", default=False,
-                    help="Equivalent to passing GARFLAVOR=DBG")
-  parser.add_option("-g", "--gar-path", dest="garpath",
-                    default=DEFAULT_GARPATH,
-                    help="Absolute path to the GAR tree. "
-                    "default: %s" % DEFAULT_GARPATH)
-  parser.add_option("-c", "--checkout", dest="checkout",
-                    default=False, action="store_true",
-                    help="Check out Subversion sources "
-                         "before building")
-  (options, args) = parser.parse_args()
-  if not options.software:
-    raise Error("I need a software name. Run --help.")
-  versions_to_build = []
-  if options.build_sol_8:
-    versions_to_build.append("8")
-  if options.build_sol_9:
-    versions_to_build.append("9")
-  if options.build_sol_10:
-    versions_to_build.append("10")
-  sb = SolarisBuilder(options.software,
-                      versions_to_build=versions_to_build,
-                      build_64_bit=options.build_64_bit,
-                      branch=options.branch,
-                      checkpkg=options.checkpkg,
-                      debug_flavor=options.debug_flavor,
-                      garpath=options.garpath,
-                      checkout=options.checkout)
-  sb.Build()
-
-if __name__ == "__main__":
-  main()


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list