Example #1
0
    def _assign_dependencies(self, hash_key, installs, data):
        # Add dependencies from other records in the install DB to
        # form a full spec.
        spec = data[hash_key].spec
        spec_dict = installs[hash_key]['spec']
        if 'dependencies' in spec_dict[spec.name]:
            yaml_deps = spec_dict[spec.name]['dependencies']
            for dname, dhash, dtypes in spack.spec.Spec.read_yaml_dep_specs(
                    yaml_deps):
                # It is important that we always check upstream installations
                # in the same order, and that we always check the local
                # installation first: if a downstream Spack installs a package
                # then dependents in that installation could be using it.
                # If a hash is installed locally and upstream, there isn't
                # enough information to determine which one a local package
                # depends on, so the convention ensures that this isn't an
                # issue.
                upstream, record = self.query_by_spec_hash(dhash, data=data)
                child = record.spec if record else None

                if not child:
                    msg = ("Missing dependency not in database: "
                           "%s needs %s-%s" %
                           (spec.cformat('{name}{/hash:7}'), dname, dhash[:7]))
                    if self._fail_when_missing_deps:
                        raise MissingDependenciesError(msg)
                    tty.warn(msg)
                    continue

                spec._add_dependency(child, dtypes)
Example #2
0
    def _read_spec_from_yaml(self, hash_key, installs, parent_key=None):
        """Recursively construct a spec from a hash in a YAML database.

        Does not do any locking.
        """
        spec_dict = installs[hash_key]['spec']

        # Install records don't include hash with spec, so we add it in here
        # to ensure it is read properly.
        for name in spec_dict:
            spec_dict[name]['hash'] = hash_key

        # Build spec from dict first.
        spec = Spec.from_node_dict(spec_dict)

        # Add dependencies from other records in the install DB to
        # form a full spec.
        for dep_hash in spec_dict[spec.name]['dependencies'].values():
            child = self._read_spec_from_yaml(dep_hash, installs, hash_key)
            spec._add_dependency(child)

        # Specs from the database need to be marked concrete because
        # they represent actual installations.
        spec._mark_concrete()
        return spec
Example #3
0
    def _assign_dependencies(self, hash_key, installs, data):
        # Add dependencies from other records in the install DB to
        # form a full spec.
        spec = data[hash_key].spec
        spec_dict = installs[hash_key]['spec']

        if 'dependencies' in spec_dict[spec.name]:
            yaml_deps = spec_dict[spec.name]['dependencies']
            for dname, dhash, dtypes in spack.spec.Spec.read_yaml_dep_specs(
                    yaml_deps):
                if dhash not in data:
                    tty.warn("Missing dependency not in database: ",
                             "%s needs %s-%s" % (
                                 spec.cformat('$_$/'), dname, dhash[:7]))
                    continue

                child = data[dhash].spec
                spec._add_dependency(child, dtypes)
Example #4
0
    def _assign_dependencies(self, hash_key, installs, data):
        # Add dependencies from other records in the install DB to
        # form a full spec.
        spec = data[hash_key].spec
        spec_dict = installs[hash_key]['spec']

        if 'dependencies' in spec_dict[spec.name]:
            yaml_deps = spec_dict[spec.name]['dependencies']
            for dname, dhash, dtypes in spack.spec.Spec.read_yaml_dep_specs(
                    yaml_deps):
                if dhash not in data:
                    tty.warn("Missing dependency not in database: ",
                             "%s needs %s-%s" % (
                                 spec.cformat('$_$/'), dname, dhash[:7]))
                    continue

                child = data[dhash].spec
                spec._add_dependency(child, dtypes)
Example #5
0
    def _read_spec_from_yaml(self, hash_key, installs, parent_key=None):
        """Recursively construct a spec from a hash in a YAML database.

        Does not do any locking.
        """
        if hash_key not in installs:
            parent = read_spec(installs[parent_key]['path'])

        spec_dict = installs[hash_key]['spec']

        # Build spec from dict first.
        spec = Spec.from_node_dict(spec_dict)

        # Add dependencies from other records in the install DB to
        # form a full spec.
        for dep_hash in spec_dict[spec.name]['dependencies'].values():
            child = self._read_spec_from_yaml(dep_hash, installs, hash_key)
            spec._add_dependency(child)

        return spec
Example #6
0
    def _read_spec_from_yaml(self, hash_key, installs, parent_key=None):
        """Recursively construct a spec from a hash in a YAML database.

        Does not do any locking.
        """
        if hash_key not in installs:
            parent = read_spec(installs[parent_key]['path'])

        spec_dict = installs[hash_key]['spec']

        # Build spec from dict first.
        spec = Spec.from_node_dict(spec_dict)

        # Add dependencies from other records in the install DB to
        # form a full spec.
        for dep_hash in spec_dict[spec.name]['dependencies'].values():
            child = self._read_spec_from_yaml(dep_hash, installs, hash_key)
            spec._add_dependency(child)

        # Specs from the database need to be marked concrete because
        # they represent actual installations.
        spec._mark_concrete()
        return spec
Example #7
0
    def _read_spec_from_yaml(self, hash_key, installs, parent_key=None):
        """Recursively construct a spec from a hash in a YAML database.

        Does not do any locking.
        """
        if hash_key not in installs:
            parent = read_spec(installs[parent_key]["path"])

        spec_dict = installs[hash_key]["spec"]

        # Build spec from dict first.
        spec = Spec.from_node_dict(spec_dict)

        # Add dependencies from other records in the install DB to
        # form a full spec.
        for dep_hash in spec_dict[spec.name]["dependencies"].values():
            child = self._read_spec_from_yaml(dep_hash, installs, hash_key)
            spec._add_dependency(child)

        # Specs from the database need to be marked concrete because
        # they represent actual installations.
        spec._mark_concrete()
        return spec