update export_to_json and README

This commit is contained in:
Brendan McDevitt 2022-08-17 03:00:09 -05:00
parent d64681dce4
commit cf7ac4bb65
2 changed files with 9 additions and 6 deletions

View file

@ -27,8 +27,11 @@ grep ^Source /var/lib/apt/lists/*_Packages | awk ' {print $2}' | sort -u > sourc
# this works for me pulling the following: # this works for me pulling the following:
# ubuntu:latest, ubuntu:22.10, ubuntu:22.04, ubuntu:20.04 # ubuntu:latest, ubuntu:22.10, ubuntu:22.04, ubuntu:20.04
docker run ubuntu:latest /bin/bash -c "apt-get update && apt-get install lz4 && lz4cat /var/lib/apt/lists/*_Packages.lz4 | grep ^Source | cut -f 2 -d : | cut -f 2 -d ' ' | sort -u " # SEED INDIVIDUAL OS DATA TO FILE
``` docker run ubuntu:latest /bin/bash -c "apt-get update && apt-get install lz4 && lz4cat /var/lib/apt/lists/*_Packages.lz4 | grep ^Source | cut -f 2 -d : | cut -f 2 -d ' ' | sort -u " > ubuntu_latest_source_packages.container
# to seed all modern ubuntu from their containers run the provided shellscript
./source_package_names.sh
# it is grepping through information that is stored as follows. Below is an example from the package lvm2 # it is grepping through information that is stored as follows. Below is an example from the package lvm2

View file

@ -4,10 +4,10 @@
import json import json
from package_version_history import PackageVersionHistory as pvh from package_version_history import PackageVersionHistory as pvh
# start with just ubuntu 20.04 # start with just ubuntu 22.04
distro_version = '20.04' distro_version = '22.04'
source_pkgs_filepath = './package_data/source_packages_remote_ubuntu_2004.default' source_pkgs_filepath = './package_data/ubuntu_22.04_source_packages.container'
source_file = open(source_pkgs_filepath, 'r') source_file = open(source_pkgs_filepath, 'r')
lines = source_file.readlines() lines = source_file.readlines()
@ -27,5 +27,5 @@ json_obj = json.dumps(results)
json_arr = json.loads(json_obj) json_arr = json.loads(json_obj)
# write to a file # write to a file
with open('./version_history_data/ubuntu_2004_source_package_version_history.data', 'w') as outfile: with open('./version_history_data/ubuntu_latest_source_package_version_history.container', 'w') as outfile:
json.dump(json_arr, outfile, indent=4) json.dump(json_arr, outfile, indent=4)