[Yum-devel] yumdownloader (1.1.2/3.1.6) with --installroot
Charlie Brady
charlieb-yum-devel at budge.apana.org.au
Thu Apr 12 20:30:16 UTC 2007
First off, excuse my ignorance of much of yum and python. New territory
for me.
I'm investigating use of yumdownloader to marshall a coherent set of RPMs
for a small CentOS based iso image. Although my target is CentOS5, my
development platform is FC6, so I started with yum-3.0.5-2 and
yum-utils-1.0.3. I was able to patch yumdownloader to take a --installroot
arg (see end of post).
This gave me something that ran, but not to completion:
$ ./yumdownloader-1.0.3 -c yum.conf --installroot installroot --destdir RPMS.x --resolve bash
smeos 100% |=========================| 951 B 00:00
smetest 100% |=========================| 951 B 00:00
c5 100% |=========================| 951 B 00:00
Traceback (most recent call last):
File "./yumdownloader-1.0.3", line 199, in ?
main()
File "./yumdownloader-1.0.3", line 167, in main
if not pkg in toDownload:
File "/usr/lib/python2.4/site-packages/yum/packages.py", line 191, in __eq__
if other == None:
File "/usr/lib/python2.4/site-packages/yum/transactioninfo.py", line 403, in __cmp__
if self.name > other.name:
AttributeError: 'NoneType' object has no attribute 'name'
This patch to /usr/lib/python2.4/site-packages/yum/packages.py fixed that
little problem:
def __eq__(self, other):
# if other == None:
# return False
if comparePoEVR(self, other) == 0 and self.arch == other.arch and self.name == other.name:
return True
return False
OK, now it runs, but it doesn't "resolve" a very complete RPM set:
$ ls RPMS.x/
bash-3.1-16.1.i386.rpm
$
No glibc, etc.
So now I'm trying again, but with yum-3.1.6 and yum-install-1.1.2. I now
find that yumdownloader requires various things to already exist in the
installroot which it was happy and able to create in the earlier version.
Specifically it expects the installroot to already include an rpmdb and
cache directories for each repository (both of which I've found
workarounds for), and then also demands to find a pre-cached repomd.xml
file per repository.
Are these intentional changes of behaviour, or are they regressions which
I can help to debug?
Here's the --installroot patch for yum-utils-1.0.3:
-def initYum(yumconfigfile):
+def initYum(opts):
global logger
my = yum.YumBase()
- my.doConfigSetup(fn=yumconfigfile,init_plugins=False) # init yum, without plugins
+ my.doConfigSetup(fn=opts.config,init_plugins=False) # init yum, without plugins
my.conf.uid = os.geteuid()
if my.conf.uid != 0:
cachedir = getCacheDir()
@@ -62,6 +62,8 @@
help='operate on source packages')
parser.add_option("-e","--enablerepo", default=[], action="append",
dest="repo",
help='enable repository')
+ parser.add_option("", "--installroot", default="/",
+ help="set install root")
(opts, args) = parser.parse_args()
if len(args) < 1:
@@ -73,7 +75,13 @@
global logger
logger = logging.getLogger("yum.verbose.yumdownloader")
(opts, args) = parseArgs()
- my = initYum(opts.config)
+ my = initYum(opts)
More information about the Yum-devel
mailing list