Skip to content

Commit

Permalink
Fix some bugs in setopt for repo config. entries. BZ 1023595.
Browse files Browse the repository at this point in the history
1. Sort the wildcard entries, so we always do them in the same order
(probably almost never get more than one anyway).

2. Split repoid.config_name on the last dot instead of the first as
repoid can contain dots.

3. Don't set non-wildcard entries twice, just for fun.
  • Loading branch information
james-antill committed Oct 29, 2013
1 parent 587288e commit a39f131
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _parseSetOpts(self, setopts):
bad_setopt_ne.append(item)
continue
k,v = vals
period = k.find('.')
period = k.rfind('.')
if period != -1:
repo = k[:period]
k = k[period+1:]
Expand Down
8 changes: 7 additions & 1 deletion yum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,13 @@ def getReposFromConfigFile(self, repofn, repo_age=None, validate=None):
thisrepo.base_persistdir = self.conf._repos_persistdir

# do the wildcard ones first
for i in self.repo_setopts:
# The keys are in indeterminate order at this point, *sigh*.
for i in sorted(self.repo_setopts):
# Skip normal names, as we want to do wildcard matches first
# and then override with specific id stuff.
if not misc.re_glob(i):
continue

if fnmatch.fnmatch(thisrepo.id, i):
for opt in self.repo_setopts[i].items:
if not hasattr(thisrepo, opt):
Expand Down

0 comments on commit a39f131

Please sign in to comment.