From ee0140e66e3f2621e3d6ecc2644dd39253450a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ozan=20=C3=87a=C4=9Flayan?= Date: Thu, 9 Apr 2009 13:08:19 +0000 Subject: [PATCH] Special method for correctly installing headers needed by userspace(libc, etc.) into /usr/include --- pisi/actionsapi/kerneltools.py | 53 +++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/pisi/actionsapi/kerneltools.py b/pisi/actionsapi/kerneltools.py index 1ba40095..069fe7d1 100644 --- a/pisi/actionsapi/kerneltools.py +++ b/pisi/actionsapi/kerneltools.py @@ -105,11 +105,7 @@ def install(): pisitools.remove("/lib/modules/%s/source" % suffix) pisitools.remove("/lib/modules/%s/build" % suffix) - - # Install kernel image - # TODO: For supporting more architectures in the future, we'll need a more - # flexible method here instead of hardcoding x86. pisitools.insinto("/boot/", "arch/x86/boot/bzImage", "kernel-%s" % suffix) @@ -131,7 +127,7 @@ def installHeaders(extra=[]): ( " -prune -o -path ".join(["'./%s/*'" % l for l in pruned]), " -o -name ".join(["'%s'" % k for k in wanted]) - ) + " | cpio -pd --preserve-modification-time %s" % destination + ) + " | cpio -pVd --preserve-modification-time %s" % destination shelltools.system(find_cmd) @@ -145,14 +141,53 @@ def installHeaders(extra=[]): # Finally copy the include directories found in arch/ shelltools.system("(find arch -name include -type d -print | \ xargs -n1 -i: find : -type f) | \ - cpio -pd --preserve-modification-time %s" % destination) + cpio -pVd --preserve-modification-time %s" % destination) # Settle the correct build symlink to this headers pisitools.dosym("/%s" % headersDirectoryName, "/lib/modules/%s/build" % suffix) +def installLibcHeaders(): + headers_tmp = os.path.join(get.installDIR(), 'tmp-headers') + headers_dir = os.path.join(get.installDIR(), 'usr/include') + + make_cmd = "O=%s INSTALL_HDR_PATH=%s/install" % (headers_tmp, headers_tmp) + + # Cleanup temporary header directory + shelltools.system("rm -rf %s" % headers_tmp) + + # Create directories + shelltools.makedirs(headers_tmp) + shelltools.makedirs(headers_dir) + + # make defconfig and install the headers + autotools.make("%s defconfig" % make_cmd) + autotools.rawInstall(make_cmd, "headers_install") + + oldwd = os.getcwd() + + shelltools.cd(os.path.join(headers_tmp, "install", "include")) + shelltools.system("find . -name '.' -o -name '.*' -prune -o -print | \ + cpio -pVd --preserve-modification-time %s" % headers_dir) + + shelltools.cd(oldwd) + + # FIXME: Do we really need to delete those directories below? + """ + # remove all directories other than asm/asm-generic and linux + # FIXME: Check this. + for directory in shelltools.ls("%s/usr/include/" % get.installDIR()): + if directory not in ["asm", "asm-generic", "linux"]: + pisitools.removeDir("/usr/include/%s" % directory) + """ + + # Remove tmp directory + shelltools.system("rm -rf %s" % headers_tmp) + + def installSource(): destination = "usr/src/linux-source-%s" % __getSuffix() + # Copy the whole source directory pisitools.dodir("/usr/src") shelltools.copytree("../%s/" % os.path.basename(get.curDIR()), os.path.join(get.installDIR(), destination)) @@ -160,12 +195,14 @@ def installSource(): shelltools.cd(os.path.join(get.installDIR(), destination)) autotools.make("clean") autotools.make("modules_prepare") + shelltools.system("rm -rf ./.*") def cleanModuleFiles(): """ Cleans module.* files generated by depmod """ # Remove modules.* files, they will be autogenerated during pakhandler. - # TODO: Ubuntu doesn't remove modules.order, reinvestigate. - pisitools.remove("/lib/modules/%s/modules.*" % __getSuffix()) + # Don't remove modules.order generated by kbuild for ordering the modules + # according to the link order. + shelltools.system("find . -name 'modules.*' -not -name 'modules.order' -exec rm -f '{}' \;") def mkinitramfs(): """ Create and install the initramfs image into the package. This will hopefully be done on user's system. """