|
|
|
@ -1632,51 +1632,54 @@ class cl_assemble(color_print):
|
|
|
|
|
self.clVars.Get('cl_assemble_pkgdir'))
|
|
|
|
|
dbPkg = pathJoin(chrootPath, 'var/db/pkg')
|
|
|
|
|
|
|
|
|
|
if not path.exists(dbPkg):
|
|
|
|
|
os.makedirs(dbPkg)
|
|
|
|
|
if not path.exists(pkgDir):
|
|
|
|
|
os.makedirs(pkgDir)
|
|
|
|
|
if path.exists(dbPkg) and path.exists(pkgDir):
|
|
|
|
|
# get pkg list from distro
|
|
|
|
|
pkgList = \
|
|
|
|
|
reduce(lambda x,y:x+y,
|
|
|
|
|
map(lambda x:map(lambda z:path.join(x,"%s.tbz2"%z),
|
|
|
|
|
os.listdir(path.join(dbPkg,x))),
|
|
|
|
|
os.listdir(dbPkg)),[])
|
|
|
|
|
# get binary packages
|
|
|
|
|
binList = \
|
|
|
|
|
reduce(lambda x,y:x+y,
|
|
|
|
|
map(lambda x:map(lambda z:path.join(x,z)[len(pkgDir)+1:],
|
|
|
|
|
os.listdir(path.join(x))),
|
|
|
|
|
filter(lambda x:path.isdir(x),
|
|
|
|
|
map(lambda x:path.join(pkgDir,x),
|
|
|
|
|
os.listdir(pkgDir)))),[])
|
|
|
|
|
|
|
|
|
|
# remove files which in binary and not in db/pkg
|
|
|
|
|
map(lambda x:os.unlink(x),
|
|
|
|
|
map(lambda x:pathJoin(pkgDir,x),
|
|
|
|
|
list(set(binList)-set(pkgList))))
|
|
|
|
|
|
|
|
|
|
# remove empty directories
|
|
|
|
|
map(lambda x:os.rmdir(x),
|
|
|
|
|
filter(lambda x:path.isdir(x) and not os.listdir(x),
|
|
|
|
|
map(lambda x:path.join(pkgDir,x),
|
|
|
|
|
os.listdir(pkgDir))))
|
|
|
|
|
|
|
|
|
|
#packagesDir = 'usr/portage/packages'
|
|
|
|
|
#x11_drivers = 'x11-drivers'
|
|
|
|
|
#nvidiaDir = pathJoin(chrootPath, packagesDir,x11_drivers)
|
|
|
|
|
|
|
|
|
|
#pkgDirX11Drivers = pathJoin(pkgDir,'x11-drivers')
|
|
|
|
|
#if not path.exists(pkgDirX11Drivers):
|
|
|
|
|
# os.makedirs(pkgDirX11Drivers,mode=0755)
|
|
|
|
|
#map(lambda x:copyfile(pathJoin(nvidiaDir,x),
|
|
|
|
|
# pathJoin(pkgDirX11Drivers,x)),
|
|
|
|
|
# listDirectory(nvidiaDir))
|
|
|
|
|
|
|
|
|
|
self.regenPackages(chrootPath,pkgDir[len(chrootPath):])
|
|
|
|
|
else:
|
|
|
|
|
self.printByResult(skip=True)
|
|
|
|
|
try:
|
|
|
|
|
if not path.exists(dbPkg):
|
|
|
|
|
os.makedirs(dbPkg)
|
|
|
|
|
if not path.exists(pkgDir):
|
|
|
|
|
os.makedirs(pkgDir)
|
|
|
|
|
if path.exists(dbPkg) and path.exists(pkgDir):
|
|
|
|
|
# get pkg list from distro
|
|
|
|
|
pkgList = \
|
|
|
|
|
reduce(lambda x,y:x+y,
|
|
|
|
|
map(lambda x:map(lambda z:path.join(x,"%s.tbz2"%z),
|
|
|
|
|
os.listdir(path.join(dbPkg,x))),
|
|
|
|
|
os.listdir(dbPkg)),[])
|
|
|
|
|
# get binary packages
|
|
|
|
|
binList = \
|
|
|
|
|
reduce(lambda x,y:x+y,
|
|
|
|
|
map(lambda x:map(lambda z:path.join(x,z)[len(pkgDir)+1:],
|
|
|
|
|
os.listdir(path.join(x))),
|
|
|
|
|
filter(lambda x:path.isdir(x),
|
|
|
|
|
map(lambda x:path.join(pkgDir,x),
|
|
|
|
|
os.listdir(pkgDir)))),[])
|
|
|
|
|
|
|
|
|
|
# remove files which in binary and not in db/pkg
|
|
|
|
|
map(lambda x:os.unlink(x),
|
|
|
|
|
map(lambda x:pathJoin(pkgDir,x),
|
|
|
|
|
list(set(binList)-set(pkgList))))
|
|
|
|
|
|
|
|
|
|
# remove empty directories
|
|
|
|
|
map(lambda x:os.rmdir(x),
|
|
|
|
|
filter(lambda x:path.isdir(x) and not os.listdir(x),
|
|
|
|
|
map(lambda x:path.join(pkgDir,x),
|
|
|
|
|
os.listdir(pkgDir))))
|
|
|
|
|
|
|
|
|
|
#packagesDir = 'usr/portage/packages'
|
|
|
|
|
#x11_drivers = 'x11-drivers'
|
|
|
|
|
#nvidiaDir = pathJoin(chrootPath, packagesDir,x11_drivers)
|
|
|
|
|
|
|
|
|
|
#pkgDirX11Drivers = pathJoin(pkgDir,'x11-drivers')
|
|
|
|
|
#if not path.exists(pkgDirX11Drivers):
|
|
|
|
|
# os.makedirs(pkgDirX11Drivers,mode=0755)
|
|
|
|
|
#map(lambda x:copyfile(pathJoin(nvidiaDir,x),
|
|
|
|
|
# pathJoin(pkgDirX11Drivers,x)),
|
|
|
|
|
# listDirectory(nvidiaDir))
|
|
|
|
|
|
|
|
|
|
self.regenPackages(chrootPath,pkgDir[len(chrootPath):])
|
|
|
|
|
else:
|
|
|
|
|
self.printByResult(skip=True)
|
|
|
|
|
except OSError,e:
|
|
|
|
|
raise AssembleError(str(e))
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def createMaskList(self,chrootdir,filename):
|
|
|
|
|