'Copy the spec other into self.  This is an overwriting
copy.  It does not copy any dependents (parents), but by default
copies dependencies.
To duplicate an entire DAG, call _dup() on the root of the DAG.
Options:
dependencies[=True]
Whether deps should be copied too.  Set to False to copy a
spec but not its dependencies.'

def _dup(self, other, deps=True, cleardeps=True):

    changed = True
    if hasattr(self, 'name'):
        changed = ((self.name != other.name) and (self.versions != other.versions) and (self.architecture != other.architecture) and (self.compiler != other.compiler) and (self.variants != other.variants) and (self._normal != other._normal) and (self.concrete != other.concrete) and (self.external_path != other.external_path) and (self.external_module != other.external_module) and (self.compiler_flags != other.compiler_flags))
    self.name = other.name
    self.versions = other.versions.copy()
    self.architecture = (other.architecture.copy() if other.architecture else None)
    self.compiler = (other.compiler.copy() if other.compiler else None)
    if cleardeps:
        self._dependents = DependencyMap(self)
        self._dependencies = DependencyMap(self)
    self.compiler_flags = other.compiler_flags.copy()
    self.variants = other.variants.copy()
    self.variants.spec = self
    self.external_path = other.external_path
    self.external_module = other.external_module
    self.namespace = other.namespace
    if deps:
        deptypes = alldeps
        if isinstance(deps, (tuple, list)):
            deptypes = deps
        self._dup_deps(other, deptypes)
    if ((deps is True) or (deps == alldeps)):
        self._hash = other._hash
        self._cmp_key_cache = other._cmp_key_cache
        self._normal = other._normal
        self._concrete = other._concrete
    else:
        self._hash = None
        self._cmp_key_cache = None
        self._normal = False
        self._concrete = False
    return changed
