commit:     118df436abd49eecfeaf95df8a052861d463a896
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 30 10:57:12 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 31 13:33:04 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=118df436

Report a warning when unaccelerated Whirlpool is being used

The warning serves two purposes: it informs the user that they should
expect very slow hashing (i.e. Portage did not hang) and that they
should inform the repository owner about the problem. Far from ideal
but probably good enough given how rare Whirlpool-only ebuilds are.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Closes: https://github.com/gentoo/portage/pull/967
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/util/whirlpool.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/portage/util/whirlpool.py b/lib/portage/util/whirlpool.py
index 8454a874a..d26780604 100644
--- a/lib/portage/util/whirlpool.py
+++ b/lib/portage/util/whirlpool.py
@@ -30,6 +30,10 @@
 
 # pylint: disable=mixed-indentation
 
+import warnings
+
+from portage.localization import _
+
 try:
     from ._whirlpool import Whirlpool as WhirlpoolExt
 except ImportError:
@@ -47,6 +51,13 @@ class PyWhirlpool:
     hashed."""
 
     def __init__(self, arg=b""):
+        warnings.warn(
+            _(
+                "The last-resort unaccelerated Whirlpool implementation is "
+                "being used. It is known to be absurdly slow. Please report "
+                "that the Whirlpool hash is deprecated to the repository 
owner."
+            )
+        )
         self.ctx = WhirlpoolStruct()
         self.update(arg)
 

Reply via email to