[yum-commits] 5 commits - docs/yum.8 output.py yumcommands.py yum/packages.py yum/yumRepo.py
James Antill
james at osuosl.org
Fri Sep 7 19:47:28 UTC 2012
docs/yum.8 | 6 ++++++
output.py | 2 +-
yum/packages.py | 4 ++++
yum/yumRepo.py | 34 +++++++++++++++++++---------------
yumcommands.py | 13 ++++++++-----
5 files changed, 38 insertions(+), 21 deletions(-)
New commits:
commit efe39763a2f4f8cb669ea6d5b7cb508faa3b8e92
Merge: 2870ccc db0d1e1
Author: James Antill <james at and.org>
Date: Fri Sep 7 15:47:17 2012 -0400
Merge branch 'master' of ssh://yum.baseurl.org/srv/projects/yum/git/yum
* 'master' of ssh://yum.baseurl.org/srv/projects/yum/git/yum: (3 commits)
cleanup: Use URLGrabError consistently
...
diff --cc yum/yumRepo.py
index 21f65f7,a6c3122..56a665f
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@@ -816,12 -812,12 +816,12 @@@ class YumRepository(Repository, config.
ugopts = self._default_grabopts(cache=self.http_caching=='all')
try:
ug = URLGrabber(progress_obj = self.callback, **ugopts)
- result = ug.urlgrab(url, local, text="%s/metalink" % self)
+ result = ug.urlgrab(url, local, text="%s/metalink" % self.ui_id)
- except urlgrabber.grabber.URLGrabError, e:
+ except URLGrabError, e:
if not os.path.exists(self.metalink_filename):
msg = ("Cannot retrieve metalink for repository: %s. "
- "Please verify its path and try again" % self )
+ "Please verify its path and try again" % self.ui_id )
raise Errors.RepoError, msg
# Now, we have an old usable metalink, so we can't move to
# a newer repomd.xml ... or checksums won't match.
commit 2870ccc5eefc5a67f19d2c19cf08a9c751b7dd6b
Author: James Antill <james at and.org>
Date: Fri Sep 7 15:44:27 2012 -0400
Add ui_id to yum info and a stub. to FakeRepo().
diff --git a/output.py b/output.py
index caac21a..05b255e 100755
--- a/output.py
+++ b/output.py
@@ -820,7 +820,7 @@ class YumOutput:
print _("Version : %s") % to_unicode(pkg.version)
print _("Release : %s") % to_unicode(pkg.release)
print _("Size : %s") % self.format_number(float(pkg.size))
- print _("Repo : %s") % to_unicode(pkg.repoid)
+ print _("Repo : %s") % to_unicode(pkg.repo.ui_id)
if pkg.repoid == 'installed' and 'from_repo' in pkg.yumdb_info:
print _("From repo : %s") % to_unicode(pkg.yumdb_info.from_repo)
if self.verbose_logger.isEnabledFor(logginglevels.DEBUG_3):
diff --git a/yum/packages.py b/yum/packages.py
index f67169f..07c555c 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -225,6 +225,10 @@ class FakeRepository:
def __str__(self):
return self.id
+ def _ui_id(self):
+ return self.id
+ ui_id = property(fget=lambda self: self._ui_id())
+
# Goal for the below is to have a packageobject that can be used by generic
# functions independent of the type of package - ie: installed or available
commit 2a409da47f463258f929959220b3fbd9aac010fa
Author: James Antill <james at and.org>
Date: Fri Sep 7 15:36:09 2012 -0400
Add repoinfo command to do repolist -v.
diff --git a/docs/yum.8 b/docs/yum.8
index 15a8345..dab01f6 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -68,6 +68,8 @@ gnome\-packagekit application\&.
.br
.I \fR * repolist [all|enabled|disabled]
.br
+.I \fR * repoinfo [all|enabled|disabled]
+.br
.I \fR * version [ all | installed | available | group-* | nogroups* | grouplist | groupinfo ]
.br
.I \fR * history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]
@@ -335,6 +337,10 @@ then yum will ignore any repo errors and output the information it can get
(Eg. "yum clean all; yum -C repolist" will output something, although the
package counts/etc. will be zeroed out).
.IP
+.IP "\fBrepoinfo\fP"
+.IP
+This ocmmand works exactly like repolist -v.
+.IP
.IP "\fBversion\fP"
Produces a "version" of the rpmdb, and of the enabled repositories if "all" is
given as the first argument. You can also specify version groups in the
diff --git a/yumcommands.py b/yumcommands.py
index c28cf87..a2e0b1b 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1837,7 +1837,7 @@ class RepoListCommand(YumCommand):
:return: a list containing the names of this command
"""
- return ('repolist',)
+ return ('repolist', 'repoinfo')
def getUsage(self):
"""Return a usage string for this command.
@@ -1893,7 +1893,10 @@ class RepoListCommand(YumCommand):
arg = 'enabled'
extcmds = map(lambda x: x.lower(), extcmds)
- verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
+ if basecmd == 'repoinfo':
+ verbose = True
+ else:
+ verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
if arg != 'disabled' or extcmds:
try:
# Setup so len(repo.sack) is correct
@@ -1980,7 +1983,7 @@ class RepoListCommand(YumCommand):
md = repo.repoXML
else:
md = None
- out = [base.fmtKeyValFill(_("Repo-id : "), repo),
+ out = [base.fmtKeyValFill(_("Repo-id : "), repo.ui_id),
base.fmtKeyValFill(_("Repo-name : "), repo.name)]
if force_show or extcmds:
@@ -2067,7 +2070,7 @@ class RepoListCommand(YumCommand):
out += [base.fmtKeyValFill(_("Repo-filename: "),
repo.repofile)]
- base.verbose_logger.log(logginglevels.DEBUG_3, "%s\n",
+ base.verbose_logger.info("%s\n",
"\n".join(map(misc.to_unicode, out)))
if not verbose and cols:
commit f4f62aab79894626957872b5d476a1e0d34c5a16
Author: James Antill <james at and.org>
Date: Fri Sep 7 15:27:31 2012 -0400
Convert some str(repo) to repo.ui_id so we can keep the former 100% compatible.
Already had to ammend, so some are probably still missing.
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index d31b1c9..21f65f7 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -107,7 +107,7 @@ class YumPackageSack(packageSack.PackageSack):
if repo in self.added:
if 'metadata' not in self.added[repo]:
raise Errors.RepoError, '%s md for %s imported before primary' \
- % (datatype, repo.id)
+ % (datatype, repo.ui_id)
current = 0
for pkgid in dataobj:
current += 1
@@ -510,7 +510,7 @@ class YumRepository(Repository, config.RepoConf):
on then raise a repo error"""
if len(self._urls) < 1 and not self.mediaid:
raise Errors.RepoError, \
- 'Cannot find a valid baseurl for repo: %s' % self.id
+ 'Cannot find a valid baseurl for repo: %s' % self.ui_id
def doProxyDict(self):
if self._proxy_dict:
@@ -816,12 +816,12 @@ class YumRepository(Repository, config.RepoConf):
ugopts = self._default_grabopts(cache=self.http_caching=='all')
try:
ug = URLGrabber(progress_obj = self.callback, **ugopts)
- result = ug.urlgrab(url, local, text="%s/metalink" % self)
+ result = ug.urlgrab(url, local, text="%s/metalink" % self.ui_id)
except urlgrabber.grabber.URLGrabError, e:
if not os.path.exists(self.metalink_filename):
msg = ("Cannot retrieve metalink for repository: %s. "
- "Please verify its path and try again" % self )
+ "Please verify its path and try again" % self.ui_id )
raise Errors.RepoError, msg
# Now, we have an old usable metalink, so we can't move to
# a newer repomd.xml ... or checksums won't match.
@@ -880,7 +880,7 @@ class YumRepository(Repository, config.RepoConf):
if local is None or relative is None:
raise Errors.RepoError, \
- "get request for Repo %s, gave no source or dest" % self
+ "get request for Repo %s, gave no source or dest" % self.ui_id
if self.cache == 1:
if os.path.exists(local): # FIXME - we should figure out a way
@@ -890,7 +890,7 @@ class YumRepository(Repository, config.RepoConf):
raise Errors.RepoError, \
"Caching enabled but no local cache of %s from %s" % (local,
- self)
+ self.ui_id)
if url:
(scheme, netloc, path, query, fragid) = urlparse.urlsplit(url)
@@ -1120,7 +1120,7 @@ Insufficient space in download directory %s
def _cachingRepoXML(self, local):
""" Should we cache the current repomd.xml """
if self.cache and not os.path.exists(local):
- raise Errors.RepoError, 'Cannot find repomd.xml file for %s' % self
+ raise Errors.RepoError, 'Cannot find repomd.xml file for %s' % self.ui_id
if self.cache or self.metadataCurrent():
return True
return False
@@ -1176,7 +1176,7 @@ Insufficient space in download directory %s
parse_can_fail = 'old_repo_XML' in self._oldRepoMDData
if parse_can_fail:
return None
- raise Errors.RepoError, 'Error importing repomd.xml from %s: %s' % (self, e)
+ raise Errors.RepoError, 'Error importing repomd.xml from %s: %s' % (self.ui_id, e)
def _saveOldRepoXML(self, local):
""" If we have an older repomd.xml file available, save it out. """
@@ -1203,7 +1203,7 @@ Insufficient space in download directory %s
# We still want the old data, so we don't download twice. So we
# pretend everything is good until the revert.
if not self.timestamp_check:
- raise Errors.RepoError, "Can't download or revert repomd.xml"
+ raise Errors.RepoError, "Can't download or revert repomd.xml for:" % self.ui_id
if 'old_repo_XML' not in self._oldRepoMDData:
self._oldRepoMDData = {}
@@ -1570,12 +1570,12 @@ Insufficient space in download directory %s
except KeyboardInterrupt:
self._revertOldRepoXML() # Undo metadata cookie?
raise
- raise Errors.RepoError, 'Bad loadRepoXML policy: %s' % (self.mdpolicy)
+ raise Errors.RepoError, 'Bad loadRepoXML policy (for %s): %s' % (self.ui_id, self.mdpolicy)
def _getRepoXML(self):
if self._repoXML:
return self._repoXML
- self._loadRepoXML(text=self)
+ self._loadRepoXML(text=self.ui_id)
return self._repoXML
@@ -1599,7 +1599,7 @@ Insufficient space in download directory %s
result = self._getFile(relative='repodata/repomd.xml.asc',
copy_local=1,
local = sigfile,
- text='%s/signature' % self,
+ text='%s/signature' % self.ui_id,
reget=None,
checkfunc=None,
cache=self.http_caching == 'all',
@@ -1717,7 +1717,7 @@ Insufficient space in download directory %s
else: # ain't there - raise
raise Errors.RepoError, \
"Caching enabled but no local cache of %s from %s" % (local,
- self)
+ self.ui_id)
if (os.path.exists(local) or
self._preload_md_from_system_cache(os.path.basename(local))):
@@ -1754,7 +1754,7 @@ Insufficient space in download directory %s
if retrieve_can_fail:
return None
raise Errors.RepoError, \
- "Could not retrieve %s matching remote checksum from %s" % (local, self)
+ "Could not retrieve %s matching remote checksum from %s" % (local, self.ui_id)
else:
return local
diff --git a/yumcommands.py b/yumcommands.py
index 52c3127..c28cf87 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1968,7 +1968,7 @@ class RepoListCommand(YumCommand):
ui_endis_wid = utf8_width(_('disabled'))
if not verbose:
- rid = str(repo)
+ rid = repo.ui_id # can't use str()
if enabled and repo.metalink:
mdts = repo.metalink_data.repomd.timestamp
if mdts > repo.repoXML.timestamp:
commit 602ae1d548a8165049b55cf30ff810806c795747
Author: James Antill <james at and.org>
Date: Fri Sep 7 15:21:01 2012 -0400
Have str(repo) mean repo.id again, as multiple callers have assumed it.
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 876dc12..d31b1c9 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -434,7 +434,11 @@ class YumRepository(Repository, config.RepoConf):
return thisdata.location
def __str__(self):
- return self.ui_id
+ # Note: You might expect this to be .ui_id, except people got used to
+ # the fact that str(repo) == repo.id and used the former instead of
+ # the later when they wanted just the .id. So we have to live with it
+ # and use .ui_id explicitly.
+ return self.id
def _checksum(self, sumtype, file, CHUNK=2**16, checksum_can_fail=False,
datasize=None):
More information about the Yum-commits
mailing list