diff --git a/check_out_of_date.py b/check_out_of_date.py deleted file mode 100755 index 91785525ba..0000000000 --- a/check_out_of_date.py +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/python2 -# TODO: This script needs porting to python3, since portage is also in python3 now. - -# Prints out a list of all packages in portage-stable and how they stand relative to gentoo upstream - -import argparse -import json -import os -import subprocess -import sys - -import portage.versions - - -def split_package(p): - # split into cat/package,ver-rev - split = portage.versions.catpkgsplit(p.strip()) - return (split[0] + "/" + split[1], split[2] + "-" + split[3]) - - -def build_pkg_map(pkgs): - pkgs = map(split_package, pkgs) - package_map = dict() - for pkg, ver in pkgs: - if pkg not in package_map: - package_map[pkg] = [ver] - else: - package_map[pkg].append(ver) - return package_map - - -def exec_command_strict(cmd): - """ Wraps check_output splitting the input and string'ing the output""" - return bytes.decode(subprocess.check_output(cmd.split())) - - -def exec_command(cmd): - """ Like exec_command_strict but returns the output even if the command exited unsuccessfully""" - try: - return exec_command_strict(cmd) - except subprocess.CalledProcessError as e: - return bytes.decode(e.output) - - -def get_portage_tree_packages(tree_path): - """ returns a list of all packages in a portage tree/overlay in the form of cat/pkg-ver""" - pkgs = exec_command_strict("find -L {} -maxdepth 3 -type f -name *.ebuild -not -name skel.ebuild -printf %P\\n".format(tree_path)) - - def process_line(line): - # cat/pkg/pkg-ver.ebuild -> cat/pkg-ver - chunks = line.split("/") - end = chunks[2].replace(".ebuild", "") - return chunks[0] + "/" + end - return build_pkg_map(map(process_line, pkgs.splitlines())) - - -def process_emerge_output(eout): - """ transform from emerge --unordered-dispaly to cat/pkg-ver""" - def process_line(line): - return line.strip().split("] ")[1].split(":")[0] - - def is_package(line): - # none of the header line have a / - return "/" in line - - return map(process_line, filter(is_package, eout.splitlines())) - - -def get_board_packages(board): - """ gets a list of packages used by a board. valid boards are {arm,amd}64-usr, sdk, and bootstrap""" - emerge_args = "--emptytree --pretend --verbose --unordered-display" - if board == "sdk": - cmd = "emerge {} @system sdk-depends sdk-extras".format(emerge_args) - elif board == "amd64-usr" or board == "arm64-usr": - cmd = "emerge-{} {} @system board-packages".format(board, emerge_args) - elif board == "bootstrap": - pkgs = exec_command_strict("/usr/lib64/catalyst/targets/stage1/build.py") - cmd = "emerge {} {}".format(emerge_args, pkgs) - elif board == "image": - cmd = "emerge-amd64-usr {} --usepkgonly board-packages".format(emerge_args) - else: - raise "invalid board" - return build_pkg_map(process_emerge_output(exec_command(cmd))) - - -def print_table(report, head, line_head, line_tail, tail, joiner, pkg_joiner): - print(head) - # metapackage that acts as the header - report.insert(0, {"name": "Package", - "common": ["Common"], - "ours": ["Ours"], - "upstream": ["Upstream"], - "tag": "Tag", - "sdk": ["sdk"], - "arm64-usr": ["arm64-usr"], - "amd64-usr": ["amd64-usr"], - "bootstrap": ["bootstrap"], - "modified": "Modified"}) - for entry in report: - print(line_head + joiner.join([entry.get("name",""), - pkg_joiner.join(entry.get("common",[])), - pkg_joiner.join(entry.get("ours",[])), - pkg_joiner.join(entry.get("upstream",[])), - entry.get("tag",""), - pkg_joiner.join(entry.get("sdk", [])), - pkg_joiner.join(entry.get("arm64-usr", [])), - pkg_joiner.join(entry.get("amd64-usr", [])), - pkg_joiner.join(entry.get("bootstrap", [])), - entry.get("modified","")]) + line_tail) - print(tail) - - -def print_table_human(report): - print_table(report, "", "", "", "", "\t", " ") - - -def print_html_table(report): - print_table(report, "
", " |