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
This commit is contained in:
Antoine Mercadal
2014-03-20 16:28:57 -07:00
parent 9e918cc717
commit c21d0c64a0
2 changed files with 58 additions and 31 deletions
+4 -14
View File
@@ -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()
+54 -17
View File
@@ -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))