Added timestamp to each row of each analysis' result. Package changes analysis now specifies if a package source has no packages that changed.

This commit is contained in:
antux18 2024-08-07 17:31:35 +02:00
parent 3d6b6d1ade
commit a5e32f9224
3 changed files with 19 additions and 8 deletions

View File

@ -8,6 +8,7 @@
import argparse import argparse
import csv import csv
import os import os
import datetime
def artifact_changed(table, name): def artifact_changed(table, name):
""" """
@ -150,6 +151,10 @@ def main():
# Analyzing the inputs: # Analyzing the inputs:
output_dict = analysis(input_table) 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: # Writing analysis to output file:
output_file = open(output_path, "w+") output_file = open(output_path, "w+")

View File

@ -8,6 +8,7 @@
import argparse import argparse
import csv import csv
import os import os
import datetime
def analysis(input_table): def analysis(input_table):
""" """
@ -83,6 +84,10 @@ def main():
# Analyzing the inputs: # Analyzing the inputs:
output_dict = analysis(input_table) 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: # Writing analysis to output file:
output_file = open(output_path, "w+") output_file = open(output_path, "w+")

View File

@ -9,6 +9,7 @@
import argparse import argparse
import csv import csv
import os import os
import datetime
def sources_stats(input_table): def sources_stats(input_table):
""" """
@ -105,19 +106,15 @@ def pkgs_changes(input_table):
pkgname = row[0] # Package name is in the first column pkgname = row[0] # Package name is in the first column
pkgsource = row[2] # Package source is in the 3rd column pkgsource = row[2] # Package source is in the 3rd column
if (pkgname, pkgsource) not in checked_artifacts[artifact_name]: 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): if pkg_changed(input_table, artifact_name, pkgname, pkgsource):
# Third column is the package source: pkgchanges_dict[pkgsource] += 1
if row[2] not in pkgchanges_dict:
pkgchanges_dict[row[2]] = 1
else:
pkgchanges_dict[row[2]] += 1
checked_artifacts[artifact_name].append((pkgname, pkgsource)) checked_artifacts[artifact_name].append((pkgname, pkgsource))
return pkgchanges_dict return pkgchanges_dict
def pkgs_per_container(input_table): def pkgs_per_container(input_table):
""" print("ERROR: Not implemented!")
"""
pass
def main(): def main():
# Command line arguments parsing: # Command line arguments parsing:
@ -189,6 +186,10 @@ def main():
output_dict = pkgs_changes(input_table) output_dict = pkgs_changes(input_table)
elif analysis_type == "pkgs-per-container": elif analysis_type == "pkgs-per-container":
output_dict = pkgs_per_container(input_table) 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: # Writing analysis to output file:
output_file = open(output_path, "w+") output_file = open(output_path, "w+")