pmbootstrap status: print checked out git repos (!1882)

Related: #1829
This commit is contained in:
Oliver Smith 2020-02-10 19:59:07 +01:00 committed by Alexey Min
parent 6877532f5d
commit 1358424703
No known key found for this signature in database
GPG key ID: 0B19D2A65870B448

View file

@ -1,14 +1,16 @@
# Copyright 2020 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
import os
import logging
import pmb.config
import pmb.config.workdir
import pmb.helpers.git
def print_config(args):
""" Print an overview of what was set in "pmbootstrap init". """
logging.info("*** CONFIG ***")
info = args.deviceinfo
logging.info("Device: {} ({}, \"{}\")"
.format(args.device, info["arch"], info["name"]))
@ -22,6 +24,23 @@ def print_config(args):
logging.info("User Interface: {}".format(args.ui))
def print_git_repos(args):
logging.info("*** GIT REPOS ***")
logging.info("Path: {}/cache_git".format(args.work))
for repo in pmb.config.git_repos.keys():
path = pmb.helpers.git.get_path(args, repo)
if not os.path.exists(path):
continue
# Get branch name (if on branch) or current commit
ref = pmb.helpers.git.rev_parse(args, path,
extra_args=["--abbrev-ref"])
if ref == "HEAD":
ref = pmb.helpers.git.rev_parse(args, path)[0:8]
logging.info("- {} ({})".format(repo, ref))
def print_checks_chroots_outdated(args, details):
""" Check if chroots were zapped recently.
:param details: if True, print each passing check instead of a summary
@ -62,6 +81,8 @@ def print_status(args, details=False):
:returns: True if all checks passed, False otherwise """
print_config(args)
logging.info("")
print_git_repos(args)
logging.info("")
ret = print_checks(args, details)
return ret