comps-sync.py: cosmetic changes for clearer result output

This commit is contained in:
Timothée Ravier 2019-04-07 12:29:21 +02:00
parent 09669b418d
commit af221374f2

View file

@ -36,7 +36,7 @@ parser.add_argument("src", help="Source path")
args = parser.parse_args() args = parser.parse_args()
print("Syncing packages common to all ostree based desktop versions:") print("Syncing packages common to all desktops:")
base_pkgs_path = 'fedora-common-ostree-pkgs.yaml' base_pkgs_path = 'fedora-common-ostree-pkgs.yaml'
with open(base_pkgs_path) as f: with open(base_pkgs_path) as f:
@ -100,11 +100,11 @@ for pkg in manifest_packages:
# Look for packages in the manifest but not in comps at all # Look for packages in the manifest but not in comps at all
n_manifest_new = len(comps_unknown) n_manifest_new = len(comps_unknown)
if n_manifest_new == 0: if n_manifest_new == 0:
print("All manifest packages are already listed in comps.") print(" - All manifest packages are already listed in comps.")
else: else:
print("{} packages not in {}:".format(n_manifest_new, ws_env_name)) print(" - {} packages not in {}:".format(n_manifest_new, ws_env_name))
for pkg in sorted(comps_unknown): for pkg in sorted(comps_unknown):
print(' ' + pkg) print(' {}'.format(pkg))
manifest_packages.remove(pkg) manifest_packages.remove(pkg)
# Look for packages in workstation but not in the manifest # Look for packages in workstation but not in the manifest
@ -116,12 +116,12 @@ for (pkg,data) in ws_pkgs.items():
n_comps_new = len(ws_added) n_comps_new = len(ws_added)
if n_comps_new == 0: if n_comps_new == 0:
print("All comps packages are already listed in manifest.") print(" - All comps packages are already listed in manifest.")
else: else:
print("{} packages not in manifest:".format(n_comps_new)) print(" - {} packages not in manifest:".format(n_comps_new))
for pkg in sorted(ws_added): for pkg in sorted(ws_added):
(req, groups) = ws_added[pkg] (req, groups) = ws_added[pkg]
print(' {} ({}, groups: {})'.format(pkg, format_pkgtype(req), ', '.join(groups))) print(' {} ({}, groups: {})'.format(pkg, format_pkgtype(req), ', '.join(groups)))
if (n_manifest_new > 0 or n_comps_new > 0) and args.save: if (n_manifest_new > 0 or n_comps_new > 0) and args.save:
write_manifest(base_pkgs_path, manifest_packages) write_manifest(base_pkgs_path, manifest_packages)
@ -129,7 +129,7 @@ if (n_manifest_new > 0 or n_comps_new > 0) and args.save:
# Generate treefiles for all desktops # Generate treefiles for all desktops
for desktop in [ 'gnome-desktop', 'kde-desktop', 'xfce-desktop', 'lxqt-desktop' ]: for desktop in [ 'gnome-desktop', 'kde-desktop', 'xfce-desktop', 'lxqt-desktop' ]:
print() print()
print("Syncing packages for {} specific version:".format(desktop)) print("Syncing packages for {}:".format(desktop))
manifest_path = '{}-pkgs.yaml'.format(desktop) manifest_path = '{}-pkgs.yaml'.format(desktop)
with open(manifest_path) as f: with open(manifest_path) as f:
@ -158,11 +158,11 @@ for desktop in [ 'gnome-desktop', 'kde-desktop', 'xfce-desktop', 'lxqt-desktop'
# Look for packages in the manifest but not in comps at all # Look for packages in the manifest but not in comps at all
n_manifest_new = len(comps_unknown) n_manifest_new = len(comps_unknown)
if n_manifest_new == 0: if n_manifest_new == 0:
print("All manifest packages are already listed in comps.") print(" - All manifest packages are already listed in comps.")
else: else:
print("{} packages not in {}:".format(n_manifest_new, ws_ostree_name)) print(" - {} packages not in {} comps group:".format(n_manifest_new, ws_ostree_name))
for pkg in sorted(comps_unknown): for pkg in sorted(comps_unknown):
print(' ' + pkg) print(' {}'.format(pkg))
manifest_packages.remove(pkg) manifest_packages.remove(pkg)
# Look for packages in comps but not in the manifest # Look for packages in comps but not in the manifest
@ -174,11 +174,11 @@ for desktop in [ 'gnome-desktop', 'kde-desktop', 'xfce-desktop', 'lxqt-desktop'
n_comps_new = len(ws_added) n_comps_new = len(ws_added)
if n_comps_new == 0: if n_comps_new == 0:
print("All comps packages are already listed in manifest.") print(" - All comps packages are already listed in manifest.")
else: else:
print("{} packages not in manifest:".format(n_comps_new)) print(" - {} packages not in {} manifest:".format(n_comps_new, ws_ostree_name))
for pkg in sorted(ws_added): for pkg in sorted(ws_added):
print(' {}'.format(pkg)) print(' {}'.format(pkg))
if (n_manifest_new > 0 or n_comps_new > 0) and args.save: if (n_manifest_new > 0 or n_comps_new > 0) and args.save:
write_manifest(manifest_path, manifest_packages, include="fedora-common-ostree.yaml") write_manifest(manifest_path, manifest_packages, include="fedora-common-ostree.yaml")