MCPcopy Create free account
hub / github.com/apache/solr / verifyMavenDigests

Function verifyMavenDigests

dev-tools/scripts/smokeTestRelease.py:844–873  ·  view source on GitHub ↗
(artifacts)

Source from the content-addressed store, hash-verified

842
843
844def verifyMavenDigests(artifacts):
845 print(" verify Maven artifacts' md5/sha1 digests...")
846 reJarWarPom = re.compile(r'\.(?:[wj]ar|pom)$')
847 for artifactFile in [a for a in artifacts if reJarWarPom.search(a)]:
848 if artifactFile + '.md5' not in artifacts:
849 raise RuntimeError('missing: MD5 digest for %s' % artifactFile)
850 if artifactFile + '.sha1' not in artifacts:
851 raise RuntimeError('missing: SHA1 digest for %s' % artifactFile)
852 with open(artifactFile + '.md5', encoding='UTF-8') as md5File:
853 md5Expected = md5File.read().strip()
854 with open(artifactFile + '.sha1', encoding='UTF-8') as sha1File:
855 sha1Expected = sha1File.read().strip()
856 md5 = hashlib.md5()
857 sha1 = hashlib.sha1()
858 inputFile = open(artifactFile, 'rb')
859 while True:
860 bytes = inputFile.read(65536)
861 if len(bytes) == 0:
862 break
863 md5.update(bytes)
864 sha1.update(bytes)
865 inputFile.close()
866 md5Actual = md5.hexdigest()
867 sha1Actual = sha1.hexdigest()
868 if md5Actual != md5Expected:
869 raise RuntimeError('MD5 digest mismatch for %s: expected %s but got %s'
870 % (artifactFile, md5Expected, md5Actual))
871 if sha1Actual != sha1Expected:
872 raise RuntimeError('SHA1 digest mismatch for %s: expected %s but got %s'
873 % (artifactFile, sha1Expected, sha1Actual))
874
875
876def getPOMcoordinate(treeRoot):

Callers 1

checkMavenFunction · 0.85

Calls 5

stripMethod · 0.80
readMethod · 0.65
updateMethod · 0.65
closeMethod · 0.65
searchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…