修复RHEL5添加/删除软件包管理BUG

 使用硬盘上的iso装上RHEL5,用了几天感觉不错,还差个Emacs没有弄好。使用rpm -ivh --aid始终不成功,于是想用RHEL5自带的包管理安装,但是发现Browse和List都是空的,而且List一项也只有安装过的文件。想 想:RHEL5中没有了rpmdb包,但还没有rpmdb工具,rpmdb --rebuilddb完成后,Package Manager还是老样子。再分析一下:Package Manager使用的是yum,应该是和找不到源有关。给yum添加本地软件包更新源,在/etc/yum.repos.d下面新建一个 RHEL5media.repo,填入以下内容:
Quotation

[base]
name=Base RPM Repository for RHEL5
baseurl=file:///mnt/iso/Server/
enabled=1
gpgcheck=0

这里我的RHEL5DVD.iso挂载于/mnt/iso/Server
这样就给yum添加好了本地更新源,yum clean all,然后再试试Package Manager,可以了,Browse 和 List都有内容了,也可以选择软件包了。但是点Apply时却出现了错误:
Quotation

Component: Software Manager
Summary: TBe634e670 __init__.py:767:downloadHeader:RepoError: failed to retrieve emacs-21.4-17.i386.rpm from base
error was [Errno 4] IOError:

Traceback (most recent call last):
 File "/usr/sbin/pirut", line 334, in _apply
   self.applyChanges(self.mainwin)
 File "/usr/lib/python2.4/site-packages/pirut/__init__.py", line 557, in applyChanges
   self.checkDeps(mainwin)
 File "/usr/lib/python2.4/site-packages/pirut/__init__.py", line 322, in checkDeps
   self.populateTs(keepold=0)
 File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 153, in populateTs
   self.downloadHeader(txmbr.po)
 File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 767, in downloadHeader
   raise Errors.RepoError, saved_repo_error
RepoError: failed to retrieve emacs-21.4-17.i386.rpm from base
error was [Errno 4] IOError:

Local variables in innermost frame:
errors: {}
e: [Errno 2] No such file or directory: '//var/cache/yum/base/headers/emacs-21.4-17.i386.hdr'
self: <__main__.PackageManager object at 0x8c2e1ec>
saved_repo_error: failed to retrieve emacs-21.4-17.i386.rpm from base
error was [Errno 4] IOError:
repo: base
checkfunc: ( <__main__.PackageManager object at 0x8c2e1ec>>, ( , 1), {})
local: //var/cache/yum/base/headers/emacs-21.4-17.i386.hdr
po: emacs - 21.4-17.i386

错误信息的重要点应该是,Google了一下,能够修改个url的文件就在/usr/lib/python2.4/site-packages/yum/yumRepo.py中,将其中的第411行由
Quotation
remote = url + '/' + relative

改为
Quotation
remote = "file:///mnt/iso/Server/" + '/' + relative

再次运行Package Manager,安装rpm包成功

你可能感兴趣的:(manager,object,list,File,emacs,variables)