def add_to_excludes(baseurl, addexcludes):
    print >>sys.stderr, "Reading repository information for", baseurl
    repomd = ooblib.get_repomd(baseurl)
    url = baseurl + '/' + repomd['primary']

    print >>sys.stderr, "Reading package information from", url
    fd = ooblib.cachedurlopen(url)
    data = fd.read()
    fd.close()
    fd = GzipFile(fileobj=StringIO(data))
    ooblib.add_packages_from_xml(fd, addexcludes, farch)
# read in repos
for var in os.environ:
    if not var.startswith("CFG_yumcfg__addrepo"):
        continue
    value = os.environ[var]
    for_excludes, name, url = value.split(',', 2)
    for_excludes = bool(int(for_excludes))
    addrepos.append((for_excludes, name, url))

# generate excludes info
for for_excludes, name, baseurl in addrepos:
    if not for_excludes:
        continue

    print >> sys.stderr, "Reading repository information for", baseurl
    repomd = ooblib.get_repomd(baseurl)
    url = baseurl + '/' + repomd['primary']

    print >> sys.stderr, "Reading package information from", url
    fd = ooblib.cachedurlopen(url)
    data = fd.read()
    fd.close()
    fd = GzipFile(fileobj=StringIO(data))
    ooblib.add_packages_from_xml(fd, excludes, farch)

# write shell code to generate yum repo files
for for_excludes, name, url in addrepos:
    print "cat > /etc/yum.repos.d/%s.repo <<EOF" % name
    print "[%s]" % name
    print "name=%s" % name
    print "failovermethod=priority"
Esempio n. 3
0
# read in repos
for var in os.environ:
    if not var.startswith("CFG_yumcfg__addrepo"):
        continue
    value = os.environ[var]
    for_excludes, name, url = value.split(',', 2)
    for_excludes = bool(int(for_excludes))
    addrepos.append((for_excludes, name, url))

# generate excludes info
for for_excludes, name, baseurl in addrepos:
    if not for_excludes:
        continue

    print >>sys.stderr, "Reading repository information for", baseurl
    repomd = ooblib.get_repomd(baseurl)
    url = baseurl + '/' + repomd['primary']

    print >>sys.stderr, "Reading package information from", url
    fd = ooblib.cachedurlopen(url)
    data = fd.read()
    fd.close()
    fd = GzipFile(fileobj=StringIO(data))
    ooblib.add_packages_from_xml(fd, excludes, farch)

# write shell code to generate yum repo files
for for_excludes, name, url in addrepos:
    print "cat > /etc/yum.repos.d/%s.repo <<EOF" % name
    print "[%s]" % name
    print "name=%s" % name
    print "failovermethod=priority"