From c21d0c64a04137731b43ea7ab0ce83d46589ed3f Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Thu, 20 Mar 2014 15:26:32 -0700 Subject: [PATCH] FIXED: dependency to tusk Previously, jake install was calling tusk to ensure installed packages are up to date, and was used to install the new build. As tusk and all that narwhal suite is deprecated and causes more and more problems, this patch: - removes the up-to-date check: it's very likely that no package will never be updated anymore - uses a local function to install the freshly build --- Jakefile | 18 +++----------- common.jake | 71 ++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/Jakefile b/Jakefile index 4dcff0811..d88f8aa73 100644 --- a/Jakefile +++ b/Jakefile @@ -43,24 +43,14 @@ task ("CommonJS", [$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCIN task ("install", ["CommonJS"], function() { - // FIXME: require("narwhal/tusk/install").install({}, $COMMONJS); - // Doesn't work due to some weird this.print business. - if (OS.system(["tusk", "install", "--force", $BUILD_CJS_OBJECTIVE_J, $BUILD_CJS_CAPPUCCINO])) { - colorPrint("Installation failed, possibly because you do not have permissions.", "red"); - colorPrint("Try re-running using '" + colorize("jake sudo-install", "yellow") + "'.", "red"); - OS.exit(1); //rake abort if ($? != 0) - } + installCopy($BUILD_CJS_OBJECTIVE_J, false); + installCopy($BUILD_CJS_CAPPUCCINO, false); }); task ("sudo-install", ["CommonJS"], function() { - // FIXME: require("narwhal/tusk/install").install({}, $COMMONJS); - // Doesn't work due to some weird this.print business. - if (OS.system(["sudo", "tusk", "install", "--force", $BUILD_CJS_OBJECTIVE_J, $BUILD_CJS_CAPPUCCINO])) - { - // Attempt a hackish work-around for sudo compiled with the --with-secure-path option - sudo("tusk install --force " + $BUILD_CJS_OBJECTIVE_J + " " + $BUILD_CJS_CAPPUCCINO); - } + installCopy($BUILD_CJS_OBJECTIVE_J, true); + installCopy($BUILD_CJS_CAPPUCCINO, true); }); task ("install-symlinks", function() diff --git a/common.jake b/common.jake index d9112d415..f9a7f6569 100644 --- a/common.jake +++ b/common.jake @@ -35,6 +35,8 @@ SYSTEM.args.slice(1).forEach(function(arg) function ensurePackageUpToDate(packageName, requiredVersion, options) { + return; + options = options || {}; var packageInfo = require("narwhal/packages").catalog[packageName]; @@ -94,23 +96,25 @@ function ensurePackageUpToDate(packageName, requiredVersion, options) } } -// UPDATE THESE TO PICK UP CORRESPONDING CHANGES IN DEPENDENCIES -ensurePackageUpToDate("jake", "0.3"); -ensurePackageUpToDate("browserjs", "0.1.1"); -ensurePackageUpToDate("shrinksafe", "0.2"); -ensurePackageUpToDate("narwhal", "0.3.1", { - noupdate : true, - message : "Update Narwhal by re-running bootstrap.sh, or pulling the latest from git (see: http://github.com/280north/narwhal)." -}); -ensurePackageUpToDate("narwhal-jsc", "0.3", { - optional : true, - after : function(dir) { - if (OS.system("cd " + OS.enquote(dir) + " && make webkit")) { - print("Problem building narwhal-jsc."); - OS.exit(1); - } - } -}); +// This is disabled because tusk causes a lot of problems, and no packages will +// never be updated anyway +// // UPDATE THESE TO PICK UP CORRESPONDING CHANGES IN DEPENDENCIES +// ensurePackageUpToDate("jake", "0.3"); +// ensurePackageUpToDate("browserjs", "0.1.1"); +// ensurePackageUpToDate("shrinksafe", "0.2"); +// ensurePackageUpToDate("narwhal", "0.3.1", { +// noupdate : true, +// message : "Update Narwhal by re-running bootstrap.sh, or pulling the latest from git (see: http://github.com/280north/narwhal)." +// }); +// ensurePackageUpToDate("narwhal-jsc", "0.3", { +// optional : true, +// after : function(dir) { +// if (OS.system("cd " + OS.enquote(dir) + " && make webkit")) { +// print("Problem building narwhal-jsc."); +// OS.exit(1); +// } +// } +// }); var JAKE = require("jake"); @@ -444,6 +448,39 @@ global.installSymlink = function(sourcePath) } }; +global.installCopy = function(sourcePath, useSudo) +{ + if (!FILE.isDirectory(sourcePath)) + return; + + var packageName = FILE.basename(sourcePath), + targetPath = FILE.join(SYSTEM.prefix, "packages", packageName); + + if (FILE.isDirectory(targetPath)) + FILE.rmtree(targetPath); + else if (FILE.linkExists(targetPath)) + FILE.remove(targetPath); + + stream.print("Copying \0cyan(" + sourcePath + "\0) ==> \0cyan(" + targetPath + "\0)"); + + // hacky way to do a sudo copy. + if (useSudo) + OS.system(["sudo", "cp", "-r", sourcePath, targetPath]); + else + FILE.copyTree(sourcePath, targetPath); + + var binPath = FILE.Path(FILE.join(targetPath, "bin")); + + if (binPath.isDirectory()) + { + binPath.list().forEach(function (name) + { + var binary = binPath.join(name); + binary.chmod(0755); + }); + } +}; + global.spawnJake = function(/*String*/ aTaskName) { if (OS.system(serializedENV() + " " + SYSTEM.args[0] + " " + aTaskName))