commit:     236dc594e15792d1b53501b7595edd571993e03b
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  5 02:52:40 2018 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Mon Feb  5 02:52:40 2018 +0000
URL:        
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=236dc594

use perform_checksum for checksum on files

 pym/tbc/build_job.py   | 3 ++-
 pym/tbc/build_log.py   | 4 ++--
 pym/tbc/check_setup.py | 5 +++--
 pym/tbc/package.py     | 3 ++-
 pym/tbc/updatedb.py    | 3 ++-
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/pym/tbc/build_job.py b/pym/tbc/build_job.py
index d0d72c3..8d10a68 100644
--- a/pym/tbc/build_job.py
+++ b/pym/tbc/build_job.py
@@ -12,6 +12,7 @@ from portage import _encodings
 from portage import _unicode_decode
 from portage.versions import cpv_getkey
 from portage.dep import check_required_use
+from portage.checksum import perform_checksum
 from tbc.depclean import do_depclean
 from tbc.flags import tbc_use_flags
 from tbc.qachecks import check_file_in_manifest
@@ -34,7 +35,7 @@ class build_job_action(object):
                pkgdir = portdb.getRepositoryPath(repo) + "/" + cp
                build_use_flags_list = []
                try:
-                       ebuild_version_checksum_tree = 
portage.checksum.sha256hash(pkgdir + "/" + package + "-" + 
build_dict['ebuild_version'] + ".ebuild")[0]
+                       ebuild_version_checksum_tree = perform_checksum(pkgdir 
+ "/" + package + "-" + build_dict['ebuild_version'] + ".ebuild", "SHA256")[0]
                except:
                        ebuild_version_checksum_tree = None
                if ebuild_version_checksum_tree == build_dict['checksum']:

diff --git a/pym/tbc/build_log.py b/pym/tbc/build_log.py
index 762ebd4..e9e5dd0 100644
--- a/pym/tbc/build_log.py
+++ b/pym/tbc/build_log.py
@@ -14,7 +14,7 @@ from portage.util import writemsg, \
        writemsg_level, writemsg_stdout
 from portage import _encodings
 from portage import _unicode_encode
-
+from portage.checksum import perform_checksum
 from _emerge.main import parse_opts
 
 portage.proxy.lazyimport.lazyimport(globals(),
@@ -106,7 +106,7 @@ def get_build_dict_db(session, config_id, settings, 
tbc_settings_dict, pkg):
        else:
                build_dict['build_useflags'] = use_flagsDict
        pkgdir = myportdb.getRepositoryPath(repo) + "/" + categories + "/" + 
package
-       ebuild_version_checksum_tree = portage.checksum.sha256hash(pkgdir+ "/" 
+ package + "-" + ebuild_version + ".ebuild")[0]
+       ebuild_version_checksum_tree = perform_checksum(pkgdir+ "/" + package + 
"-" + ebuild_version + ".ebuild", "SHA256")[0]
        build_dict['checksum'] = ebuild_version_checksum_tree
        ebuild_id_list, status = get_ebuild_id_db(session, 
build_dict['checksum'], build_dict['package_id'], build_dict['ebuild_version'])
        if status:

diff --git a/pym/tbc/check_setup.py b/pym/tbc/check_setup.py
index a5f53e7..dcd7a0c 100644
--- a/pym/tbc/check_setup.py
+++ b/pym/tbc/check_setup.py
@@ -7,6 +7,7 @@ import os
 import errno
 
 from portage.exception import DigestException, FileNotFound, ParseError, 
PermissionDenied
+from portage.checksum import perform_checksum
 from tbc.text import get_file_text
 from tbc.sqlquerys import get_config_all_info, add_logs, 
get_configmetadata_info, get_setup_info
 from tbc.sync import git_pull
@@ -29,7 +30,7 @@ def check_make_conf(session, config_id):
                # Check if we have some error in the file. 
(portage.util.getconfig)
                # Check if we envorment error with the config. 
(settings.validate)
                try:
-                       make_conf_checksum_tree = 
portage.checksum.sha256hash(make_conf_file)[0]
+                       make_conf_checksum_tree = 
perform_checksum(make_conf_file, "SHA256")[0]
                        portage.util.getconfig(make_conf_file, tolerant=0, 
allow_sourcing=True, expand=True)
                        mysettings = portage.config(config_root = 
check_config_dir)
                        mysettings.validate()
@@ -61,7 +62,7 @@ def check_configure_guest(session, config_id):
        # Check if we have some error in the file (portage.util.getconfig)
        # Check if we envorment error with the config (settings.validate)
        try:
-               make_conf_checksum_tree = 
portage.checksum.sha256hash(make_conf_file)[0]
+               make_conf_checksum_tree = perform_checksum(make_conf_file, 
"SHA256")[0]
                portage.util.getconfig(make_conf_file, tolerant=0, 
allow_sourcing=True, expand=True)
                mysettings = portage.config(config_root = "/")
                mysettings.validate()

diff --git a/pym/tbc/package.py b/pym/tbc/package.py
index 721f9b1..84e3907 100644
--- a/pym/tbc/package.py
+++ b/pym/tbc/package.py
@@ -9,6 +9,7 @@ import git
 import portage
 import datetime
 from portage.xml.metadata import MetaDataXML
+from portage.checksum import perform_checksum
 from tbc.flags import tbc_use_flags
 from tbc.text import get_ebuild_cvs_revision, get_log_text_dict
 from tbc.flags import tbc_use_flags
@@ -111,7 +112,7 @@ class tbc_package(object):
                ebuild_file = pkgdir + "/" + package + "-" + 
ebuild_version_tree + ".ebuild"
                # Make a checksum of the ebuild
                try:
-                       ebuild_version_checksum_tree = 
portage.checksum.sha256hash(ebuild_file)[0]
+                       ebuild_version_checksum_tree = 
perform_checksum(ebuild_file, "SHA256")[0]
                except:
                        ebuild_version_checksum_tree = "0"
                        log_msg = "QA: Can't checksum the ebuild file. %s on 
repo %s" % (cpv, repo,)

diff --git a/pym/tbc/updatedb.py b/pym/tbc/updatedb.py
index 437cfd5..d32f0ac 100644
--- a/pym/tbc/updatedb.py
+++ b/pym/tbc/updatedb.py
@@ -9,6 +9,7 @@ import time
 import re
 import portage
 from portage.xml.metadata import MetaDataXML
+from portage.checksum import perform_checksum
 from sqlalchemy.orm import scoped_session, sessionmaker
 from tbc.ConnectionManager import NewConnection
 from tbc.sqlquerys import get_package_info, update_repo_db, \
@@ -46,7 +47,7 @@ def get_categories_metadataDict(pkgdir):
                pkg_md = MetaDataXML(pkgdir + "/metadata.xml", None)
                metadata_xml_descriptions_tree = re.sub('\t', '', 
pkg_md.descriptions()[0])
                categories_metadataDict['metadata_xml_descriptions'] = 
re.sub('\n', '', metadata_xml_descriptions_tree)
-               categories_metadataDict['metadata_xml_checksum'] =  
portage.checksum.sha256hash(pkgdir + "/metadata.xml")[0]
+               categories_metadataDict['metadata_xml_checksum'] =  
perform_checksum(pkgdir + "/metadata.xml", "SHA256")[0]
                return categories_metadataDict
 
 def update_cpv_db_pool(mysettings, myportdb, cp, repo, tbc_settings, 
config_id):

Reply via email to