Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 315382 Details for
Bug 457583
modifying default repo to specify different URL fails
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch to simplify repo handling
457583.patch (text/plain), 12.79 KB, created by
Chris Lumens
on 2008-08-29 17:45:33 UTC
(
hide
)
Description:
patch to simplify repo handling
Filename:
MIME Type:
Creator:
Chris Lumens
Created:
2008-08-29 17:45:33 UTC
Size:
12.79 KB
patch
obsolete
>commit d3ce2ecdae711afd5cc572da9a1466b2bb0df4e4 >Author: Chris Lumens <clumens@redhat.com> >Date: Fri Aug 29 13:09:46 2008 -0400 > > Various simplifications of our yum repo handling code. > >diff --git a/iw/task_gui.py b/iw/task_gui.py >index 4027a60..0864e17 100644 >--- a/iw/task_gui.py >+++ b/iw/task_gui.py >@@ -40,6 +40,7 @@ log = logging.getLogger("anaconda") > def setupRepo(anaconda, repo): > try: > anaconda.backend.doRepoSetup(anaconda, thisrepo = repo.id, fatalerrors = False) >+ anaconda.backend.ayum.repos.populateSack(which=[repo]) > log.info("added repository %s with with source URL %s" % (repo.name, repo.baseurl[0])) > except yum.Errors.RepoError, e: > anaconda.intf.messageWindow(_("Error"), >@@ -51,13 +52,6 @@ def setupRepo(anaconda, repo): > anaconda.backend.ayum.repos.delete(repo.id) > return False > >- if not repo.groups_added: >- anaconda.intf.messageWindow(_("Warning"), >- _("Unable to find a group file for %s. " >- "This will prevent manual selection of packages " >- "from the repository from working") %(repo.name,), >- type="warning") >- > return True > > class RepoEditor: >@@ -142,8 +136,17 @@ class RepoEditor: > except: > return 0 > >- def _enableRepo(self, repourl): >- # FIXME: Don't do anything here for now. >+ def _enableRepo(self): >+ try: >+ self.backend.ayum.repos.add(self.repo) >+ self.backend.ayum.repos.enableRepo(self.repo.id) >+ except yum.Errors.DuplicateRepoError, e: >+ self.intf.messageWindow(_("Error"), >+ _("The repository %s has already been added. Please " >+ "choose a different repository name and " >+ "URL.") % reponame, type="ok", custom_icon="error") >+ return False >+ > return True > > def _validURL(self, url): >@@ -284,7 +287,7 @@ class RepoEditor: > def _applyHd(self, repo): > return True > >- def run(self, createNewRepoObj=False): >+ def run(self): > applyFuncs = [ self._applyURL, self._applyMedia, self._applyNfs, > self._applyHd ] > >@@ -300,26 +303,33 @@ class RepoEditor: > _("You must provide a repository name.")) > continue > >- if createNewRepoObj: >- self.repo = AnacondaYumRepo(repoid=reponame.replace(" ", "")) >+ # Always create a new repo object here instead of attempting to >+ # somehow expire the metadata and refetch. We'll just have to make >+ # sure that if we're just editing the repo, we grab all the >+ # attributes from the old one before deleting it. >+ if self.repo: >+ newRepoObj = AnacondaYumRepo(self.repo.id) >+ >+ try: >+ os.unlink("%s/cachecookie" % self.repo.cachedir) >+ os.unlink("%s/repomd.xml" % self.repo.cachedir) >+ except: >+ pass >+ >+ self.repo.close() >+ self.anaconda.backend.ayum.repos.delete(self.repo.id) > else: >- self.repo.repoid = reponame.replace(" ", "") >+ newRepoObj = AnacondaYumRepo(reponame.replace(" ", "")) >+ >+ self.repo = newRepoObj > > type = self.typeComboBox.get_active() > if not applyFuncs[type](self.repo): > continue > >- repourl = self.baseurlEntry.get_text() >- repourl.strip() >- >- if not self._enableRepo(repourl): >+ if not self._enableRepo(): > continue > >- # this is a bit gross... but we need to make sure that >- # the urls and grabber get set back up based on new urls >- self.repo._grab = None >- self.repo._urls = None >- > if not setupRepo(self.anaconda, self.repo): > continue > >@@ -410,20 +420,6 @@ class RepoCreator(RepoEditor): > def createDialog(self): > RepoEditor.createDialog(self) > self.dialog.set_title(_("Add Repository")) >- def _enableRepo(self, repourl): >- try: >- self.backend.ayum.repos.add(self.repo) >- except yum.Errors.DuplicateRepoError, e: >- self.intf.messageWindow(_("Error"), >- _("The repository %s has already been added. Please " >- "choose a different repository name and " >- "URL.") % reponame, type="ok", custom_icon="error") >- return False >- >- return True >- >- def run(self, createNewRepoObj=True): >- return RepoEditor.run(self, createNewRepoObj) > > class TaskWindow(InstallWindow): > def getNext(self): >@@ -486,6 +482,8 @@ class TaskWindow(InstallWindow): > dialog.createDialog() > dialog.run() > >+ model.set_value(iter, 2, dialog.repo) >+ > def _addRepo(self, *args): > if not network.hasActiveNetDev(): > if not self.anaconda.intf.enableNetwork(self.anaconda): >diff --git a/yuminstall.py b/yuminstall.py >index 6f5063b..ed82126 100644 >--- a/yuminstall.py >+++ b/yuminstall.py >@@ -233,28 +233,6 @@ class AnacondaCallback: > self.progress.processEvents() > > class AnacondaYumRepo(YumRepository): >- def __init__( self, repoid='anaconda%s' % productStamp, >- uri=None, mirrorlist=None, >- root = "/mnt/sysimage/"): >- YumRepository.__init__(self, repoid) >- conf = yum.config.RepoConf() >- for k, v in conf.iteritems(): >- if v or not self.getAttribute(k): >- self.setAttribute(k, v) >- self.gpgcheck = False >- #self.gpgkey = "%s/RPM-GPG-KEY-fedora" % (method, ) >- self.keepalive = False >- >- if type(uri) == types.ListType: >- self.baseurl = uri >- elif uri: >- self.baseurl = [ uri ] >- else: >- self.baseurl = [] >- >- if mirrorlist: >- self.mirrorlist = mirrorlist >- > def needsNetwork(self): > def _isURL(s): > return s.startswith("http") or s.startswith("ftp") >@@ -478,8 +456,8 @@ class AnacondaYum(YumSorter): > replace = False > else: > # If there was an error finding the "base" repo, create a new one now. >- repo = AnacondaYumRepo(uri=uri, repoid="anaconda-%s-%s" %(rid, productStamp), >- root = root) >+ repo = AnacondaYumRepo("anaconda-%s-%s" % (rid, productStamp)) >+ repo.uri = [ uri ] > > repo.name = name > repo.cost = 100 >@@ -596,17 +574,17 @@ class AnacondaYum(YumSorter): > dirname = os.path.basename(os.path.dirname(d)) > rid = "anaconda-%s" % dirname > >- repo = AnacondaYumRepo(uri="file:///%s" % d, repoid=rid, >- root=root) >+ repo = AnacondaYumRepo(rid) >+ repo.uri = [ "file:///%s" % d ] > 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 = AnacondaYumRepo(ksrepo.name) >+ repo.uri = [ ksrepo.baseurl ] >+ repo.mirrorlist = ksrepo.mirrorlist > repo.name = ksrepo.name > > if ksrepo.cost: >@@ -978,6 +956,8 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon > iutil.writeRpmPlatform() > self.ayum = AnacondaYum(anaconda) > >+ self.ayum.doMacros() >+ > def doGroupSetup(self): > # FIXME: this is a pretty ugly hack to make it so that we don't lose > # groups being selected (#237708) >@@ -993,10 +973,6 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon > txmbr.groups = yum.misc.unique(txmbr.groups) > > def doRepoSetup(self, anaconda, thisrepo = None, fatalerrors = True): >- # We want to call ayum.doRepoSetup one repo at a time so we have >- # some concept of which repo didn't set up correctly. >- repos = [] >- > # Don't do this if we're being called as a dispatcher step (instead > # of being called when a repo is added via the UI) and we're going > # back. >@@ -1004,33 +980,22 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon > return > > if thisrepo is not None: >- repos.append(self.ayum.repos.getRepo(thisrepo)) >+ repos = [self.ayum.repos.getRepo(thisrepo)] > else: >- repos.extend(self.ayum.repos.listEnabled()) >- >- self.ayum.doMacros() >- >- longtasks = ( (self.ayum.doRepoSetup, 4), >- (self.ayum.doSackSetup, 6) ) >- >- tot = 0 >- for t in longtasks: >- tot += t[1] >+ repos = self.ayum.repos.listEnabled() > > for repo in repos: > if repo.name is None: > txt = _("Retrieving installation information...") > else: >- txt = _("Retrieving installation information for %s...")%(repo.name) >- while 1: >- waitwin = YumProgress(anaconda.intf, txt, tot) >- self.ayum.repos.callback = waitwin >+ txt = _("Retrieving installation information for %s...") % (repo.name) >+ >+ while True: >+ waitwin = anaconda.intf.waitWindow(_("Installation Progress"), txt) > > try: >- for (task, incr) in longtasks: >- waitwin.set_incr(incr) >- task(thisrepo = repo.id) >- waitwin.next_task() >+ repo.setup(self.ayum.conf.cache) >+ repo._getRepoXML() > waitwin.pop() > except RepoError, e: > waitwin.pop() >@@ -1083,29 +1048,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon > {"tsInfo":self.ayum.tsInfo, > "repo": repo.id})) > >- while 1: >- try: >- self.doGroupSetup() >- except (GroupsError, NoSuchGroup, RepoError), e: >- buttons = [_("_Exit installer"), _("_Retry")] >- else: >- break # success >- >- rc = anaconda.intf.messageWindow(_("Error"), >- _("Unable to read group information " >- "from repositories. This is " >- "a problem with the generation " >- "of your install tree."), >- type="custom", custom_icon="error", >- custom_buttons = buttons) >- if rc == 0: >- sys.exit(0) >- else: >- self.ayum._setGroups(None) >- continue >- > self._catchallCategory() >- self.ayum.repos.callback = None > > def _catchallCategory(self): > # FIXME: this is a bad hack, but catch groups which aren't in >@@ -1784,41 +1727,6 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon > def getRequiredMedia(self): > return self.ayum.tsInfo.reqmedia.keys() > >-class YumProgress: >- def __init__(self, intf, text, total): >- window = intf.progressWindow(_("Installation Progress"), text, >- total, 0.01) >- self.window = window >- self.current = 0 >- self.incr = 1 >- self.total = total >- self.popped = False >- >- def set_incr(self, incr): >- self.incr = incr >- >- def progressbar(self, current, total, name=None): >- if not self.popped: >- self.window.set(float(current)/total * self.incr + self.current) >- else: >- warnings.warn("YumProgress.progressbar called when popped", >- RuntimeWarning, stacklevel=2) >- >- def pop(self): >- self.window.pop() >- self.popped = True >- >- def next_task(self, current = None): >- if current: >- self.current = current >- else: >- self.current += self.incr >- if not self.popped: >- self.window.set(self.current) >- else: >- warnings.warn("YumProgress.set called when popped", >- RuntimeWarning, stacklevel=2) >- > class DownloadHeaderProgress: > def __init__(self, intf, ayum=None): > window = intf.progressWindow(_("Install Starting"),
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 457583
:
315382
|
315383
|
316478