From: Michael Tremer Date: Tue, 26 Jan 2010 19:26:46 +0000 (+0100) Subject: naoki: Link /tools_XXX to actual directory if needed. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6855a9e69d0816bd7aed5ad16bb8e2f4ddbf900;p=ipfire-3.x.git naoki: Link /tools_XXX to actual directory if needed. --- diff --git a/naoki/chroot.py b/naoki/chroot.py index 266a0670e..defcc4b5f 100644 --- a/naoki/chroot.py +++ b/naoki/chroot.py @@ -256,6 +256,8 @@ class Environment(object): class Toolchain(object): + arch = "i686" + def __init__(self): util.mkdir(TOOLCHAINSDIR) @@ -314,6 +316,8 @@ class Toolchain(object): util.rm(source_dir) util.mkdir(source_dir) + self.checkLink() + return self.make(pkg, "package") def compress(self): @@ -327,9 +331,25 @@ class Toolchain(object): def build(self): self.log.info("Building toolchain...") + packages = package.depsort(package.list(toolchain=True)) for pkg in packages: if pkg.isBuilt: continue self.build_package(pkg) self.compress() + + def checkLink(self): + link = "/tools_%s" % self.arch + destination = os.path.abspath(self.build_dir) + + if not os.path.islink(link): + # File is not a link. Remove it... + util.rm(link) + + else: + # If link points to correct destination we break up + if os.path.abspath(os.readlink(link)) == destination: + return + + os.symlink(destination, link)