Repository: conan-io/conan
Pull request #2804 (2018-04-24 23:09:23)

Feature/proxy refactor
- Refactors:
  - Removed SearchAdapterABC, SearchManagerABC
  - Moved functionality among files, simplifying duplicated code
- Changes:
  - The only minor change should be that upload now always upload the recipe for ``-p=id`` argument (it didn't in the past, only uploaded binary. Breaking?



Patch:
diff --git a/conans/client/build/autotools_environment.py b/conans/client/build/autotools_environment.py
index 0106e1cb0..a73d55b7f 100644
--- a/conans/client/build/autotools_environment.py
+++ b/conans/client/build/autotools_environment.py
@@ -12,7 +12,7 @@ from conans.client.build.cppstd_flags import cppstd_flag
 from conans.client.tools.oss import OSInfo
 from conans.client.tools.win import unix_path
 from conans.tools import (environment_append, args_to_string, cpu_count, cross_building,
-                          detected_architecture)
+                          detected_architecture, get_gnu_triplet)
 
 
 class AutoToolsBuildEnvironment(object):
@@ -57,68 +57,32 @@ class AutoToolsBuildEnvironment(object):
         # Not declared by default
         self.fpic = None
 
-    def _get_triplet(self, the_arch, the_os):
-        """
-        machine-vendor-op_system, But vendor can be omitted in practice
-        """
-
-        # Calculate the arch
-        machine = {"x86": "i686" if the_os != "Linux" else "x86",
-                   "x86_64": "x86_64",
-                   "armv6": "arm",
-                   "armv7": "arm",
-                   "armv7s": "arm",
-                   "armv7k": "arm",
-                   "armv7hf": "arm",
-                   "armv8": "aarch64"}.get(the_arch, None)
-        if machine is None:
-            self._conanfile.output.warn("Unknown '%s' machine, Conan doesn't know how to "
-                                        "translate it to the GNU triplet, please report at "
-                                        " https://github.com/conan-io/conan/issues" % the_arch)
-            return "unknown"
-
-        # Calculate the OS
-        compiler = self._conanfile.settings.get_safe("compiler")
-        if compiler == "gcc":
-            windows_op = "w64-mingw32"
-        elif compiler == "Visual Studio":
-            windows_op = "windows-msvc"
-        else:
-            windows_op = "windows"
-
-        op_system = {"Windows": windows_op,
-                     "Linux": "linux-gnu",
-                     "Darwin": "apple-darwin",
-                     "Android": "linux-android",
-                     "Macos": "apple-darwin",
-                     "iOS": "apple-darwin",
-                     "watchOS": "apple-darwin",
-                     "tvOS": "apple-darwin"}.get(the_os, the_os.lower())
-
-        if the_os in ("Linux", "Android"):
-            if "arm" in the_arch and the_arch != "armv8":
-                op_system += "eabi"
-
-            if the_arch == "armv7hf" and the_os == "Linux":
-                op_system += "hf"
-
-        return "%s-%s" % (machine, op_system)
+        # Precalculate build, host, target triplets
+        self.build, self.host, self.target = self._get_host_build_target_flags()
 
-    def _get_host_build_target_flags(self, arch_detected, os_detected):
+    def _get_host_build_target_flags(self):
         """Based on google search for build/host triplets, it could need a lot
         and complex verification"""
 
+        arch_detected = detected_architecture() or platform.machine()
+        os_detected = platform.system()
+        arch_settings = self._conanfile.settings.get_safe("arch")
+        os_settings = self._conanfile.settings.get_safe("os")
+        compiler = self._conanfile.settings.get_safe("compiler")
+
+        if (os_detected is None or arch_detected is None or arch_settings is None or
+                os_settings is None):
+            return False, False, False
         if not cross_building(self._conanfile.settings, os_detected, arch_detected):
             return False, False, False
 
-        build = self._get_triplet(arch_detected, os_detected)
-        host = self._get_triplet(self._conanfile.settings.get_safe("arch"),
-                                 self._conanfile.settings.get_safe("os"))
+        build = get_gnu_triplet(os_detected, arch_detected, compiler)
+        host = get_gnu_triplet(os_settings, arch_settings, compiler)
 
         return build, host, None
 
     def configure(self, configure_dir=None, args=None, build=None, host=None, target=None,
-                  pkg_config_paths=None):
+                  pkg_config_paths=None, vars=None):
         """
         :param pkg_config_paths: Optional paths to locate the *.pc files
         :param configure_dir: Absolute or relative path to the configure script
@@ -141,25 +105,20 @@ class AutoToolsBuildEnvironment(object):
             configure_dir = configure_dir.rstrip("/")
         else:
             configure_dir = "."
-        auto_build, auto_host, auto_target = None, None, None
-        if build is None or host is None or target is None:
-            arch_detected = detected_architecture() or platform.machine()
-            os_detected = platform.system()
-            flags = self._get_host_build_target_flags(arch_detected, os_detected)
-            auto_build, auto_host, auto_target = flags
+
         triplet_args = []
 
         if build is not False:  # Skipped by user
-            if build or auto_build:  # User specified value or automatic
-                triplet_args.append("--build=%s" % (build or auto_build))
+            if build or self.build:  # User specified value or automatic
+                triplet_args.append("--build=%s" % (build or self.build))
 
         if host is not False:   # Skipped by user
-            if host or auto_host:  # User specified value or automatic
-                triplet_args.append("--host=%s" % (host or auto_host))
+            if host or self.host:  # User specified value or automatic
+                triplet_args.append("--host=%s" % (host or self.host))
 
         if target is not False:  # Skipped by user
-            if target or auto_target:  # User specified value or automatic
-                triplet_args.append("--target=%s" % (target or auto_target))
+            if target or self.target:  # User specified value or automatic
+                triplet_args.append("--target=%s" % (target or self.target))
 
         if pkg_config_paths:
             pkg_env = {"PKG_CONFIG_PATH": os.pathsep.join(pkg_config_paths)}
@@ -169,8 +128,14 @@ class AutoToolsBuildEnvironment(object):
             pkg_env = {"PKG_CONFIG_PATH": self._conanfile.build_folder} \
                 if "pkg_config" in self._conanfile.generators else {}
 
+        if self._conanfile.package_folder is not None:
+            if not args:
+                args = ["--prefix=%s" % self._conanfile.package_folder.replace("\\", "/")]
+            elif not any(["--prefix=" in arg for arg in args]):
+                args.append("--prefix=%s" % self._conanfile.package_folder.replace("\\", "/"))
+
         with environment_append(pkg_env):
-            with environment_append(self.vars):
+            with environment_append(vars or self.vars):
                 configure_dir = self._adjust_path(configure_dir)
                 command = '%s/configure %s %s' % (configure_dir,
                                                   args_to_string(args), " ".join(triplet_args))
@@ -184,17 +149,20 @@ class AutoToolsBuildEnvironment(object):
             path = unix_path(path, path_flavor=self.subsystem)
         return '"%s"' % path if " " in path else path
 
-    def make(self, args="", make_program=None, target=None):
+    def make(self, args="", make_program=None, target=None, vars=None):
         if not self._conanfile.should_build:
             return
         make_program = os.getenv("CONAN_MAKE_PROGRAM") or make_program or "make"
-        with environment_append(self.vars):
+        with environment_append(vars or self.vars):
             str_args = args_to_string(args)
             cpu_count_option = ("-j%s" % cpu_count()) if "-j" not in str_args else None
             self._conanfile.run("%s" % join_arguments([make_program, target, str_args,
                                                        cpu_count_option]),
                                 win_bash=self._win_bash, subsystem=self.subsystem)
 
+    def install(self, args="", make_program=None, vars=None):
+        self.make(args=args, make_program=make_program, target="install", vars=vars)
+
     def _configure_link_flags(self):
         """Not the -L"""
         ret = copy.copy(self._deps_cpp_info.sharedlinkflags)
@@ -313,7 +281,6 @@ class AutoToolsBuildEnvironment(object):
 
     @property
     def vars(self):
-
         ld_flags, cpp_flags, libs, cxx_flags, c_flags = self._get_vars()
 
         cpp_flags = " ".join(cpp_flags) + _environ_value_prefix("CPPFLAGS")
@@ -328,7 +295,6 @@ class AutoToolsBuildEnvironment(object):
                "LDFLAGS": ldflags.strip(),
                "LIBS": libs.strip(),
                }
-
         return ret
 
 
diff --git a/conans/client/cmd/copy.py b/conans/client/cmd/copy.py
index 8f7d84f44..69660d81e 100644
--- a/conans/client/cmd/copy.py
+++ b/conans/client/cmd/copy.py
@@ -4,13 +4,14 @@ from conans.util.files import rmdir
 import shutil
 from conans.errors import ConanException
 from conans.client.loader_parse import load_conanfile_class
+from conans.client.source import complete_recipe_sources
 
 
-def _prepare_sources(client_cache, reference, remote_proxy):
+def _prepare_sources(client_cache, reference, remote_manager, registry):
     conan_file_path = client_cache.conanfile(reference)
     conanfile = load_conanfile_class(conan_file_path)
-    remote_proxy.complete_recipe_sources(conanfile, reference,
-                                         short_paths=conanfile.short_paths)
+    complete_recipe_sources(remote_manager, client_cache, registry,
+                            conanfile, reference)
     return conanfile.short_paths
 
 
@@ -26,14 +27,14 @@ def _get_package_ids(client_cache, reference, package_ids):
     return package_ids
 
 
-def cmd_copy(reference, user_channel, package_ids, client_cache, user_io, remote_proxy,
-             force=False):
+def cmd_copy(reference, user_channel, package_ids, client_cache, user_io, remote_manager,
+             registry, force=False):
     """
     param package_ids: Falsey=do not copy binaries. True=All existing. []=list of ids
     """
     src_ref = ConanFileReference.loads(reference)
 
-    short_paths = _prepare_sources(client_cache, src_ref, remote_proxy)
+    short_paths = _prepare_sources(client_cache, src_ref, remote_manager, registry)
     package_ids = _get_package_ids(client_cache, src_ref, package_ids)
     package_copy(src_ref, user_channel, package_ids, client_cache, user_io,
                  short_paths, force)
diff --git a/conans/client/cmd/export.py b/conans/client/cmd/export.py
index 8dbed0463..dae536e93 100644
--- a/conans/client/cmd/export.py
+++ b/conans/client/cmd/export.py
@@ -15,10 +15,26 @@ from conans.model.manifest import FileTreeManifest
 from conans.model.ref import ConanFileReference
 from conans.paths import CONAN_MANIFEST, CONANFILE
 from conans.search.search import DiskSearchManager
-from conans.util.files import save, load, rmdir, is_dirty, set_dirty
+from conans.util.files import save, load, rmdir, is_dirty, set_dirty, mkdir
 from conans.util.log import logger
 
 
+def export_alias(reference, target_reference, client_cache):
+    conanfile = """
+from conans import ConanFile
+
+class AliasConanfile(ConanFile):
+    alias = "%s"
+""" % str(target_reference)
+
+    export_path = client_cache.export(reference)
+    mkdir(export_path)
+    save(os.path.join(export_path, CONANFILE), conanfile)
+    mkdir(client_cache.export_sources(reference))
+    digest = FileTreeManifest.create(export_path)
+    save(os.path.join(export_path, CONAN_MANIFEST), str(digest))
+
+
 def cmd_export(conanfile_path, name, version, user, channel, keep_source,
                output, client_cache):
     """ Export the recipe
diff --git a/conans/client/cmd/uploader.py b/conans/client/cmd/uploader.py
index 29d42ca70..afde653c0 100644
--- a/conans/client/cmd/uploader.py
+++ b/conans/client/cmd/uploader.py
@@ -1,4 +1,3 @@
-import os
 import time
 
 from conans.errors import ConanException, NotFoundException
@@ -6,6 +5,8 @@ from conans.model.ref import PackageReference, ConanFileReference
 from conans.util.log import logger
 from conans.client.loader_parse import load_conanfile_class
 from conans.search.search import DiskSearchManager
+from conans.paths import EXPORT_SOURCES_TGZ_NAME
+from conans.client.source import complete_recipe_sources
 
 
 def _is_a_reference(ref):
@@ -19,51 +20,29 @@ def _is_a_reference(ref):
 
 class CmdUpload(object):
 
-    def __init__(self, client_cache, user_io, remote_proxy):
+    def __init__(self, client_cache, user_io, remote_manager, registry):
         self._client_cache = client_cache
         self._user_io = user_io
-        self._remote_proxy = remote_proxy
+        self._remote_manager = remote_manager
+        self._registry = registry
         self._cache_search = DiskSearchManager(self._client_cache)
 
-    def upload(self, conan_reference_or_pattern, package_id=None, all_packages=None,
+    def upload(self, reference_or_pattern, package_id=None, all_packages=None,
                force=False, confirm=False, retry=0, retry_wait=0, skip_upload=False,
-               integrity_check=False, no_overwrite=None):
+               integrity_check=False, no_overwrite=None, remote_name=None):
         """If package_id is provided, conan_reference_or_pattern is a ConanFileReference"""
-        if package_id and not _is_a_reference(conan_reference_or_pattern):
+        if package_id and not _is_a_reference(reference_or_pattern):
             raise ConanException("-p parameter only allowed with a valid recipe reference, "
                                  "not with a pattern")
         t1 = time.time()
-        if package_id:  # Upload package
-            ref = ConanFileReference.loads(conan_reference_or_pattern)
-            self._check_reference(ref)
-            self.upload_package(PackageReference(ref, package_id), retry=retry,
-                                retry_wait=retry_wait, skip_upload=skip_upload,
-                                integrity_check=integrity_check, no_overwrite=no_overwrite)
-        else:  # Upload conans
-            self._run_upload(conan_reference_or_pattern, all_packages=all_packages,
-                             force=force, confirm=confirm,
-                             retry=retry, retry_wait=retry_wait, skip_upload=skip_upload,
-                             integrity_check=integrity_check, no_overwrite=no_overwrite)
-
-        logger.debug("====> Time manager upload: %f" % (time.time() - t1))
-
-    def _run_upload(self, ref_or_pattern, force=False, all_packages=False, confirm=False,
-                    retry=None, retry_wait=None, skip_upload=False, integrity_check=False,
-                    no_overwrite=None):
-        """Upload all the recipes matching 'pattern'"""
-        if _is_a_reference(ref_or_pattern):
-            ref = ConanFileReference.loads(ref_or_pattern)
-            export_path = self._client_cache.export(ref)
-            if not os.path.exists(export_path):
-                raise NotFoundException("There is no local conanfile exported as %s"
-                                        % str(ref))
+        if package_id or _is_a_reference(reference_or_pattern):  # Upload package
+            ref = ConanFileReference.loads(reference_or_pattern)
             references = [ref, ]
             confirm = True
         else:
-            references = self._cache_search.search_recipes(ref_or_pattern)
-
-        if not references:
-            raise NotFoundException("No packages found matching pattern '%s'" % ref_or_pattern)
+            references = self._cache_search.search_recipes(reference_or_pattern)
+            if not references:
+                raise NotFoundException("No packages found matching pattern '%s'" % reference_or_pattern)
 
         for conan_ref in references:
             upload = True
@@ -71,55 +50,88 @@ class CmdUpload(object):
                 msg = "Are you sure you want to upload '%s'?" % str(conan_ref)
                 upload = self._user_io.request_boolean(msg)
             if upload:
-                self._upload(conan_ref, force, all_packages, retry, retry_wait, skip_upload,
-                             integrity_check, no_overwrite)
-
-    def _upload(self, conan_ref, force, all_packages, retry, retry_wait, skip_upload,
-                integrity_check, no_overwrite):
-        """Uploads the recipes and binaries identified by conan_ref"""
-        if not force:
-            self._check_recipe_date(conan_ref)
-
-        self._user_io.out.info("Uploading %s" % str(conan_ref))
-        self._remote_proxy.upload_recipe(conan_ref, retry, retry_wait, skip_upload, no_overwrite)
+                try:
+                    conanfile_path = self._client_cache.conanfile(conan_ref)
+                    conan_file = load_conanfile_class(conanfile_path)
+                except NotFoundException:
+                    raise NotFoundException("There is no local conanfile exported as %s"
+                                            % str(conan_ref))
+                if all_packages:
+                    packages_ids = self._client_cache.conan_packages(conan_ref)
+                elif package_id:
+                    packages_ids = [package_id, ]
+                else:
+                    packages_ids = []
+                self._upload(conan_file, conan_ref, force, packages_ids, retry, retry_wait, skip_upload,
+                             integrity_check, no_overwrite, remote_name=remote_name)
 
-        if all_packages:
-            self._check_reference(conan_ref)
-
-            packages = self._client_cache.conan_packages(conan_ref)
-            total = len(packages)
-            for index, package_id in enumerate(packages):
-                self.upload_package(PackageReference(conan_ref, package_id), index + 1, total,
-                                    retry, retry_wait, skip_upload, integrity_check, no_overwrite)
+        logger.debug("====> Time manager upload: %f" % (time.time() - t1))
 
-    def _check_reference(self, conan_reference):
-        try:
-            conanfile_path = self._client_cache.conanfile(conan_reference)
-            conan_file = load_conanfile_class(conanfile_path)
-        except NotFoundException:
-            raise NotFoundException("There is no local conanfile exported as %s"
-                                    % str(conan_reference))
+    def _upload(self, conan_file, conan_ref, force, packages_ids, retry, retry_wait, skip_upload,
+                integrity_check, no_overwrite, remote_name):
+        """Uploads the recipes and binaries identified by conan_ref"""
 
-        # Can't use build_policy_always here because it's not loaded (only load_class)
-        if conan_file.build_policy == "always":
-            raise ConanException("Conanfile has build_policy='always', "
-                                 "no packages can be uploaded")
+        defined_remote = self._registry.get_ref(conan_ref)
+        if remote_name:  # If remote_name is given, use it
+            upload_remote = self._registry.remote(remote_name)
+        elif defined_remote:  # Else, if the package had defined a remote, use it
+            upload_remote = defined_remote
+        else:  # Or use the default otherwise
+            upload_remote = self._registry.default_remote
 
-    def upload_package(self, package_ref, index=1, total=1, retry=None, retry_wait=None,
-                       skip_upload=False, integrity_check=False, no_overwrite=None):
+        if not force:
+            self._check_recipe_date(conan_ref, upload_remote)
+
+        self._user_io.out.info("Uploading %s to remote '%s'"
+                               % (str(conan_ref), upload_remote.name))
+        self._upload_recipe(conan_ref, retry, retry_wait, skip_upload, no_overwrite, upload_remote)
+
+        if packages_ids:
+            # Can't use build_policy_always here because it's not loaded (only load_class)
+            if conan_file.build_policy == "always":
+                raise ConanException("Conanfile has build_policy='always', "
+                                     "no packages can be uploaded")
+            total = len(packages_ids)
+            for index, package_id in enumerate(packages_ids):
+                self._upload_package(PackageReference(conan_ref, package_id), index + 1, total,
+                                     retry, retry_wait, skip_upload, integrity_check, no_overwrite,
+                                     upload_remote)
+
+        if not defined_remote and not skip_upload:
+            self._registry.set_ref(conan_ref, upload_remote)
+
+    def _upload_recipe(self, conan_reference, retry, retry_wait, skip_upload, no_overwrite, remote):
+        conan_file_path = self._client_cache.conanfile(conan_reference)
+        current_remote = self._registry.get_ref(conan_reference)
+        if remote != current_remote:
+            conanfile = load_conanfile_class(conan_file_path)
+            complete_recipe_sources(self._remote_manager, self._client_cache, self._registry,
+                                    conanfile, conan_reference)
+            ignore_deleted_file = None
+        else:
+            ignore_deleted_file = EXPORT_SOURCES_TGZ_NAME
+        result = self._remote_manager.upload_recipe(conan_reference, remote, retry, retry_wait,
+                                                    ignore_deleted_file=ignore_deleted_file,
+                                                    skip_upload=skip_upload,
+                                                    no_overwrite=no_overwrite)
+        return result
+
+    def _upload_package(self, package_ref, index=1, total=1, retry=None, retry_wait=None,
+                        skip_upload=False, integrity_check=False, no_overwrite=None, remote=None):
         """Uploads the package identified by package_id"""
 
         msg = ("Uploading package %d/%d: %s" % (index, total, str(package_ref.package_id)))
         t1 = time.time()
         self._user_io.out.info(msg)
-        self._remote_proxy.upload_package(package_ref, retry, retry_wait, skip_upload,
-                                          integrity_check, no_overwrite)
 
+        result = self._remote_manager.upload_package(package_ref, remote, retry, retry_wait,
+                                                     skip_upload, integrity_check, no_overwrite)
+        return result
         logger.debug("====> Time uploader upload_package: %f" % (time.time() - t1))
 
-    def _check_recipe_date(self, conan_ref):
+    def _check_recipe_date(self, conan_ref, remote):
         try:
-            remote_recipe_manifest = self._remote_proxy.get_conan_manifest(conan_ref)
+            remote_recipe_manifest = self._remote_manager.get_conan_manifest(conan_ref, remote)
         except NotFoundException:
             return  # First time uploading this package
 
diff --git a/conans/client/conan_api.py b/conans/client/conan_api.py
index 96727d3f7..600d3398d 100644
--- a/conans/client/conan_api.py
+++ b/conans/client/conan_api.py
@@ -40,6 +40,8 @@ from conans.client.cmd.profile import cmd_profile_update, cmd_profile_get,\
     cmd_profile_delete_key, cmd_profile_create, cmd_profile_list
 from conans.client.cmd.search import Search
 from conans.client.cmd.user import users_clean, users_list, user_set
+from conans.client.importer import undo_imports
+from conans.client.cmd.export import cmd_export, export_alias
 
 
 default_manifest_folder = '.conan_manifests'
@@ -159,15 +161,11 @@ class ConanAPIV1(object):
                 or (not color_set
                     and hasattr(sys.stdout, "isatty")
                     and sys.stdout.isatty())):
-            # in PyCharm disable convert/strip
-            if get_env("PYCHARM_HOSTED"):
-                convert = False
-                strip = False
-            else:
-                convert = None
-                strip = None
             import colorama
-            colorama.init(convert=convert, strip=strip)
+            if get_env("PYCHARM_HOSTED"):  # in PyCharm disable convert/strip
+                colorama.init(convert=False, strip=False)
+            else:
+                colorama.init()
             color = True
         else:
             color = False
@@ -203,8 +201,8 @@ class ConanAPIV1(object):
             # Settings preprocessor
             if interactive is None:
                 interactive = not get_env("CONAN_NON_INTERACTIVE", False)
-            conan = Conan(client_cache, user_io, get_conan_runner(), remote_manager, search_manager,
-                          settings_preprocessor, interactive=interactive)
+            conan = ConanAPIV1(client_cache, user_io, get_conan_runner(), remote_manager, search_manager,
+                               settings_preprocessor, interactive=interactive)
 
         return conan, client_cache, user_io
 
@@ -307,7 +305,8 @@ class ConanAPIV1(object):
         # Forcing an export!
         if not not_export:
             scoped_output.highlight("Exporting package recipe")
-            self._manager.export(conanfile_path, name, version, user, channel, keep_source)
+            cmd_export(conanfile_path, name, version, user, channel, keep_source,
+                       self._user_io.out, self._client_cache)
 
         if build_modes is None:  # Not specified, force build the tested library
             build_modes = [name]
@@ -405,7 +404,8 @@ class ConanAPIV1(object):
            (version and conanfile.version and conanfile.version != version):
             raise ConanException("Specified name/version doesn't match with the "
                                  "name/version in the conanfile")
-        self._manager.export(conanfile_path, name, version, user, channel)
+        cmd_export(conanfile_path, name, version, user, channel, False,
+                   self._user_io.out, self._client_cache)
 
         if not (name and version):
             name = conanfile.name
@@ -610,12 +610,13 @@ class ConanAPIV1(object):
     def imports_undo(self, manifest_path):
         cwd = os.getcwd()
         manifest_path = _make_abs_path(manifest_path, cwd)
-        self._manager.imports_undo(manifest_path)
+        undo_imports(manifest_path, self._user_io.out)
 
     @api_method
     def export(self, path, name, version, user, channel, keep_source=False, cwd=None):
         conanfile_path = _get_conanfile_path(path, cwd, py=True)
-        self._manager.export(conanfile_path, name, version, user, channel, keep_source)
+        cmd_export(conanfile_path, name, version, user, channel, keep_source,
+                   self._user_io.out, self._client_cache)
 
     @api_method
     def remove(self, pattern, query=None, packages=None, builds=None, src=False, force=False,
@@ -631,9 +632,8 @@ class ConanAPIV1(object):
         """
         from conans.client.cmd.copy import cmd_copy
         # FIXME: conan copy does not support short-paths in Windows
-        remote_proxy = self._manager.get_proxy()
         cmd_copy(reference, user_channel, packages, self._client_cache,
-                 self._user_io, remote_proxy, force=force)
+                 self._user_io, self._remote_manager, self._registry, force=force)
 
     @api_method
     def authenticate(self, name, password, remote=None):
@@ -681,10 +681,9 @@ class ConanAPIV1(object):
         if force and no_overwrite:
             raise ConanException("'no_overwrite' argument cannot be used together with 'force'")
 
-        remote_proxy = self._manager.get_proxy(remote_name=remote)
-        uploader = CmdUpload(self._client_cache, self._user_io, remote_proxy)
+        uploader = CmdUpload(self._client_cache, self._user_io, self._remote_manager, self._registry)
         return uploader.upload(pattern, package, all_packages, force, confirm, retry, retry_wait,
-                               skip_upload, integrity_check, no_overwrite)
+                               skip_upload, integrity_check, no_overwrite, remote)
 
     @api_method
     def remote_list(self):
@@ -750,14 +749,22 @@ class ConanAPIV1(object):
 
     @api_method
     def get_path(self, reference, package_id=None, path=None, remote=None):
+        from conans.client.local_file_getter import get_path
         reference = ConanFileReference.loads(str(reference))
-        return self._manager.get_path(reference, package_id, path, remote)
+        if not path:
+            path = "conanfile.py" if not package_id else "conaninfo.txt"
+
+        if not remote:
+            return get_path(self._client_cache, reference, package_id, path), path
+        else:
+            remote = self._registry.remote(remote)
+            return self._remote_manager.get_path(reference, package_id, path, remote), path
 
     @api_method
     def export_alias(self, reference, target_reference):
         reference = ConanFileReference.loads(str(reference))
         target_reference = ConanFileReference.loads(str(target_reference))
-        return self._manager.export_alias(reference, target_reference)
+        return export_alias(reference, target_reference, self._client_cache)
 
 
 Conan = ConanAPIV1
diff --git a/conans/client/graph/graph_builder.py b/conans/client/graph/graph_builder.py
index 4fb1889d7..4131ae325 100644
--- a/conans/client/graph/graph_builder.py
+++ b/conans/client/graph/graph_builder.py
@@ -48,13 +48,13 @@ class DepsGraphBuilder(object):
         logger.debug("Deps-builder: Propagate info %s" % (time.time() - t1))
         return dep_graph
 
-    def _resolve_deps(self, node, aliased):
+    def _resolve_deps(self, node, aliased, update):
         # Resolve possible version ranges of the current node requirements
         # new_reqs is a shallow copy of what is propagated upstream, so changes done by the
         # RequireResolver are also done in new_reqs, and then propagated!
         conanfile, conanref = node.conanfile, node.conan_ref
         for _, require in conanfile.requires.items():
-            self._resolver.resolve(require, conanref)
+            self._resolver.resolve(require, conanref, update)
 
         # After resolving ranges,
         for req in conanfile.requires.values():
@@ -86,7 +86,7 @@ class DepsGraphBuilder(object):
         # basic node configuration
         new_reqs, new_options = self._config_node(node, down_reqs, down_ref, down_options)
 
-        self._resolve_deps(node, aliased)
+        self._resolve_deps(node, aliased, update)
 
         # Expand each one of the current requirements
         for name, require in node.conanfile.requires.items():
diff --git a/conans/client/graph/require_resolver.py b/conans/client/graph/require_resolver.py
index e59029363..e0629a5d7 100644
--- a/conans/client/graph/require_resolver.py
+++ b/conans/client/graph/require_resolver.py
@@ -22,13 +22,12 @@ def satisfying(list_versions, versionexpr, output):
 
 class RequireResolver(object):
 
-    def __init__(self, output, local_search, remote_search, update):
+    def __init__(self, output, local_search, remote_search):
         self._output = output
         self._local_search = local_search
         self._remote_search = remote_search
-        self._update = update
 
-    def resolve(self, require, base_conanref):
+    def resolve(self, require, base_conanref, update):
         version_range = require.version_range
         if version_range is None:
             return
@@ -50,7 +49,7 @@ class RequireResolver(object):
         # The search pattern must be a string
         search_ref = str(ConanFileReference(ref.name, "*", ref.user, ref.channel))
 
-        if self._update:
+        if update:
             searches = (self._resolve_remote, self._resolve_local)
         else:
             searches = (self._resolve_local, self._resolve_remote)
@@ -82,7 +81,7 @@ class RequireResolver(object):
         if remote_found:
             return self._resolve_version(version_range, remote_found)
 
-    def _resolve_version(self, version_range, local_found):
-        versions = {ref.version: ref for ref in local_found}
+    def _resolve_version(self, version_range, refs_found):
+        versions = {ref.version: ref for ref in refs_found}
         result = satisfying(versions, version_range, self._output)
         return versions.get(result)
diff --git a/conans/client/installer.py b/conans/client/installer.py
index e45c815e3..f60ca7e54 100644
--- a/conans/client/installer.py
+++ b/conans/client/installer.py
@@ -19,7 +19,7 @@ from conans.client.packager import create_package
 from conans.client.generators import write_generators, TXTGenerator
 from conans.model.build_info import CppInfo
 from conans.client.output import ScopedOutput
-from conans.client.source import config_source
+from conans.client.source import config_source, complete_recipe_sources
 from conans.util.env_reader import get_env
 from conans.client.importer import remove_imports
 
@@ -362,7 +362,8 @@ class ConanInstaller(object):
                 raise ConanException(msg)
         else:
             with self._client_cache.conanfile_write_lock(conan_ref):
-                self._remote_proxy.get_recipe_sources(conan_ref, conan_file.short_paths)
+                complete_recipe_sources(self._remote_proxy._remote_manager, self._client_cache,
+                                        self._remote_proxy.registry, conan_file, conan_ref)
                 builder.prepare_build()
 
         with self._client_cache.conanfile_read_lock(conan_ref):
diff --git a/conans/client/manager.py b/conans/client/manager.py
index 8a6d0e8e9..94a724896 100644
--- a/conans/client/manager.py
+++ b/conans/client/manager.py
@@ -5,11 +5,11 @@ from collections import Counter
 from conans.client import packager
 from conans.client.graph.build_requires import BuildRequires
 from conans.client.client_cache import ClientCache
-from conans.client.cmd.export import cmd_export, _execute_export
+from conans.client.cmd.export import _execute_export
 from conans.client.graph.graph_builder import DepsGraphBuilder
 from conans.client.generators import write_generators
 from conans.client.generators.text import TXTGenerator
-from conans.client.importer import run_imports, undo_imports, run_deploy
+from conans.client.importer import run_imports, run_deploy
 from conans.client.installer import ConanInstaller, call_system_requirements
 from conans.client.loader import ConanFileLoader
 from conans.client.manifest_manager import ManifestManager
@@ -19,14 +19,13 @@ from conans.client.profile_loader import read_conaninfo_profile
 from conans.client.proxy import ConanProxy
 from conans.client.remover import ConanRemover
 from conans.client.graph.require_resolver import RequireResolver
-from conans.client.source import config_source_local
+from conans.client.source import config_source_local, complete_recipe_sources
 from conans.client.tools import cross_building, get_cross_building_settings
 from conans.client.userio import UserIO
 from conans.errors import NotFoundException, ConanException, conanfile_exception_formatter
 from conans.model.conan_file import get_env_context_manager
-from conans.model.manifest import FileTreeManifest
 from conans.model.ref import ConanFileReference, PackageReference
-from conans.paths import CONANFILE, CONANINFO, CONANFILE_TXT, CONAN_MANIFEST, BUILD_INFO
+from conans.paths import CONANFILE, CONANINFO, CONANFILE_TXT, BUILD_INFO
 from conans.util.files import save, rmdir, normalize, mkdir, load
 from conans.util.log import logger
 from conans.client.loader_parse import load_conanfile_class
@@ -158,10 +157,6 @@ class ConanManager(object):
             self._settings_preprocessor.preprocess(cache_settings)
         return ConanFileLoader(self._runner, cache_settings, profile)
 
-    def export(self, conanfile_path, name, version, user, channel,  keep_source=False):
-        cmd_export(conanfile_path, name, version, user, channel, keep_source,
-                   self._user_io.out, self._client_cache)
-
     def get_proxy(self, remote_name=None, manifest_manager=None):
         remote_proxy = ConanProxy(self._client_cache, self._user_io, self._remote_manager,
                                   remote_name=remote_name, recorder=self._recorder, registry=self._registry,
@@ -181,7 +176,7 @@ class ConanManager(object):
         if install_folder and existing_info_files(install_folder):
             _load_deps_info(install_folder, conanfile, required=True)
 
-        graph_builder = self._get_graph_builder(loader, False, remote_proxy)
+        graph_builder = self._get_graph_builder(loader, remote_proxy)
         deps_graph = graph_builder.load_graph(conanfile, check_updates=False, update=False)
 
         # this is a bit tricky, but works. The loading of a cache package makes the referenced
@@ -234,8 +229,8 @@ class ConanManager(object):
         # Download the sources too, don't be lazy
         conan_file_path = self._client_cache.conanfile(reference)
         conanfile = load_conanfile_class(conan_file_path)
-        remote_proxy.complete_recipe_sources(conanfile, reference,
-                                             short_paths=conanfile.short_paths)
+        complete_recipe_sources(self._remote_manager, self._client_cache, self._registry,
+                                conanfile, reference)
 
         if package_ids:
             remote_proxy.download_packages(reference, package_ids)
@@ -262,16 +257,16 @@ class ConanManager(object):
         conanfile._user = inject_require.user
         conanfile._channel = inject_require.channel
 
-    def _get_graph_builder(self, loader, update, remote_proxy):
+    def _get_graph_builder(self, loader, remote_proxy):
         local_search = self._search_manager
-        resolver = RequireResolver(self._user_io.out, local_search, remote_proxy, update=update)
+        resolver = RequireResolver(self._user_io.out, local_search, remote_proxy)
         graph_builder = DepsGraphBuilder(remote_proxy, self._user_io.out, loader, resolver)
         return graph_builder
 
     def _get_deps_graph(self, reference, profile, remote_proxy, check_updates, update):
         loader = self.get_loader(profile)
         conanfile = self._load_install_conanfile(loader, reference)
-        graph_builder = self._get_graph_builder(loader, False, remote_proxy)
+        graph_builder = self._get_graph_builder(loader, remote_proxy)
         deps_graph = graph_builder.load_graph(conanfile, check_updates, update)
         return deps_graph, graph_builder, conanfile
 
@@ -358,7 +353,7 @@ class ConanManager(object):
         conanfile = self._load_install_conanfile(loader, reference)
         if inject_require:
             self._inject_require(conanfile, inject_require)
-        graph_builder = self._get_graph_builder(loader, update, remote_proxy)
+        graph_builder = self._get_graph_builder(loader, remote_proxy)
         deps_graph = graph_builder.load_graph(conanfile, False, update)
 
         if not isinstance(reference, ConanFileReference):
@@ -433,9 +428,6 @@ class ConanManager(object):
                             source_folder, output)
         config_source_local(source_folder, conanfile, output)
 
-    def imports_undo(self, current_path):
-        undo_imports(current_path, self._user_io.out)
-
     def imports(self, conan_file_path, dest_folder, info_folder):
         """
         :param conan_file_path: Abs path to a conanfile
@@ -531,30 +523,6 @@ class ConanManager(object):
         remover.remove(pattern, remote_name, src, build_ids, package_ids_filter, force=force,
                        packages_query=packages_query, outdated=outdated)
 
-    def get_path(self, reference, package_id=None, path=None, remote_name=None):
-        remote_proxy = self.get_proxy(remote_name=remote_name)
-        if not path and not package_id:
-            path = "conanfile.py"
-        elif not path and package_id:
-            path = "conaninfo.txt"
-        return remote_proxy.get_path(reference, package_id, path), path
-
-    def export_alias(self, reference, target_reference):
-
-        conanfile = """
-from conans import ConanFile
-
-class AliasConanfile(ConanFile):
-    alias = "%s"
-""" % str(target_reference)
-
-        export_path = self._client_cache.export(reference)
-        mkdir(export_path)
-        save(os.path.join(export_path, CONANFILE), conanfile)
-        mkdir(self._client_cache.export_sources(reference))
-        digest = FileTreeManifest.create(export_path)
-        save(os.path.join(export_path, CONAN_MANIFEST), str(digest))
-
 
 def _load_deps_info(current_path, conanfile, required):
 
diff --git a/conans/client/proxy.py b/conans/client/proxy.py
index 2125617e1..ac74424f1 100644
--- a/conans/client/proxy.py
+++ b/conans/client/proxy.py
@@ -3,16 +3,14 @@ import os
 from requests.exceptions import RequestException
 
 from conans.client.loader_parse import load_conanfile_class
-from conans.client.local_file_getter import get_path
 from conans.client.output import ScopedOutput
 from conans.client.remover import DiskRemover
 from conans.client.action_recorder import INSTALL_ERROR_MISSING, INSTALL_ERROR_NETWORK
 from conans.errors import (ConanException, NotFoundException, NoRemoteAvailable)
 from conans.model.ref import PackageReference
-from conans.paths import EXPORT_SOURCES_TGZ_NAME
-from conans.util.files import mkdir
 from conans.util.log import logger
 from conans.util.tracer import log_recipe_got_from_local_cache
+from conans.client.source import complete_recipe_sources
 
 
 class ConanProxy(object):
@@ -72,20 +70,6 @@ class ConanProxy(object):
             remote = self._registry.get_ref(package_ref.conan)
             self._manifest_manager.check_package(package_ref, remote)
 
-    def get_recipe_sources(self, conan_reference, short_paths=False):
-        export_path = self._client_cache.export(conan_reference)
-        sources_folder = self._client_cache.export_sources(conan_reference, short_paths)
-        if os.path.exists(sources_folder):
-            return
-
-        current_remote = self._registry.get_ref(conan_reference)
-        if not current_remote:
-            raise ConanException("Error while trying to get recipe sources for %s. "
-                                 "No remote defined" % str(conan_reference))
-        else:
-            self._remote_manager.get_recipe_sources(conan_reference, export_path, sources_folder,
-                                                    current_remote)
-
     def get_recipe(self, conan_reference, check_updates, update):
         with self._client_cache.conanfile_write_lock(conan_reference):
             result = self._get_recipe(conan_reference, check_updates, update)
@@ -136,7 +120,9 @@ class ConanProxy(object):
         if self._manifest_manager:
             # Just make sure that the recipe sources are there to check
             conanfile = load_conanfile_class(conanfile_path)
-            self.get_recipe_sources(conan_reference, conanfile.short_paths)
+            complete_recipe_sources(self._remote_manager, self._client_cache, self._registry,
+                                    conanfile, conan_reference)
+
             remote = self._registry.get_ref(conan_reference)
             self._manifest_manager.check_recipe(conan_reference, remote)
 
@@ -208,74 +194,15 @@ class ConanProxy(object):
 
         raise ConanException("No remote defined")
 
-    def complete_recipe_sources(self, conanfile, conan_reference, force_complete=True, short_paths=False):
-        sources_folder = self._client_cache.export_sources(conan_reference, short_paths)
-        if not hasattr(conanfile, "exports_sources"):
-            mkdir(sources_folder)
-            return None
-
-        ignore_deleted_file = None
-        if not os.path.exists(sources_folder):
-            # If not path to sources exists, we have a problem, at least an empty folder
-            # should be there
-            upload_remote, current_remote = self._get_remote(conan_reference)
-            if not current_remote:
-                raise ConanException("Trying to upload a package recipe without sources, "
-                                     "and the remote for the sources no longer exists")
-            if force_complete or current_remote != upload_remote:
-                # If uploading to a different remote than the one from which the recipe
-                # was retrieved, we definitely need to get the sources, so the recipe is complete
-                self.get_recipe_sources(conan_reference, short_paths=short_paths)
-            else:
-                # But if same remote, no need to upload again the TGZ, it is already in the server
-                # But the upload API needs to know it to not remove the server file.
-                ignore_deleted_file = EXPORT_SOURCES_TGZ_NAME
-        return ignore_deleted_file
-
-    def upload_recipe(self, conan_reference, retry, retry_wait, skip_upload, no_overwrite):
-        """ upload to defined remote in (-r=remote), to current remote
-        or to default remote, in that order.
-        If the remote is not set, set it
-        """
-        conan_file_path = self._client_cache.conanfile(conan_reference)
-        conanfile = load_conanfile_class(conan_file_path)
-        ignore_deleted_file = self.complete_recipe_sources(conanfile, conan_reference,
-                                                           force_complete=False,
-                                                           short_paths=conanfile.short_paths)
-        remote, ref_remote = self._get_remote(conan_reference)
-
-        result = self._remote_manager.upload_recipe(conan_reference, remote, retry, retry_wait,
-                                                    ignore_deleted_file=ignore_deleted_file,
-                                                    skip_upload=skip_upload,
-                                                    no_overwrite=no_overwrite)
-        if not ref_remote and not skip_upload:
-            self._registry.set_ref(conan_reference, remote)
-        return result
-
     def _get_remote(self, conan_ref=None):
         # Prioritize -r , then reference registry and then the default remote
         ref_remote = self._registry.get_ref(conan_ref) if conan_ref else None
         if self._remote_name:
             remote = self._registry.remote(self._remote_name)
         else:
-            if ref_remote:
-                remote = ref_remote
-            else:
-                remote = self._registry.default_remote
+            remote = ref_remote or self._registry.default_remote
         return remote, ref_remote
 
-    def upload_package(self, package_ref, retry, retry_wait, skip_upload, integrity_check,
-                       no_overwrite):
-        remote, current_remote = self._get_remote(package_ref.conan)
-        if not current_remote:
-            self._out.warn("Remote for '%s' not defined, uploading to %s"
-                           % (str(package_ref.conan), remote.name))
-        result = self._remote_manager.upload_package(package_ref, remote, retry, retry_wait,
-                                                     skip_upload, integrity_check, no_overwrite)
-        if not current_remote and not skip_upload:
-            self._registry.set_ref(package_ref.conan, remote)
-        return result
-
     def get_conan_manifest(self, conan_ref):
         """ used by update to check the date of packages, require force if older
         """
@@ -314,29 +241,6 @@ class ConanProxy(object):
             if search_result:
                 return search_result
 
-    def remove(self, conan_ref):
-        if not self._remote_name:
-            raise ConanException("Cannot remove, remote not defined")
-        remote = self._registry.remote(self._remote_name)
-        result = self._remote_manager.remove(conan_ref, remote)
-        current_remote = self._registry.get_ref(conan_ref)
-        if current_remote == remote:
-            self._registry.remove_ref(conan_ref)
-        return result
-
-    def remove_packages(self, conan_ref, remove_ids):
-        if not self._remote_name:
-            raise ConanException("Cannot remove, remote not defined")
-        remote = self._registry.remote(self._remote_name)
-        return self._remote_manager.remove_packages(conan_ref, remove_ids, remote)
-
-    def get_path(self, conan_ref, package_id, path):
-        if not self._remote_name:
-            return get_path(self._client_cache, conan_ref, package_id, path)
-        else:
-            remote = self._registry.remote(self._remote_name)
-            return self._remote_manager.get_path(conan_ref, package_id, path, remote)
-
     def download_packages(self, reference, package_ids):
         assert(isinstance(package_ids, list))
         remote, _ = self._get_remote(reference)
diff --git a/conans/client/remover.py b/conans/client/remover.py
index bb34d2e81..053e0de41 100644
--- a/conans/client/remover.py
+++ b/conans/client/remover.py
@@ -87,11 +87,15 @@ class ConanRemover(object):
         self._remote_manager = remote_manager
         self._registry = remote_registry
 
-    def _remote_remove(self, reference, package_ids):
+    def _remote_remove(self, reference, package_ids, remote):
         if package_ids is None:
-            self._remote_proxy.remove(reference)
+            result = self._remote_manager.remove(reference, remote)
+            current_remote = self._registry.get_ref(reference)
+            if current_remote == remote:
+                self._registry.remove_ref(reference)
+            return result
         else:
-            self._remote_proxy.remove_packages(reference, package_ids)
+            return self._remote_manager.remove_packages(reference, package_ids, remote)
 
     def _local_remove(self, reference, src, build_ids, package_ids):
         # Make sure to clean the locks too
@@ -159,7 +163,7 @@ class ConanRemover(object):
             if self._ask_permission(reference, src, build_ids, package_ids, force):
                 deleted_refs.append(reference)
                 if remote:
-                    self._remote_remove(reference, package_ids)
+                    self._remote_remove(reference, package_ids, remote)
                 else:
                     deleted_refs.append(reference)
                     self._local_remove(reference, src, build_ids, package_ids)
diff --git a/conans/client/source.py b/conans/client/source.py
index 84012443f..8a1ce0f21 100644
--- a/conans/client/source.py
+++ b/conans/client/source.py
@@ -8,7 +8,28 @@ from conans.model.conan_file import get_env_context_manager
 from conans.errors import ConanException, conanfile_exception_formatter, \
     ConanExceptionInUserConanfileMethod
 from conans.paths import EXPORT_TGZ_NAME, EXPORT_SOURCES_TGZ_NAME, CONANFILE, CONAN_MANIFEST
-from conans.util.files import rmdir, set_dirty, is_dirty, clean_dirty
+from conans.util.files import rmdir, set_dirty, is_dirty, clean_dirty, mkdir
+
+
+def complete_recipe_sources(remote_manager, client_cache, registry, conanfile, conan_reference):
+    sources_folder = client_cache.export_sources(conan_reference, conanfile.short_paths)
+    if os.path.exists(sources_folder):
+        return None
+
+    if not hasattr(conanfile, "exports_sources"):
+        mkdir(sources_folder)
+        return None
+
+    # If not path to sources exists, we have a problem, at least an empty folder
+    # should be there
+    current_remote = registry.get_ref(conan_reference)
+    if not current_remote:
+        raise ConanException("Error while trying to get recipe sources for %s. "
+                             "No remote defined" % str(conan_reference))
+
+    export_path = client_cache.export(conan_reference)
+    remote_manager.get_recipe_sources(conan_reference, export_path, sources_folder,
+                                      current_remote)
 
 
 def merge_directories(src, dst):
diff --git a/conans/client/tools/oss.py b/conans/client/tools/oss.py
index 014224365..fb9398b74 100644
--- a/conans/client/tools/oss.py
+++ b/conans/client/tools/oss.py
@@ -307,6 +307,60 @@ def get_cross_building_settings(settings, self_os=None, self_arch=None):
     return build_os, build_arch, host_os, host_arch
 
 
+def get_gnu_triplet(os, arch, compiler=None):
+    """
+    Returns string with <machine>-<vendor>-<op_system> triplet (<vendor> can be omitted in practice)
+
+    :param os: os to be used to create the triplet
+    :param arch: arch to be used to create the triplet
+    :param compiler: compiler used to create the triplet (only needed fo windows)
+    """
+
+    if os == "Windows" and compiler is None:
+        raise ConanException("'compiler' parameter for 'get_gnu_triplet()' is not specified and "
+                             "needed for os=Windows")
+
+    # Calculate the arch
+    machine = {"x86": "i686" if os != "Linux" else "x86",
+                "x86_64": "x86_64",
+                "armv6": "arm",
+                "armv7": "arm",
+                "armv7s": "arm",
+                "armv7k": "arm",
+                "armv7hf": "arm",
+                "armv8": "aarch64"}.get(arch, None)
+    if machine is None:
+        raise ConanException("Unknown '%s' machine. Conan doesn't know how to "
+                                "translate it to the GNU triplet, please report at "
+                                "https://github.com/conan-io/conan/issues" % arch)
+
+    # Calculate the OS
+    if compiler == "gcc":
+        windows_op = "w64-mingw32"
+    elif compiler == "Visual Studio":
+        windows_op = "windows-msvc"
+    else:
+        windows_op = "windows"
+
+    op_system = {"Windows": windows_op,
+                 "Linux": "linux-gnu",
+                 "Darwin": "apple-darwin",
+                 "Android": "linux-android",
+                 "Macos": "apple-darwin",
+                 "iOS": "apple-darwin",
+                 "watchOS": "apple-darwin",
+                 "tvOS": "apple-darwin"}.get(os, os.lower())
+
+    if os in ("Linux", "Android"):
+        if "arm" in arch and arch != "armv8":
+            op_system += "eabi"
+
+        if arch == "armv7hf" and os == "Linux":
+            op_system += "hf"
+
+    return "%s-%s" % (machine, op_system)
+
+
 try:
     os_info = OSInfo()
 except Exception as exc:
diff --git a/conans/search/search.py b/conans/search/search.py
index 6187ae24d..edab96e09 100644
--- a/conans/search/search.py
+++ b/conans/search/search.py
@@ -1,6 +1,7 @@
 import re
+import os
+
 
-from abc import ABCMeta, abstractmethod
 from fnmatch import translate
 
 from conans.errors import ConanException, NotFoundException
@@ -8,59 +9,8 @@ from conans.model.info import ConanInfo
 from conans.model.ref import PackageReference, ConanFileReference
 from conans.paths import CONANINFO
 from conans.util.log import logger
-import os
 from conans.search.query_parse import infix_to_postfix, evaluate_postfix
-
-
-class SearchAdapterABC(object):
-    """Methods that allows access to disk or s3 or whatever to make a search"""
-    __metaclass__ = ABCMeta
-
-    @abstractmethod
-    def list_folder_subdirs(self, basedir, level):
-        pass
-
-    @abstractmethod
-    def path_exists(self, path):
-        pass
-
-    @abstractmethod
-    def load(self, filepath):
-        pass
-
-    @abstractmethod
-    def join_paths(self, *args):
-        pass
-
-
-class DiskSearchAdapter(SearchAdapterABC):
-
-    def list_folder_subdirs(self, basedir, level):
-        from conans.util.files import list_folder_subdirs
-        return list_folder_subdirs(basedir, level)
-
-    def path_exists(self, path):
-        return os.path.exists(path)
-
-    def load(self, filepath):
-        from conans.util.files import load
-        return load(filepath)
-
-    def join_paths(self, *args):
-        return os.path.join(*args)
-
-
-class SearchManagerABC(object):
-    """Methods that allows access to disk or s3 or whatever to make a search"""
-    __metaclass__ = ABCMeta
-
-    @abstractmethod
-    def search_recipes(self, pattern=None, ignorecase=True):
-        pass
-
-    @abstractmethod
-    def search_packages(self, reference, query):
-        pass
+from conans.util.files import list_folder_subdirs, load
 
 
 def filter_outdated(packages_infos, recipe_hash):
@@ -124,13 +74,12 @@ def evaluate(prop_name, prop_value, conan_vars_info):
     return False
 
 
-class DiskSearchManager(SearchManagerABC):
+class DiskSearchManager(object):
     """Will search recipes and packages using a file system.
     Can be used with a SearchAdapter"""
 
-    def __init__(self, paths, disk_search_adapter=None):
+    def __init__(self, paths):
         self._paths = paths
-        self._adapter = disk_search_adapter or DiskSearchAdapter()
 
     def search_recipes(self, pattern=None, ignorecase=True):
         # Conan references in main storage
@@ -140,7 +89,7 @@ class DiskSearchManager(SearchManagerABC):
             pattern = translate(pattern)
             pattern = re.compile(pattern, re.IGNORECASE) if ignorecase else re.compile(pattern)
 
-        subdirs = self._adapter.list_folder_subdirs(basedir=self._paths.store, level=4)
+        subdirs = list_folder_subdirs(basedir=self._paths.store, level=4)
         if not pattern:
             return sorted([ConanFileReference(*folder.split("/")) for folder in subdirs])
         else:
@@ -166,17 +115,16 @@ class DiskSearchManager(SearchManagerABC):
     def _get_local_infos_min(self, reference):
         result = {}
         packages_path = self._paths.packages(reference)
-        subdirs = self._adapter.list_folder_subdirs(packages_path, level=1)
+        subdirs = list_folder_subdirs(packages_path, level=1)
         for package_id in subdirs:
             # Read conaninfo
             try:
                 package_reference = PackageReference(reference, package_id)
-                info_path = self._adapter.join_paths(self._paths.package(package_reference,
-                                                                         short_paths=None),
-                                                     CONANINFO)
-                if not self._adapter.path_exists(info_path):
+                info_path = os.path.join(self._paths.package(package_reference,
+                                                             short_paths=None), CONANINFO)
+                if not os.path.exists(info_path):
                     raise NotFoundException("")
-                conan_info_content = self._adapter.load(info_path)
+                conan_info_content = load(info_path)
                 conan_vars_info = ConanInfo.loads(conan_info_content).serialize_min()
                 result[package_id] = conan_vars_info
 
diff --git a/conans/server/server_launcher.py b/conans/server/server_launcher.py
index b200fd8e0..58e60288d 100644
--- a/conans/server/server_launcher.py
+++ b/conans/server/server_launcher.py
@@ -11,7 +11,7 @@ from conans.model.version import Version
 from conans.server.migrate import migrate_and_get_server_config
 from conans import __version__ as SERVER_VERSION
 from conans.paths import conan_expand_user, SimplePaths
-from conans.search.search import DiskSearchManager, DiskSearchAdapter
+from conans.search.search import DiskSearchManager
 from conans import SERVER_CAPABILITIES
 
 
@@ -37,9 +37,7 @@ class ServerLauncher(object):
 
         file_manager = get_file_manager(server_config, updown_auth_manager=updown_auth_manager)
 
-        search_adapter = DiskSearchAdapter()
-        search_manager = DiskSearchManager(SimplePaths(server_config.disk_storage_path),
-                                           search_adapter)
+        search_manager = DiskSearchManager(SimplePaths(server_config.disk_storage_path))
 
         server_capabilities = SERVER_CAPABILITIES
         self.ra = ConanServer(server_config.port, credentials_manager, updown_auth_manager,


Test patch:
diff --git a/conans/test/build_helpers/autotools_configure_test.py b/conans/test/build_helpers/autotools_configure_test.py
index 83eced2eb..f89722174 100644
--- a/conans/test/build_helpers/autotools_configure_test.py
+++ b/conans/test/build_helpers/autotools_configure_test.py
@@ -379,142 +379,14 @@ class AutoToolsConfigureTest(unittest.TestCase):
 
     def test_previous_env(self):
         settings = MockSettings({"arch": "x86",
-                                 "os": "Linux"})
+                                 "os": "Linux",
+                                 "compiler": "gcc"})
         conanfile = MockConanfile(settings)
 
         with tools.environment_append({"CPPFLAGS": "MyCppFlag"}):
             be = AutoToolsBuildEnvironment(conanfile)
             self.assertEquals(be.vars["CPPFLAGS"], "MyCppFlag")
 
-    def cross_build_flags_test(self):
-
-        def get_values(this_os, this_arch, setting_os, setting_arch, compiler=None):
-            settings = MockSettings({"arch": setting_arch,
-                                     "os": setting_os,
-                                     "compiler": compiler})
-            conanfile = MockConanfile(settings)
-            conanfile.settings = settings
-            be = AutoToolsBuildEnvironment(conanfile)
-            return be._get_host_build_target_flags(this_arch, this_os)
-
-        build, host, target = get_values("Linux", "x86_64", "Linux", "armv7hf")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "arm-linux-gnueabihf")
-
-        build, host, target = get_values("Linux", "x86", "Linux", "armv7hf")
-        self.assertEquals(build, "x86-linux-gnu")
-        self.assertEquals(host, "arm-linux-gnueabihf")
-
-        build, host, target = get_values("Linux", "x86", "Linux", "x86")
-        self.assertFalse(build)
-        self.assertFalse(host)
-        self.assertFalse(target)
-
-        build, host, target = get_values("Linux", "x86_64", "Linux", "x86_64")
-        self.assertFalse(build)
-        self.assertFalse(host)
-        self.assertFalse(target)
-
-        build, host, target = get_values("Linux", "x86_64", "Linux", "x86")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "x86-linux-gnu")
-        self.assertFalse(target)
-
-        build, host, target = get_values("Linux", "x86_64", "Windows", "x86", compiler="gcc")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "i686-w64-mingw32")
-        self.assertFalse(target)
-
-        build, host, target = get_values("Linux", "x86_64", "Windows", "x86", compiler="Visual Studio")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "i686-windows-msvc")  # Not very common but exists sometimes
-        self.assertFalse(target)
-
-        build, host, target = get_values("Linux", "x86_64", "Linux", "armv7hf")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "arm-linux-gnueabihf")
-
-        build, host, target = get_values("Linux", "x86_64", "Linux", "armv7")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "arm-linux-gnueabi")
-
-        build, host, target = get_values("Linux", "x86_64", "Linux", "armv6")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "arm-linux-gnueabi")
-
-        build, host, target = get_values("Linux", "x86_64", "Android", "x86")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "i686-linux-android")
-
-        build, host, target = get_values("Linux", "x86_64", "Android", "x86_64")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "x86_64-linux-android")
-
-        build, host, target = get_values("Linux", "x86_64", "Android", "armv7")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "arm-linux-androideabi")
-
-        build, host, target = get_values("Linux", "x86_64", "Android", "armv7hf")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "arm-linux-androideabi")
-
-        build, host, target = get_values("Linux", "x86_64", "Android", "armv8")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "aarch64-linux-android")
-
-        build, host, target = get_values("Linux", "x86_64", "Android", "armv6")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "arm-linux-androideabi")
-
-        build, host, target = get_values("Linux", "x86_64", "Windows", "x86", compiler="gcc")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "i686-w64-mingw32")
-
-        build, host, target = get_values("Linux", "x86_64", "Windows", "x86_64", compiler="gcc")
-        self.assertEquals(build, "x86_64-linux-gnu")
-        self.assertEquals(host, "x86_64-w64-mingw32")
-
-        build, host, target = get_values("Windows", "x86_64", "Windows", "x86_64")
-        self.assertFalse(build)
-        self.assertFalse(host)
-        self.assertFalse(target)
-
-        build, host, target = get_values("Windows", "x86", "Windows", "x86")
-        self.assertFalse(build)
-        self.assertFalse(host)
-        self.assertFalse(target)
-
-        build, host, target = get_values("Windows", "x86_64", "Windows", "x86", compiler="gcc")
-        self.assertEquals(build, "x86_64-w64-mingw32")
-        self.assertEquals(host, "i686-w64-mingw32")
-        self.assertFalse(target)
-
-        build, host, target = get_values("Windows", "x86_64", "Linux", "armv7hf", compiler="gcc")
-        self.assertEquals(build, "x86_64-w64-mingw32")
-        self.assertEquals(host, "arm-linux-gnueabihf")
-        self.assertFalse(target)
-
-        build, host, target = get_values("Darwin", "x86_64", "Android", "armv7hf")
-
-        self.assertEquals(build, "x86_64-apple-darwin")
-        self.assertEquals(host, "arm-linux-androideabi")
-
-        build, host, target = get_values("Darwin", "x86_64", "Macos", "x86")
-        self.assertEquals(build, "x86_64-apple-darwin")
-        self.assertEquals(host, "i686-apple-darwin")
-
-        build, host, target = get_values("Darwin", "x86_64", "iOS", "armv7")
-        self.assertEquals(build, "x86_64-apple-darwin")
-        self.assertEquals(host, "arm-apple-darwin")
-
-        build, host, target = get_values("Darwin", "x86_64", "watchOS", "armv7k")
-        self.assertEquals(build, "x86_64-apple-darwin")
-        self.assertEquals(host, "arm-apple-darwin")
-
-        build, host, target = get_values("Darwin", "x86_64", "tvOS", "armv8")
-        self.assertEquals(build, "x86_64-apple-darwin")
-        self.assertEquals(host, "aarch64-apple-darwin")
-
     def test_pkg_config_paths(self):
         if platform.system() == "Windows":
             return
@@ -552,6 +424,10 @@ class HelloConan(ConanFile):
         runner = RunnerMock()
         conanfile = MockConanfile(MockSettings({}), None, runner)
         ab = AutoToolsBuildEnvironment(conanfile)
+        self.assertFalse(ab.build)
+        self.assertFalse(ab.host)
+        self.assertFalse(ab.target)
+
         ab.configure()
         self.assertEquals(runner.command_called, "./configure  ")
 
@@ -564,13 +440,106 @@ class HelloConan(ConanFile):
         ab.configure(target="i686-apple-darwin")
         self.assertEquals(runner.command_called, "./configure  --target=i686-apple-darwin")
 
-    def test_make_targets(self):
+        conanfile = MockConanfile(MockSettings({"build_type": "Debug",
+                                                "arch": "x86_64",
+                                                "os": "Windows",
+                                                "compiler": "gcc",
+                                                "compiler.libcxx": "libstdc++"}),
+                                  None, runner)
+        ab = AutoToolsBuildEnvironment(conanfile)
+        ab.configure()
+        if platform.system() == "Windows":
+            # Not crossbuilding
+            self.assertFalse(ab.host)
+            self.assertFalse(ab.build)
+            self.assertIn("./configure", runner.command_called)
+            self.assertNotIn("--build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32",
+                             runner.command_called)
+        elif platform.system() == "Linux":
+            self.assertIn("x86_64-w64-mingw32", ab.host)
+            self.assertIn("x86_64-linux-gnu", ab.build)
+            self.assertIn("./configure  --build=x86_64-linux-gnu --host=x86_64-w64-mingw32",
+                          runner.command_called)
+        else:
+            self.assertIn("x86_64-w64-mingw32", ab.host)
+            self.assertIn("x86_64-apple-darwin", ab.build)
+            self.assertIn("./configure  --build=x86_64-apple-darwin --host=x86_64-w64-mingw32",
+                          runner.command_called)
+
+        ab.configure(build="fake_build_triplet", host="fake_host_triplet")
+        self.assertIn("./configure  --build=fake_build_triplet --host=fake_host_triplet",
+                      runner.command_called)
+
+        ab.build = "superfake_build_triplet"
+        ab.host = "superfake_host_triplet"
+        ab.configure()
+        self.assertIn("./configure  --build=superfake_build_triplet --host=superfake_host_triplet",
+                      runner.command_called)
+
+    def test_make_targets_install(self):
         runner = RunnerMock()
         conanfile = MockConanfile(MockSettings({}), None, runner)
-        
+
         ab = AutoToolsBuildEnvironment(conanfile)
         ab.configure()
-        
+
         ab.make(target="install")
-        self.assertEquals(runner.command_called,"make install -j%s" % cpu_count())        
+        self.assertEquals(runner.command_called, "make install -j%s" % cpu_count())
+        ab.install()
+        self.assertEquals(runner.command_called, "make install -j%s" % cpu_count())
+
+    def autotools_prefix_test(self):
+        runner = RunnerMock()
+        conanfile = MockConanfile(MockSettings({}), None, runner)
+        # Package folder is not defined
+        ab = AutoToolsBuildEnvironment(conanfile)
+        ab.configure()
+        self.assertNotIn("--prefix", runner.command_called)
+        # package folder defined
+        conanfile.package_folder = "/package_folder"
+        ab.configure()
+        if platform.system() == "Windows":
+            self.assertIn("./configure --prefix=/package_folder", runner.command_called)
+        else:
+            self.assertIn("./configure '--prefix=/package_folder'", runner.command_called)
+        # --prefix already used in args
+        ab.configure(args=["--prefix=/my_package_folder"])
+        if platform.system() == "Windows":
+            self.assertIn("./configure --prefix=/my_package_folder", runner.command_called)
+            self.assertNotIn("--prefix=/package_folder", runner.command_called)
+        else:
+            self.assertIn("./configure '--prefix=/my_package_folder'", runner.command_called)
+            self.assertNotIn("'--prefix=/package_folder'", runner.command_called)
+
+    def autotools_configure_vars_test(self):
+        from mock import patch
+
+        runner = RunnerMock()
+        settings = MockSettings({"build_type": "Debug",
+                                 "arch": "x86_64",
+                                 "compiler": "gcc",
+                                 "compiler.libcxx": "libstdc++"})
+        conanfile = MockConanfile(settings, None, runner)
+        conanfile.settings = settings
+        self._set_deps_info(conanfile)
+
+        def custom_configure(obj, configure_dir=None, args=None, build=None, host=None, target=None,
+                             pkg_config_paths=None, vars=None):  # @UnusedVariable
+            self.assertNotEqual(obj.vars, vars)
+            return vars or obj.vars
+
+        with patch.object(AutoToolsBuildEnvironment, 'configure', new=custom_configure):
+            be = AutoToolsBuildEnvironment(conanfile)
+
+            # Get vars and modify them
+            my_vars = be.vars
+            my_vars["fake_var"] = "fake"
+            my_vars["super_fake_var"] = "fakefake"
+
+            # TEST with default vars
+            mocked_result = be.configure()
+            self.assertEqual(mocked_result, be.vars)
 
+            # TEST with custom vars
+            mocked_result = be.configure(vars=my_vars)
+            self.assertEqual(mocked_result, my_vars)
diff --git a/conans/test/command/upload_complete_test.py b/conans/test/command/upload_complete_test.py
index 2c5a2ff20..35c510aff 100644
--- a/conans/test/command/upload_complete_test.py
+++ b/conans/test/command/upload_complete_test.py
@@ -239,16 +239,16 @@ class TestConan(ConanFile):
         self.client.run("upload Hello/1.2@lasote/stable", ignore_error=False)
         self.assertIn("Uploading conanmanifest.txt", self.client.user_io.out)
 
-    def simple_test(self):
+    def single_binary_test(self):
         """ basic installation of a new conans
         """
-
         # Try to upload an package without upload conans first
-        self.client.run('upload %s -p %s' % (self.conan_ref, str(self.package_ref.package_id)),
-                        ignore_error=True)
-        self.assertIn("There are no remote conanfiles like %s" % str(self.conan_ref),
-                      self.client.user_io.out)
+        self.client.run('upload %s -p %s' % (self.conan_ref, str(self.package_ref.package_id)))
+        self.assertIn("Uploaded conan recipe '%s'" % str(self.conan_ref), self.client.out)
 
+    def simple_test(self):
+        """ basic installation of a new conans
+        """
         # Upload conans
         self.client.run('upload %s' % str(self.conan_ref))
         self.assertTrue(os.path.exists(self.server_reg_folder))
@@ -305,7 +305,7 @@ class TestConan(ConanFile):
         self.client.run('upload %s --all' % str(self.conan_ref))
         lines = [line.strip() for line in str(self.client.user_io.out).splitlines()
                  if line.startswith("Uploading")]
-        self.assertEqual(lines, ["Uploading Hello/1.2.1@frodo/stable",
+        self.assertEqual(lines, ["Uploading Hello/1.2.1@frodo/stable to remote 'default'",
                                  "Uploading conanmanifest.txt",
                                  "Uploading conanfile.py",
                                  "Uploading conan_export.tgz",
diff --git a/conans/test/command/upload_test.py b/conans/test/command/upload_test.py
index b985945ac..3564c3a47 100644
--- a/conans/test/command/upload_test.py
+++ b/conans/test/command/upload_test.py
@@ -239,7 +239,7 @@ class MyPkg(ConanFile):
 
         # CASE: Without changes
         client.run("create . frodo/stable")
-        ## upload recipe and packages
+        # upload recipe and packages
         client.run("upload Hello0/1.2.1@frodo/stable --all --no-overwrite")
         self.assertIn("Recipe is up to date, upload skipped", client.all_output)
         self.assertIn("Package is up to date, upload skipped", client.out)
@@ -250,18 +250,18 @@ class MyPkg(ConanFile):
                                            "self.copy(\"*.h\")\n        self.copy(\"*.cpp\")")
         client.save({"conanfile.py": new_recipe})
         client.run("create . frodo/stable")
-        ## upload recipe and packages
+        # upload recipe and packages
         error = client.run("upload Hello0/1.2.1@frodo/stable --all --no-overwrite",
                            ignore_error=True)
         self.assertTrue(error)
         self.assertIn("Forbbiden overwrite", client.out)
         self.assertNotIn("Uploading package", client.out)
 
-         # CASE: When package changes
+        # CASE: When package changes
         client.run("upload Hello0/1.2.1@frodo/stable --all")
         with environment_append({"MY_VAR": "True"}):
             client.run("create . frodo/stable")
-        ## upload recipe and packages
+        # upload recipe and packages
         error = client.run("upload Hello0/1.2.1@frodo/stable --all --no-overwrite",
                            ignore_error=True)
         self.assertTrue(error)
@@ -315,7 +315,7 @@ class MyPkg(ConanFile):
                                            "self.copy(\"*.h\")\n        self.copy(\"*.cpp\")")
         client.save({"conanfile.py": new_recipe})
         client.run("create . frodo/stable")
-        ## upload recipe and packages
+        # upload recipe and packages
         error = client.run("upload Hello0/1.2.1@frodo/stable --all --no-overwrite recipe",
                            ignore_error=True)
         self.assertTrue(error)
@@ -326,7 +326,7 @@ class MyPkg(ConanFile):
         client.run("upload Hello0/1.2.1@frodo/stable --all")
         with environment_append({"MY_VAR": "True"}):
             client.run("create . frodo/stable")
-        ## upload recipe and packages
+        # upload recipe and packages
         client.run("upload Hello0/1.2.1@frodo/stable --all --no-overwrite recipe")
         self.assertIn("Recipe is up to date, upload skipped", client.out)
         self.assertIn("Uploading conan_package.tgz", client.out)
@@ -403,7 +403,7 @@ class Pkg(ConanFile):
         self.assertNotIn("Uploading conanmanifest.txt", client.out)
         self.assertNotIn("Uploading conanfile.py", client.out)
         self.assertNotIn("Uploading conan_export.tgz", client.out)
-        
+
     def upload_login_prompt_disabled_user_not_authenticated_test(self):
         """ When a user is not authenticated, uploads should fail when login prompt has been disabled.
         """
@@ -420,7 +420,7 @@ class Pkg(ConanFile):
         self.assertNotIn("Uploading conanmanifest.txt", client.out)
         self.assertNotIn("Uploading conanfile.py", client.out)
         self.assertNotIn("Uploading conan_export.tgz", client.out)
-        
+
     def upload_login_prompt_disabled_user_authenticated_test(self):
         """ When a user is authenticated, uploads should work even when login prompt has been disabled.
         """
diff --git a/conans/test/functional/disk_search_test.py b/conans/test/functional/disk_search_test.py
index 1fd15f69c..b2e14a52b 100644
--- a/conans/test/functional/disk_search_test.py
+++ b/conans/test/functional/disk_search_test.py
@@ -3,7 +3,7 @@ import unittest
 from conans.paths import (BUILD_FOLDER, PACKAGES_FOLDER, EXPORT_FOLDER, SimplePaths, CONANINFO)
 from conans.model.ref import ConanFileReference
 from conans.test.utils.test_files import temp_folder
-from conans.search.search import DiskSearchManager, DiskSearchAdapter
+from conans.search.search import DiskSearchManager
 from conans.util.files import save
 from conans.model.info import ConanInfo
 
@@ -13,8 +13,7 @@ class SearchTest(unittest.TestCase):
     def setUp(self):
         folder = temp_folder()
         paths = SimplePaths(folder)
-        search_adapter = DiskSearchAdapter()
-        self.search_manager = DiskSearchManager(paths, search_adapter)
+        self.search_manager = DiskSearchManager(paths)
         os.chdir(paths.store)
         self.paths = paths
 
@@ -63,8 +62,7 @@ class SearchTest(unittest.TestCase):
         conan_ref5 = ConanFileReference.loads("SDL_fake/1.10@lasote/testing")
         os.makedirs("%s/%s" % (root_folder5, EXPORT_FOLDER))
         # Case insensitive searches
-        search_adapter = DiskSearchAdapter()
-        search_manager = DiskSearchManager(self.paths, search_adapter)
+        search_manager = DiskSearchManager(self.paths)
 
         reg_conans = sorted([str(_reg) for _reg in search_manager.search_recipes("*")])
         self.assertEqual(reg_conans, [str(conan_ref5),
diff --git a/conans/test/integration/export_sources_test.py b/conans/test/integration/export_sources_test.py
index 5fe5a517a..1d8bfb548 100644
--- a/conans/test/integration/export_sources_test.py
+++ b/conans/test/integration/export_sources_test.py
@@ -166,12 +166,7 @@ class ExportsSourcesTest(unittest.TestCase):
             expected_exports.append("license.txt")
 
         self.assertEqual(scan_folder(self.export_folder), sorted(expected_exports))
-        if reuploaded and mode == "exports":
-            # In this mode, we know the sources are not required
-            # So the local folder is created, but empty
-            self.assertTrue(os.path.exists(self.export_sources_folder))
-        else:
-            self.assertFalse(os.path.exists(self.export_sources_folder))
+        self.assertFalse(os.path.exists(self.export_sources_folder))
 
     def _check_export_uploaded_folder(self, mode, export_folder=None, export_src_folder=None):
         if mode == "exports_sources":
diff --git a/conans/test/model/transitive_reqs_test.py b/conans/test/model/transitive_reqs_test.py
index 7780e2560..ee4560b7d 100644
--- a/conans/test/model/transitive_reqs_test.py
+++ b/conans/test/model/transitive_reqs_test.py
@@ -120,7 +120,7 @@ def _get_edges(graph):
 
 
 class MockRequireResolver(object):
-    def resolve(self, rquire, conanref):  # @UnusedVariable
+    def resolve(self, rquire, conanref, update):  # @UnusedVariable
         return
 
 
diff --git a/conans/test/model/version_ranges_test.py b/conans/test/model/version_ranges_test.py
index 919b29a8c..81dd6ff71 100644
--- a/conans/test/model/version_ranges_test.py
+++ b/conans/test/model/version_ranges_test.py
@@ -172,7 +172,7 @@ class VersionRangesTest(unittest.TestCase):
         self.loader = ConanFileLoader(None, Settings.loads(""), Profile())
         self.retriever = Retriever(self.loader, self.output)
         self.remote_search = MockSearchRemote()
-        self.resolver = RequireResolver(self.output, self.retriever, self.remote_search, update=False)
+        self.resolver = RequireResolver(self.output, self.retriever, self.remote_search)
         self.builder = DepsGraphBuilder(self.retriever, self.output, self.loader, self.resolver)
 
         for v in ["0.1", "0.2", "0.3", "1.1", "1.1.2", "1.2.1", "2.1", "2.2.1"]:
diff --git a/conans/test/server/service/service_test.py b/conans/test/server/service/service_test.py
index 52a06f4bd..a69af5301 100644
--- a/conans/test/server/service/service_test.py
+++ b/conans/test/server/service/service_test.py
@@ -15,7 +15,7 @@ from time import sleep
 from conans.model.manifest import FileTreeManifest
 from conans.test.utils.test_files import temp_folder
 from conans.server.store.disk_adapter import ServerDiskAdapter
-from conans.search.search import DiskSearchManager, DiskSearchAdapter
+from conans.search.search import DiskSearchManager
 
 
 class MockFileSaver(object):
@@ -91,8 +91,7 @@ class ConanServiceTest(unittest.TestCase):
         self.paths = SimplePaths(self.tmp_dir)
         self.file_manager = FileManager(self.paths, adapter)
 
-        search_adapter = DiskSearchAdapter()
-        self.search_manager = DiskSearchManager(self.paths, search_adapter)
+        self.search_manager = DiskSearchManager(self.paths)
 
         self.service = ConanService(authorizer, self.file_manager, "lasote")
         self.search_service = SearchService(authorizer, self.search_manager, "lasote")
diff --git a/conans/test/server/utils/server_launcher.py b/conans/test/server/utils/server_launcher.py
index 7cbe9ee2d..d503f027e 100644
--- a/conans/test/server/utils/server_launcher.py
+++ b/conans/test/server/utils/server_launcher.py
@@ -9,7 +9,7 @@ from conans.util.log import logger
 from conans.util.files import mkdir
 from conans.test.utils.test_files import temp_folder
 from conans.server.migrate import migrate_and_get_server_config
-from conans.search.search import DiskSearchAdapter, DiskSearchManager
+from conans.search.search import DiskSearchManager
 from conans.paths import SimplePaths
 import time
 import shutil
@@ -54,8 +54,7 @@ class TestServerLauncher(object):
         self.file_manager = get_file_manager(server_config, public_url=base_url,
                                              updown_auth_manager=updown_auth_manager)
 
-        search_adapter = DiskSearchAdapter()
-        self.search_manager = DiskSearchManager(SimplePaths(server_config.disk_storage_path), search_adapter)
+        self.search_manager = DiskSearchManager(SimplePaths(server_config.disk_storage_path))
         # Prepare some test users
         if not read_permissions:
             read_permissions = server_config.read_permissions
diff --git a/conans/test/util/tools_test.py b/conans/test/util/tools_test.py
index 78da180b2..f8bc63a4b 100644
--- a/conans/test/util/tools_test.py
+++ b/conans/test/util/tools_test.py
@@ -685,6 +685,126 @@ class MyConan(ConanFile):
         tools.download("https://httpbin.org/basic-auth/user/passwd", dest,
                        headers={"Authorization": "Basic dXNlcjpwYXNzd2Q="}, overwrite=True)
 
+    def get_gnu_triplet_test(self):
+        def get_values(this_os, this_arch, setting_os, setting_arch, compiler=None):
+            build = tools.get_gnu_triplet(this_os, this_arch, compiler)
+            host = tools.get_gnu_triplet(setting_os, setting_arch, compiler)
+            return build, host
+
+        build, host = get_values("Linux", "x86_64", "Linux", "armv7hf")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "arm-linux-gnueabihf")
+
+        build, host = get_values("Linux", "x86", "Linux", "armv7hf")
+        self.assertEquals(build, "x86-linux-gnu")
+        self.assertEquals(host, "arm-linux-gnueabihf")
+
+        build, host = get_values("Linux", "x86_64", "Linux", "x86")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "x86-linux-gnu")
+
+        build, host = get_values("Linux", "x86_64", "Windows", "x86", compiler="gcc")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "i686-w64-mingw32")
+
+        build, host = get_values("Linux", "x86_64", "Windows", "x86", compiler="Visual Studio")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "i686-windows-msvc")  # Not very common but exists sometimes
+
+        build, host = get_values("Linux", "x86_64", "Linux", "armv7hf")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "arm-linux-gnueabihf")
+
+        build, host = get_values("Linux", "x86_64", "Linux", "armv7")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "arm-linux-gnueabi")
+
+        build, host = get_values("Linux", "x86_64", "Linux", "armv6")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "arm-linux-gnueabi")
+
+        build, host = get_values("Linux", "x86_64", "Android", "x86")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "i686-linux-android")
+
+        build, host = get_values("Linux", "x86_64", "Android", "x86_64")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "x86_64-linux-android")
+
+        build, host = get_values("Linux", "x86_64", "Android", "armv7")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "arm-linux-androideabi")
+
+        build, host = get_values("Linux", "x86_64", "Android", "armv7hf")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "arm-linux-androideabi")
+
+        build, host = get_values("Linux", "x86_64", "Android", "armv8")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "aarch64-linux-android")
+
+        build, host = get_values("Linux", "x86_64", "Android", "armv6")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "arm-linux-androideabi")
+
+        build, host = get_values("Linux", "x86_64", "Windows", "x86", compiler="gcc")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "i686-w64-mingw32")
+
+        build, host = get_values("Linux", "x86_64", "Windows", "x86_64", compiler="gcc")
+        self.assertEquals(build, "x86_64-linux-gnu")
+        self.assertEquals(host, "x86_64-w64-mingw32")
+
+        build, host = get_values("Windows", "x86_64", "Windows", "x86", compiler="gcc")
+        self.assertEquals(build, "x86_64-w64-mingw32")
+        self.assertEquals(host, "i686-w64-mingw32")
+
+        build, host = get_values("Windows", "x86_64", "Linux", "armv7hf", compiler="gcc")
+        self.assertEquals(build, "x86_64-w64-mingw32")
+        self.assertEquals(host, "arm-linux-gnueabihf")
+
+        build, host = get_values("Darwin", "x86_64", "Android", "armv7hf")
+        self.assertEquals(build, "x86_64-apple-darwin")
+        self.assertEquals(host, "arm-linux-androideabi")
+
+        build, host = get_values("Darwin", "x86_64", "Macos", "x86")
+        self.assertEquals(build, "x86_64-apple-darwin")
+        self.assertEquals(host, "i686-apple-darwin")
+
+        build, host = get_values("Darwin", "x86_64", "iOS", "armv7")
+        self.assertEquals(build, "x86_64-apple-darwin")
+        self.assertEquals(host, "arm-apple-darwin")
+
+        build, host = get_values("Darwin", "x86_64", "watchOS", "armv7k")
+        self.assertEquals(build, "x86_64-apple-darwin")
+        self.assertEquals(host, "arm-apple-darwin")
+
+        build, host = get_values("Darwin", "x86_64", "tvOS", "armv8")
+        self.assertEquals(build, "x86_64-apple-darwin")
+        self.assertEquals(host, "aarch64-apple-darwin")
+
+        for os in ["Windows", "Linux"]:
+            for arch in ["x86_64", "x86"]:
+                triplet = tools.get_gnu_triplet(os, arch, "gcc")
+
+                output = ""
+                if arch == "x86_64":
+                    output += "x86_64"
+                else:
+                    output += "i686" if os != "Linux" else "x86"
+
+                output += "-"
+                if os == "Windows":
+                    output += "w64-mingw32"
+                else:
+                    output += "linux-gnu"
+
+                self.assertIn(output, triplet)
+
+        # Compiler not specified for os="Windows"
+        with self.assertRaises(ConanException):
+            tools.get_gnu_triplet("Windows", "x86")
+
     def detect_windows_subsystem_test(self):
         # Dont raise test
         result = tools.os_info.detect_windows_subsystem()
diff --git a/conans/test/utils/conanfile.py b/conans/test/utils/conanfile.py
index aa42e7c3e..409d10cb7 100644
--- a/conans/test/utils/conanfile.py
+++ b/conans/test/utils/conanfile.py
@@ -41,6 +41,8 @@ class MockConanfile(object):
         self.should_build = True
         self.should_install = True
 
+        self.package_folder = None
+
     def run(self, *args, **kwargs):
         if self.runner:
             kwargs["output"] = None