哎,MI生成ISO一直是131M......
锁定在这个文件RpmPkgInfor.py我还在trace中
#!/usr/bin/python
# Copyright (C) 2003, Charles Wang.
# Author:Charles Wang <[email protected]>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANT; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public LIcense for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, 59 Temple
# Place - Suite 330, Boston, MA 02111-1307, USA.
import glob
import os
import os.path
import stat
import string
import sys
import types
from getopt import getopt
import rpm
# Usage:
# RpmPkgInfor.py [-o outputfn] [-l logfn] dirs....
try:
import pkgpublic
except ImportError:
sys.path.insert(0, 'scripts')
import pkgpublic
#import rpmshow
basement_arches = {'i386' : 'y', 'i586' : 'y', 'noarch' : 'y'}
instpath = 'root'
ts = rpm.TransactionSet(instpath)
ts.setVSFlags(rpm.RPMVSF_NODSA | rpm.RPMVSF_NORSA)
rpmfn_map = {}
provide_map = {}
file_requires_map = {}
rpm_n_v_r_map = {}
def print_rpmfn_map():
result = '{\n'
for k in rpmfn_map.keys():
result = result + "\t'%s': [ %dL,\n" % \
(k, rpmfn_map)
result = result + "\t\t'%s',\n" % rpmfn_map
result = result + "\t\t%s," % str(rpmfn_map)
deplist = rpmfn_map
if deplist == []:
result = result + ' [], '
else:
for i in range(len(deplist)):
if i == 0:
result = result + '\n\t\t['
else:
result = result + '\t\t '
dep = deplist
if type(dep) == types.StringType:
result = result + "'%s'" % dep
else:
result = result + '%s' % str(dep)
if i != len(deplist) - 1:
result = result + ',\n'
else:
result = result + '],'
pathes = rpmfn_map
if pathes == []:
result = result + ' []]'
else:
for i in range(len(pathes)):
if i == 0:
result = result + '\n\t\t['
else:
result = result + '\t\t '
result = result + '%s' % str(pathes)
if i != len(pathes) - 1:
result = result + ',\n'
else:
result = result + ']]'
if k != rpmfn_map.keys()[-1]:
result = result + ',\n'
result = result + '}\n'
return result
optlist, args = getopt(sys.argv, 'o:l:')
outfd = 1
logfd = 2
for (optname, optval) in optlist:
if optname == '-o':
if outfd > 2:
os.close(outfd)
try:
outfd = os.open(optval, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
except OSError:
outfd = 1
elif optname == '-l':
if logfd > 2:
os.close(logfd)
try:
logfd = os.open(optval, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0644)
except OSError:
logfd = 2
for dir in sys.argv:
for rpmfnpath in glob.glob('%s/*.rpm' % dir):
os.write(2, 'Reading %s...\n' % rpmfnpath)
rpmfn = os.path.basename(rpmfnpath)
if rpmfn_map.has_key(rpmfn):
os.write(2, "More then one %s encountered.\n" % rpmfn)
sys.exit(1)
rpmstat = os.stat(rpmfnpath)
rpmsize = rpmstat
rpmfd = os.open(rpmfnpath, os.O_RDONLY)
hdr = ts.hdrFromFdno(rpmfd)
os.close(rpmfd)
#rpmshow.addHdr(hdr)
# Fill rpm_n_v_r_map.
rpmname = hdr
rpmversion = hdr
rpmrelease = hdr
rpmarch = hdr
n_v_r_key = '%s-%s-%s' % (rpmname, rpmversion, rpmrelease)
if rpm_n_v_r_map.has_key(n_v_r_key):
rpm_n_v_r_map.append((rpmfnpath, rpmarch, rpmsize))
else:
rpm_n_v_r_map = [(rpmfnpath, rpmarch, rpmsize)]
if not basement_arches.has_key(rpmarch):
continue
rpmgroup = string.split(hdr, '/')
# Fill provides and record requires.
provide_name = hdr
provide_version = hdr
provide_flags = hdr
n_provides = len(provide_name)
if n_provides == 1 and type(provide_flags) != types.ListType:
provide_flags =
for i in range(n_provides):
provide_tuple = (rpmfn,
provide_version,
provide_flags)
if provide_map.has_key(provide_name):
provide_map].append(provide_tuple)
else:
provide_map] =
requires = []
require_name = hdr
require_version = hdr
require_flags = hdr
n_requires = len(require_name)
if n_requires == 1 and type(require_flags) != types.ListType:
require_flags =
for i in range(n_requires):
requires_tuple = (require_name,
require_version,
require_flags)
requires.append(requires_tuple)
if string.find(require_name, '/') >= 0:
file_requires_map] = 'y'
# Place n_v_r_key in pkgpublic.pathes position temporary.
rpmfn_map =
# Search all keys in file_requires_map.
for rpmfn in rpmfn_map.keys():
os.write(2, 'Reread %s...\n' % rpmfn_map)
rpmfd = os.open(rpmfn_map, os.O_RDONLY)
hdr = ts.hdrFromFdno(rpmfd)
os.close(rpmfd)
for f in hdr:
if file_requires_map.has_key(f):
if file_requires_map == 'y':
file_requires_map = rpmfn
else:
os.write(logfd,
"Warning: '%s' provide '%s', but it is provided by '%s' already. Use '%s'\n" % \
(rpmfn, f, file_requires_map, file_requires_map))
#for f in file_requires_map.keys():
# if file_requires_map == 'y':
# os.write(logfd, "Error: Unresolvable require(file): '%s'\n" % f)
# Convert all require/provide to rpm package name.
for rpmfn in rpmfn_map.keys():
newrequires = []
for require in rpmfn_map:
reqname = require
if 0 <= string.find(reqname, '(') and \
string.find(reqname, '(') <= string.find(reqname, ')'):
continue# Omit the xxx(xxx) dependency.
if string.find(reqname, '/') >= 0:
# Deal with file dependency latter.
if file_requires_map != 'y':
newrequires.append((file_requires_map, require, require))
else:
os.write(logfd, "Error: Unresolvable require for '%s': '%s'.\n" % \
(rpmfn, reqname))
elif provide_map.has_key(reqname):
prov_rpm = provide_map
if len(provide_map) > 1:
diff_prov = None
for prov in provide_map:
if prov != prov_rpm:
diff_prov = 1
break
if diff_prov:
os.write(logfd, 'Warning: Multiple provide(Use %s): \'%s\'.\n' % (prov_rpm, reqname))
for prov in provide_map:
os.write(logfd, '\t%s\n' % str(prov))
newrequires.append((prov_rpm, require, require))
else:
os.write(logfd, "Error: Unresolvable require for '%s': '%s'.\n" % \
(rpmfn, reqname))
# Compress newrequies. Some information is lost here, but if the specified
# rpm package is self-contained, things will be ok.
reqmap = {}
for requires in newrequires:
if requires != rpmfn:
# Omit the self-dependency.
reqmap] = 'y'
rpmfn_map = reqmap.keys()
# Fill pkgpublic.totalsz and pkgpublic.pathes.
for rpmfn in rpmfn_map.keys():
n_v_r_key = rpmfn_map
rpmfn_map = rpm_n_v_r_map
for (rpmfnpath, rpmarch, rpmsize) in rpm_n_v_r_map:
rpmfn_map += rpmsize
title = '#!/usr/bin/python\n\npackages_infor =\\\n'
os.write(outfd, title + print_rpmfn_map())
if outfd > 2:
os.close(outfd)
if logfd > 2:
os.close(logfd) 我用的是这个版本的,没有发现大小方面的问题
只是不能正常引导 oh my god....... so there must be something we do not know about MI, we'd better ask Charles Wang for some input I agree with you~ :P :mrgreen: 在家好无聊呀。看书看书。。。。
页:
[1]