File: remove_version_check.patch

package info (click to toggle)
ansible-lint 25.6.1%2Breally25.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,628 kB
  • sloc: python: 18,973; sh: 66; makefile: 7
file content (82 lines) | stat: -rw-r--r-- 2,912 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From: Samuel Henrique <samueloph@debian.org>
Date: Sun, 6 Apr 2025 15:10:41 +0100
Subject: Remove version check at runtime

Forwarded: not-needed
---
 src/ansiblelint/config.py | 55 ++---------------------------------------------
 test/test_main.py         |  2 +-
 2 files changed, 3 insertions(+), 54 deletions(-)

--- a/src/ansiblelint/config.py
+++ b/src/ansiblelint/config.py
@@ -282,56 +282,5 @@
 
 
 def get_version_warning() -> str:
-    """Display warning if current version is outdated."""
-    # 0.1dev1 is special fallback version
-    if __version__ == "0.1.dev1":  # pragma: no cover
-        return ""
-    pip = guess_install_method()
-    # If we do not know how to upgrade, we do not want to show any warnings
-    # about version.
-    if not pip:
-        return ""
-
-    msg = ""
-    data = {}
-    current_version = Version(__version__)
-
-    if not os.path.exists(CACHE_DIR):  # pragma: no cover
-        os.makedirs(CACHE_DIR)
-    cache_file = f"{CACHE_DIR}/latest.json"
-    refresh = True
-    if os.path.exists(cache_file):
-        age = time.time() - os.path.getmtime(cache_file)
-        if age < 24 * 60 * 60:
-            refresh = False
-        with open(cache_file, encoding="utf-8") as f:
-            data = json.load(f)
-
-    if not options.offline and (refresh or not data):
-        release_url = (
-            "https://api.github.com/repos/ansible/ansible-lint/releases/latest"
-        )
-        try:
-            with urllib.request.urlopen(release_url) as url:  # noqa: S310
-                data = json.load(url)
-                with open(cache_file, "w", encoding="utf-8") as f:
-                    json.dump(data, f)
-        except (URLError, HTTPError, HTTPException) as exc:  # pragma: no cover
-            _logger.debug(
-                "Unable to fetch latest version from %s due to: %s",
-                release_url,
-                exc,
-            )
-            return ""
-
-    if data:
-        html_url = data["html_url"]
-        new_version = Version(data["tag_name"][1:])  # removing v prefix from tag
-
-        if current_version > new_version:
-            msg = "[dim]You are using a pre-release version of ansible-lint.[/]"
-        elif current_version < new_version:
-            msg = f"""[warning]A new release of ansible-lint is available: [warning]{current_version}[/] → [success][link={html_url}]{new_version}[/link][/][/]"""
-            msg += f" Upgrade by running: [info]{pip}[/]"
-
-    return msg
+    """Patched on Debian to not download release information from third parties"""
+    return ""
--- a/test/test_main.py
+++ b/test/test_main.py
@@ -60,7 +60,7 @@
     warning_found = "PATH altered to include" in proc.stderr
     assert warning_found is in_path
 
-
+@pytest.mark.skip(reason="This functionality is disabled on Debian")
 @pytest.mark.parametrize(
     ("ver_diff", "found", "check", "outlen"),
     (