This will rebuild all project if project.py changes. Not the best
solution but is good enough to prevent corruption.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
apps_gen_events_folder = os.path.join(apps_folder, "gen_ust_events")
apps_preload_provider_folder = os.path.join(apps_folder, "preload_provider")
apps_gen_events_folder = os.path.join(apps_folder, "gen_ust_events")
apps_preload_provider_folder = os.path.join(apps_folder, "preload_provider")
+# Used for checksum validation
+project_py_file_location = os.path.join(base_dir, "utils/project.py")
+
tmp_object_prefix = "lttng-ivc-"
default_babeltrace = "babeltrace-1.5"
tmp_object_prefix = "lttng-ivc-"
default_babeltrace = "babeltrace-1.5"
import lttng_ivc.utils.project as Project
import lttng_ivc.settings as Settings
import lttng_ivc.utils.project as Project
import lttng_ivc.settings as Settings
+from lttng_ivc.utils.utils import sha256_checksum
_logger = logging.getLogger('project.factory')
_project_constructor = {
_logger = logging.getLogger('project.factory')
_project_constructor = {
+_project_py_checksum = sha256_checksum(Settings.project_py_file_location)
+
_markers = None
with open(Settings.run_configuration_file, 'r') as stream:
# This is voluntary static across calls, no need to perform this
_markers = None
with open(Settings.run_configuration_file, 'r') as stream:
# This is voluntary static across calls, no need to perform this
def _validate_pickle(pickle, label):
_logger.debug("Checking validate for {} {}".format(pickle,
def _validate_pickle(pickle, label):
_logger.debug("Checking validate for {} {}".format(pickle,
+ label))
+ if pickle._py_file_checksum != _project_py_checksum:
+ _logger.warn("Project py file changed".format(pickle.label,
+ label))
+ return False
+
if pickle.label != label:
_logger.warn("Label {} and {} are not the same".format(pickle.label,
if pickle.label != label:
_logger.warn("Label {} and {} are not the same".format(pickle.label,
return False
if pickle.sha1 != _markers[label]['sha1']:
_logger.warn("Sha1 {} and {} are not the same".format(pickle.sha1,
return False
if pickle.sha1 != _markers[label]['sha1']:
_logger.warn("Sha1 {} and {} are not the same".format(pickle.sha1,
import git
import subprocess
import logging
import git
import subprocess
import logging
+import lttng_ivc.settings as Settings
+
+from lttng_ivc.utils.utils import sha256_checksum
_logger = logging.getLogger('project')
_logger = logging.getLogger('project')
""" A collection of Project dependencies """
self.dependencies = {}
""" A collection of Project dependencies """
self.dependencies = {}
+ # used for project cache and pickle validation
+ self._py_file_checksum = sha256_checksum(Settings.project_py_file_location)
# State
self.isBuilt = False
# State
self.isBuilt = False
def line_count(file_path):
line_count = 0
def line_count(file_path):
line_count = 0
+def sha256_checksum(filename, block_size=65536):
+ sha256 = hashlib.sha256()
+ with open(filename, 'rb') as f:
+ for block in iter(lambda: f.read(block_size), b''):
+ sha256.update(block)
+ return sha256.hexdigest()
+
+
def __dummy_sigusr1_handler():
pass
def __dummy_sigusr1_handler():
pass