def check_packages_exist(specs):
    'Ensure all packages mentioned in specs exist.'
    repo = spack.repo.path
    for spec in specs:
        for s in spec.traverse():
            try:
                check_passed = (repo.exists(s.name) or repo.is_virtual(s.name))
            except Exception as e:
                msg = 'Cannot find package: {0}'.format(str(e))
                check_passed = False
                tty.debug(msg)
            if (not check_passed):
                raise spack.repo.UnknownPackageError(str(s.fullname))
Ensure all packages mentioned in specs exist.
def check_packages_exist(specs):
    
    repo = spack.repo.path
    for spec in specs:
        for s in spec.traverse():
            try:
                check_passed = (repo.exists(s.name) or repo.is_virtual(s.name))
            except Exception as e:
                msg = 'Cannot find package: {0}'.format(str(e))
                check_passed = False
                tty.debug(msg)
            if (not check_passed):
                raise spack.repo.UnknownPackageError(str(s.fullname))