mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'devel' into windows-preview-0.2.1
This commit is contained in:
@@ -70,6 +70,12 @@ CS.PackagesResolver.prototype.resolve = function (dependencies, constraints,
|
||||
CS.PackagesResolver._resolveWithInput = function (input, options) {
|
||||
options = options || {};
|
||||
|
||||
if (Meteor.isServer &&
|
||||
process.env['METEOR_PRINT_CONSTRAINT_SOLVER_INPUT']) {
|
||||
console.log("CONSTRAINT_SOLVER_INPUT = ");
|
||||
console.log(JSON.stringify(input.toJSONable(), null, 2));
|
||||
}
|
||||
|
||||
var solver = new CS.Solver(input, {
|
||||
nudge: options.nudge
|
||||
});
|
||||
|
||||
@@ -718,3 +718,20 @@ Tinytest.add("constraint solver - input - update indirect deps", function (test)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Tinytest.add("constraint solver - input - package is only weak dep", function (test) {
|
||||
doTest(test, {
|
||||
dependencies: ["foo"],
|
||||
constraints: [],
|
||||
previousSolution: {},
|
||||
catalogCache: {
|
||||
data: {
|
||||
"foo 1.0.0": ["?bar"]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
answer: {
|
||||
foo: "1.0.0"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -167,7 +167,7 @@ CS.Solver.prototype.analyze = function () {
|
||||
analysis.unknownPackages[p2].push(pvVar(p, v));
|
||||
} else {
|
||||
if (! dep.isWeak) {
|
||||
if (analysis.reachablePackages[p2] !== true) {
|
||||
if (! _.has(analysis.reachablePackages, p2)) {
|
||||
markReachable(p2);
|
||||
}
|
||||
}
|
||||
@@ -551,11 +551,26 @@ CS.Solver.prototype.getSolution = function (options) {
|
||||
});
|
||||
self.throwAnyErrors();
|
||||
|
||||
var unknownPackages = _.keys(analysis.unknownPackages);
|
||||
if (unknownPackages.length) {
|
||||
// XXX make sure we've created variables for these so we don't
|
||||
// get an error from the solver. there is probably a better
|
||||
// way to address this.
|
||||
_.each(unknownPackages, function (p) {
|
||||
logic.getVarNum(p);
|
||||
});
|
||||
self.solution = logic.solve();
|
||||
if (! self.solution) {
|
||||
// all we did was add new, unconstrained variables
|
||||
throw new Error("Unexpected unsatisfiability");
|
||||
}
|
||||
}
|
||||
|
||||
// try not to use any unknown packages. If the minimum is greater
|
||||
// than 0, we'll throw an error later, after we apply the constraints
|
||||
// and the cost function, so that we can explain the problem to the
|
||||
// user in a convincing way.
|
||||
self.minimize('unknown_packages', _.keys(analysis.unknownPackages));
|
||||
self.minimize('unknown_packages', unknownPackages);
|
||||
|
||||
// try not to set the conflictVar on any constraint. If the minimum
|
||||
// is greater than 0, we'll throw an error later, after we've run the
|
||||
@@ -689,7 +704,6 @@ CS.Solver.prototype.getSolution = function (options) {
|
||||
|
||||
// throw errors about unknown packages
|
||||
if (self.stepsByName['unknown_packages'].optimum > 0) {
|
||||
var unknownPackages = _.keys(analysis.unknownPackages);
|
||||
var unknownPackagesNeeded = _.filter(unknownPackages, function (p) {
|
||||
return self.solution.evaluate(p);
|
||||
});
|
||||
|
||||
@@ -933,80 +933,6 @@ LExit:
|
||||
SetProgressState(hrStatus);
|
||||
}
|
||||
|
||||
/*
|
||||
virtual STDMETHODIMP_(int) OnResolveSource(
|
||||
__in_z LPCWSTR wzPackageOrContainerId,
|
||||
__in_z_opt LPCWSTR wzPayloadId,
|
||||
__in_z LPCWSTR wzLocalSource,
|
||||
__in_z_opt LPCWSTR wzDownloadSource
|
||||
)
|
||||
{
|
||||
int nResult = IDERROR; // assume we won't resolve source and that is unexpected.
|
||||
|
||||
LPWSTR sczHTTPDwnUserName = NULL;
|
||||
LPWSTR sczHTTPDwnPassword = NULL;
|
||||
LPWSTR sczHTTPDwnHost = NULL;
|
||||
BOOL bUseHTTPAuth = FALSE;
|
||||
BOOL bUpdateDwnSrc = FALSE;
|
||||
|
||||
|
||||
|
||||
if (BOOTSTRAPPER_DISPLAY_FULL == m_command.display)
|
||||
{
|
||||
if (wzDownloadSource)
|
||||
{
|
||||
if (bUseHTTPAuth || bUpdateDwnSrc)
|
||||
{
|
||||
HRESULT hr = m_pEngine->SetDownloadSource(wzPackageOrContainerId, wzPayloadId, wzDownloadSource, sczHTTPDwnUserName, sczHTTPDwnPassword);
|
||||
nResult = SUCCEEDED(hr) ? IDDOWNLOAD : IDERROR;
|
||||
}
|
||||
else
|
||||
nResult = IDDOWNLOAD;
|
||||
}
|
||||
else // prompt to change the source location.
|
||||
{
|
||||
OPENFILENAMEW ofn = { };
|
||||
WCHAR wzFile[MAX_PATH] = { };
|
||||
|
||||
::StringCchCopyW(wzFile, countof(wzFile), wzLocalSource);
|
||||
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = m_hWnd;
|
||||
ofn.lpstrFile = wzFile;
|
||||
ofn.nMaxFile = countof(wzFile);
|
||||
ofn.lpstrFilter = L"All Files\0*.*\0";
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
|
||||
ofn.lpstrTitle = m_pTheme->sczCaption;
|
||||
|
||||
if (::GetOpenFileNameW(&ofn))
|
||||
{
|
||||
HRESULT hr = m_pEngine->SetLocalSource(wzPackageOrContainerId, wzPayloadId, ofn.lpstrFile);
|
||||
nResult = SUCCEEDED(hr) ? IDRETRY : IDERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
nResult = IDCANCEL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (wzDownloadSource)
|
||||
{
|
||||
// If doing a non-interactive install and download source is available, let's try downloading the package silently
|
||||
if (bUseHTTPAuth || bUpdateDwnSrc)
|
||||
{
|
||||
HRESULT hr = m_pEngine->SetDownloadSource(wzPackageOrContainerId, wzPayloadId, wzDownloadSource, sczHTTPDwnUserName, sczHTTPDwnPassword);
|
||||
nResult = SUCCEEDED(hr) ? IDRETRY : IDERROR;
|
||||
}
|
||||
else
|
||||
nResult = IDDOWNLOAD;
|
||||
}
|
||||
// else there's nothing more we can do in non-interactive mode
|
||||
|
||||
return CheckCanceled() ? IDCANCEL : nResult;
|
||||
}
|
||||
*/
|
||||
|
||||
virtual STDMETHODIMP_(int) OnResolveSource(
|
||||
__in_z LPCWSTR wzPackageOrContainerId,
|
||||
__in_z_opt LPCWSTR wzPayloadId,
|
||||
|
||||
@@ -181,7 +181,6 @@ var running = false;
|
||||
|
||||
var start = function () {
|
||||
bucketTimes = {};
|
||||
currentEntry = [];
|
||||
running = true;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ var release = require('./release.js');
|
||||
var tropohouse = require('./tropohouse.js');
|
||||
var utils = require('./utils.js');
|
||||
var watch = require('./watch.js');
|
||||
var Profile = require('./profile.js').Profile;
|
||||
|
||||
// The ProjectContext represents all the context associated with an app:
|
||||
// metadata files in the `.meteor` directory, the choice of package versions
|
||||
@@ -407,6 +408,8 @@ _.extend(ProjectContext.prototype, {
|
||||
var anticipatedPrereleases = self._getAnticipatedPrereleases(
|
||||
depsAndConstraints.constraints, cachedVersions);
|
||||
|
||||
var resolverRunCount = 0;
|
||||
|
||||
// Nothing before this point looked in the official or project catalog!
|
||||
// However, the resolver does, so it gets run in the retry context.
|
||||
catalog.runAndRetryWithRefreshIfHelpful(function (canRetry) {
|
||||
@@ -433,10 +436,18 @@ _.extend(ProjectContext.prototype, {
|
||||
resolveOptions.upgradeIndirectDepPatchVersions = true;
|
||||
}
|
||||
|
||||
resolverRunCount++;
|
||||
|
||||
var solution;
|
||||
try {
|
||||
var solution = resolver.resolve(
|
||||
depsAndConstraints.deps, depsAndConstraints.constraints,
|
||||
resolveOptions);
|
||||
Profile.run(
|
||||
"Select Package Versions" +
|
||||
(resolverRunCount > 1 ? (" (Try " + resolverRunCount + ")") : ""),
|
||||
function () {
|
||||
solution = resolver.resolve(
|
||||
depsAndConstraints.deps, depsAndConstraints.constraints,
|
||||
resolveOptions);
|
||||
});
|
||||
} catch (e) {
|
||||
if (!e.constraintSolverError && !e.versionParserError)
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user