Ejemplo n.º 1
0
  def makerestr(self):
    """Create restricted.sh file."""
    environ = { }
    environ.update(os.environ)
    environ.update(self.buildenv)

    environ["__MAKE_SHELL"] = "/rescue/sh"
    environ["LOCALBASE"] = "/nonexistentlocal"
    environ["LINUXBASE"] = "/nonexistentlinux"
    environ["PKG_DBDIR"] = "/nonexistentpkg"
    environ["PORT_DBDIR"] = "/nonexistentport"

    error = None
    cmdf = "{0}/scripts/makerestr {1} {2} {3} {4}"
    cmd = cmdf.format(pbc, self.arch, self.branch, self.buildid, \
                      self.subsetfile if self.subsetfile else "")

    util.log("Creating restricted.sh file...")
    try:
      f = util.shell_cmd(cmd, cwd=self.portsdir)
      if f.returncode != 0:
        error = "Failed to build restricted.sh file."
    except KeyboardInterrupt:
      error = "Failed to build restricted.sh file."

    if error:
      raise BuildMissingMetadata(error)
Ejemplo n.º 2
0
 def create(builddir, component):
   """Create a new tarball."""
   cachedir = os.path.join(pbd, "tarballs")
   if os.path.isdir(cachedir):
     destdir = cachedir
   else:
     destdir = builddir
   prefix = component + "-"
   (f, tmp) = tempfile.mkstemp(dir=destdir, prefix=prefix, suffix=".tbz")
   util.log("Creating {0} tarball...".format(component))
   cmd = "/usr/bin/tar -C {0} -cjf {1} {2}".format(builddir, tmp, component)
   try:
     util.shell_cmd(cmd)
   except KeyboardInterrupt:
     print "Cleaning up temporary tarball..."
     os.unlink(tmp)
     raise
   else:
     return Tarball(builddir, component, tmp)