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)
# 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" print "baseurl=%s" % url print "enabled=1" print "metadata_expire=7d" print "gpgcheck=0" print "EOF\n\n" # write shell code to force enable selected repos force_enable = ooblib.read_config('yumcfg', 'force_enable')
# 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" print "baseurl=%s" % url print "enabled=1" print "metadata_expire=7d" print "gpgcheck=0" print "EOF\n\n" # write shell code to force enable selected repos force_enable = ooblib.read_config('yumcfg', 'force_enable')