diff --git a/src/mio.py b/src/mio.py index 4ac6fd9c2366d605c30b4fe4adae776effa9cc86..31152143df87403614fb162d420cfafc3ac3def7 100755 --- a/src/mio.py +++ b/src/mio.py @@ -48,10 +48,24 @@ def find_and_parse(target, builder, url=None): if target.startswith("/"): m = re.match("^/([^/]*)", target) file = "%s/%s.mio" % (dir, m.group(1)) + pass elif target.startswith("@"): file = "%s/base/comps.xml" % dir + try: + # Try to locate group file via repomd.xml + tree = mio.parser.parse("%s/repodata/repomd.xml" % dir) + for l in tree._data_._location_: + if l.type[1] == 'group': + file = "%s/%s" % (dir, l.href[0]) + break + pass + pass + except IOError, e: + continue + pass else: file = "%s/hostinfo.xml" % dir + pass try: parse(file, builder) return @@ -63,8 +77,17 @@ def find_and_parse(target, builder, url=None): traceback.print_exc() print "Failed to locate: %s" % target sys.exit(1) - - print "Failed to locate: %s" % target + pass + pass + if options.noyum and target.startswith('@'): + # Synthetic target + tmp1 = mio.parser.Node("mio", 0) + tmp2 = mio.parser.Node("group", 0, { "name": target }) + tmp1._add(tmp2) + builder.add(tmp1._group_) + pass + else: + print "Failed to locate: %s" % target if __name__ == '__main__': optParser = VerboseOptionParser(usage="%prog [options] targets*")