Recursing on repos
pirla <[email protected]>
| Newsgroups | gmane.linux.rpm.yum |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I would like to do something simple...
I would like a script that:
disable all repos
recurse on every repos and enable one repo at once
retrieve a list from the enabled repo
disable the repo
go to the next repo and do the same things.
I coded this, but it do not work
import yum, os, sys
yb = yum.YumBase()
yb.conf.cache = os.geteuid() != 1
for repo in sorted(yb.repos.disableRepo('*')):
print "----", repo
yb.repos.enableRepo(repo)
for enabrepo in yb.repos.listEnabled():
print "Abilitato ",enabrepo,"\n"
pkgs = yb.pkgSack.returnPackages()
for pkg in pkgs:
print pkg.name, pkg.ver, pkg.rel, pkg.arch, pkg.repo
yb.repos.disableRepo(repo)
print "repo disabilitato", repo
I have two kinds of errors.
first...
in every package I receive the same package from the first repo
second...
if I remove the sorted in the first for, I receive the error:
Traceback (most recent call last):
File "yumlist.py", line 10, in <module>
pkgs = yb.pkgSack.returnPackages()
File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 592, in
<lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 435, in
_getSacks
self.repos.populateSack(which=repos)
File "/usr/lib/python2.5/site-packages/yum/repos.py", line 251, in
populateSack
sack.populate(repo, mdtype, callback, cacheonly)
File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 162, in
populate
if self._check_db_version(repo, mydbtype):
File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 223, in
_check_db_version
return repo._check_db_version(mdtype)
File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 1147, in
_check_db_version
repoXML = self.repoXML
File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 1305, in
<lambda>
repoXML = property(fget=lambda self: self._getRepoXML(),
File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 1301, in
_getRepoXML
raise Errors.RepoError, msg
yum.Errors.RepoError: Cannot retrieve repository metadata (repomd.xml)
for repository: kwizart-rawhide-debuginfo. Please verify its path and
try again
I can't understand how to make the pkgs consistent with the repo enabled
Tnx
--
Ciao
Pirla
Per rispondere in E-mail the (punto) pirla (chiocciola) gdit.it
*** un bacio ai pupi ***
---> Linux user since yesterday <---
---> Linux User #389536 <---
_______________________________________________
Yum mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum
signature.asc
(application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAkmIt00ACgkQKwNtDFlgBVR/VQCgw2JDBCNQYB/4I8rHHrXyhLSS cdYAoIYgu+NTRl1YAxnclUPn7ekfIDQM =Ur1n -----END PGP SIGNATURE-----