Add creating mask,unmask list.

master
Mike Hiretsky 14 years ago
parent c2f879de85
commit f02cb81d65

Binary file not shown.

@ -434,6 +434,12 @@ class cl_builder(color_print):
self.printMessageForTest(_("Creating installed package list"))
self.printByResult(self.createPackageList(sourceDirectory,
isoFile[:-4]+".list"))
self.printMessageForTest(_("Creating mask list"))
self.printByResult(self.createMaskList(sourceDirectory,
isoFile[:-4]+".mask"))
self.printMessageForTest(_("Creating unmask list"))
self.printByResult(self.createUnmaskList(sourceDirectory,
isoFile[:-4]+".unmask"))
self.printMessageForTest(_("Creating DIGESTS file"))
self.printByResult(self.createDigest(isoFile,isoFile+".DIGESTS"))
@ -650,6 +656,38 @@ class cl_builder(color_print):
return False
return True
def createMaskList(self,chrootdir,filename):
"""Create package mask list by chrootdir"""
pkgdir = path.join(chrootdir,'var/db/pkg')
reVerSplit = re.compile(r"^(.*?)-(([^-]+?)(?:-(r\d+))?)$",re.S)
if not path.exists(chrootdir):
return False
try:
packageList = sorted(reduce(lambda x,y:x+map(lambda x:path.join(y,x),
os.listdir(path.join(pkgdir,y))), os.listdir(pkgdir),[]))
open(filename,'w').writelines(
map(lambda x:"%s\n"%x,
map(lambda x:x.groups()[0],
filter(lambda x:x,
map(reVerSplit.search,
packageList)))))
except (IOError,OSError),e:
return False
return True
def createUnmaskList(self,chrootdir,filename):
"""Create package unmask list by chrootdir"""
pkgdir = path.join(chrootdir,'var/db/pkg')
if not path.exists(chrootdir):
return False
try:
packageList = sorted(reduce(lambda x,y:x+map(lambda x:path.join(y,x),
os.listdir(path.join(pkgdir,y))), os.listdir(pkgdir),[]))
open(filename,'w').writelines(map(lambda x:"=%s\n"%x,packageList))
except (IOError,OSError),e:
return False
return True
def createDigest(self,filename,digestfile):
"""Create file with digest"""
template = """# %(alg)s HASH\n%(digest)s %(filename)s\n"""

Loading…
Cancel
Save