code: def run(self, context):
          
          # Don't do something when running non-interactive.
          if not sys.stdout.isatty():
              return
  
          with local.cwd(context.in_container):
              from benchbuild.projects.gentoo import gentoo
              gentoo.setup_networking()
              gentoo.configure_portage()
  
              sed_in_chroot = uchroot.uchroot()["/bin/sed"]
              emerge_in_chroot = uchroot.uchroot()["/usr/bin/emerge"]
              has_pkg = uchroot.uchroot()["/usr/bin/qlist", "-I"]
  
              run.run(sed_in_chroot["-i", '/CC=/d', "/etc/portage/make.conf"])
              run.run(sed_in_chroot["-i", '/CXX=/d', "/etc/portage/make.conf"])
  
              want_sync = bool(CFG["container"]["strategy"]["polyjit"]["sync"])
              want_upgrade = bool(
                  CFG["container"]["strategy"]["polyjit"]["upgrade"])
  
              packages = \
                  CFG["container"]["strategy"]["polyjit"]["packages"].value
              with local.env(MAKEOPTS="-j{0}".format(int(CFG["jobs"]))):
                  if want_sync:
                      LOG.debug("Synchronizing portage.")
                      run.run(emerge_in_chroot["--sync"])
                  if want_upgrade:
                      LOG.debug("Upgrading world.")
                      run.run(emerge_in_chroot["--autounmask-only=y", "-uUDN",
                                               "--with-bdeps=y", "@world"])
                  for pkg in packages:
                      if has_pkg[pkg["name"]] & TF:
                          continue
                      env = pkg["env"]
                      with local.env(**env):
                          run.run(emerge_in_chroot[pkg["name"]])
  
              gentoo.setup_benchbuild()
  
          print("Packing new container image.")
          with local.cwd(context.builddir):
              pack_container(context.in_container, context.out_container)
docs: Setup a gentoo container suitable for PolyJIT.