Repository: conan-io/conan

Issue:
conan updates all my software installed with yum
Hi,

my system:
CentOs7, conan 1.16.0, packet manager yum

```python
installer = SystemPackageTool()
installer.update()
```
The above code will instuct conan to update ALL installed packets in the system. It was introduced here: https://github.com/conan-io/conan/pull/3181

This contradicts with the docu that states:

> update(): Updates the system package manager database. It’s called automatically from the install() method by default.

This would be achieved with `yum check-update` instead of `yum update`.
In my opinion conan should not touch any installed packets, unless expicitly instructed to do so. So I would like to see the old behavior back, like it is discribed in the docu.

Cheers


Discussion:
Indeed it's an unfortunate default. You can change the behaviour for sysrequirements with a config variable `sysrequires_mode`:
https://docs.conan.io/en/latest/reference/config_files/conan.conf.html#conan-conf
Maybe Conan should change the default in order to not break the userspace? 
Indeed it's a bug I think. For APT, SystemPackageTool uses `apt update` which means update only the local cache, but doesn't upgrade any package.

Resolving patch:
diff --git a/conans/client/tools/system_pm.py b/conans/client/tools/system_pm.py
--- a/conans/client/tools/system_pm.py
+++ b/conans/client/tools/system_pm.py
@@ -185,7 +185,7 @@ def add_repository(self, repository, repo_key=None):
         raise ConanException("YumTool::add_repository not implemented")
 
     def update(self):
-        _run(self._runner, "%syum update -y" % self._sudo_str, accepted_returns=[0, 100],
+        _run(self._runner, "%syum check-update -y" % self._sudo_str, accepted_returns=[0, 100],
              output=self._output)
 
     def install(self, package_name):


Test patch:
diff --git a/conans/test/unittests/client/tools/system_pm_test.py b/conans/test/unittests/client/tools/system_pm_test.py
--- a/conans/test/unittests/client/tools/system_pm_test.py
+++ b/conans/test/unittests/client/tools/system_pm_test.py
@@ -152,7 +152,7 @@ def system_package_tool_test(self):
             os_info.linux_distro = "fedora"
             spt = SystemPackageTool(runner=runner, os_info=os_info, output=self.out)
             spt.update()
-            self.assertEqual(runner.command_called, "sudo -A yum update -y")
+            self.assertEqual(runner.command_called, "sudo -A yum check-update -y")
 
             os_info.linux_distro = "opensuse"
             spt = SystemPackageTool(runner=runner, os_info=os_info, output=self.out)
@@ -224,7 +224,7 @@ def system_package_tool_test(self):
             spt.install("a_package", force=True)
             self.assertEqual(runner.command_called, "yum install -y a_package")
             spt.update()
-            self.assertEqual(runner.command_called, "yum update -y")
+            self.assertEqual(runner.command_called, "yum check-update -y")
 
             os_info.linux_distro = "ubuntu"
             spt = SystemPackageTool(runner=runner, os_info=os_info, output=self.out)
@@ -414,7 +414,7 @@ def get_linux_error_message():
             if os_info.with_apt:
                 update_command = "sudo -A apt-get update"
             elif os_info.with_yum:
-                update_command = "sudo -A yum update -y"
+                update_command = "sudo -A yum check-update -y"
             elif os_info.with_zypper:
                 update_command = "sudo -A zypper --non-interactive ref"
             elif os_info.with_pacman: