use repo config files instead of a list
In past releases of Fedora, we've maintained a list in the install class
that specifies extra repos that should be added to the task list UI. In the last release (F9), we got nailed because the mirror URLs changed and we didn't notice, so clicking "Additional Fedora Software" failed. Further, people keep wanting the updates repo enabled. What better way to fix up both these problems than to use the existing /etc/yum.repos.d/* files from the fedora-release package instead of maintaing our own list? That's what the attached patch does. It's not complete yet but it is getting there. Problems: - Driver disks should write out repo files as well, but I think driver disks are broken in general so it's not really worth fixing this immediately. - The repo configured in loader that gets passed to anaconda as method= is enabled, as is the regular Fedora release repo from the fedora-release package. This sounds like an exciting battle. I suppose it can be fixed a little bit with cost=, but I probably need a way to only enable one "base" repo. Thoughts? - Chris diff --git a/installclasses/fedora.py b/installclasses/fedora.py index a6657cf..c51c743 100644 --- a/installclasses/fedora.py +++ b/installclasses/fedora.py @@ -45,8 +45,6 @@ class InstallClass(BaseInstallClass): (N_("Software Development"), ["development-libs", "development-tools", "gnome-software-development", "x-software-development"],), (N_("Web server"), ["web-server"])] - repos = { "Additional Fedora Software": (None, "http://mirrors.fedoraproject.org/mirrorlist?repo=%s&arch=%s" %(productVersion, rpmUtils.arch.getBaseArch())) } - def getPackagePaths(self, uri): if not type(uri) == types.ListType: uri = [uri,] diff --git a/iw/task_gui.py b/iw/task_gui.py index e7a8e3a..441d2da 100644 --- a/iw/task_gui.py +++ b/iw/task_gui.py @@ -371,6 +371,8 @@ class TaskWindow(InstallWindow): store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) + store.set_sort_column_id(1, gtk.SORT_ASCENDING) + tl = self.xml.get_widget("repoList") tl.set_model(store) diff --git a/kickstart.py b/kickstart.py index cbe387d..06c0841 100644 --- a/kickstart.py +++ b/kickstart.py @@ -676,6 +676,32 @@ class Raid(commands.raid.F9_Raid): addPartRequest(self.handler.anaconda, request) self.handler.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) +class Repo(commands.repo.F8_Repo): + def parse(self, args): + commands.repo.F8_Repo.parse(self, args) + repo = self.repoList[-1] + repoid = repo.name.replace(" ", "-") + + buf = """ +[%(repoid)] +name=%(name) +enabled=1 +gpgcheck=0 +""" % {"repoid": repoid, "name": repo.name} + + # pykickstart enforces that only one of these options may be specified + if repo.mirrorlist: + buf += " mirrorlist=%s" % repo.mirrorlist + else: + buf += " baseurl=%s" % repo.baseurl + + if repo.priority: + buf += " cost=%s" % repo.priority + + fd = open("/etc/yum.repos.d/%s.repo" % repoid, "w") + fd.write(buf) + fd.close() + class RootPw(commands.rootpw.F8_RootPw): def parse(self, args): commands.rootpw.F8_RootPw.parse(self, args) @@ -801,7 +827,7 @@ commandMap = { "poweroff": Reboot, "raid": Raid, "reboot": Reboot, - "repo": commands.repo.F8_Repo, + "repo": Repo, "rootpw": RootPw, "selinux": SELinux, "services": commands.services.FC6_Services, diff --git a/scripts/upd-instroot b/scripts/upd-instroot index 1645aad..d9eaca9 100755 --- a/scripts/upd-instroot +++ b/scripts/upd-instroot @@ -165,7 +165,7 @@ PACKAGES="glibc-common setup python newt slang libselinux device-mapper device-mapper-libs dmraid keyutils-libs libsemanage-python python-pyblock mkinitrd libbdevid libbdevid-python nss nspr pcre cryptsetup-luks libgcrypt libgpg-error dbus dbus-python hal - cracklib-python module-init-tools cracklib-dicts" + cracklib-python module-init-tools cracklib-dicts system-release" if [ $ARCH = i386 ]; then PACKAGES="$PACKAGES glibc.i386 openssl.i386" @@ -329,6 +329,7 @@ etc/selinux/targeted etc/shells etc/udev etc/yum/pluginconf.d/fedorakmod.conf +etc/yum/yum.repos.d/* lib/terminfo $LIBDIR/libnss_dns* $LIBDIR/libnss_files* diff --git a/yuminstall.py b/yuminstall.py index 6713a6c..460294c 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -488,16 +488,49 @@ class AnacondaYum(YumSorter): text=kwargs["text"], range=kwargs["range"], copy_local=1) return kwargs["local"] - def doConfigSetup(self, fn='/etc/yum.conf', root='/'): - self.conf = yum.config.YumConf() - self.conf.installroot = root - self.conf.reposdir=["/tmp/repos.d"] - self.conf.logfile="/tmp/yum.log" - self.conf.obsoletes=True - self.conf.cache=0 - self.conf.cachedir = "%s/var/cache/yum" % self.anaconda.rootPath - self.conf.metadata_expire = 0 + # XXX: This is straight out of yum, but we need to override it here in + # order to use our own repo class. + def readRepoConfig(self, parser, section): + 'Parse an INI file section for a repository. + + @param parser: ConfParser or similar to read INI file values from. + @param section: INI file section to read. + @return: YumRepository instance. + ' + repo = AnacondaYumRepo(section) + repo.populate(parser, section, self.conf) + + # Ensure that the repo name is set + if not repo.name: + repo.name = section + self.logger.error(_('Repository %r is missing name in configuration, ' + 'using id') % section) + + # Set attributes not from the config file + repo.basecachedir = self.conf.cachedir + repo.yumvar.update(self.conf.yumvar) + repo.cfg = parser + + return repo + + # We need to make sure $releasever gets set up before .repo files are + # read. Since there's no redhat-release package in /mnt/sysimage (and + # won't be for quite a while), we need to do our own substutition. + def getReposFromConfig(self): + def _getReleasever(): + from ConfigParser import ConfigParser + c = ConfigParser() + ConfigParser.read(c, "%s/.treeinfo" % self.tree) + return c.get("general", "version") + + self.yumvar["releasever"] = _getReleasever() + YumSorter.getReposFromConfig(self) + + # Override this method so yum doesn't nuke our existing logging config. + def doLoggingSetup(self, debuglevel, errorlevel): + pass + def doConfigSetup(self, fn='/etc/yum.conf', root='/'): if self.anaconda.methodstr.startswith("nfs:"): if os.path.isdir(self.anaconda.methodstr[4:]): self.tree = self.anaconda.methodstr[4:] @@ -514,7 +547,9 @@ class AnacondaYum(YumSorter): elif self.anaconda.methodstr.startswith("ftp:") or self.anaconda.methodstr.startswith("http:"): methodstr = self.anaconda.methodstr - # set up logging to log to our logs + YumSorter.doConfigSetup(self, fn=fn, root=root) + + # override default logging to use our logs ylog = logging.getLogger("yum") map(lambda x: ylog.addHandler(x), log.handlers) @@ -550,19 +585,6 @@ class AnacondaYum(YumSorter): repo.enable() self.repos.add(repo) - extraRepos = [] - - # add some additional not enabled by default repos. - # FIXME: this is a hack and should probably be integrated - # with the above - for (name, (uri, mirror)) in self.anaconda.id.instClass.repos.items(): - rid = name.replace(" ", "") - repo = AnacondaYumRepo(uri=uri, mirrorlist=mirror, repoid=rid, - root=root) - repo.name = name - repo.disable() - extraRepos.append(repo) - if self.anaconda.id.extraModules: for d in glob.glob("/tmp/DD-*/rpms"): dirname = os.path.basename(os.path.dirname(d)) @@ -572,33 +594,8 @@ class AnacondaYum(YumSorter): root=root, addon=False) repo.name = "Driver Disk %s" % dirname.split("-")[1] repo.enable() - extraRepos.append(repo) - - if self.anaconda.isKickstart: - for ksrepo in self.anaconda.id.ksdata.repo.repoList: - repo = AnacondaYumRepo(uri=ksrepo.baseurl, - mirrorlist=ksrepo.mirrorlist, - repoid=ksrepo.name) - repo.name = ksrepo.name - repo.enable() - extraRepos.append(repo) - - for repo in extraRepos: - try: - self.repos.add(repo) - log.info("added repository %s with URL %s" % (repo.name, repo.mirrorlist or repo.baseurl)) - except yum.Errors.DuplicateRepoError, e: - log.warning("ignoring duplicate repository %s with URL %s" % (repo.name, repo.mirrorlist or repo.baseurl)) - - self.doPluginSetup(searchpath=["/usr/lib/yum-plugins", - "/tmp/updates/yum-plugins", - "/mnt/source/RHupdates/yum-plugins"], - confpath=["/etc/yum/pluginconf.d", - "/tmp/updates/pluginconf.d", - "/mnt/source/RHupdates/pluginconf.d"]) - self.plugins.run('init') - self.repos.setCacheDir("%s/var/cache/yum" % self.anaconda.rootPath) + self.repos.setCacheDir("%s/var/cache/yum" % self.conf.cachedir) def downloadHeader(self, po): while True: @@ -882,6 +879,23 @@ class YumBackend(AnacondaBackend): AnacondaBackend.__init__(self, anaconda) self.supportsPackageSelection = True + buf = """ +[main] +cachedir=%s/var/cache/yum +installroot=%s +keepcache=0 +logfile=/tmp/yum.log +metadata_expire=0 +obsoletes=True +pluginpath=/usr/lib/yum-plugins,/tmp/updates/yum-plugins,/mnt/source/RHupdates/yum-plugins +pluginconfpath=/etc/yum/pluginconf.d,/tmp/updates/pluginconf.d,/mnt/source/RHupdates/pluginconf.d +reposdir=/etc/yum.repos.d,/tmp/updates/yum.repos.d,/mnt/source/RHupdates/yum.repos.d +""" % (anaconda.rootPath, anaconda.rootPath) + + fd = open("/etc/yum.conf", "w") + fd.write(buf) + fd.close() + def complete(self, anaconda): try: isys.umount(self.ayum.tree) _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
use repo config files instead of a list
On Wed, 2008-05-28 at 17:08 -0400, Chris Lumens wrote:
> In past releases of Fedora, we've maintained a list in the install class > that specifies extra repos that should be added to the task list UI. In > the last release (F9), we got nailed because the mirror URLs changed and > we didn't notice, so clicking "Additional Fedora Software" failed. > Further, people keep wanting the updates repo enabled. > > What better way to fix up both these problems than to use the existing > /etc/yum.repos.d/* files from the fedora-release package instead of > maintaing our own list? That's what the attached patch does. It's not > complete yet but it is getting there. Nice. One problem I'd note - you're using .treeinfo (yay) to get the "version" string, except .treeinfo and fedora-release don't usually agree on the version. For example: in F9Beta we have fedora-release-8.92, but .treeinfo version is "9-Beta". Maybe we want to force them to be the same with some patching in buildinstall? Or add a "releasever" .treeinfo variable that definitely matches what yum will consider $releasever? -w _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
use repo config files instead of a list
How about looking for repo config file in /etc/yum.repos.d in product.img as
well? This makes it easy for distro customizers to extend the base set from the original distro. Kay -----Original Message----- From: anaconda-devel-list-bounces@redhat.com [mailto:anaconda-devel-list-bounces@redhat.com] On Behalf Of Chris Lumens Sent: Wednesday, May 28, 2008 2:09 PM To: anaconda-devel-list@redhat.com Subject: [PATCH] use repo config files instead of a list In past releases of Fedora, we've maintained a list in the install class that specifies extra repos that should be added to the task list UI. In the last release (F9), we got nailed because the mirror URLs changed and we didn't notice, so clicking "Additional Fedora Software" failed. Further, people keep wanting the updates repo enabled. What better way to fix up both these problems than to use the existing /etc/yum.repos.d/* files from the fedora-release package instead of maintaing our own list? That's what the attached patch does. It's not complete yet but it is getting there. Problems: - Driver disks should write out repo files as well, but I think driver disks are broken in general so it's not really worth fixing this immediately. - The repo configured in loader that gets passed to anaconda as method= is enabled, as is the regular Fedora release repo from the fedora-release package. This sounds like an exciting battle. I suppose it can be fixed a little bit with cost=, but I probably need a way to only enable one "base" repo. Thoughts? - Chris _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
use repo config files instead of a list
Chris Lumens (clumens@redhat.com) said:
> @@ -329,6 +329,7 @@ etc/selinux/targeted > etc/shells > etc/udev > etc/yum/pluginconf.d/fedorakmod.conf > +etc/yum/yum.repos.d/* > lib/terminfo > $LIBDIR/libnss_dns* > $LIBDIR/libnss_files* etc/yum.repos.d/*, surely? Bill _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
use repo config files instead of a list
On Wed, 2008-05-28 at 23:51 -0400, Bill Nottingham wrote:
> Chris Lumens (clumens@redhat.com) said: > > @@ -329,6 +329,7 @@ etc/selinux/targeted > > etc/shells > > etc/udev > > etc/yum/pluginconf.d/fedorakmod.conf > > +etc/yum/yum.repos.d/* > > lib/terminfo > > $LIBDIR/libnss_dns* > > $LIBDIR/libnss_files* > > etc/yum.repos.d/*, surely? > it's actually supposed to be /etc/yum/repos.d. We move it around in the fedora release so we don't go breaking everyone's configs. -sv _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
use repo config files instead of a list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512 Chris Lumens wrote: | - The repo configured in loader that gets passed to anaconda as method= | is enabled, as is the regular Fedora release repo from the | fedora-release package. This sounds like an exciting battle. I | suppose it can be fixed a little bit with cost=, but I probably need | a way to only enable one "base" repo. While you're at it any objections to make anaconda write the method= repo under /etc/yum.repos.d/ as well ? Does this get too complicated with RHEL where we have Server, VT, Cluster, ClusterStorage repos as well? Thanks, Alexander. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org iD8DBQFIPmZZhmd3WOiFct4RCiQIAKCLJorhCpTUuLgvVY56wA XZGWcy5QCgsH8J iL9IOW/0tT8xRbq504/wByc= =v4AV -----END PGP SIGNATURE----- _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
use repo config files instead of a list
> Chris Lumens (clumens@redhat.com) said:
> > @@ -329,6 +329,7 @@ etc/selinux/targeted > > etc/shells > > etc/udev > > etc/yum/pluginconf.d/fedorakmod.conf > > +etc/yum/yum.repos.d/* > > lib/terminfo > > $LIBDIR/libnss_dns* > > $LIBDIR/libnss_files* > > etc/yum.repos.d/*, surely? Oops, that's what I meant. In fact that's what I use everywhere else throughout the patch. I must have just gotten caught up in reading the previous line. - Chris _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
use repo config files instead of a list
> | - The repo configured in loader that gets passed to anaconda as method=
> | is enabled, as is the regular Fedora release repo from the > | fedora-release package. This sounds like an exciting battle. I > | suppose it can be fixed a little bit with cost=, but I probably need > | a way to only enable one "base" repo. > > While you're at it any objections to make anaconda write the method= repo under > /etc/yum.repos.d/ as well ? I think this is the direction I want to head, yes. However I also have a big patch in the works regarding stage2=/method= to finish up the work I started last release, so I've left this untouched for now. > Does this get too complicated with RHEL where we > have Server, VT, Cluster, ClusterStorage repos as well? I'm going on the assumption that RHEL6 is going to be completely different from RHEL5 (we sure love to do that sort of thing) so I'm not going to worry about it for now. - Chris _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
use repo config files instead of a list
> How about looking for repo config file in /etc/yum.repos.d in product.img as
> well? This makes it easy for distro customizers to extend the base set from > the original distro. We've talked about completely overhauling the product.img support but who knows if that will actually get done or not. Your request seems like a much easier way to specify multiple repos than what we had (the repos dict in the installclass) so sure, I can do that. - Chris _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
use repo config files instead of a list
Chris Lumens wrote:
In past releases of Fedora, we've maintained a list in the install class that specifies extra repos that should be added to the task list UI. In the last release (F9), we got nailed because the mirror URLs changed and we didn't notice, so clicking "Additional Fedora Software" failed. Further, people keep wanting the updates repo enabled. Another thing for the list of problems is what to do on media installs -- updates + installing from a multiple disc set is going to not work like we want. Unless we want to seriously dive into the ordering problem. But maybe it's time to do that... :-/ Jeremy _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
| All times are GMT. The time now is 08:37 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.