Repository: conan-io/conan

Issue:
Move memsharded/hello repository to the conan-io organization
When using the ``conan new`` command, the conanfile.py created points to https://github.com/memsharded/hello and it is a bit weird to use an example out of the organization.

We should move it to a isolated repo in the conan-io org and give it a better name, like: hello-cpp-lib-example

After that, the ``conan new`` command should be updated to use the new repo



Discussion:

Patch:
diff --git a/conans/client/cache/cache.py b/conans/client/cache/cache.py
index 317153e0e..b2cb956a4 100644
--- a/conans/client/cache/cache.py
+++ b/conans/client/cache/cache.py
@@ -88,11 +88,6 @@ class ClientCache(object):
     def store(self):
         return self._store_folder
 
-    def base_folder(self, ref):
-        """ the base folder for this package reference, for each ConanFileReference
-        """
-        return self.package_layout(ref).base_folder()
-
     def package(self, pref, short_paths=False):
         # TODO: This is deprecated, only used in testing
         return self.package_layout(pref.ref, short_paths).package(pref)
@@ -258,19 +253,9 @@ class ClientCache(object):
                 hooks.append(hook_name[:-3])
         return hooks
 
-    def conan_packages(self, ref):
-        """ Returns a list of package_id from a local cache package folder """
-        layout = self.package_layout(ref)
-        return layout.conan_packages()
-
-    def conan_builds(self, ref):
-        """ Returns a list of package ids from a local cache build folder """
-        layout = self.package_layout(ref)
-        return layout.conan_builds()
-
     def delete_empty_dirs(self, deleted_refs):
         for ref in deleted_refs:
-            ref_path = self.base_folder(ref)
+            ref_path = self.package_layout(ref).base_folder()
             for _ in range(4):
                 if os.path.exists(ref_path):
                     try:  # Take advantage that os.rmdir does not delete non-empty dirs
@@ -279,20 +264,6 @@ class ClientCache(object):
                         break  # not empty
                 ref_path = os.path.dirname(ref_path)
 
-    def remove_package_system_reqs(self, reference):
-        assert isinstance(reference, ConanFileReference)
-        conan_folder = self.base_folder(reference)
-        system_reqs_folder = os.path.join(conan_folder, SYSTEM_REQS_FOLDER)
-        if not os.path.exists(conan_folder):
-            raise ValueError("%s does not exist" % repr(reference))
-        if not os.path.exists(system_reqs_folder):
-            return
-        try:
-            rmdir(system_reqs_folder)
-        except Exception as e:
-            raise ConanException("Unable to remove system requirements at %s: %s"
-                                 % (system_reqs_folder, str(e)))
-
     def remove_locks(self):
         folders = list_folder_subdirs(self._store_folder, 4)
         for folder in folders:
@@ -300,10 +271,6 @@ class ClientCache(object):
             Lock.clean(conan_folder)
             shutil.rmtree(os.path.join(conan_folder, "locks"), ignore_errors=True)
 
-    def remove_package_locks(self, ref):
-        package_layout = self.package_layout(ref=ref)
-        package_layout.remove_package_locks()
-
     def invalidate(self):
         self._config = None
         self._no_lock = None
diff --git a/conans/client/cmd/new.py b/conans/client/cmd/new.py
index 45ef53664..cc7bafc9d 100644
--- a/conans/client/cmd/new.py
+++ b/conans/client/cmd/new.py
@@ -21,13 +21,12 @@ class {package_name}Conan(ConanFile):
     generators = "cmake"
 
     def source(self):
-        self.run("git clone https://github.com/memsharded/hello.git")
-        self.run("cd hello && git checkout static_shared")
+        self.run("git clone https://github.com/conan-io/hello.git")
         # This small hack might be useful to guarantee proper /MT /MD linkage
         # in MSVC if the packaged project doesn't have variables to set it
         # properly
-        tools.replace_in_file("hello/CMakeLists.txt", "PROJECT(MyHello)",
-                              '''PROJECT(MyHello)
+        tools.replace_in_file("hello/CMakeLists.txt", "PROJECT(HelloWorld)",
+                              '''PROJECT(HelloWorld)
 include(${{CMAKE_BINARY_DIR}}/conanbuildinfo.cmake)
 conan_basic_setup()''')
 
diff --git a/conans/client/cmd/new_ci.py b/conans/client/cmd/new_ci.py
index 492a22dde..e334ed091 100644
--- a/conans/client/cmd/new_ci.py
+++ b/conans/client/cmd/new_ci.py
@@ -11,9 +11,8 @@ env:
 linux: &linux
    os: linux
    dist: xenial
-   sudo: required
    language: python
-   python: "3.6"
+   python: "3.7"
    services:
      - docker
 osx: &osx
diff --git a/conans/client/cmd/uploader.py b/conans/client/cmd/uploader.py
index 820d4bcb7..22ed4ded6 100644
--- a/conans/client/cmd/uploader.py
+++ b/conans/client/cmd/uploader.py
@@ -505,6 +505,7 @@ def compress_files(files, symlinks, name, dest_dir, output=None):
             info = tarfile.TarInfo(name=filename)
             info.type = tarfile.SYMTYPE
             info.linkname = dest
+            info.size = 0  # A symlink shouldn't have size
             tgz.addfile(tarinfo=info)
 
         mask = ~(stat.S_IWOTH | stat.S_IWGRP)
@@ -519,6 +520,7 @@ def compress_files(files, symlinks, name, dest_dir, output=None):
             info.mode = os.stat(abs_path).st_mode & mask
             if os.path.islink(abs_path):
                 info.type = tarfile.SYMTYPE
+                info.size = 0  # A symlink shouldn't have size
                 info.linkname = os.readlink(abs_path)  # @UndefinedVariable
                 tgz.addfile(tarinfo=info)
             else:
diff --git a/conans/client/command.py b/conans/client/command.py
index 1d66310c8..2d0670c7e 100644
--- a/conans/client/command.py
+++ b/conans/client/command.py
@@ -903,7 +903,7 @@ class Command(object):
             if args.packages:
                 raise ConanException("'-t' and '-p' parameters can't be used at the same time")
             try:
-                self._cache.remove_package_system_reqs(ref)
+                self._cache.package_layout(ref).remove_system_reqs()
                 self._user_io.out.info("Cache system_reqs from %s has been removed" % repr(ref))
                 return
             except Exception as error:
diff --git a/conans/client/graph/graph_builder.py b/conans/client/graph/graph_builder.py
index ab00a32ed..936a129da 100644
--- a/conans/client/graph/graph_builder.py
+++ b/conans/client/graph/graph_builder.py
@@ -150,6 +150,9 @@ class DepsGraphBuilder(object):
             new_node.inverse_closure.add(node)
             node.public_deps[new_node.name] = new_node
 
+            # If the parent node is a build-require, this new node will be a build-require
+            # If the requirement is a build-require, this node will also be a build-require
+            new_node.build_require = node.build_require or require.build_require
             # New nodes will inherit the private property of its ancestor
             new_node.private = node.private or require.private
             if require.private or require.build_require:
diff --git a/conans/client/installer.py b/conans/client/installer.py
index 5aba8faee..14ed46b0a 100644
--- a/conans/client/installer.py
+++ b/conans/client/installer.py
@@ -421,7 +421,7 @@ class BinaryInstaller(object):
         assert pref.id, "Package-ID without value"
 
         # It is necessary to complete the sources of python requires, which might be used
-        for name, python_require in conanfile.python_requires.items():
+        for python_require in conanfile.python_requires.values():
             assert python_require.ref.revision is not None, \
                 "Installer should receive python_require.ref always"
             complete_recipe_sources(self._remote_manager, self._cache,
diff --git a/conans/client/manager.py b/conans/client/manager.py
index 98fa6742c..d6f10eb13 100644
--- a/conans/client/manager.py
+++ b/conans/client/manager.py
@@ -77,7 +77,7 @@ class ConanManager(object):
         installer = BinaryInstaller(self._cache, self._user_io.out, self._remote_manager,
                                     recorder=self._recorder,
                                     hook_manager=self._hook_manager)
-        installer.install(deps_graph, remotes, keep_build=keep_build)
+        installer.install(deps_graph, remotes, keep_build=keep_build, graph_info=graph_info)
 
         if manifest_folder:
             manifest_manager = ManifestManager(manifest_folder, user_io=self._user_io,
diff --git a/conans/client/tools/oss.py b/conans/client/tools/oss.py
index cb46d19dc..32065dbbf 100644
--- a/conans/client/tools/oss.py
+++ b/conans/client/tools/oss.py
@@ -323,13 +323,14 @@ class OSInfo(object):
         if "cygwin" in output:
             return CYGWIN
         elif "msys" in output or "mingw" in output:
-            output = OSInfo.uname("-r")
-            if output.startswith("2"):
-                return MSYS2
-            elif output.startswith("1"):
-                return MSYS
-            else:
-                return None
+            version = OSInfo.uname("-r").split('.')
+            if version and version[0].isdigit():
+                major = int(version[0])
+                if major == 1:
+                    return MSYS
+                elif major >= 2:
+                    return MSYS2
+            return None
         elif "linux" in output:
             return WSL
         else:
diff --git a/conans/paths/package_layouts/package_cache_layout.py b/conans/paths/package_layouts/package_cache_layout.py
index 495408737..80de2f990 100644
--- a/conans/paths/package_layouts/package_cache_layout.py
+++ b/conans/paths/package_layouts/package_cache_layout.py
@@ -7,7 +7,7 @@ from contextlib import contextmanager
 
 import fasteners
 
-from conans.errors import NotFoundException
+from conans.errors import NotFoundException, ConanException
 from conans.errors import RecipeNotFoundException, PackageNotFoundException
 from conans.model.manifest import FileTreeManifest
 from conans.model.manifest import discarded_file
@@ -84,6 +84,18 @@ class PackageCacheLayout(object):
         assert pref.ref == self._ref
         return os.path.join(self._base_folder, SYSTEM_REQS_FOLDER, pref.id, SYSTEM_REQS)
 
+    def remove_system_reqs(self):
+        system_reqs_folder = os.path.join(self._base_folder, SYSTEM_REQS_FOLDER)
+        if not os.path.exists(self._base_folder):
+            raise ValueError("%s does not exist" % repr(self._ref))
+        if not os.path.exists(system_reqs_folder):
+            return
+        try:
+            rmdir(system_reqs_folder)
+        except Exception as e:
+            raise ConanException("Unable to remove system requirements at %s: %s"
+                                 % (system_reqs_folder, str(e)))
+
     def packages(self):
         return os.path.join(self._base_folder, PACKAGES_FOLDER)
 


Test patch:
diff --git a/conans/test/functional/build_helpers/autotools_environment_test.py b/conans/test/functional/build_helpers/autotools_environment_test.py
index c6462eb5d..51d866774 100644
--- a/conans/test/functional/build_helpers/autotools_environment_test.py
+++ b/conans/test/functional/build_helpers/autotools_environment_test.py
@@ -120,9 +120,8 @@ AC_OUTPUT
                      "hello.h": header,
                      "hello.cpp": body})
         client.run("create . danimtb/testing")
-        pkg_path = client.cache.package(
-                PackageReference.loads(
-                        "test/1.0@danimtb/testing:%s" % NO_SETTINGS_PACKAGE_ID))
+        pref = PackageReference.loads("test/1.0@danimtb/testing:%s" % NO_SETTINGS_PACKAGE_ID)
+        pkg_path = client.cache.package_layout(pref.ref).package(pref)
 
         [self.assertIn(folder, os.listdir(pkg_path)) for folder in ["lib", "bin"]]
 
diff --git a/conans/test/functional/build_helpers/cmake_flags_test.py b/conans/test/functional/build_helpers/cmake_flags_test.py
index 4d470d026..16d0f6669 100644
--- a/conans/test/functional/build_helpers/cmake_flags_test.py
+++ b/conans/test/functional/build_helpers/cmake_flags_test.py
@@ -6,7 +6,6 @@ from textwrap import dedent
 from nose.plugins.attrib import attr
 from parameterized.parameterized import parameterized
 
-from conans import load
 from conans.client.build.cmake import CMake
 from conans.model.version import Version
 from conans.test.utils.tools import TestClient
@@ -132,7 +131,8 @@ int main(){
                      "CMakeLists.txt": cmake}, clean_first=True)
 
         client.run('install . -g cmake')
-        client.runner("cmake .", cwd=client.current_folder)
+        generator = '-G "Visual Studio 15 Win64"' if platform.system() == "Windows" else ""
+        client.runner("cmake . %s" % generator, cwd=client.current_folder)
         cmake_cxx_flags = self._get_line(client.user_io.out, "CMAKE_CXX_FLAGS")
         self.assertTrue(cmake_cxx_flags.endswith("MyFlag1 MyFlag2"))
         self.assertIn("CONAN_CXX_FLAGS=MyFlag1 MyFlag2", client.out)
@@ -151,7 +151,8 @@ int main(){
                      "CMakeLists.txt": cmake}, clean_first=True)
 
         client.run('install . -g cmake')
-        client.runner("cmake .", cwd=client.current_folder)
+        generator = '-G "Visual Studio 15 Win64"' if platform.system() == "Windows" else ""
+        client.runner("cmake . %s" % generator, cwd=client.current_folder)
         cmake_cxx_flags = self._get_line(client.user_io.out, "CMAKE_CXX_FLAGS")
         self.assertTrue(cmake_cxx_flags.endswith("MyFlag1 MyFlag2 MyChatFlag1 MyChatFlag2"))
         self.assertIn("CONAN_CXX_FLAGS=MyFlag1 MyFlag2 MyChatFlag1 MyChatFlag2",
@@ -172,7 +173,8 @@ int main(){
                     clean_first=True)
 
         client.run('install . -g cmake')
-        client.runner("cmake .", cwd=client.current_folder)
+        generator = '-G "Visual Studio 15 Win64"' if platform.system() == "Windows" else ""
+        client.runner("cmake . %s" % generator, cwd=client.current_folder)
         cmake_cxx_flags = self._get_line(client.out, "CMAKE_CXX_FLAGS")
         self.assertNotIn("My", cmake_cxx_flags)
         self.assertIn("CONAN_CXX_FLAGS=MyFlag1 MyFlag2", client.out)
@@ -198,7 +200,9 @@ int main(){
                     clean_first=True)
 
         client.run('install . -g cmake')
-        client.runner("cmake . -DCONAN_CXX_FLAGS=CmdCXXFlag", cwd=client.current_folder)
+        generator = '-G "Visual Studio 15 Win64"' if platform.system() == "Windows" else ""
+        client.runner("cmake . %s -DCONAN_CXX_FLAGS=CmdCXXFlag" % generator,
+                      cwd=client.current_folder)
         cmake_cxx_flags = self._get_line(client.user_io.out, "CMAKE_CXX_FLAGS")
         self.assertNotIn("My", cmake_cxx_flags)
         self.assertIn("CmdCXXFlag", cmake_cxx_flags)
@@ -227,7 +231,8 @@ int main(){
                     clean_first=True)
 
         client.run('install . -g cmake')
-        client.runner("cmake .", cwd=client.current_folder)
+        generator = '-G "Visual Studio 15 Win64"' if platform.system() == "Windows" else ""
+        client.runner("cmake . %s" % generator, cwd=client.current_folder)
 
         cmake_cxx_flags = self._get_line(client.user_io.out, "CMAKE_CXX_FLAGS")
         self.assertNotIn("My", cmake_cxx_flags)
diff --git a/conans/test/functional/build_requires/build_requires_test.py b/conans/test/functional/build_requires/build_requires_test.py
index 763873309..a2e3e8b02 100644
--- a/conans/test/functional/build_requires/build_requires_test.py
+++ b/conans/test/functional/build_requires/build_requires_test.py
@@ -6,6 +6,7 @@ from parameterized.parameterized import parameterized
 from conans.paths import CONANFILE
 from conans.test.utils.tools import TestClient
 from conans.util.files import load
+from conans.test.utils.conanfile import TestConanFile
 
 tool_conanfile = """from conans import ConanFile
 
@@ -50,6 +51,20 @@ nonexistingpattern*: SomeTool/1.2@user/channel
 
 
 class BuildRequiresTest(unittest.TestCase):
+    def test_build_requires_diamond(self):
+        t = TestClient()
+        t.save({"conanfile.py": str(TestConanFile("libA", "0.1"))})
+        t.run("create . libA/0.1@user/testing")
+
+        t.save({"conanfile.py": str(TestConanFile("libB", "0.1",
+                                                  requires=["libA/0.1@user/testing"]))})
+        t.run("create . libB/0.1@user/testing")
+
+        t.save({"conanfile.py": str(TestConanFile("libC", "0.1",
+                                                  build_requires=["libB/0.1@user/testing",
+                                                                  "libA/0.1@user/testing"]))})
+        t.run("create . libC/0.1@user/testing")
+        self.assertIn("libC/0.1@user/testing: Created package", t.out)
 
     def create_with_tests_and_build_requires_test(self):
         client = TestClient()
diff --git a/conans/test/functional/command/build_test.py b/conans/test/functional/command/build_test.py
index 2295678f7..564a52d01 100644
--- a/conans/test/functional/command/build_test.py
+++ b/conans/test/functional/command/build_test.py
@@ -126,7 +126,7 @@ class AConan(ConanFile):
         client.save({"my_conanfile.py": conanfile_scope_env})
         client.run("build ./my_conanfile.py")
         pref = PackageReference.loads("Hello/0.1@lasote/testing:%s" % NO_SETTINGS_PACKAGE_ID)
-        package_folder = client.cache.package(pref).replace("\\", "/")
+        package_folder = client.cache.package_layout(pref.ref).package(pref).replace("\\", "/")
         self.assertIn("my_conanfile.py: INCLUDE PATH: %s/include" % package_folder, client.out)
         self.assertIn("my_conanfile.py: HELLO ROOT PATH: %s" % package_folder, client.out)
         self.assertIn("my_conanfile.py: HELLO INCLUDE PATHS: %s/include"
diff --git a/conans/test/functional/command/config_install_test.py b/conans/test/functional/command/config_install_test.py
index 8dfcdbf35..aa2229ac6 100644
--- a/conans/test/functional/command/config_install_test.py
+++ b/conans/test/functional/command/config_install_test.py
@@ -16,6 +16,7 @@ from conans.errors import ConanException
 from conans.test.utils.test_files import temp_folder
 from conans.test.utils.tools import TestClient, StoppableThreadBottle
 from conans.util.files import load, mkdir, save, save_files
+import textwrap
 
 win_profile = """[settings]
     os: Windows
@@ -101,6 +102,33 @@ class ConfigInstallTest(unittest.TestCase):
                             })
         return folder
 
+    def config_hooks_test(self):
+        # Make sure the conan.conf hooks information is appended
+        folder = temp_folder(path_with_spaces=False)
+        conan_conf = textwrap.dedent("""
+            [hooks]
+            foo
+            custom/custom
+            """)
+        save_files(folder, {"config/conan.conf": conan_conf})
+        client = TestClient()
+        client.run('config install "%s"' % folder)
+        self.assertIn("Processing conan.conf", client.out)
+        content = load(client.cache.conan_conf_path)
+        self.assertEqual(1, content.count("foo"))
+        self.assertEqual(1, content.count("custom/custom"))
+
+        config = ConanClientConfigParser(client.cache.conan_conf_path)
+        hooks = config.get_item("hooks")
+        self.assertIn("foo", hooks)
+        self.assertIn("custom/custom", hooks)
+        self.assertIn("attribute_checker", hooks)
+        client.run('config install "%s"' % folder)
+        self.assertIn("Processing conan.conf", client.out)
+        content = load(client.cache.conan_conf_path)
+        self.assertEqual(1, content.count("foo"))
+        self.assertEqual(1, content.count("custom/custom"))
+
     def _create_zip(self, zippath=None):
         folder = self._create_profile_folder()
         zippath = zippath or os.path.join(folder, "myconfig.zip")
diff --git a/conans/test/functional/command/create_test.py b/conans/test/functional/command/create_test.py
index 229b93950..537dbf4f4 100644
--- a/conans/test/functional/command/create_test.py
+++ b/conans/test/functional/command/create_test.py
@@ -162,13 +162,13 @@ class MyPkg(ConanFile):
         client.run("create . pkg/0.1@danimtb/testing")
         ref = ConanFileReference("pkg", "0.1", "danimtb", "testing")
         pref = PackageReference(ref, NO_SETTINGS_PACKAGE_ID)
-        package_files = os.listdir(client.cache.package(pref))
+        package_files = os.listdir(client.cache.package_layout(pref.ref).package(pref))
         self.assertIn("header.h", package_files)
         self.assertNotIn("source.cpp", package_files)
         client.save({"conanfile.py": conanfile.replace("self.copy(\"*.h\")",
                                                        "self.copy(\"*.cpp\")")})
         client.run("create . pkg/0.1@danimtb/testing -kb")
-        package_files = os.listdir(client.cache.package(pref))
+        package_files = os.listdir(client.cache.package_layout(pref.ref).package(pref))
         self.assertNotIn("header.h", package_files)
         self.assertIn("source.cpp", package_files)
 
@@ -510,5 +510,5 @@ class TestConanLib(ConanFile):
         pref = PackageReference(ref, NO_SETTINGS_PACKAGE_ID, None)
         client.run("create . %s" % ref.full_repr(), assert_error=True)
         self.assertIn("Build error", client.out)
-        package_folder = client.cache.package(pref)
+        package_folder = client.cache.package_layout(pref.ref).package(pref)
         self.assertFalse(os.path.exists(package_folder))
diff --git a/conans/test/functional/command/download_test.py b/conans/test/functional/command/download_test.py
index 20d7925d2..4ff1bb7cc 100644
--- a/conans/test/functional/command/download_test.py
+++ b/conans/test/functional/command/download_test.py
@@ -32,7 +32,7 @@ class Pkg(ConanFile):
         client.run("create . lasote/stable")
         ref = ConanFileReference.loads("pkg/0.1@lasote/stable")
         self.assertTrue(os.path.exists(client.cache.package_layout(ref).conanfile()))
-        conan = client.cache.base_folder(ref)
+        conan = client.cache.package_layout(ref).base_folder()
         self.assertTrue(os.path.exists(os.path.join(conan, "package")))
         client.run("upload pkg/0.1@lasote/stable --all")
         client.run("remove pkg/0.1@lasote/stable -f")
@@ -47,7 +47,7 @@ class Pkg(ConanFile):
         self.assertEqual(conanfile, load(os.path.join(export, "conanfile.py")))
         source = client.cache.package_layout(ref).export_sources()
         self.assertFalse(os.path.exists(os.path.join(source, "file.h")))
-        conan = client.cache.base_folder(ref)
+        conan = client.cache.package_layout(ref).base_folder()
         self.assertFalse(os.path.exists(os.path.join(conan, "package")))
 
     def download_with_sources_test(self):
@@ -124,21 +124,22 @@ class Pkg(ConanFile):
         client.run("create . lasote/stable")
 
         ref = ConanFileReference.loads("pkg/0.1@lasote/stable")
-        self.assertTrue(os.path.exists(client.cache.package_layout(ref).conanfile()))
+        package_layout = client.cache.package_layout(ref)
+        self.assertTrue(os.path.exists(package_layout.conanfile()))
 
-        package_folder = os.path.join(client.cache.base_folder(ref), "package",
-                                      os.listdir(client.cache.package_layout(ref).packages())[0])
+        package_folder = os.path.join(package_layout.packages(),
+                                      os.listdir(package_layout.packages())[0])
 
         client.run("upload pkg/0.1@lasote/stable --all")
         client.run("remove pkg/0.1@lasote/stable -f")
-        self.assertFalse(os.path.exists(client.cache.package_layout(ref).export()))
+        self.assertFalse(os.path.exists(package_layout.export()))
 
         client.run("download pkg/0.1@lasote/stable")
 
         # Check not 'No remote binary packages found' warning
         self.assertNotIn("WARN: No remote binary packages found in remote", client.out)
         # Check at conanfile.py is downloaded
-        self.assertTrue(os.path.exists(client.cache.package_layout(ref).conanfile()))
+        self.assertTrue(os.path.exists(package_layout.conanfile()))
         # Check package folder created
         self.assertTrue(os.path.exists(package_folder))
 
diff --git a/conans/test/functional/command/export_pkg_test.py b/conans/test/functional/command/export_pkg_test.py
index 4608f7fc0..2c20a21cf 100644
--- a/conans/test/functional/command/export_pkg_test.py
+++ b/conans/test/functional/command/export_pkg_test.py
@@ -225,13 +225,15 @@ class TestConan(ConanFile):
         client.run("export-pkg . Hello/0.1@lasote/stable -s os=Windows")
         ref = ConanFileReference.loads("Hello/0.1@lasote/stable")
         win_pref = PackageReference(ref, "3475bd55b91ae904ac96fde0f106a136ab951a5e")
-        package_folder = client.cache.package(win_pref, short_paths=short_paths)
+        package_folder = client.cache.package_layout(win_pref.ref,
+                                                     short_paths=short_paths).package(win_pref)
         if short_paths and platform.system() == "Windows":
-            self.assertEqual(load(os.path.join(client.cache.package(win_pref),
+            self.assertEqual(load(os.path.join(client.cache.package_layout(win_pref.ref, False).package(win_pref),
                                                ".conan_link")),
                              package_folder)
         else:
-            self.assertEqual(client.cache.package(win_pref), package_folder)
+            self.assertEqual(client.cache.package_layout(win_pref.ref).package(win_pref),
+                             package_folder)
         self.assertEqual(load(os.path.join(package_folder, "include/header.h")),
                          "//Windows header")
         self._consume(client, ". -s os=Windows")
@@ -336,7 +338,7 @@ class TestConan(ConanFile):
         client.run("export-pkg . Hello/0.1@lasote/stable -s os=Windows --build-folder=.")
         ref = ConanFileReference.loads("Hello/0.1@lasote/stable")
         pref = PackageReference(ref, "3475bd55b91ae904ac96fde0f106a136ab951a5e")
-        package_folder = client.cache.package(pref)
+        package_folder = client.cache.package_layout(pref.ref).package(pref)
         inc = os.path.join(package_folder, "inc")
         self.assertEqual(os.listdir(inc), ["header.h"])
         self.assertEqual(load(os.path.join(inc, "header.h")), "//Windows header")
@@ -359,7 +361,7 @@ class TestConan(ConanFile):
         client.run("export-pkg . Hello/0.1@lasote/stable -s os=Windows --build-folder=build")
         ref = ConanFileReference.loads("Hello/0.1@lasote/stable")
         pref = PackageReference(ref, NO_SETTINGS_PACKAGE_ID)
-        package_folder = client.cache.package(pref)
+        package_folder = client.cache.package_layout(pref.ref).package(pref)
         header = os.path.join(package_folder, "include/header.h")
         self.assertTrue(os.path.exists(header))
 
@@ -386,7 +388,7 @@ class TestConan(ConanFile):
                    "--source-folder=src")
         ref = ConanFileReference.loads("Hello/0.1@lasote/stable")
         pref = PackageReference(ref, "3475bd55b91ae904ac96fde0f106a136ab951a5e")
-        package_folder = client.cache.package(pref)
+        package_folder = client.cache.package_layout(pref.ref).package(pref)
         inc = os.path.join(package_folder, "inc")
         self.assertEqual(os.listdir(inc), ["header.h"])
         self.assertEqual(load(os.path.join(inc, "header.h")), "//Windows header")
diff --git a/conans/test/functional/command/install_test.py b/conans/test/functional/command/install_test.py
index 834abdf0e..a732157f9 100644
--- a/conans/test/functional/command/install_test.py
+++ b/conans/test/functional/command/install_test.py
@@ -270,13 +270,13 @@ class Pkg(ConanFile):
             self.assertEqual("language=%s\nstatic=True" % lang, conan_info.options.dumps())
             ref = ConanFileReference.loads("Hello0/0.1@lasote/stable")
 
-            hello0 = self.client.cache.package(PackageReference(ref, id0))
+            hello0 = self.client.cache.package_layout(ref).package(PackageReference(ref, id0))
             hello0_info = os.path.join(hello0, CONANINFO)
             hello0_conan_info = ConanInfo.load_file(hello0_info)
             self.assertEqual(lang, hello0_conan_info.options.language)
 
             pref1 = PackageReference(ConanFileReference.loads("Hello1/0.1@lasote/stable"), id1)
-            hello1 = self.client.cache.package(pref1)
+            hello1 = self.client.cache.package_layout(pref1.ref).package(pref1)
             hello1_info = os.path.join(hello1, CONANINFO)
             hello1_conan_info = ConanInfo.load_file(hello1_info)
             self.assertEqual(lang, hello1_conan_info.options.language)
@@ -293,8 +293,8 @@ class Pkg(ConanFile):
         self.assertEqual("language=1\nstatic=True", conan_info.options.dumps())
         ref = ConanFileReference.loads("Hello0/0.1@lasote/stable")
 
-        hello0 = self.client.cache.package(PackageReference(ref,
-                                           "8b964e421a5b7e48b7bc19b94782672be126be8b"))
+        pref = PackageReference(ref, "8b964e421a5b7e48b7bc19b94782672be126be8b")
+        hello0 = self.client.cache.package_layout(ref).package(pref)
 
         hello0_info = os.path.join(hello0, CONANINFO)
         hello0_conan_info = ConanInfo.load_file(hello0_info)
@@ -302,7 +302,7 @@ class Pkg(ConanFile):
 
         pref1 = PackageReference(ConanFileReference.loads("Hello1/0.1@lasote/stable"),
                                  "44671ecdd9c606eb7166f2197ab50be8d36a3c3b")
-        hello1 = self.client.cache.package(pref1)
+        hello1 = self.client.cache.package_layout(pref1.ref).package(pref1)
         hello1_info = os.path.join(hello1, CONANINFO)
         hello1_conan_info = ConanInfo.load_file(hello1_info)
         self.assertEqual(0, hello1_conan_info.options.language)
@@ -320,8 +320,8 @@ class Pkg(ConanFile):
 
         self.assertEqual("language=0\nstatic=True", conan_info.options.dumps())
         ref = ConanFileReference.loads("Hello0/0.1@lasote/stable")
-        hello0 = self.client.cache.package(PackageReference(ref,
-                                           "2e38bbc2c3ef1425197c8e2ffa8532894c347d26"))
+        pref = PackageReference(ref, "2e38bbc2c3ef1425197c8e2ffa8532894c347d26")
+        hello0 = self.client.cache.package_layout(ref).package(pref)
 
         hello0_info = os.path.join(hello0, CONANINFO)
         hello0_conan_info = ConanInfo.load_file(hello0_info)
@@ -329,7 +329,7 @@ class Pkg(ConanFile):
 
         pref1 = PackageReference(ConanFileReference.loads("Hello1/0.1@lasote/stable"),
                                  "3eeab577a3134fa3afdcd82881751789ec48e08f")
-        hello1 = self.client.cache.package(pref1)
+        hello1 = self.client.cache.package_layout(pref1.ref).package(pref1)
         hello1_info = os.path.join(hello1, CONANINFO)
         hello1_conan_info = ConanInfo.load_file(hello1_info)
         self.assertEqual("language=1\nstatic=True", hello1_conan_info.options.dumps())
@@ -354,15 +354,15 @@ class Pkg(ConanFile):
         conan_info = ConanInfo.load_file(info_path)
         self.assertEqual("", conan_info.options.dumps())
         ref = ConanFileReference.loads("Hello0/0.1@lasote/stable")
-        hello0 = self.client.cache.package(PackageReference(ref,
-                                           "8b964e421a5b7e48b7bc19b94782672be126be8b"))
+        pref = PackageReference(ref, "8b964e421a5b7e48b7bc19b94782672be126be8b")
+        hello0 = self.client.cache.package_layout(ref).package(pref)
         hello0_info = os.path.join(hello0, CONANINFO)
         hello0_conan_info = ConanInfo.load_file(hello0_info)
         self.assertEqual(1, hello0_conan_info.options.language)
 
         pref1 = PackageReference(ConanFileReference.loads("Hello1/0.1@lasote/stable"),
                                  "44671ecdd9c606eb7166f2197ab50be8d36a3c3b")
-        hello1 = self.client.cache.package(pref1)
+        hello1 = self.client.cache.package_layout(pref1.ref).package(pref1)
         hello1_info = os.path.join(hello1, CONANINFO)
         hello1_conan_info = ConanInfo.load_file(hello1_info)
         self.assertEqual(0, hello1_conan_info.options.language)
@@ -519,7 +519,7 @@ class Pkg(ConanFile):
         ref = ConanFileReference.loads("Hello/0.1@lasote/stable")
         # Because the folder is removed, the metadata is removed and the
         # origin remote is lost
-        rmdir(os.path.join(client.cache.base_folder(ref)))
+        rmdir(os.path.join(client.cache.package_layout(ref).base_folder()))
         client.run("install Hello/0.1@lasote/stable", assert_error=True)
         self.assertIn("ERROR: Unable to find 'Hello/0.1@lasote/stable' in remotes",
                       client.out)
diff --git a/conans/test/functional/command/remove_test.py b/conans/test/functional/command/remove_test.py
index 75383c682..c62452f40 100644
--- a/conans/test/functional/command/remove_test.py
+++ b/conans/test/functional/command/remove_test.py
@@ -165,7 +165,7 @@ class RemoveTest(unittest.TestCase):
 
         # Create the manifests to be able to upload
         for pref in prefs:
-            pkg_folder = client.cache.package(pref)
+            pkg_folder = client.cache.package_layout(pref.ref).package(pref)
             expected_manifest = FileTreeManifest.create(pkg_folder)
             files["%s/%s/%s/%s" % (pref.ref.dir_repr(),
                                    PACKAGES_FOLDER,
diff --git a/conans/test/functional/command/upload_complete_test.py b/conans/test/functional/command/upload_complete_test.py
index 18f77f5d4..ba035565a 100644
--- a/conans/test/functional/command/upload_complete_test.py
+++ b/conans/test/functional/command/upload_complete_test.py
@@ -88,7 +88,7 @@ class UploadTest(unittest.TestCase):
         fake_metadata.recipe.revision = DEFAULT_REVISION_V1
         fake_metadata.packages[self.pref.id].revision = DEFAULT_REVISION_V1
         self.client.save({"metadata.json": fake_metadata.dumps()},
-                         path=self.client.cache.base_folder(self.ref))
+                         path=self.client.cache.package_layout(self.ref).base_folder())
         self.client.save(files, path=reg_folder)
         self.client.save({CONANFILE: myconan1,
                           "include/math/lib1.h": "//copy",
@@ -224,8 +224,8 @@ class UploadTest(unittest.TestCase):
 
     def upload_same_package_dont_compress_test(self):
         # Create a manifest for the faked package
-        pack_path = self.client.cache.package(self.pref)
-        package_path = self.client.cache.package(self.pref)
+        pack_path = self.client.cache.package_layout(self.pref.ref).package(self.pref)
+        package_path = self.client.cache.package_layout(self.pref.ref).package(self.pref)
         expected_manifest = FileTreeManifest.create(package_path)
         expected_manifest.save(pack_path)
 
diff --git a/conans/test/functional/command/upload_compression_test.py b/conans/test/functional/command/upload_compression_test.py
index 7806a00f2..1112c5778 100644
--- a/conans/test/functional/command/upload_compression_test.py
+++ b/conans/test/functional/command/upload_compression_test.py
@@ -80,7 +80,7 @@ class UploadCompressionTest(unittest.TestCase):
         server_paths = self.servers["default"].server_store
         conan_path = server_paths.conan_revisions_root(ref)
         self.assertTrue(os.path.exists(conan_path))
-        package_ids = self.client.cache.conan_packages(ref)
+        package_ids = self.client.cache.package_layout(ref).conan_packages()
         pref = PackageReference(ref, package_ids[0])
 
         # Upload package
diff --git a/conans/test/functional/command/upload_test.py b/conans/test/functional/command/upload_test.py
index c049e7f2f..d227bcf38 100644
--- a/conans/test/functional/command/upload_test.py
+++ b/conans/test/functional/command/upload_test.py
@@ -173,7 +173,7 @@ class UploadTest(unittest.TestCase):
             client.run("upload * --confirm --all", assert_error=True)
             self.assertIn("ERROR: Error gzopen conan_package.tgz", client.out)
 
-            export_folder = client.cache.package(pref)
+            export_folder = client.cache.package_layout(pref.ref).package(pref)
             tgz = os.path.join(export_folder, PACKAGE_TGZ_NAME)
             self.assertTrue(os.path.exists(tgz))
             self.assertTrue(is_dirty(tgz))
diff --git a/conans/test/functional/conan_api/two_conan_creates_test.py b/conans/test/functional/conan_api/two_conan_creates_test.py
index 3edde15d6..c4f578a92 100644
--- a/conans/test/functional/conan_api/two_conan_creates_test.py
+++ b/conans/test/functional/conan_api/two_conan_creates_test.py
@@ -32,8 +32,8 @@ class ConanCreateTest(unittest.TestCase):
 
                 def get_conaninfo(info):
                     package_id = info["installed"][0]["packages"][0]["id"]
-                    folder = cache.package(PackageReference.loads("lib/1.0@conan/stable:%s"
-                                                                  % package_id))
+                    pref = PackageReference.loads("lib/1.0@conan/stable:%s" % package_id)
+                    folder = cache.package_layout(pref.ref).package(pref)
                     return load(os.path.join(folder, "conaninfo.txt"))
 
                 settings = ["compiler=Visual Studio", "compiler.version=15", "build_type=Release"]
diff --git a/conans/test/functional/conanfile/imports_tests.py b/conans/test/functional/conanfile/imports_tests.py
index 9ee5a01c8..064a5ad2b 100644
--- a/conans/test/functional/conanfile/imports_tests.py
+++ b/conans/test/functional/conanfile/imports_tests.py
@@ -55,7 +55,7 @@ class TestConan(ConanFile):
                       client.out)
         pref = PackageReference(ConanFileReference.loads("Pkg/0.1@user/testing"),
                                 "e6f2dac07251ad9958120a7f7c324366fb3b6f2a")
-        pkg_folder = client.cache.package(pref)
+        pkg_folder = client.cache.package_layout(pref.ref).package(pref)
         self.assertTrue(os.path.exists(os.path.join(pkg_folder, "licenses/LibA/LICENSE.txt")))
         self.assertTrue(os.path.exists(os.path.join(pkg_folder, "licenses/LibB/LICENSE.md")))
         self.assertTrue(os.path.exists(os.path.join(pkg_folder, "licenses/LibC/license.txt")))
diff --git a/conans/test/functional/configuration/compressed_symlinks_test.py b/conans/test/functional/configuration/compressed_symlinks_test.py
new file mode 100644
index 000000000..f93ff3007
--- /dev/null
+++ b/conans/test/functional/configuration/compressed_symlinks_test.py
@@ -0,0 +1,53 @@
+import os
+import platform
+import unittest
+
+from conans.model.ref import ConanFileReference
+from conans.test.utils.tools import TestServer, TurboTestClient
+
+
+class CompressSymlinksZeroSize(unittest.TestCase):
+
+    @unittest.skipIf(platform.system() != "Linux", "Only linux")
+    def test_package_symlinks_zero_size(self):
+        server = TestServer()
+        client = TurboTestClient(servers={"default": server})
+
+        conanfile = """
+import os
+from conans import ConanFile, tools
+
+class HelloConan(ConanFile):
+
+    def package(self):
+        # Link to file.txt and then remove it
+        tools.save(os.path.join(self.package_folder, "file.txt"), "contents")
+        os.symlink("file.txt", os.path.join(self.package_folder, "link.txt"))    
+"""
+        ref = ConanFileReference.loads("lib/1.0@conan/stable")
+        # By default it is not allowed
+        pref = client.create(ref, conanfile=conanfile)
+        # Upload, it will create the tgz
+        client.upload_all(ref)
+
+        # We can uncompress it without warns
+        p_folder = client.cache.package_layout(pref.ref).package(pref)
+        tgz = os.path.join(p_folder, "conan_package.tgz")
+        client.run_command('gzip -d "{}"'.format(tgz))
+        client.run_command('tar tvf "{}"'.format(os.path.join(p_folder, "conan_package.tar")))
+        lines = str(client.out).splitlines()
+        """
+-rw-r--r-- 0/0               8 1970-01-01 01:00 file.txt
+lrw-r--r-- 0/0               0 1970-01-01 01:00 link.txt -> file.txt
+        """
+
+        self.assertIn("link.txt", " ".join(lines))
+        for line in lines:
+            if ".txt" not in line:
+                continue
+
+            size = int([i for i in line.split(" ") if i][2])
+            if "link.txt" in line:
+                self.assertEqual(int(size), 0)
+            elif "file.txt":
+                self.assertGreater(int(size), 0)
diff --git a/conans/test/functional/editable/graph_related_test.py b/conans/test/functional/editable/graph_related_test.py
index 4630f29f3..a9ab2c9fb 100644
--- a/conans/test/functional/editable/graph_related_test.py
+++ b/conans/test/functional/editable/graph_related_test.py
@@ -30,7 +30,7 @@ class EmptyCacheTestMixin(object):
         self.t = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]},
                             path_with_spaces=False)
         self.ref = ConanFileReference.loads('lib/version@user/channel')
-        self.assertFalse(os.path.exists(self.t.cache.base_folder(self.ref)))
+        self.assertFalse(os.path.exists(self.t.cache.package_layout(self.ref).base_folder()))
 
     def tearDown(self):
         self.t.run('editable remove {}'.format(self.ref))
@@ -46,15 +46,15 @@ class ExistingCacheTestMixin(object):
         self.ref = ConanFileReference.loads('lib/version@user/channel')
         self.t.save(files={'conanfile.py': conanfile})
         self.t.run('create . {}'.format(self.ref))
-        self.assertTrue(os.path.exists(self.t.cache.base_folder(self.ref)))
-        self.assertListEqual(sorted(os.listdir(self.t.cache.base_folder(self.ref))),
+        self.assertTrue(os.path.exists(self.t.cache.package_layout(self.ref).base_folder()))
+        self.assertListEqual(sorted(os.listdir(self.t.cache.package_layout(self.ref).base_folder())),
                              ['build', 'export', 'export_source', 'locks', 'metadata.json',
                               'metadata.json.lock', 'package', 'source'])
 
     def tearDown(self):
         self.t.run('editable remove {}'.format(self.ref))
-        self.assertTrue(os.path.exists(self.t.cache.base_folder(self.ref)))
-        self.assertListEqual(sorted(os.listdir(self.t.cache.base_folder(self.ref))),
+        self.assertTrue(os.path.exists(self.t.cache.package_layout(self.ref).base_folder()))
+        self.assertListEqual(sorted(os.listdir(self.t.cache.package_layout(self.ref).base_folder())),
                              ['build', 'export', 'export_source', 'locks', 'metadata.json',
                               'metadata.json.lock', 'package', 'source'])
 
@@ -75,7 +75,7 @@ class RelatedToGraphBehavior(object):
         self.t.run('create . {}'.format(ref_parent))
         self.t.run('upload {} --all'.format(ref_parent))
         self.t.run('remove {} --force'.format(ref_parent))
-        self.assertFalse(os.path.exists(self.t.cache.base_folder(ref_parent)))
+        self.assertFalse(os.path.exists(self.t.cache.package_layout(ref_parent).base_folder()))
 
         # Create our project and link it
         self.t.save(files={'conanfile.py':
@@ -89,7 +89,7 @@ class RelatedToGraphBehavior(object):
         self.assertIn("    lib/version@user/channel from user folder - Editable", self.t.out)
         self.assertIn("    parent/version@lasote/channel from 'default' - Downloaded",
                       self.t.out)
-        self.assertTrue(os.path.exists(self.t.cache.base_folder(ref_parent)))
+        self.assertTrue(os.path.exists(self.t.cache.package_layout(ref_parent).base_folder()))
 
     @parameterized.expand([(True,), (False,)])
     def test_middle_graph(self, update):
@@ -99,7 +99,7 @@ class RelatedToGraphBehavior(object):
         self.t.run('create . {}'.format(ref_parent))
         self.t.run('upload {} --all'.format(ref_parent))
         self.t.run('remove {} --force'.format(ref_parent))
-        self.assertFalse(os.path.exists(self.t.cache.base_folder(ref_parent)))
+        self.assertFalse(os.path.exists(self.t.cache.package_layout(ref_parent).base_folder()))
 
         # Create our project and link it
         path_to_lib = os.path.join(self.t.current_folder, 'lib')
@@ -123,7 +123,7 @@ class RelatedToGraphBehavior(object):
                       self.t.out)
         self.assertIn("    lib/version@user/channel from user folder - Editable", self.t.out)
         self.assertIn("    parent/version@lasote/channel from 'default' - Downloaded", self.t.out)
-        self.assertTrue(os.path.exists(self.t.cache.base_folder(ref_parent)))
+        self.assertTrue(os.path.exists(self.t.cache.package_layout(ref_parent).base_folder()))
 
 
 class CreateLinkOverEmptyCache(EmptyCacheTestMixin, RelatedToGraphBehavior, unittest.TestCase):
diff --git a/conans/test/functional/editable/layouts_test.py b/conans/test/functional/editable/layouts_test.py
index a06bd84c2..e42e1ce74 100644
--- a/conans/test/functional/editable/layouts_test.py
+++ b/conans/test/functional/editable/layouts_test.py
@@ -6,6 +6,8 @@ import textwrap
 import unittest
 
 from conans.model.editable_layout import LAYOUTS_FOLDER
+from conans.model.ref import ConanFileReference
+from conans.test.utils.conanfile import TestConanFile
 from conans.test.utils.test_files import temp_folder
 from conans.test.utils.tools import TestClient
 from conans.util.files import load, save_files, save
@@ -13,6 +15,23 @@ from conans.util.files import load, save_files, save
 
 class LayoutTest(unittest.TestCase):
 
+    def test_editable_crash(self):
+        ref = ConanFileReference.loads("lib/1.0@conan/stable")
+        client = TestClient()
+        layout = textwrap.dedent("""
+                    [build_folder]
+                    build
+                    """)
+        client.save({"conanfile.py": TestConanFile("lib", "1.0"),
+                     "mylayout": layout})
+        client.run("editable add . {} --layout mylayout".format(ref))
+        client2 = TestClient(base_folder=client.base_folder)
+        client2.save({"conanfile.py": TestConanFile("app", "1.0",
+                                                    requires=["lib/1.0@conan/stable"])})
+        client2.run("create . user/testing")
+        graph_info = os.path.join(client.current_folder, "build", "graph_info.json")
+        self.assertTrue(os.path.exists(graph_info))
+
     def test_missing_wrong_layouts(self):
         client = TestClient()
         conanfile = textwrap.dedent("""
@@ -202,7 +221,8 @@ class LayoutTest(unittest.TestCase):
         client2.run("install . -g cmake -s build_type=Debug", assert_error=True)
         self.assertIn("ERROR: Error parsing layout file '{}' (for reference "
                       "'mytool/0.1@user/testing')\n'settings.build_type' doesn't exist".format(
-            os.path.join(client.current_folder, 'layout')), client2.out)
+                          os.path.join(client.current_folder, 'layout')),
+                      client2.out)
 
         # Now add settings to conanfile
         client.save({"conanfile.py": conanfile.replace("pass", 'settings = "build_type"')})
diff --git a/conans/test/functional/environment/apply_environment_test.py b/conans/test/functional/environment/apply_environment_test.py
index a61ef5a45..4a38df130 100644
--- a/conans/test/functional/environment/apply_environment_test.py
+++ b/conans/test/functional/environment/apply_environment_test.py
@@ -735,19 +735,19 @@ class LibConan(ConanFile):
         # With no overrides, B takes dependency D and the value should be ValueByLibD
         client.run("install libB/1.0@foo/bar --build")
         self.assertTrue("Value of MYVAR: ValueByLibD")
-        conaninfo = load(os.path.join(client.cache.package(pref), CONANINFO))
+        conaninfo = load(os.path.join(client.cache.package_layout(pref.ref).package(pref), CONANINFO))
         self.assertTrue(conaninfo.endswith("[env]\n\n"))  # Not user input env
 
         # B takes dependency C and the value should be ValueByLibC
         client.run("install libB/1.0@foo/bar --build -e DEP=C")
         self.assertTrue("Value of MYVAR: ValueByLibC")
-        conaninfo = load(os.path.join(client.cache.package(pref), CONANINFO))
+        conaninfo = load(os.path.join(client.cache.package_layout(pref.ref).package(pref), CONANINFO))
         self.assertTrue(conaninfo.endswith("[env]\n\n"))  # Not user input env
 
         # Consumer overrides MYVAR, so his conaninfo should have it
         client.run("install libB/1.0@foo/bar --build -e MYVAR=ValueByConsumer")
         self.assertTrue("Value of MYVAR: ValueByConsumer")
-        conaninfo = load(os.path.join(client.cache.package(pref), CONANINFO))
+        conaninfo = load(os.path.join(client.cache.package_layout(pref.ref).package(pref), CONANINFO))
         self.assertTrue(conaninfo.endswith("[env]\n    MYVAR=ValueByConsumer\n"))
 
         # Consumer overrides MYVAR, so his conaninfo should have it, but not the libC, because
@@ -755,14 +755,14 @@ class LibConan(ConanFile):
         client.run("install libB/1.0@foo/bar --build -e libB:MYVAR=ValueByConsumer "
                    "-e libC:MYVAR=OtherValue")
         self.assertTrue("Value of MYVAR: ValueByConsumer")
-        conaninfo = load(os.path.join(client.cache.package(pref), CONANINFO))
+        conaninfo = load(os.path.join(client.cache.package_layout(pref.ref).package(pref), CONANINFO))
         self.assertTrue(conaninfo.endswith("[env]\n    libB:MYVAR=ValueByConsumer\n"))
 
         # Consumer overrides MYVAR, so his conaninfo should have it, both libB and libD
         client.run("install libB/1.0@foo/bar --build -e libB:MYVAR=ValueByConsumer "
                    "-e libD:MYVAR=OtherValue")
         self.assertTrue("Value of MYVAR: ValueByConsumer")
-        conaninfo = load(os.path.join(client.cache.package(pref), CONANINFO))
+        conaninfo = load(os.path.join(client.cache.package_layout(pref.ref).package(pref), CONANINFO))
         self.assertTrue(conaninfo.endswith("[env]\n    libB:MYVAR=ValueByConsumer\n"
                                            "    libD:MYVAR=OtherValue\n"))  # Not user input env
 
diff --git a/conans/test/functional/generators/cmake_skip_rpath_test.py b/conans/test/functional/generators/cmake_skip_rpath_test.py
index 302cae32a..ed76d162c 100644
--- a/conans/test/functional/generators/cmake_skip_rpath_test.py
+++ b/conans/test/functional/generators/cmake_skip_rpath_test.py
@@ -40,7 +40,8 @@ class CMakeSkipRpathTest(unittest.TestCase):
             client.save({"conanfile.txt": conanfile,
                          "CMakeLists.txt": cmake % way_to_skip}, clean_first=True)
             client.run('install . -g cmake --build')
-            client.runner("cmake .", cwd=client.current_folder)
+            generator = '-G "Visual Studio 15 Win64"' if platform.system() == "Windows" else ""
+            client.runner("cmake . %s" % generator, cwd=client.current_folder)
             self.assertNotIn("Conan: Adjusting default RPATHs Conan policies", client.out)
             self.assertIn("Build files have been written", client.out)
             if way_to_skip == "SKIP_RPATH":
@@ -52,7 +53,7 @@ class CMakeSkipRpathTest(unittest.TestCase):
                         clean_first=True)
 
             client.run('install . -g cmake --build')
-            client.runner("cmake .", cwd=client.current_folder)
+            client.runner("cmake . %s" % generator, cwd=client.current_folder)
             self.assertNotIn("Conan: Adjusting default RPATHs Conan policies", client.out)
             self.assertIn("Build files have been written", client.out)
 
diff --git a/conans/test/functional/generators/xcode_gcc_vs_test.py b/conans/test/functional/generators/xcode_gcc_vs_test.py
index c3ee2f114..a965c6ff6 100644
--- a/conans/test/functional/generators/xcode_gcc_vs_test.py
+++ b/conans/test/functional/generators/xcode_gcc_vs_test.py
@@ -78,7 +78,7 @@ xcode
 
         package_id = os.listdir(client.cache.package_layout(ref).packages())[0]
         pref = PackageReference(ref, package_id)
-        package_path = client.cache.package(pref)
+        package_path = client.cache.package_layout(pref.ref).package(pref)
 
         replaced_path = re.sub(os.getenv("USERPROFILE", "not user profile").replace("\\", "\\\\"),
                                "$(USERPROFILE)", package_path, flags=re.I)
diff --git a/conans/test/functional/graph/graph_manager_test.py b/conans/test/functional/graph/graph_manager_test.py
index b1d7b034d..3b0ac9c24 100644
--- a/conans/test/functional/graph/graph_manager_test.py
+++ b/conans/test/functional/graph/graph_manager_test.py
@@ -769,7 +769,7 @@ class TransitiveGraphTest(GraphManagerTest):
         self._check_node(liba2, "liba/0.2@user/testing#123", deps=[], build_deps=[],
                          dependents=[libc], closure=[])
 
-    def consecutive_private(self):
+    def test_consecutive_private(self):
         liba_ref = "liba/0.1@user/testing"
         libb_ref = "libb/0.1@user/testing"
         libc_ref = "libc/0.1@user/testing"
diff --git a/conans/test/functional/old/package_copier_test.py b/conans/test/functional/old/package_copier_test.py
index 8ed485962..decdbd819 100644
--- a/conans/test/functional/old/package_copier_test.py
+++ b/conans/test/functional/old/package_copier_test.py
@@ -67,7 +67,8 @@ class PackageCopierTest(unittest.TestCase):
                      user_io=userio, force=False)
         conanfile_content = load(paths.package_layout(new_ref).conanfile())
         self.assertEqual(conanfile_content, "new content")
-        package_content = load(os.path.join(paths.package(PackageReference(new_ref, "0101001")),
+        pref = PackageReference(new_ref, "0101001")
+        package_content = load(os.path.join(paths.package_layout(new_ref).package(pref),
                                             "package.lib"))
         self.assertEqual(package_content, "new lib content")
 
@@ -83,7 +84,8 @@ class PackageCopierTest(unittest.TestCase):
         conanfile_content = load(paths.package_layout(new_ref).conanfile())
         self.assertEqual(conanfile_content, "new content")  # Not content22
         pref = PackageReference(new_ref, "0101001")
-        package_content = load(os.path.join(paths.package(pref), "package.lib"))
+        package_content = load(os.path.join(paths.package_layout(new_ref).package(pref),
+                                            "package.lib"))
         self.assertEqual(package_content, "new lib content")  # Not newlib22
         # If conanfile is not override it exist
         self.assertNotIn("Package '2222222' already exist. Override?", output)
@@ -113,11 +115,13 @@ class PackageCopierTest(unittest.TestCase):
 
     def _assert_package_exists(self, ref, package_id, paths):
         pref = PackageReference(ref, package_id)
-        self.assertTrue(os.path.exists(os.path.join(paths.package(pref), "package.lib")))
+        self.assertTrue(os.path.exists(os.path.join(paths.package_layout(ref).package(pref),
+                                                    "package.lib")))
 
     def _assert_package_doesnt_exists(self, ref, package_id, paths):
         pref = PackageReference(ref, package_id)
-        self.assertFalse(os.path.exists(os.path.join(paths.package(pref), "package.lib")))
+        self.assertFalse(os.path.exists(os.path.join(paths.package_layout(ref).package(pref),
+                                                     "package.lib")))
 
     def _create_conanfile(self, ref, paths, content="default_content"):
         origin_reg = paths.package_layout(ref).export()
@@ -128,6 +132,6 @@ class PackageCopierTest(unittest.TestCase):
 
     def _create_package(self, ref, package_id, paths, content="default_content"):
         pref = PackageReference(ref, package_id)
-        package1_dir = paths.package(pref)
+        package1_dir = paths.package_layout(ref).package(pref)
         mkdir(package1_dir)
         save(os.path.join(package1_dir, "package.lib"), content)
diff --git a/conans/test/functional/old/package_integrity_test.py b/conans/test/functional/old/package_integrity_test.py
index b7a2829b3..c13f38cb2 100644
--- a/conans/test/functional/old/package_integrity_test.py
+++ b/conans/test/functional/old/package_integrity_test.py
@@ -16,7 +16,7 @@ class PackageIngrityTest(unittest.TestCase):
         client.run("create . lasote/testing")
         self.assertNotIn('does not contain a number!', client.out)
         ref = ConanFileReference.loads("Hello/0.1@lasote/testing")
-        conan_folder = client.cache.base_folder(ref)
+        conan_folder = client.cache.package_layout(ref).base_folder()
         self.assertIn("locks", os.listdir(conan_folder))
         self.assertTrue(os.path.exists(conan_folder + ".count"))
         self.assertTrue(os.path.exists(conan_folder + ".count.lock"))
@@ -37,7 +37,7 @@ class PackageIngrityTest(unittest.TestCase):
         client.run("create . lasote/testing")
         ref = ConanFileReference.loads("Hello/0.1@lasote/testing")
         pref = PackageReference(ref, NO_SETTINGS_PACKAGE_ID)
-        package_folder = client.cache.package(pref)
+        package_folder = client.cache.package_layout(pref.ref).package(pref)
         set_dirty(package_folder)
 
         client.run("upload * --all --confirm", assert_error=True)
diff --git a/conans/test/functional/old/path_limit_test.py b/conans/test/functional/old/path_limit_test.py
index 053563a58..bce2f1255 100644
--- a/conans/test/functional/old/path_limit_test.py
+++ b/conans/test/functional/old/path_limit_test.py
@@ -101,9 +101,10 @@ class PathLengthLimitTest(unittest.TestCase):
             export_files = os.listdir(export_folder)
             self.assertNotIn('conan_export.tgz', export_files)
             pref = PackageReference.loads("lib/0.1@lasote/channel:" + NO_SETTINGS_PACKAGE_ID)
-            package_folder = client2.cache.package(pref, short_paths=None)
+            package_folder = client2.cache.package_layout(pref.ref).package(pref)
             if platform.system() == "Windows":
-                original_folder = client2.cache.package(pref)
+                original_folder = client2.cache.package_layout(pref.ref,
+                                                               short_paths=False).package(pref)
                 link = load(os.path.join(original_folder, ".conan_link"))
                 self.assertEqual(link, package_folder)
 
@@ -127,7 +128,7 @@ class PathLengthLimitTest(unittest.TestCase):
                          "file0 content")
         client.run("install lib/0.1@user/channel --build=missing")
         pref = PackageReference.loads("lib/0.1@user/channel:%s" % NO_SETTINGS_PACKAGE_ID)
-        package_folder = client.cache.package(pref)
+        package_folder = client.cache.package_layout(pref.ref, short_paths=False).package(pref)
         if platform.system() == "Windows":
             package_folder = load(os.path.join(package_folder, ".conan_link"))
         self.assertTrue(os.path.exists(package_folder))
@@ -151,7 +152,7 @@ class PathLengthLimitTest(unittest.TestCase):
 
         ref = ConanFileReference.loads("lib/0.1@lasote/channel")
         pref = PackageReference(ref, NO_SETTINGS_PACKAGE_ID)
-        package_folder = client.cache.package(pref)
+        package_folder = client.cache.package_layout(pref.ref, short_paths=False).package(pref)
         if platform.system() == "Windows":
             package_folder = load(os.path.join(package_folder, ".conan_link"))
         self.assertTrue(os.path.exists(package_folder))
@@ -168,7 +169,7 @@ class PathLengthLimitTest(unittest.TestCase):
         client.run("search lib/0.1@user/channel")
         self.assertIn("Package_ID: %s" % NO_SETTINGS_PACKAGE_ID, client.user_io.out)
 
-        package_folder = client.cache.package(pref, short_paths=None)
+        package_folder = client.cache.package_layout(pref.ref, short_paths=None).package(pref)
         file1 = load(os.path.join(package_folder, "myfile.txt"))
         self.assertEqual("Hello extra path length", file1)
         file2 = load(os.path.join(package_folder, "myfile2.txt"))
@@ -256,12 +257,12 @@ class ConanLib(ConanFile):
         client.run("install lib/0.1@user/channel --build")
         # print client.paths.store
         pref = PackageReference.loads("lib/0.1@user/channel:%s" % NO_SETTINGS_PACKAGE_ID)
-        package_folder = client.cache.package(pref, short_paths=None)
+        package_folder = client.cache.package_layout(pref.ref, short_paths=None).package(pref)
         file1 = load(os.path.join(package_folder, "myfile.txt"))
         self.assertEqual("Hello world!", file1)
 
         client.run("install lib/0.1@user/channel --build")
         pref = PackageReference.loads("lib/0.1@user/channel:%s" % NO_SETTINGS_PACKAGE_ID)
-        package_folder = client.cache.package(pref, short_paths=None)
+        package_folder = client.cache.package_layout(pref.ref, short_paths=None).package(pref)
         file1 = load(os.path.join(package_folder, "myfile.txt"))
         self.assertEqual("Hello world!", file1)
diff --git a/conans/test/functional/old/read_only_test.py b/conans/test/functional/old/read_only_test.py
index 49de8b499..3498cbf5d 100644
--- a/conans/test/functional/old/read_only_test.py
+++ b/conans/test/functional/old/read_only_test.py
@@ -28,7 +28,7 @@ class MyPkg(ConanFile):
     def basic_test(self):
         pref = PackageReference(ConanFileReference.loads("Pkg/0.1@lasote/channel"),
                                 NO_SETTINGS_PACKAGE_ID)
-        path = os.path.join(self.client.cache.package(pref), "myheader.h")
+        path = os.path.join(self.client.cache.package_layout(pref.ref).package(pref), "myheader.h")
         with self.assertRaises(IOError):
             save(path, "Bye World")
         os.chmod(path, 0o777)
@@ -53,7 +53,7 @@ class MyPkg(ConanFile):
         client.run("install Pkg/0.1@lasote/channel")
         pref = PackageReference(ConanFileReference.loads("Pkg/0.1@lasote/channel"),
                                 NO_SETTINGS_PACKAGE_ID)
-        path = os.path.join(client.cache.package(pref), "myheader.h")
+        path = os.path.join(client.cache.package_layout(pref.ref).package(pref), "myheader.h")
         with self.assertRaises(IOError):
             save(path, "Bye World")
         os.chmod(path, 0o777)
diff --git a/conans/test/functional/old/short_paths_test.py b/conans/test/functional/old/short_paths_test.py
index b7ff2218b..bf9d7eec3 100644
--- a/conans/test/functional/old/short_paths_test.py
+++ b/conans/test/functional/old/short_paths_test.py
@@ -40,10 +40,10 @@ class TestConan(ConanFile):
                      "source_file.cpp": ""})
         client.run("create . danimtb/testing")
         ref = ConanFileReference("test", "1.0", "danimtb", "testing")
-        source_folder = os.path.join(client.cache.base_folder(ref), "source")
-        build_folder = os.path.join(client.cache.base_folder(ref), "build",
+        source_folder = os.path.join(client.cache.package_layout(ref).base_folder(), "source")
+        build_folder = os.path.join(client.cache.package_layout(ref).base_folder(), "build",
                                     NO_SETTINGS_PACKAGE_ID)
-        package_folder = os.path.join(client.cache.base_folder(ref), "package",
+        package_folder = os.path.join(client.cache.package_layout(ref).base_folder(), "package",
                                       NO_SETTINGS_PACKAGE_ID)
         self.assertIn("SOURCE: source_file.cpp", client.out)
         self.assertEqual(["source_file.cpp"], os.listdir(source_folder))
diff --git a/conans/test/functional/tgz_macos_dot_files.py b/conans/test/functional/tgz_macos_dot_files.py
index 0ba25f218..4dc3fca85 100644
--- a/conans/test/functional/tgz_macos_dot_files.py
+++ b/conans/test/functional/tgz_macos_dot_files.py
@@ -85,7 +85,7 @@ class TgzMacosDotFilesTest(unittest.TestCase):
         # Check if the metadata travels through the Conan commands
         pref = PackageReference.loads(
             "lib/version@lasote/channel:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9")
-        pkg_folder = t.cache.package(pref)
+        pkg_folder = t.cache.package_layout(pref.ref).package(pref)
 
         # 1) When copied to the package folder, the metadata is lost
         self._test_for_metadata(pkg_folder, 'file.txt', dot_file_expected=False)
diff --git a/conans/test/integration/build_id_test.py b/conans/test/integration/build_id_test.py
index 3a5405148..b0fc4989e 100644
--- a/conans/test/integration/build_id_test.py
+++ b/conans/test/integration/build_id_test.py
@@ -54,28 +54,28 @@ class BuildIdTest(unittest.TestCase):
         # Check that conaninfo is correct
         pref_debug = PackageReference.loads("Pkg/0.1@user/channel:"
                                             "f3989dcba0ab50dc5ed9b40ede202bdd7b421f09")
-        conaninfo = load(os.path.join(client.cache.package(pref_debug), "conaninfo.txt"))
+        conaninfo = load(os.path.join(client.cache.package_layout(pref_debug.ref).package(pref_debug), "conaninfo.txt"))
         self.assertIn("os=Windows", conaninfo)
         self.assertIn("build_type=Debug", conaninfo)
         self.assertNotIn("Release", conaninfo)
 
         pref_release = PackageReference.loads("Pkg/0.1@user/channel:"
                                               "ab2e9f86b4109980930cdc685f4a320b359e7bb4")
-        conaninfo = load(os.path.join(client.cache.package(pref_release), "conaninfo.txt"))
+        conaninfo = load(os.path.join(client.cache.package_layout(pref_release.ref).package(pref_release), "conaninfo.txt"))
         self.assertIn("os=Windows", conaninfo)
         self.assertIn("build_type=Release", conaninfo)
         self.assertNotIn("Debug", conaninfo)
 
         pref_debug = PackageReference.loads("Pkg/0.1@user/channel:"
                                             "322de4b4a41f905f6b18f454ab5f498690b39c2a")
-        conaninfo = load(os.path.join(client.cache.package(pref_debug), "conaninfo.txt"))
+        conaninfo = load(os.path.join(client.cache.package_layout(pref_debug.ref).package(pref_debug), "conaninfo.txt"))
         self.assertIn("os=Linux", conaninfo)
         self.assertIn("build_type=Debug", conaninfo)
         self.assertNotIn("Release", conaninfo)
 
         pref_release = PackageReference.loads("Pkg/0.1@user/channel:"
                                               "24c3aa2d6c5929d53bd86b31e020c55d96b265c7")
-        conaninfo = load(os.path.join(client.cache.package(pref_release), "conaninfo.txt"))
+        conaninfo = load(os.path.join(client.cache.package_layout(pref_release.ref).package(pref_release), "conaninfo.txt"))
         self.assertIn("os=Linux", conaninfo)
         self.assertIn("build_type=Release", conaninfo)
         self.assertNotIn("Debug", conaninfo)
@@ -205,9 +205,9 @@ class BuildIdTest(unittest.TestCase):
         ref = ConanFileReference.loads("Pkg/0.1@user/channel")
 
         def _check_builds():
-            builds = client.cache.conan_builds(ref)
+            builds = client.cache.package_layout(ref).conan_builds()
             self.assertEqual(1, len(builds))
-            packages = client.cache.conan_packages(ref)
+            packages = client.cache.package_layout(ref).conan_packages()
             self.assertEqual(2, len(packages))
             self.assertNotIn(builds[0], packages)
             return builds[0], packages
@@ -216,9 +216,9 @@ class BuildIdTest(unittest.TestCase):
         client.run("remove Pkg/0.1@user/channel -b %s -f" % packages[0])
         _check_builds()
         client.run("remove Pkg/0.1@user/channel -b %s -f" % build)
-        builds = client.cache.conan_builds(ref)
+        builds = client.cache.package_layout(ref).conan_builds()
         self.assertEqual(0, len(builds))
-        packages = client.cache.conan_packages(ref)
+        packages = client.cache.package_layout(ref).conan_packages()
         self.assertEqual(2, len(packages))
 
     @parameterized.expand([(True, ), (False,)])
diff --git a/conans/test/integration/complete_test.py b/conans/test/integration/complete_test.py
index c22801aed..e48930fb7 100644
--- a/conans/test/integration/complete_test.py
+++ b/conans/test/integration/complete_test.py
@@ -41,7 +41,7 @@ class CompleteFlowTest(unittest.TestCase):
         # Now install it but with other options
         other_conan.run('install %s -o language=1 --build missing' % (str(ref)))
         # Should have two packages
-        package_ids = other_conan.cache.conan_packages(ref)
+        package_ids = other_conan.cache.package_layout(ref).conan_packages()
         self.assertEqual(len(package_ids), 2)
 
     def reuse_test(self):
@@ -56,7 +56,7 @@ class CompleteFlowTest(unittest.TestCase):
         self.assertIn("Hello0/0.1@lasote/stable package(): Packaged 1 '.h' file: helloHello0.h",
                       self.client.out)
         # Check compilation ok
-        package_ids = self.client.cache.conan_packages(ref)
+        package_ids = self.client.cache.package_layout(ref).conan_packages()
         self.assertEqual(len(package_ids), 1)
         pref = PackageReference(ref, package_ids[0])
         self._assert_library_exists(pref, self.client.cache)
@@ -104,7 +104,7 @@ class CompleteFlowTest(unittest.TestCase):
         # Now install it but with other options
         other_conan.run('install %s -o language=1 --build missing' % (str(ref)))
         # Should have two packages
-        package_ids = other_conan.cache.conan_packages(ref)
+        package_ids = other_conan.cache.package_layout(ref).conan_packages()
         self.assertEqual(len(package_ids), 2)
         for package_id in package_ids:
             pref = PackageReference(ref, package_id)
@@ -130,7 +130,7 @@ class CompleteFlowTest(unittest.TestCase):
         self.assertIn("Hola Hello0", client3.user_io.out)
 
     def _assert_library_exists(self, pref, paths):
-        package_path = paths.package(pref)
+        package_path = paths.package_layout(pref.ref).package(pref)
         self.assertTrue(os.path.exists(os.path.join(package_path, "lib")))
         self._assert_library_files(package_path)
 
diff --git a/conans/test/integration/conan_test_test.py b/conans/test/integration/conan_test_test.py
index dbd6d65f1..6b5a87709 100644
--- a/conans/test/integration/conan_test_test.py
+++ b/conans/test/integration/conan_test_test.py
@@ -116,14 +116,14 @@ class HelloReuseConan(ConanFile):
         client.run("test test Hello/0.1@lasote/stable")
         pref = PackageReference.loads("Hello/0.1@lasote/stable:%s" % NO_SETTINGS_PACKAGE_ID)
         self.assertEqual("Hello FindCmake",
-                         load(os.path.join(client.cache.package(pref), "FindXXX.cmake")))
+                         load(os.path.join(client.cache.package_layout(pref.ref).package(pref), "FindXXX.cmake")))
         client.save({"FindXXX.cmake": "Bye FindCmake"})
         client.run("test test Hello/0.1@lasote/stable")  # Test do not rebuild the package
         self.assertEqual("Hello FindCmake",
-                         load(os.path.join(client.cache.package(pref), "FindXXX.cmake")))
+                         load(os.path.join(client.cache.package_layout(pref.ref).package(pref), "FindXXX.cmake")))
         client.run("create . lasote/stable")  # create rebuild the package
         self.assertEqual("Bye FindCmake",
-                         load(os.path.join(client.cache.package(pref), "FindXXX.cmake")))
+                         load(os.path.join(client.cache.package_layout(pref.ref).package(pref), "FindXXX.cmake")))
 
     def conan_test_test(self):
         conanfile = '''
diff --git a/conans/test/integration/devflow_test.py b/conans/test/integration/devflow_test.py
index 54e856f56..2df69b9fc 100644
--- a/conans/test/integration/devflow_test.py
+++ b/conans/test/integration/devflow_test.py
@@ -244,7 +244,7 @@ class DevOutSourceFlowTest(unittest.TestCase):
         install_dir = os.path.join(client.current_folder, "install_x86_64")
         tools.replace_in_file(os.path.join(client.current_folder, "src", "hello", "CMakeLists.txt"),
                               "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake",
-                              '"%s/conanbuildinfo.cmake"' % install_dir,
+                              '"%s/conanbuildinfo.cmake"' % install_dir.replace("\\", "/"),
                               output=client.out)
 
         client.run("install . --install-folder install_x86_64 -s arch=x86_64")
diff --git a/conans/test/integration/go_complete_test.py b/conans/test/integration/go_complete_test.py
index 2bed41e6f..84aba2b26 100644
--- a/conans/test/integration/go_complete_test.py
+++ b/conans/test/integration/go_complete_test.py
@@ -98,7 +98,7 @@ class GoCompleteTest(unittest.TestCase):
         self.client.run("export . lasote/stable")
         self.client.run("install %s --build missing" % str(ref))
         # Check compilation ok
-        package_ids = self.client.cache.conan_packages(ref)
+        package_ids = self.client.cache.package_layout(ref).conan_packages()
         self.assertEqual(len(package_ids), 1)
         pref = PackageReference(ref, package_ids[0])
         self._assert_package_exists(pref, self.client.cache, files_without_conanfile)
@@ -143,7 +143,7 @@ class GoCompleteTest(unittest.TestCase):
         self.assertIn("Hello, Go!", reuse_conan.user_io.out)
 
     def _assert_package_exists(self, pref, paths, files):
-        package_path = paths.package(pref)
+        package_path = paths.package_layout(pref.ref).package(pref)
         self.assertTrue(os.path.exists(os.path.join(package_path)))
         real_files = scan_folder(package_path)
         for f in files:
diff --git a/conans/test/integration/install_selected_packages_test.py b/conans/test/integration/install_selected_packages_test.py
index 3cbadf153..0e7c4532c 100644
--- a/conans/test/integration/install_selected_packages_test.py
+++ b/conans/test/integration/install_selected_packages_test.py
@@ -54,8 +54,8 @@ class InstallSelectedPackagesTest(unittest.TestCase):
 
     def download_packages_twice_test(self):
         expected_header_contents = self.files["helloHello0.h"]
-        package_folder = self.new_client.cache.package(PackageReference(self.ref,
-                                                                        self.package_ids[0]))
+        pref = PackageReference(self.ref, self.package_ids[0])
+        package_folder = self.new_client.cache.package_layout(self.ref).package(pref)
 
         self.new_client.run("download Hello0/0.1@lasote/stable")
         got_header = load(os.path.join(package_folder, "include", "helloHello0.h"))
diff --git a/conans/test/integration/install_update_test.py b/conans/test/integration/install_update_test.py
index b8dde39e1..f1593946f 100644
--- a/conans/test/integration/install_update_test.py
+++ b/conans/test/integration/install_update_test.py
@@ -176,7 +176,7 @@ class Pkg(ConanFile):
         pref = PackageReference(ref, "55a3af76272ead64e6f543c12ecece30f94d3eda")
         export_folder = self.client.cache.package_layout(ref).export()
         recipe_manifest = os.path.join(export_folder, CONAN_MANIFEST)
-        package_folder = self.client.cache.package(pref)
+        package_folder = self.client.cache.package_layout(pref.ref).package(pref)
         package_manifest = os.path.join(package_folder, CONAN_MANIFEST)
 
         def timestamps():
@@ -249,8 +249,9 @@ class Pkg(ConanFile):
 
         client2.run("install Hello0/1.0@lasote/stable --update")
         ref = ConanFileReference.loads("Hello0/1.0@lasote/stable")
-        package_ids = client2.cache.conan_packages(ref)
-        package_path = client2.cache.package(PackageReference(ref, package_ids[0]))
+        package_ids = client2.cache.package_layout(ref).conan_packages()
+        pref = PackageReference(ref, package_ids[0])
+        package_path = client2.cache.package_layout(ref).package(pref)
         header = load(os.path.join(package_path, "include/helloHello0.h"))
         self.assertEqual(header, "//EMPTY!")
 
@@ -291,7 +292,7 @@ class ConanLib(ConanFile):
                       client.out)
         ref = ConanFileReference.loads("Pkg/0.1@lasote/channel")
         pref = PackageReference(ref, NO_SETTINGS_PACKAGE_ID)
-        header = os.path.join(client.cache.package(pref), "header.h")
+        header = os.path.join(client.cache.package_layout(pref.ref).package(pref), "header.h")
         self.assertEqual(load(header), "mycontent2")
 
     def fail_usefully_when_failing_retrieving_package_test(self):
@@ -311,4 +312,4 @@ class ConanLib(ConanFile):
         client.run("remote update default http://this_not_exist8823.com")
         # Try to install ref2, it will try to download the binary for ref1
         client.run("install {}".format(ref2), assert_error=True)
-        self.assertIn("ERROR: Error downloading binary package: '{}'".format(pref1), client.out)
\ No newline at end of file
+        self.assertIn("ERROR: Error downloading binary package: '{}'".format(pref1), client.out)
diff --git a/conans/test/integration/multi_build_test.py b/conans/test/integration/multi_build_test.py
index 557170f6b..7498bd683 100644
--- a/conans/test/integration/multi_build_test.py
+++ b/conans/test/integration/multi_build_test.py
@@ -21,7 +21,7 @@ class CollectLibsTest(unittest.TestCase):
         client.run("install %s --build missing" % str(ref))
 
         # Check compilation ok
-        package_ids = client.cache.conan_packages(ref)
+        package_ids = client.cache.package_layout(ref).conan_packages()
         self.assertEqual(len(package_ids), 1)
 
         # Reuse them
diff --git a/conans/test/integration/package_id_test.py b/conans/test/integration/package_id_test.py
index 817480f0e..c38a3bf30 100644
--- a/conans/test/integration/package_id_test.py
+++ b/conans/test/integration/package_id_test.py
@@ -298,7 +298,7 @@ class Pkg(ConanFile):
             ref = ConanFileReference.loads("Hello/1.2.0@user/testing")
             pkg = os.listdir(self.client.cache.package_layout(ref).packages())
             pref = PackageReference(ref, pkg[0])
-            pkg_folder = self.client.cache.package(pref)
+            pkg_folder = self.client.cache.package_layout(pref.ref).package(pref)
             return ConanInfo.loads(load(os.path.join(pkg_folder, CONANINFO)))
 
         info = install_and_get_info(None)  # Default
@@ -350,7 +350,7 @@ class Pkg(ConanFile):
         ref = ConanFileReference.loads("Hello/1.2.0@user/testing")
         pkg = os.listdir(self.client.cache.package_layout(ref).packages())
         pref = PackageReference(ref, pkg[0])
-        pkg_folder = self.client.cache.package(pref)
+        pkg_folder = self.client.cache.package_layout(pref.ref).package(pref)
         info = ConanInfo.loads(load(os.path.join(pkg_folder, CONANINFO)))
         self.assertEqual(str(info.settings.os_build), "Linux")
         self.assertEqual(str(info.settings.arch_build), "x86")
diff --git a/conans/test/integration/symlinks_test.py b/conans/test/integration/symlinks_test.py
index 4792a0cb6..65ce5a25a 100644
--- a/conans/test/integration/symlinks_test.py
+++ b/conans/test/integration/symlinks_test.py
@@ -43,7 +43,7 @@ Hello/0.1@lasote/stable
 class SymLinksTest(unittest.TestCase):
 
     def _check(self, client, ref, build=True):
-        folders = [client.cache.package(ref), client.current_folder]
+        folders = [client.cache.package_layout(ref.ref).package(ref), client.current_folder]
         if build:
             folders.append(client.cache.package_layout(ref.ref).build(ref))
         for base in folders:
@@ -223,10 +223,10 @@ class ConanSymlink(ConanFile):
                                        "another_other_directory")
         self.assertTrue(os.path.exists(cache_other_dir))
         pref = PackageReference(ref, NO_SETTINGS_PACKAGE_ID)
-        package_file = os.path.join(client.cache.package(pref), "another_directory",
+        package_file = os.path.join(client.cache.package_layout(pref.ref).package(pref), "another_directory",
                                     "not_to_copy.txt")
         self.assertFalse(os.path.exists(package_file))
-        package_other_dir = os.path.join(client.cache.package(pref),
+        package_other_dir = os.path.join(client.cache.package_layout(pref.ref).package(pref),
                                          "another_other_directory")
         self.assertFalse(os.path.exists(package_other_dir))
         client.save({"conanfile.py": conanfile % "True"})
diff --git a/conans/test/integration/syncronize_test.py b/conans/test/integration/syncronize_test.py
index 00b39be42..4190e71e6 100644
--- a/conans/test/integration/syncronize_test.py
+++ b/conans/test/integration/syncronize_test.py
@@ -17,8 +17,7 @@ class SynchronizeTest(unittest.TestCase):
     def upload_test(self):
         client = TestClient(servers={"default": TestServer()},
                             users={"default": [("lasote", "mypass")]})
-        ref = ConanFileReference.loads("Hello0/0.1@lasote/stable#%s" %
-                                                   DEFAULT_REVISION_V1)
+        ref = ConanFileReference.loads("Hello0/0.1@lasote/stable#%s" % DEFAULT_REVISION_V1)
         files = cpp_hello_conan_files("Hello0", "0.1", build=False)
         files["to_be_deleted.txt"] = "delete me"
         files["to_be_deleted2.txt"] = "delete me2"
@@ -83,7 +82,7 @@ class SynchronizeTest(unittest.TestCase):
 
         client.run("install %s --build missing" % str(ref))
         # Upload package
-        package_ids = client.cache.conan_packages(ref)
+        package_ids = client.cache.package_layout(ref).conan_packages()
         client.run("upload %s -p %s" % (str(ref), str(package_ids[0])))
 
         # Check that conans exists on server
@@ -94,7 +93,7 @@ class SynchronizeTest(unittest.TestCase):
         self.assertTrue(os.path.exists(package_server_path))
 
         # Add a new file to package (artificially), upload again and check
-        pack_path = client.cache.package(pref)
+        pack_path = client.cache.package_layout(pref.ref).package(pref)
         new_file_source_path = os.path.join(pack_path, "newlib.lib")
         save(new_file_source_path, "newlib")
         os.unlink(os.path.join(pack_path, PACKAGE_TGZ_NAME))  # Force new tgz
@@ -130,6 +129,6 @@ class SynchronizeTest(unittest.TestCase):
 
     def _create_manifest(self, client, package_reference):
         # Create the manifest to be able to upload the package
-        pack_path = client.cache.package(package_reference)
+        pack_path = client.cache.package_layout(package_reference.ref).package(package_reference)
         expected_manifest = FileTreeManifest.create(pack_path)
         expected_manifest.save(pack_path)
diff --git a/conans/test/unittests/client/cache_test.py b/conans/test/unittests/client/cache_test.py
index 5f859241b..cb30b4363 100644
--- a/conans/test/unittests/client/cache_test.py
+++ b/conans/test/unittests/client/cache_test.py
@@ -51,7 +51,7 @@ class CacheTest(unittest.TestCase):
 
         mkdir(layout.export())
         mkdir(layout.package(pref))
-        save(os.path.join(self.cache.base_folder(self.ref), "metadata.json"),
+        save(os.path.join(self.cache.package_layout(self.ref).package_metadata()),
              PackageMetadata().dumps())
 
         self.assertTrue(layout.package_exists(pref))
diff --git a/conans/test/unittests/client/tools/os_info/osinfo_test.py b/conans/test/unittests/client/tools/os_info/osinfo_test.py
index b361fcd99..13262a4d0 100644
--- a/conans/test/unittests/client/tools/os_info/osinfo_test.py
+++ b/conans/test/unittests/client/tools/os_info/osinfo_test.py
@@ -76,6 +76,23 @@ class OSInfoTest(unittest.TestCase):
                     self.assertEqual(OSInfo.uname(), self._uname.lower())
                     self.assertEqual(OSInfo.detect_windows_subsystem(), MSYS)
 
+    def test_msys3(self):
+        self._uname = 'MSYS_NT-10.0'
+        self._version = '3.0.6(0.338/5/3)'
+        with mock.patch("platform.system", mock.MagicMock(return_value=self._uname)):
+            self.assertTrue(OSInfo().is_windows)
+            self.assertFalse(OSInfo().is_cygwin)
+            self.assertTrue(OSInfo().is_msys)
+            self.assertFalse(OSInfo().is_linux)
+            self.assertFalse(OSInfo().is_freebsd)
+            self.assertFalse(OSInfo().is_macos)
+            self.assertFalse(OSInfo().is_solaris)
+
+            with environment_append({"CONAN_BASH_PATH": "/fake/bash.exe"}):
+                with mock.patch('conans.client.tools.oss.check_output', new=self.subprocess_check_output_mock):
+                    self.assertEqual(OSInfo.uname(), self._uname.lower())
+                    self.assertEqual(OSInfo.detect_windows_subsystem(), MSYS2)
+
     def test_mingw32(self):
         self._uname = 'MINGW32_NT-10.0'
         self._version = '2.10.0(0.325/5/3)'
diff --git a/conans/test/unittests/model/other_settings_test.py b/conans/test/unittests/model/other_settings_test.py
index a77ee1fb2..7f76c2167 100644
--- a/conans/test/unittests/model/other_settings_test.py
+++ b/conans/test/unittests/model/other_settings_test.py
@@ -78,7 +78,7 @@ class Pkg(ConanFile):
         self.assertNotIn("os: None", client.out)
         pref = PackageReference.loads("Pkg/0.1@lasote/testing:"
                                                    "544c1d8c53e9d269737e68e00ec66716171d2704")
-        info_path = os.path.join(client.cache.package(pref), CONANINFO)
+        info_path = os.path.join(client.cache.package_layout(pref.ref).package(pref), CONANINFO)
         info = load(info_path)
         self.assertNotIn("os", info)
         # Explicitly specifying None, put it in the conaninfo.txt, but does not affect the hash
diff --git a/conans/test/utils/tools.py b/conans/test/utils/tools.py
index faab494c6..012128685 100644
--- a/conans/test/utils/tools.py
+++ b/conans/test/utils/tools.py
@@ -74,7 +74,7 @@ def inc_recipe_manifest_timestamp(cache, reference, inc_time):
 
 def inc_package_manifest_timestamp(cache, package_reference, inc_time):
     pref = PackageReference.loads(package_reference)
-    path = cache.package(pref)
+    path = cache.package_layout(pref.ref).package(pref)
     manifest = FileTreeManifest.load(path)
     manifest.time += inc_time
     manifest.save(path)
@@ -848,7 +848,7 @@ servers["r2"] = TestServer()
 
     def run_command(self, command):
         self.all_output += str(self.out)
-        self.init_dynamic_vars() # Resets the output
+        self.init_dynamic_vars()  # Resets the output
         return self.runner(command, cwd=self.current_folder)
 
     def save(self, files, path=None, clean_first=False):
@@ -858,6 +858,7 @@ servers["r2"] = TestServer()
         path = path or self.current_folder
         if clean_first:
             shutil.rmtree(self.current_folder, ignore_errors=True)
+        files = {f: str(content) for f, content in files.items()}
         save_files(path, files)
         if not files:
             mkdir(self.current_folder)