示例#1
0
  def __init__(self, arch, branch):
    self._config = ConfigParser.SafeConfigParser()
    archpath = os.path.join(pbd, arch, "portbuild.conf")
    branchpath = os.path.join(pbd, arch, branch, "portbuild.conf")

    # This is a bit hackish as the current configuration files don't use
    # sections and ConfigParser needs at least one...
    for cfg in [archpath, branchpath]:
      if os.path.exists(cfg):
        (ofd, cfgng) = tempfile.mkstemp(prefix="foo")
        o = os.fdopen(ofd, "w")
        o.write("[portbuild]\n")
        with open(cfg) as i:
          o.write(i.read())
        o.close()
        try:
          self._config.read(cfgng)
        except:
          pass
        os.unlink(cfgng)

    for i in check_variables:
      if not self._config.has_option("portbuild", i):
        error = "Variable '{0}' isn't set in portbuild.conf.".format(i)
        util.error(error)
        raise InvalidConfig(error)
示例#2
0
文件: build.py 项目: flz/portbuild-ng
  def metagen(self, changed, args):
    """Create metadata files"""

    buildindex = True
    if os.path.exists(self.indexfile):
      if not changed:
        buildindex = False
      elif args.noindex:
        util.warn("Tarballs tree changed but noindex option specified.")
        buildindex = False
    else:
      if args.noindex:
        util.error("No index found but noindex option specified.")
        return False
    if buildindex:
      self.makeindex()

    buildduds = True
    if os.path.exists(self.dudsfile):
      if not changed:
        buildduds = False
      elif args.noduds:
        util.warn("Tarballs tree changed but noduds option specified.")
        buildduds = False
    else:
      if args.noduds:
        util.error("No duds found but noduds option specified.")
        return False
    if buildduds:
      self.makeduds()

    buildrestr = True
    if os.path.exists(self.restrfile):
      if not changed:
        buildrestr = False
      elif args.norestr:
        util.warn("Tarballs tree changed but norestr option specified.")
        buildrestr = False
    else:
      if args.norestr:
        util.error("No restr found but norestr option specified.")
        return False
    if buildrestr:
      self.makerestr()

    if args.cdrom:
      self.makecdrom()
示例#3
0
# Mandatory arguments
parser.add_argument("arch")
parser.add_argument("branch")
parser.add_argument("buildid", nargs="?", default="latest")

args = parser.parse_args()

arch = args.arch
branch = args.branch
buildid = args.buildid

try:
  b = build.Build(arch, branch, buildid)
except build.BuildException as e:
  util.error(e)
  sys.exit(1)

if args.target:
  b.set_subset(args.target)

try:
  changed = b.setup()
except build.BuildException as e:
  util.error(e)
  util.error("Failed to setup build. Exiting.")
  sys.exit(1)

try:
  b.metagen(changed, args)
except build.BuildMissingMetadata as e: