diff --git a/confluent_server/confluent/syncfiles.py b/confluent_server/confluent/syncfiles.py index a02d03ed..fa898938 100644 --- a/confluent_server/confluent/syncfiles.py +++ b/confluent_server/confluent/syncfiles.py @@ -32,6 +32,20 @@ def mkdirp(path): if e.errno != 17: raise +def get_entries(filename): + with open(filename, 'r') as slfile: + slist = slfile.read() + entries = slist.split('\n') + for ent in entries: + ent = ent.split('#', 1)[0].strip() + if not ent: + continue + if ent[0] == '<': + for subent in get_entries(ent[1:]): + yield subent + else: + yield subent + class SyncList(object): def __init__(self, filename, nodename, cfg): slist = None @@ -40,9 +54,7 @@ class SyncList(object): self.appendoncemap = {} self.mergemap = {} self.optmap = {} - with open(filename, 'r') as slfile: - slist = slfile.read() - entries = slist.split('\n') + entries = get_entries(filename) currmap = self.replacemap for ent in entries: try: diff --git a/imgutil/imgutil b/imgutil/imgutil index edc59bba..fcb8d6fc 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -409,10 +409,21 @@ class OsHandler(object): 'version': odata[1], 'arch': odata[2], 'name': odata[3]} return json.dumps(info) - def list_packages(self): - with open(self.pkglist, 'r') as pkglist: + def list_packages(self, pkglistfile=None): + if pkglistfile is None: + pkglistfile = self.pkglist + with open(pkglistfile, 'r') as pkglist: pkgs = pkglist.read() pkgs = pkgs.split() + retpkgs = [] + for pkg in pkgs: + pkg = pkg.split('#', 1)[0].strip() + if not pkg: + continue + if pkg[0] == '<': # Include from specified file + pkgs.extend(self.list_packages(pkg[1:])) + else: + pkgs.append(pkg) return pkgs class SuseHandler(OsHandler):