Removed files that don't make sense anymore. Added tool that takes in a distro yaml file and shows its pips and pkgs.
This commit is contained in:
parent
f43dc6df30
commit
3040ade589
@ -1,40 +0,0 @@
|
|||||||
import objgraph
|
|
||||||
import inspect
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir))
|
|
||||||
sys.path.insert(0, possible_topdir)
|
|
||||||
|
|
||||||
from devstack import settings
|
|
||||||
from devstack.progs import common
|
|
||||||
|
|
||||||
|
|
||||||
distro = settings.RHEL6
|
|
||||||
comps = common.get_default_components()
|
|
||||||
|
|
||||||
|
|
||||||
def filter_c(c):
|
|
||||||
if not inspect.isclass(c):
|
|
||||||
return False
|
|
||||||
if c is object:
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
actions = settings.ACTIONS
|
|
||||||
for action in actions:
|
|
||||||
klss = list()
|
|
||||||
|
|
||||||
for c in comps.keys():
|
|
||||||
kls = common.get_action_cls(action, c, distro)
|
|
||||||
klss.append(kls)
|
|
||||||
|
|
||||||
max_depth = 5
|
|
||||||
fn = "%s.png" % (action)
|
|
||||||
objgraph.show_refs(klss,
|
|
||||||
filename=fn,
|
|
||||||
max_depth=max_depth,
|
|
||||||
highlight=inspect.isclass,
|
|
||||||
filter=filter_c,
|
|
||||||
extra_ignore=[id(locals())])
|
|
72
tools/list_distro.py
Executable file
72
tools/list_distro.py
Executable file
@ -0,0 +1,72 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import distutils.version
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
from termcolor import cprint, colored
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
def find_all(mp, key, accum):
|
||||||
|
if type(mp) is dict:
|
||||||
|
if key in mp:
|
||||||
|
value = mp[key]
|
||||||
|
if type(value) is list:
|
||||||
|
for v in value:
|
||||||
|
accum.append(v)
|
||||||
|
else:
|
||||||
|
for (k, v) in mp.items():
|
||||||
|
find_all(v, key, accum)
|
||||||
|
|
||||||
|
|
||||||
|
def print_versions(items):
|
||||||
|
names = set([p['name'] for p in items])
|
||||||
|
for n in sorted(names):
|
||||||
|
versions_found = list()
|
||||||
|
for p in items:
|
||||||
|
if p['name'] == n:
|
||||||
|
version = p.get('version')
|
||||||
|
if version:
|
||||||
|
version = str(version)
|
||||||
|
version = version.replace("*", "0")
|
||||||
|
versions_found.append(distutils.version.LooseVersion(version))
|
||||||
|
highest_version = "??"
|
||||||
|
if versions_found:
|
||||||
|
versions_found.sort()
|
||||||
|
highest_version = "%s" % (versions_found[-1])
|
||||||
|
print("|")
|
||||||
|
print("|--%s (%s)" % (colored(n, 'blue'), colored(highest_version, 'yellow')))
|
||||||
|
metas = dict()
|
||||||
|
for p in items:
|
||||||
|
if p['name'] == n:
|
||||||
|
meta = p.get('meta')
|
||||||
|
if meta:
|
||||||
|
for (k, v) in meta.items():
|
||||||
|
metas[k] = v
|
||||||
|
if metas:
|
||||||
|
for (k, v) in metas.items():
|
||||||
|
print("|")
|
||||||
|
print("|---- %s => %s" % (colored(k, 'blue'), colored(str(v), 'yellow')))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
me = os.path.basename(sys.argv[0])
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print("%s distro" % (me))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
distro_fn = sys.argv[1]
|
||||||
|
data = None
|
||||||
|
with open(distro_fn, 'r') as fh:
|
||||||
|
data = yaml.load(fh.read())
|
||||||
|
pips = list()
|
||||||
|
find_all(data, 'pips', pips)
|
||||||
|
pkgs = list()
|
||||||
|
find_all(data, 'packages', pkgs)
|
||||||
|
cprint("<PIPS>", 'green')
|
||||||
|
print_versions(pips)
|
||||||
|
print("")
|
||||||
|
cprint("<PKGS>", 'green')
|
||||||
|
print_versions(pkgs)
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir))
|
|
||||||
sys.path.insert(0, possible_topdir)
|
|
||||||
|
|
||||||
from devstack import utils
|
|
||||||
from devstack import settings
|
|
||||||
from devstack import component
|
|
||||||
from devstack.progs import common
|
|
||||||
|
|
||||||
EPEL_DISTRO = settings.RHEL6
|
|
||||||
|
|
||||||
def get_epels(c, distro):
|
|
||||||
cls = common.get_action_cls(settings.INSTALL, c)
|
|
||||||
dummy_config = common.get_config()
|
|
||||||
dummy_root = tempfile.gettempdir()
|
|
||||||
instance = cls(instances=set(), distro=distro,
|
|
||||||
packager=None, config=dummy_config,
|
|
||||||
root=dummy_root, opts=list(),
|
|
||||||
keep_old=False)
|
|
||||||
if not isinstance(instance, component.PkgInstallComponent):
|
|
||||||
return None
|
|
||||||
else:
|
|
||||||
pkgs = instance._get_pkgs_expanded()
|
|
||||||
epel_pkgs = dict()
|
|
||||||
for (name, info) in pkgs.items():
|
|
||||||
meta = info.get("meta") or dict()
|
|
||||||
if meta and meta.get("epel"):
|
|
||||||
epel_pkgs[name] = info
|
|
||||||
return epel_pkgs
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
me = os.path.basename(sys.argv[0])
|
|
||||||
distro = EPEL_DISTRO
|
|
||||||
for c in sorted(settings.COMPONENT_NAMES):
|
|
||||||
print("Packages for %s:" % (utils.color_text(c, 'green', bold=True, underline=True)))
|
|
||||||
pkgs = get_epels(c, distro)
|
|
||||||
if not pkgs:
|
|
||||||
print("\t- %s" % (utils.color_text('N/A', 'red')))
|
|
||||||
else:
|
|
||||||
names = sorted(pkgs.keys())
|
|
||||||
for name in names:
|
|
||||||
real_name = name
|
|
||||||
info = pkgs.get(name) or dict()
|
|
||||||
if 'version' in info:
|
|
||||||
real_name = "%s (%s)" % (name, utils.color_text(str(info.get('version')), 'blue', bold=True))
|
|
||||||
print("\t- %s" % real_name)
|
|
@ -1,45 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir))
|
|
||||||
sys.path.insert(0, possible_topdir)
|
|
||||||
|
|
||||||
from devstack import utils
|
|
||||||
from devstack import settings
|
|
||||||
from devstack import component
|
|
||||||
from devstack.progs import common
|
|
||||||
|
|
||||||
def get_pips(c, distro):
|
|
||||||
cls = common.get_action_cls(settings.INSTALL, c)
|
|
||||||
dummy_config = common.get_config()
|
|
||||||
dummy_root = tempfile.gettempdir()
|
|
||||||
instance = cls(instances=set(), distro=distro,
|
|
||||||
packager=None, config=dummy_config,
|
|
||||||
root=dummy_root, opts=list(),
|
|
||||||
keep_old=False)
|
|
||||||
if not isinstance(instance, component.PythonInstallComponent):
|
|
||||||
return None
|
|
||||||
else:
|
|
||||||
return instance._get_pips_expanded()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
me = os.path.basename(sys.argv[0])
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
print("%s distro" % (me))
|
|
||||||
sys.exit(1)
|
|
||||||
distro = sys.argv[1]
|
|
||||||
for c in sorted(settings.COMPONENT_NAMES):
|
|
||||||
print("Pips for %s:" % (utils.color_text(c, 'green', bold=True, underline=True)))
|
|
||||||
pips = get_pips(c, distro)
|
|
||||||
if pips is None or not pips:
|
|
||||||
print("\t- %s" % (utils.color_text('N/A', 'red')))
|
|
||||||
else:
|
|
||||||
names = sorted(pips.keys())
|
|
||||||
for name in names:
|
|
||||||
real_name = name
|
|
||||||
info = pips.get(name) or dict()
|
|
||||||
if 'version' in info:
|
|
||||||
real_name = "%s == %s" % (name, utils.color_text(str(info.get('version')), 'blue', bold=True))
|
|
||||||
print("\t- %s" % real_name)
|
|
@ -1,45 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir))
|
|
||||||
sys.path.insert(0, possible_topdir)
|
|
||||||
|
|
||||||
from devstack import utils
|
|
||||||
from devstack import settings
|
|
||||||
from devstack import component
|
|
||||||
from devstack.progs import common
|
|
||||||
|
|
||||||
def get_pips(c, distro):
|
|
||||||
cls = common.get_action_cls(settings.INSTALL, c)
|
|
||||||
dummy_config = common.get_config()
|
|
||||||
dummy_root = tempfile.gettempdir()
|
|
||||||
instance = cls(instances=set(), distro=distro,
|
|
||||||
packager=None, config=dummy_config,
|
|
||||||
root=dummy_root, opts=list(),
|
|
||||||
keep_old=False)
|
|
||||||
if not isinstance(instance, component.PkgInstallComponent):
|
|
||||||
return None
|
|
||||||
else:
|
|
||||||
return instance._get_pkgs_expanded()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
me = os.path.basename(sys.argv[0])
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
print("%s distro" % (me))
|
|
||||||
sys.exit(1)
|
|
||||||
distro = sys.argv[1]
|
|
||||||
for c in sorted(settings.COMPONENT_NAMES):
|
|
||||||
print("Packages for %s:" % (utils.color_text(c, 'green', bold=True, underline=True)))
|
|
||||||
pips = get_pips(c, distro)
|
|
||||||
if pips is None or not pips:
|
|
||||||
print("\t- %s" % (utils.color_text('N/A', 'red')))
|
|
||||||
else:
|
|
||||||
names = sorted(pips.keys())
|
|
||||||
for name in names:
|
|
||||||
real_name = name
|
|
||||||
info = pips.get(name) or dict()
|
|
||||||
if 'version' in info:
|
|
||||||
real_name = "%s (%s)" % (name, utils.color_text(str(info.get('version')), 'blue', bold=True))
|
|
||||||
print("\t- %s" % real_name)
|
|
Loading…
x
Reference in New Issue
Block a user