Re: Treating 'not found' packages as errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



seth vidal wrote:
> On Wed, 2008-04-23 at 17:45 +0200, Anders Blomdell wrote:
>> seth vidal wrote:
>>> On Wed, 2008-04-23 at 17:26 +0200, Anders Blomdell wrote:
>>>>> My initial thought is if you want to use yum with scripted interactions
>>>>> you can call the yum module api from python pretty easily these days.
>>>>>
>>>>> does that make sense?
>>>> Yes, the software that handles updates is already in python.
>>>>
>>>> Are there any docs available for the API?
>>>>
>>> limited docs, lots of good examples, though.
>>>
>>> For an easy way to get started look at:
>>> http://fedoraproject.org/wiki/SethVidal/YumCodeSnippets
>> 1. I don't see any example equivalent to 'yum -update' there.
>> 2. Is there any way to specify a custom configuration without writing a file and
>> modify 'my.conf.config_file_path' ?
> 
> 
> import yum
> my = yum.YumBase()
> # specify config file
> my._getConfig(fn='/path/to/conf/file')
> # update all
> my.update()
> my.resolveDeps()
> my.processTransaction()
> 
> 
> 
> does that help? If you have immediate questions you can also pop in #yum
> on irc.freenode.net - someone in there can frequently help.

Don't know yet, I have problems with changing the cachedir location, this naive
code extracted and combined from the wiki:
#!/usr/bin/python

import yum, os, sys
# setup base objects
my = yum.YumBase()
# someplace you can write to as your user
my.conf.basecachedir = '/tmp/whereever'
if not os.path.exists(my.conf.basecachedir):
    os.makedirs(my.conf.basecachedir)
my.conf.cache = 0

print "before install"
my.install(name='somepackage')
print "before resolve"
my.resolveDeps()
print "before process"
my.processTransaction()

Fails with:

before install
Traceback (most recent call last):
  File "./try.py", line 13, in <module>
    my.install(name='somepackage')
  File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 1894, in install
    pkgs = self.pkgSack.searchNevra(name=nevra_dict['name'],
  File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 529, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 384, in _getSacks
    self.repos.populateSack(which=repos)
  File "/usr/lib/python2.5/site-packages/yum/repos.py", line 242, in populateSack
    sack.populate(repo, mdtype, callback, cacheonly)
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 142, in populate
    if self._check_db_version(repo, mydbtype):
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 199, in
_check_db_version
    if repo.repoXML.repoData.has_key(mdtype):
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 774, in <lambda>
    repoXML = property(fget=lambda self: self._getRepoXML(),
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 766, in _getRepoXML
    self._loadRepoXML(text=self)
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 749, in _loadRepoXML
    cache=self.http_caching == 'all')
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 623, in _getFile
    http_headers=headers,
  File "/usr/lib/python2.5/site-packages/urlgrabber/mirror.py", line 412, in urlgrab
    return self._mirror_try(func, url, kw)
  File "/usr/lib/python2.5/site-packages/urlgrabber/mirror.py", line 398, in
_mirror_try
    return func_ref( *(fullurl,), **kwargs )
  File "/usr/lib/python2.5/site-packages/urlgrabber/grabber.py", line 928, in
urlgrab
    return self._retry(opts, retryfunc, url, filename)
  File "/usr/lib/python2.5/site-packages/urlgrabber/grabber.py", line 846, in _retry
    r = apply(func, (opts,) + args, {})
  File "/usr/lib/python2.5/site-packages/urlgrabber/grabber.py", line 916, in
retryfunc
    fo._do_grab()
  File "/usr/lib/python2.5/site-packages/urlgrabber/grabber.py", line 1197, in
_do_grab
    else: new_fo = open(self.filename, 'wb')
IOError: [Errno 13] Permission denied: '//var/cache/yum/release/repomd.xml'

Seems like the cache is not changed...

Best regards

Anders Blomdell


-- 
Anders Blomdell                  Email: anders.blomdell@xxxxxxxxxxxxxx
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118                     Fax:      +46 46 138118
SE-221 00 Lund, Sweden
_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxxxxx
https://lists.dulug.duke.edu/mailman/listinfo/yum

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux