From a5e32f9224a9ad80b03f81b7877740ac59c16b46 Mon Sep 17 00:00:00 2001 From: antux18 Date: Wed, 7 Aug 2024 17:31:35 +0200 Subject: [PATCH] Added timestamp to each row of each analysis' result. Package changes analysis now specifies if a package source has no packages that changed. --- analysis/artifact_analysis.py | 5 +++++ analysis/buildstatus_analysis.py | 5 +++++ analysis/softenv_analysis.py | 17 +++++++++-------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/analysis/artifact_analysis.py b/analysis/artifact_analysis.py index f8b0b88..7964432 100755 --- a/analysis/artifact_analysis.py +++ b/analysis/artifact_analysis.py @@ -8,6 +8,7 @@ import argparse import csv import os +import datetime def artifact_changed(table, name): """ @@ -150,6 +151,10 @@ def main(): # Analyzing the inputs: output_dict = analysis(input_table) + # Adding the current time to every row: + now = datetime.datetime.now() + timestamp = str(datetime.datetime.timestamp(now)) + output_dict["timestamp"] = timestamp # Writing analysis to output file: output_file = open(output_path, "w+") diff --git a/analysis/buildstatus_analysis.py b/analysis/buildstatus_analysis.py index 901a678..f8e67a9 100755 --- a/analysis/buildstatus_analysis.py +++ b/analysis/buildstatus_analysis.py @@ -8,6 +8,7 @@ import argparse import csv import os +import datetime def analysis(input_table): """ @@ -83,6 +84,10 @@ def main(): # Analyzing the inputs: output_dict = analysis(input_table) + # Adding the current time to every row: + now = datetime.datetime.now() + timestamp = str(datetime.datetime.timestamp(now)) + output_dict["timestamp"] = timestamp # Writing analysis to output file: output_file = open(output_path, "w+") diff --git a/analysis/softenv_analysis.py b/analysis/softenv_analysis.py index a2c9230..fa04682 100755 --- a/analysis/softenv_analysis.py +++ b/analysis/softenv_analysis.py @@ -9,6 +9,7 @@ import argparse import csv import os +import datetime def sources_stats(input_table): """ @@ -105,19 +106,15 @@ def pkgs_changes(input_table): pkgname = row[0] # Package name is in the first column pkgsource = row[2] # Package source is in the 3rd column if (pkgname, pkgsource) not in checked_artifacts[artifact_name]: + if pkgsource not in pkgchanges_dict: + pkgchanges_dict[pkgsource] = 0 if pkg_changed(input_table, artifact_name, pkgname, pkgsource): - # Third column is the package source: - if row[2] not in pkgchanges_dict: - pkgchanges_dict[row[2]] = 1 - else: - pkgchanges_dict[row[2]] += 1 + pkgchanges_dict[pkgsource] += 1 checked_artifacts[artifact_name].append((pkgname, pkgsource)) return pkgchanges_dict def pkgs_per_container(input_table): - """ - """ - pass + print("ERROR: Not implemented!") def main(): # Command line arguments parsing: @@ -189,6 +186,10 @@ def main(): output_dict = pkgs_changes(input_table) elif analysis_type == "pkgs-per-container": output_dict = pkgs_per_container(input_table) + # Adding the current time to every row: + now = datetime.datetime.now() + timestamp = str(datetime.datetime.timestamp(now)) + output_dict["timestamp"] = timestamp # Writing analysis to output file: output_file = open(output_path, "w+")