Skip to contentSkip to conversation

scripts: Allow sha512 in clean_functional_cache.py, too

PATCH In review Thomas Huth 2 participants 4 messages Jan 20

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: Allow sha512 in clean_functional_cache.py, too

From: Thomas Huth <[email protected]>

The functional testing frameworks also supports assets that are identified by their sha512 checksum (instead of only using sha25), and at least one of the tests (tests/functional/ppc64/test_fadump.py) is already using such a checksum, so adjust the clean_functional_cache script to support these checksums, too.

---
 scripts/clean_functional_cache.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/clean_functional_cache.py +2 -2
index c3370ffbb87..f0342b4b438 100755
@@ -24,8 +24,8 @@
 os.chdir(cache_dir)
 
 for file in cache_dir.iterdir():
-    # Only consider the files that use a sha256 as filename:
-    if len(file.name) != 64:
+    # Only consider the files that use a sha256 or sha512 as filename:
+    if len(file.name) != 64 and len(file.name) != 128:
         continue
 
     try:
Signature · 1 line
2.52.0
#1 lore raw
Quoted 7 lines · Thomas Huth

From: Thomas Huth <[email protected]>

The functional testing frameworks also supports assets that are identified by their sha512 checksum (instead of only using sha25), and at least one of the tests (tests/functional/ppc64/test_fadump.py) is already using such a checksum, so adjust the clean_functional_cache script to support these checksums, too.

I wrote this code to match what we had in Avocado, but now I'm really struggling to justify why we should choose different checksum algorithms per asset. With only 1 test diverging from sha256, I'd rather we just dropped sha512 support

Quoted 24 lines
---
 scripts/clean_functional_cache.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/clean_functional_cache.py +2 -2
index c3370ffbb87..f0342b4b438 100755
@@ -24,8 +24,8 @@
 os.chdir(cache_dir)
 
 for file in cache_dir.iterdir():
-    # Only consider the files that use a sha256 as filename:
-    if len(file.name) != 64:
+    # Only consider the files that use a sha256 or sha512 as filename:
+    if len(file.name) != 64 and len(file.name) != 128:
         continue
 
     try:
Signature · 1 line
2.52.0

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
Quoted 9 lines · Daniel P. Berrangé
Quoted 7 lines · Thomas Huth

From: Thomas Huth <[email protected]>

The functional testing frameworks also supports assets that are identified by their sha512 checksum (instead of only using sha25), and at least one of the tests (tests/functional/ppc64/test_fadump.py) is already using such a checksum, so adjust the clean_functional_cache script to support these checksums, too.

Quoted 4 lines

I wrote this code to match what we had in Avocado, but now I'm really struggling to justify why we should choose different checksum algorithms per asset. With only 1 test diverging from sha256, I'd rather we just dropped sha512 support

Fine for me, too ... could you suggest a patch, or want me to do it?

Thomas

#3 lore raw
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Daniel P. Berrangé
Quoted 7 lines · Thomas Huth

From: Thomas Huth <[email protected]>

The functional testing frameworks also supports assets that are identified by their sha512 checksum (instead of only using sha25), and at least one of the tests (tests/functional/ppc64/test_fadump.py) is already using such a checksum, so adjust the clean_functional_cache script to support these checksums, too.

Quoted 6 lines
Quoted 4 lines

I wrote this code to match what we had in Avocado, but now I'm really struggling to justify why we should choose different checksum algorithms per asset. With only 1 test diverging from sha256, I'd rather we just dropped sha512 support

Fine for me, too ... could you suggest a patch, or want me to do it?

I'll let you do it

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|