# Path: alibuild_helpers/cmd.py
# def getoutput(command):
#   """Run command, check it succeeded, and return its stdout as a string."""
#   kwargs = {} if sys.version_info.major < 3 else {"encoding": "utf-8"}
#   proc = Popen(command, shell=is_string(command), stdout=PIPE, stderr=PIPE,
#                universal_newlines=True, **kwargs)
#   stdout, stderr = proc.communicate()
#   dieOnError(proc.returncode, "Command %s failed with code %d: %s" %
#              (command, proc.returncode, stderr))
#   return stdout
# 
# def getstatusoutput(command):
#   """Run command and return its return code and output (stdout and stderr)."""
#   kwargs = {} if sys.version_info.major < 3 else {"encoding": "utf-8"}
#   proc = Popen(command, shell=is_string(command), stdout=PIPE, stderr=STDOUT,
#                universal_newlines=True, **kwargs)
#   merged_output, _ = proc.communicate()
#   # Strip a single trailing newline, if one exists, to match the behaviour of
#   # subprocess.getstatusoutput.
#   if merged_output.endswith("\n"):
#     merged_output = merged_output[:-1]
#   return proc.returncode, merged_output
# 
# Path: alibuild_helpers/log.py
# def dieOnError(err, msg):
#   if err:
#     error("%s", msg)
#     sys.exit(1)


import yaml
import hashlib
import sys
import os
import re
    import platform
    import platform
    import platform, distro
from os.path import exists
from glob import glob
from os.path import basename, join
from datetime import datetime
  from collections import OrderedDict
  from ordereddict import OrderedDict
from alibuild_helpers.cmd import getoutput, getstatusoutput
from alibuild_helpers.log import dieOnError
      if err:
        failedRequirements.update([spec["package"]])
        spec["version"] = "failed"
      else:
        disable.append(spec["package"])

    spec["disabled"] = disable
    if spec["package"] in disable:
      continue

    # Check whether the package is compatible with the specified defaults
    if validDefaults is not None:
      (ok,msg,valid) = performValidateDefaults(spec)
      if valid:
        validDefaults = [ v for v in validDefaults if v in valid ] if validDefaults else valid[:]
        if not validDefaults:
          validDefaults = None  # no valid default works for all current packages

    # For the moment we treat build_requires just as requires.
    fn = lambda what: disabledByArchitecture(architecture, spec.get(what, []))
    spec["disabled"] += [x for x in fn("requires")]
    spec["disabled"] += [x for x in fn("build_requires")]
    fn = lambda what: filterByArchitecture(architecture, spec.get(what, []))
    spec["requires"] = [x for x in fn("requires") if not x in disable]
    spec["build_requires"] = [x for x in fn("build_requires") if not x in disable]
    if spec["package"] != "defaults-release":
      spec["build_requires"].append("defaults-release")
    spec["runtime_requires"] = spec["requires"]
    spec["requires"] = spec["runtime_requires"] + spec["build_requires"]
    # Check that version is a string

# Path: alibuild_helpers/cmd.py
# def getoutput(command):
#   """Run command, check it succeeded, and return its stdout as a string."""
#   kwargs = {} if sys.version_info.major < 3 else {"encoding": "utf-8"}
#   proc = Popen(command, shell=is_string(command), stdout=PIPE, stderr=PIPE,
#                universal_newlines=True, **kwargs)
#   stdout, stderr = proc.communicate()
#   dieOnError(proc.returncode, "Command %s failed with code %d: %s" %
#              (command, proc.returncode, stderr))
#   return stdout
# 
# def getstatusoutput(command):
#   """Run command and return its return code and output (stdout and stderr)."""
#   kwargs = {} if sys.version_info.major < 3 else {"encoding": "utf-8"}
#   proc = Popen(command, shell=is_string(command), stdout=PIPE, stderr=STDOUT,
#                universal_newlines=True, **kwargs)
#   merged_output, _ = proc.communicate()
#   # Strip a single trailing newline, if one exists, to match the behaviour of
#   # subprocess.getstatusoutput.
#   if merged_output.endswith("\n"):
#     merged_output = merged_output[:-1]
#   return proc.returncode, merged_output
# 
# Path: alibuild_helpers/log.py
# def dieOnError(err, msg):
#   if err:
#     error("%s", msg)
#     sys.exit(1)


# Path: alibuild_helpers/utilities.py
import yaml
import hashlib
import sys
import os
import re
    import platform
    import platform
    import platform, distro
from os.path import exists
from glob import glob
from os.path import basename, join
from datetime import datetime
  from collections import OrderedDict
  from ordereddict import OrderedDict
from alibuild_helpers.cmd import getoutput, getstatusoutput
from alibuild_helpers.log import dieOnError

      if err:
        failedRequirements.update([spec["package"]])
        spec["version"] = "failed"
      else:
        disable.append(spec["package"])

    spec["disabled"] = disable
    if spec["package"] in disable:
      continue

    # Check whether the package is compatible with the specified defaults
    if validDefaults is not None:
      (ok,msg,valid) = performValidateDefaults(spec)
      if valid:
        validDefaults = [ v for v in validDefaults if v in valid ] if validDefaults else valid[:]
        if not validDefaults:
          validDefaults = None  # no valid default works for all current packages

    # For the moment we treat build_requires just as requires.
    fn = lambda what: disabledByArchitecture(architecture, spec.get(what, []))
    spec["disabled"] += [x for x in fn("requires")]
    spec["disabled"] += [x for x in fn("build_requires")]
    fn = lambda what: filterByArchitecture(architecture, spec.get(what, []))
    spec["requires"] = [x for x in fn("requires") if not x in disable]
    spec["build_requires"] = [x for x in fn("build_requires") if not x in disable]
    if spec["package"] != "defaults-release":
      spec["build_requires"].append("defaults-release")
    spec["runtime_requires"] = spec["requires"]
    spec["requires"] = spec["runtime_requires"] + spec["build_requires"]
    # Check that version is a string

    dieOnError(not isinstance(spec["version"], str),