From 8bc973364526449a94d9bde16c099cd1617bf80e Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 20 May 2014 11:51:46 -0700 Subject: [PATCH 1/7] try to update to different things --- tools/catalog.js | 8 +++-- tools/commands.js | 90 +++++++++++++++++++++++++++++++++-------------- tools/main.js | 10 +++++- 3 files changed, 78 insertions(+), 30 deletions(-) diff --git a/tools/catalog.js b/tools/catalog.js index b01bd8de41..e73a6b95dc 100644 --- a/tools/catalog.js +++ b/tools/catalog.js @@ -763,11 +763,15 @@ _.extend(Catalog.prototype, { // Given a release track, return all recommended versions for this track, sorted // by their orderKey. Returns the empty array if the release track does not // exist or does not have any recommended versions. - getSortedRecommendedReleaseVersions: function (track) { + getSortedRecommendedReleaseVersions: function (track, laterThanOrderKey) { var self = this; self._requireInitialized(); - var recommended = _.where(self.releaseVersions, { track: track, recommended: true}); + var recommended = _.filter(self.releaseVersions, function (v) { + if (v.track !== track || !v.recommended) + return false; + return laterThanOrderKey === null || v.orderKey > laterThanOrderKey; + }); var recSort = _.sortBy(recommended, function (rec) { return rec.orderKey; }); diff --git a/tools/commands.js b/tools/commands.js index d616f05f19..14384644fc 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -419,17 +419,21 @@ main.registerCommand({ return 1; } - // Unless --release was passed (meaning that either the user asked for a - // particular release, or that we _just did_ this and springboarded at - // #UpdateSpringboard), go get the latest release and switch to it. (We - // already know what the latest release is because we refreshed the catalog - // above.) + // Unless --release was passed (in which case we ought to already have + // springboarded to that release), go get the latest release and switch to + // it. (We already know what the latest release is because we refreshed the + // catalog above.) Note that after springboarding, we will hit this again + // (because springboarding to a specific release does NOT set release.forced), + // but it should be a no-op next time (unless there actually was a new latest + // release in the interim). if (! release.forced) { if (! release.current || release.current.name !== release.latestDownloaded()) { // The user asked for the latest release (well, they "asked for it" by not // passing --release). We're not currently running the latest release (we // may have even just learned about it). #UpdateSpringboard + // XXX this is wrong, it should springboard to the latest release + // *IN THE CURRENT TRACK*, not METEOR-CORE (unlike 'meteor create') throw new main.SpringboardToLatestRelease; } } @@ -443,7 +447,7 @@ main.registerCommand({ // If we're not in an app, then we're done (other than maybe printing some // stuff). if (! options.appDir) { - if (release.forced) { + if (release.forced || process.env.METEOR_SPRINGBOARD_RELEASE) { // We get here if: // 1) the user ran 'meteor update' and we found a new version // 2) the user ran 'meteor update --release xyz' (regardless of @@ -451,7 +455,9 @@ main.registerCommand({ // // In case (1), we downloaded and installed the update and then // we springboarded (at #UpdateSpringboard above), causing - // release.forced to be true. + // $METEOR_SPRINGBOARD_RELEASE to be true. + // XXX probably should have a better interface than looking directly + // at the env var here // // In case (2), we downloaded, installed, and springboarded to // the requested release in the initialization code, before the @@ -481,12 +487,6 @@ main.registerCommand({ // Otherwise, we have to upgrade the app too, if the release changed. var appRelease = project.getMeteorReleaseVersion(options.appDir); if (appRelease !== null && appRelease === release.current.name) { - // Note that in this case, release.forced is true iff --release was actually - // passed on the command-line: #UpdateSpringboard can't have occured. Why? - // Well, if the user didn't specify --release but we're in an app, then - // release.current.name must have been taken from the app, and - // #UpdateSpringboard only happens if needs to try to change the app - // release, and this is the message for not needing to change the release. var maybeTheLatestRelease = release.forced ? "" : ", the latest release"; var maybeOnThisComputer = couldNotContactServer ? "\ninstalled on this computer" : ""; @@ -498,27 +498,63 @@ main.registerCommand({ // OK, let's figure out what release fits with our package constraints! - // XXX this will actually be a loop over possible releases in the non-force - // case - // XXX better error checking on name - var releaseRecord = catalog.getReleaseVersion( - release.current.name.split('@')[0], release.current.name.split('@')[1]); - if (!releaseRecord) - throw Error("missing release record?"); + // XXX better error checking on release.current.name + // XXX add a method to release.current + var currentReleaseTrack = release.current.name.split('@')[0]; + var releaseVersionsToTry; + if (release.forced) { + releaseVersionsToTry = [release.current.name.split('@')[1]]; + } else { + // XXX clean up all this splitty stuff + var appReleaseInfo = catalog.getReleaseVersion( + appRelease.split('@')[0], appRelease.split('@')[1]); + var appOrderKey = (appReleaseInfo && appReleaseInfo.orderKey) || null; + releaseVersionsToTry = catalog.getSortedRecommendedReleaseVersions( + currentReleaseTrack, appOrderKey); + if (!releaseVersionsToTry.length) { + // XXX make error better, and make sure that the "already there" error + // above truly does cover every other case + var maybeOnThisComputer = + couldNotContactServer ? "\ninstalled on this computer" : ""; + console.log( +"This project is already at Meteor %s, which is newer than the latest release%s.", + appRelease, maybeOnThisComputer); + return; + } + } + + var solutionVersions = null; var directDependencies = project.getDirectDependencies(options.appDir); var previousVersions = project.getIndirectDependencies(options.appDir); - var constraints = project.combinedConstraints( - directDependencies, releaseRecord.packages); - var solutionVersions = catalog.resolveConstraints( - constraints, { previousSolution: previousVersions }); + _.find(releaseVersionsToTry, function (releaseVersionToTry) { + var releaseRecord = catalog.getReleaseVersion( + currentReleaseTrack, releaseVersionToTry); + if (!releaseRecord) + throw Error("missing release record?"); + var constraints = project.combinedConstraints( + directDependencies, releaseRecord.packages); + try { + solutionVersions = catalog.resolveConstraints( + constraints, { previousSolution: previousVersions }); + } catch (e) { + // XXX we should make the error handling explicitly detectable, and not + // actually mention failures that are recoverable + process.stderr.write( + "XXX Update to release " + currentReleaseTrack + + "@" + releaseVersionToTry + " impossible: " + e.message + "\n"); + return false; + } + return true; + }); + if (!solutionVersions) { - // XXX text - process.stderr.write( - "Couldn't solve the update to " + release.current.name + ". Ah well.\n"); + // XXX put an error here when we stop doing an error on every failure above return 1; } + project.setDependencies(options.appDir, directDependencies.appDeps, solutionVersions); + // XXX did we have to change some package versions? we should probably // mention that fact. diff --git a/tools/main.js b/tools/main.js index bc70e5a23b..99e70c9bed 100644 --- a/tools/main.js +++ b/tools/main.js @@ -630,6 +630,7 @@ Fiber(function () { // #ImprovingCrossVersionOptionParsing. var releaseOverride = null; + var releaseForced = false; if (_.has(rawOptions, '--release')) { if (rawOptions['--release'].length > 1) { process.stderr.write( @@ -638,6 +639,7 @@ Fiber(function () { process.exit(1); } releaseOverride = rawOptions['--release'][0]; + releaseForced = true; if (! releaseOverride) { process.stderr.write( "The --release option needs a value.\n" + @@ -648,6 +650,12 @@ Fiber(function () { } if (_.has(process.env, 'METEOR_SPRINGBOARD_RELEASE')) { // See #SpringboardEnvironmentVar + // Note that this does *NOT* cause release.forced to be true. + // release.forced should only be set when the user actually + // ran with --release, not just because (eg) they ran + // 'meteor update' and we springboarded to the latest release. + // (It's important that 'meteor update' be able to tell these + // conditions apart even after the springboard!) releaseOverride = process.env['METEOR_SPRINGBOARD_RELEASE']; } @@ -741,7 +749,7 @@ Fiber(function () { throw e; } - release.setCurrent(rel, /* forced */ !! releaseOverride); + release.setCurrent(rel, releaseForced); } // If we're not running the correct version of the tools for this From fa280a364dd8e58ab9be0b799373ef0d7db54e1f Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 20 May 2014 15:38:53 -0700 Subject: [PATCH 2/7] actually update to the release we found --- tools/catalog.js | 2 +- tools/commands.js | 139 +++++++++++++++++++++++++--------------------- 2 files changed, 77 insertions(+), 64 deletions(-) diff --git a/tools/catalog.js b/tools/catalog.js index e73a6b95dc..7453ac76d0 100644 --- a/tools/catalog.js +++ b/tools/catalog.js @@ -770,7 +770,7 @@ _.extend(Catalog.prototype, { var recommended = _.filter(self.releaseVersions, function (v) { if (v.track !== track || !v.recommended) return false; - return laterThanOrderKey === null || v.orderKey > laterThanOrderKey; + return !laterThanOrderKey || v.orderKey > laterThanOrderKey; }); var recSort = _.sortBy(recommended, function (rec) { return rec.orderKey; diff --git a/tools/commands.js b/tools/commands.js index 14384644fc..397e2d1883 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -523,111 +523,124 @@ main.registerCommand({ } } - var solutionVersions = null; + var solutionPackageVersions = null; var directDependencies = project.getDirectDependencies(options.appDir); var previousVersions = project.getIndirectDependencies(options.appDir); - _.find(releaseVersionsToTry, function (releaseVersionToTry) { + var solutionReleaseVersion = _.find(releaseVersionsToTry, function (versionToTry) { var releaseRecord = catalog.getReleaseVersion( - currentReleaseTrack, releaseVersionToTry); + currentReleaseTrack, versionToTry); if (!releaseRecord) throw Error("missing release record?"); var constraints = project.combinedConstraints( directDependencies, releaseRecord.packages); try { - solutionVersions = catalog.resolveConstraints( + solutionPackageVersions = catalog.resolveConstraints( constraints, { previousSolution: previousVersions }); } catch (e) { // XXX we should make the error handling explicitly detectable, and not // actually mention failures that are recoverable process.stderr.write( "XXX Update to release " + currentReleaseTrack + - "@" + releaseVersionToTry + " impossible: " + e.message + "\n"); + "@" + versionToTry + " impossible: " + e.message + "\n"); return false; } return true; }); - if (!solutionVersions) { + if (!solutionReleaseVersion) { // XXX put an error here when we stop doing an error on every failure above return 1; } - project.setDependencies(options.appDir, directDependencies.appDeps, - solutionVersions); + var solutionReleaseName = currentReleaseTrack + '@' + solutionReleaseVersion; + + // We could at this point springboard to solutionRelease (which is no newer + // than the release we are currently running), but there's no clear advantage + // to this yet. The main reason might be if we decide to delete some + // backward-compatibility code which knows how to deal with an older release, + // but if we actually do that, we can change this code to add the extra + // springboard at that time. + // XXX did we have to change some package versions? we should probably // mention that fact. + // XXX reimplement upgraders (or don't, until we need them). + // // Find upgraders (in order) necessary to upgrade the app for the new + // // release (new metadata file formats, etc, or maybe even updating renamed + // // APIs). + // // + // // * If this is a pre-engine app with no .meteor/release file, run + // // all upgraders. + // // * If the app didn't have a release because it was created by a + // // checkout, don't run any upgraders. + // // + // // We're going to need the list of upgraders from the old release + // // (the release the app was using previously) to decide what + // // upgraders to run. It's possible that we don't have it downloaded + // // yet (if they checked out the project and immediately ran 'meteor + // // update --release foo'), so it's important to do this before we + // // actually update the project. + // var upgradersToRun; + // if (appRelease === "none") { + // upgradersToRun = []; + // } else { + // var oldUpgraders; - // Find upgraders (in order) necessary to upgrade the app for the new - // release (new metadata file formats, etc, or maybe even updating renamed - // APIs). - // - // * If this is a pre-engine app with no .meteor/release file, run - // all upgraders. - // * If the app didn't have a release because it was created by a - // checkout, don't run any upgraders. - // - // We're going to need the list of upgraders from the old release - // (the release the app was using previously) to decide what - // upgraders to run. It's possible that we don't have it downloaded - // yet (if they checked out the project and immediately ran 'meteor - // update --release foo'), so it's important to do this before we - // actually update the project. - var upgradersToRun; - if (appRelease === "none") { - upgradersToRun = []; - } else { - var oldUpgraders; + // if (appRelease === null) { + // oldUpgraders = []; + // } else { + // try { + // var oldRelease = release.load(appRelease); + // } catch (e) { + // if (e instanceof files.OfflineError) { + // process.stderr.write( + // "You need to be online to do this. Please check your internet connection.\n"); + // return 1; + // } + // if (e instanceof warehouse.NoSuchReleaseError) { + // // In this situation it's tempting to just print a warning and + // // skip the updaters, but I can't figure out how to explain + // // what's happening to the user, so let's just do this. + // process.stderr.write( + // "This project says that it uses version " + appRelease + " of Meteor, but you\n" + + // "don't have that version of Meteor installed and the Meteor update servers\n" + + // "don't have it either. Please edit the .meteor/release file in the project\n" + + // "project and change it to a valid Meteor release.\n"); + // return 1; + // } + // throw e; + // } + // oldUpgraders = oldRelease.getUpgraders(); + // } - if (appRelease === null) { - oldUpgraders = []; - } else { - try { - var oldRelease = release.load(appRelease); - } catch (e) { - if (e instanceof files.OfflineError) { - process.stderr.write( -"You need to be online to do this. Please check your internet connection.\n"); - return 1; - } - if (e instanceof warehouse.NoSuchReleaseError) { - // In this situation it's tempting to just print a warning and - // skip the updaters, but I can't figure out how to explain - // what's happening to the user, so let's just do this. - process.stderr.write( -"This project says that it uses version " + appRelease + " of Meteor, but you\n" + -"don't have that version of Meteor installed and the Meteor update servers\n" + -"don't have it either. Please edit the .meteor/release file in the project\n" + -"project and change it to a valid Meteor release.\n"); - return 1; - } - throw e; - } - oldUpgraders = oldRelease.getUpgraders(); - } + // // XXX release.current needs to be replaced with solutionReleaseName + // upgradersToRun = _.difference(release.current.getUpgraders(), oldUpgraders); + // } - upgradersToRun = _.difference(release.current.getUpgraders(), oldUpgraders); - } + // Write the new versions to .meteor/packages and .meteor/versions. + project.setDependencies(options.appDir, directDependencies.appDeps, + solutionPackageVersions); // Write the release to .meteor/release. - project.writeMeteorReleaseVersion(options.appDir, release.current.name); + project.writeMeteorReleaseVersion(options.appDir, solutionReleaseName); - // Now run the upgraders. - _.each(upgradersToRun, function (upgrader) { - require("./upgraders.js").runUpgrader(upgrader, options.appDir); - }); + // XXX redo upgrader support + // // Now run the upgraders. + // _.each(upgradersToRun, function (upgrader) { + // require("./upgraders.js").runUpgrader(upgrader, options.appDir); + // }); // This is the right spot to do any other changes we need to the app in // order to update it for the new release. console.log("%s: updated to Meteor %s.", - path.basename(options.appDir), release.current.name); + path.basename(options.appDir), solutionReleaseName); // Print any notices relevant to this upgrade. // XXX This doesn't include package-specific notices for packages that // are included transitively (eg, packages used by app packages). - var packages = project.getPackages(options.appDir); + // var packages = project.getPackages(options.appDir); // XXX reimplement "notices" for tropohouse // warehouse.printNotices(appRelease, release.current.name, packages); }); From 84e7342e82f399b5a2841158360b8b328b92d505 Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 20 May 2014 17:08:44 -0700 Subject: [PATCH 3/7] meteor update should keep you on track --- tools/catalog.js | 15 ++++++++------- tools/commands.js | 33 ++++++++++++++++++--------------- tools/main.js | 10 +++++++--- tools/release.js | 5 +++-- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/tools/catalog.js b/tools/catalog.js index 7453ac76d0..179a95a109 100644 --- a/tools/catalog.js +++ b/tools/catalog.js @@ -924,19 +924,20 @@ _.extend(Catalog.prototype, { }, // Returns the default release version: the latest recommended version on the - // default track. Returns null if no such thing exists (even after syncing - // with the server, which it only does if there is no eligible release - // version). - getDefaultReleaseVersion: function () { + // default track (or the specified track). Returns null if no such thing + // exists (even after syncing with the server, which it only does if there is + // no eligible release version). + getDefaultReleaseVersion: function (track) { var self = this; self._requireInitialized(); + track = track || catalog.DEFAULT_TRACK; + var attempt = function () { - var versions = self.getSortedRecommendedReleaseVersions( - catalog.DEFAULT_TRACK); + var versions = self.getSortedRecommendedReleaseVersions(track); if (!versions.length) return null; - return {track: catalog.DEFAULT_TRACK, version: versions[0]}; + return {track: track, version: versions[0]}; }; var ret = attempt(); diff --git a/tools/commands.js b/tools/commands.js index 397e2d1883..7f89ca1d1b 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -303,8 +303,9 @@ main.registerCommand({ // at the end.) if (! release.current.isCheckout() && release.current.name !== release.latestDownloaded() && - ! release.forced) + ! release.forced) { throw new main.SpringboardToLatestRelease; + } var exampleDir = path.join(__dirname, '..', 'examples'); var examples = _.reject(fs.readdirSync(exampleDir), function (e) { @@ -419,6 +420,14 @@ main.registerCommand({ return 1; } + // This is the release track we'll end up on --- either because it's + // the explicitly specified (with --release) track; or because we + // didn't specify a release and it's the app's current release (if we're + // in an app dir), since non-forced updates don't change the track. + // XXX better error checking on release.current.name + // XXX add a method to release.current + var releaseTrack = release.current.name.split('@')[0]; + // Unless --release was passed (in which case we ought to already have // springboarded to that release), go get the latest release and switch to // it. (We already know what the latest release is because we refreshed the @@ -428,13 +437,11 @@ main.registerCommand({ // release in the interim). if (! release.forced) { if (! release.current || - release.current.name !== release.latestDownloaded()) { + release.current.name !== release.latestDownloaded(releaseTrack)) { // The user asked for the latest release (well, they "asked for it" by not - // passing --release). We're not currently running the latest release (we - // may have even just learned about it). #UpdateSpringboard - // XXX this is wrong, it should springboard to the latest release - // *IN THE CURRENT TRACK*, not METEOR-CORE (unlike 'meteor create') - throw new main.SpringboardToLatestRelease; + // passing --release). We're not currently running the latest release on + // this track (we may have even just learned about it). #UpdateSpringboard + throw new main.SpringboardToLatestRelease(releaseTrack); } } @@ -498,9 +505,6 @@ main.registerCommand({ // OK, let's figure out what release fits with our package constraints! - // XXX better error checking on release.current.name - // XXX add a method to release.current - var currentReleaseTrack = release.current.name.split('@')[0]; var releaseVersionsToTry; if (release.forced) { releaseVersionsToTry = [release.current.name.split('@')[1]]; @@ -510,7 +514,7 @@ main.registerCommand({ appRelease.split('@')[0], appRelease.split('@')[1]); var appOrderKey = (appReleaseInfo && appReleaseInfo.orderKey) || null; releaseVersionsToTry = catalog.getSortedRecommendedReleaseVersions( - currentReleaseTrack, appOrderKey); + releaseTrack, appOrderKey); if (!releaseVersionsToTry.length) { // XXX make error better, and make sure that the "already there" error // above truly does cover every other case @@ -527,8 +531,7 @@ main.registerCommand({ var directDependencies = project.getDirectDependencies(options.appDir); var previousVersions = project.getIndirectDependencies(options.appDir); var solutionReleaseVersion = _.find(releaseVersionsToTry, function (versionToTry) { - var releaseRecord = catalog.getReleaseVersion( - currentReleaseTrack, versionToTry); + var releaseRecord = catalog.getReleaseVersion(releaseTrack, versionToTry); if (!releaseRecord) throw Error("missing release record?"); var constraints = project.combinedConstraints( @@ -540,7 +543,7 @@ main.registerCommand({ // XXX we should make the error handling explicitly detectable, and not // actually mention failures that are recoverable process.stderr.write( - "XXX Update to release " + currentReleaseTrack + + "XXX Update to release " + releaseTrack + "@" + versionToTry + " impossible: " + e.message + "\n"); return false; } @@ -552,7 +555,7 @@ main.registerCommand({ return 1; } - var solutionReleaseName = currentReleaseTrack + '@' + solutionReleaseVersion; + var solutionReleaseName = releaseTrack + '@' + solutionReleaseVersion; // We could at this point springboard to solutionRelease (which is no newer // than the release we are currently running), but there's no clear advantage diff --git a/tools/main.js b/tools/main.js index 99e70c9bed..8de8517266 100644 --- a/tools/main.js +++ b/tools/main.js @@ -80,7 +80,11 @@ main.WaitForExit = function () {}; // Exception to throw from a command to exit, restart, and reinvoke // the command with the latest available (downloaded) Meteor release. -main.SpringboardToLatestRelease = function () {}; +// If track is specified, it uses the latest available in the given +// track instead of the default track. +main.SpringboardToLatestRelease = function (track) { + this.track = track; +}; // Register a command-line command. // @@ -708,7 +712,7 @@ Fiber(function () { } } else { // Run outside an app dir with no --release flag. Use the latest - // release we know about. + // release we know about (in the default track). releaseName = release.latestDownloaded(); } } @@ -1060,7 +1064,7 @@ commandName + ": You're not in a Meteor package directory.\n"); if (e instanceof main.SpringboardToLatestRelease) { // Load the latest release's metadata so that we can figure out // the tools version that it uses. - var latestRelease = release.load(release.latestDownloaded()); + var latestRelease = release.load(release.latestDownloaded(e.track)); springboard(latestRelease, latestRelease.name); // (does not return) } diff --git a/tools/release.js b/tools/release.js index 6eb04d3a43..c85cc0f813 100644 --- a/tools/release.js +++ b/tools/release.js @@ -159,14 +159,15 @@ release.usingRightReleaseForApp = function (appDir) { // Return the name of the latest release that is downloaded and ready // for use. May not be called when running from a checkout. -release.latestDownloaded = function () { +// 'track' is optional (it defaults to the default track). +release.latestDownloaded = function (track) { if (! files.usesWarehouse()) throw new Error("called from checkout?"); // For self-test only. if (process.env.METEOR_TEST_LATEST_RELEASE) return process.env.METEOR_TEST_LATEST_RELEASE; - var defaultRelease = catalog.serverCatalog.getDefaultReleaseVersion(); + var defaultRelease = catalog.serverCatalog.getDefaultReleaseVersion(track); if (!defaultRelease) { throw new Error("no latest release available?"); } From 5954086e7ad20c62ee5409c29af497e8c9f2e539 Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 20 May 2014 18:33:13 -0700 Subject: [PATCH 4/7] fibers stopped polluting global namespace in 1.0.0 --- packages/meteor/fiber_helpers.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/meteor/fiber_helpers.js b/packages/meteor/fiber_helpers.js index 3b9cf53c10..457fd91633 100644 --- a/packages/meteor/fiber_helpers.js +++ b/packages/meteor/fiber_helpers.js @@ -3,19 +3,14 @@ var Fiber = Npm.require('fibers'); var Future = Npm.require(path.join('fibers', 'future')); Meteor._noYieldsAllowed = function (f) { - // "Fiber" and "yield" are both in the global namespace. The yield function is - // at both "yield" and "Fiber.yield". (It's also at require('fibers').yield - // but that is because require('fibers') === Fiber.) var savedYield = Fiber.yield; Fiber.yield = function () { throw new Error("Can't call yield in a noYieldsAllowed block!"); }; - global.yield = Fiber.yield; try { return f(); } finally { Fiber.yield = savedYield; - global.yield = savedYield; } }; From 8bdcdbc518d1484b7bd89b039b687a9e944aeb9f Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 20 May 2014 18:58:15 -0700 Subject: [PATCH 5/7] maybe background symlink update works however, bundling is brokenish due to buildTimeDeps when building apps not being release-sensitive (ekate understands what I mean) --- tools/catalog.js | 63 +++++++++++++-- tools/commands.js | 4 +- tools/fiber-helpers.js | 13 +++ tools/files.js | 8 ++ tools/release.js | 16 +++- tools/tropohouse.js | 12 +++ tools/unipackage.js | 2 +- tools/updater.js | 178 +++++++++++++++++++++++------------------ tools/utils.js | 7 ++ tools/warehouse.js | 39 --------- 10 files changed, 216 insertions(+), 126 deletions(-) diff --git a/tools/catalog.js b/tools/catalog.js index 179a95a109..b787befc0c 100644 --- a/tools/catalog.js +++ b/tools/catalog.js @@ -2,6 +2,7 @@ var fs = require('fs'); var path = require('path'); var semver = require('semver'); var _ = require('underscore'); +var Future = require('fibers/future'); var packageClient = require('./package-client.js'); var archinfo = require('./archinfo.js'); var packageCache = require('./package-cache.js'); @@ -12,6 +13,7 @@ var buildmessage = require('./buildmessage.js'); var tropohouse = require('./tropohouse.js'); var watch = require('./watch.js'); var files = require('./files.js'); +var fiberHelpers = require('./fiber-helpers.js'); var catalog = exports; @@ -65,6 +67,11 @@ var Catalog = function () { // Constraint solver using this catalog. self.resolver = null; + + // This is set to an array while refresh() is running; if another refresh() + // call happens during a yield, instead of doing a second refresh it just + // waits for the first to finish. + self._refreshFutures = null; }; _.extend(Catalog.prototype, { @@ -213,10 +220,53 @@ _.extend(Catalog.prototype, { // on the catalog. // // Prints a warning if `sync` is true and we can't contact the package server. + // + // If a refresh is already in progress (which is yielding), it just waits for + // the in-progress refresh to finish. What if the in-progress refresh was + // sync=false but the new call was sync=true? This can't happen because + // sync=false refreshes can't yield (and we use noYieldsAllowed to verify + // this). refresh: function (sync) { var self = this; self._requireInitialized(); + if (self._refreshFutures) { + var f = new Future; + self._refreshFutures.push(f); + f.wait(); + return; + } + + self._refreshFutures = []; + + var thrownError = null; + try { + if (sync) { + self._refresh(true); + } else { + fiberHelpers.noYieldsAllowed(function () { + self._refresh(); + }); + } + } catch (e) { + thrownError = e; + } + + while (self._refreshFutures.length) { + var fut = self._refreshFutures.pop(); + if (thrownError) { + // XXX is it really right to throw the same error multiple times? + fut.throw(thrownError); + } else { + fut.return(); + } + } + self._refreshFutures = null; + }, + + _refresh: function (sync) { + var self = this; + var localData = packageClient.loadCachedServerData(); var allPackageData; if (! self.offline && sync) { @@ -927,7 +977,7 @@ _.extend(Catalog.prototype, { // default track (or the specified track). Returns null if no such thing // exists (even after syncing with the server, which it only does if there is // no eligible release version). - getDefaultReleaseVersion: function (track) { + getDefaultRelease: function (track) { var self = this; self._requireInitialized(); @@ -940,12 +990,15 @@ _.extend(Catalog.prototype, { return {track: track, version: versions[0]}; }; - var ret = attempt(); - if (!ret) { + var key = attempt(); + if (!key) { self.refresh(true); - ret = attempt(); + key = attempt(); } - return ret; + if (!key) { + return null; + } + return self.getReleaseVersion(key.track, key.version); } }); diff --git a/tools/commands.js b/tools/commands.js index 7f89ca1d1b..0ebd6243e5 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -426,7 +426,7 @@ main.registerCommand({ // in an app dir), since non-forced updates don't change the track. // XXX better error checking on release.current.name // XXX add a method to release.current - var releaseTrack = release.current.name.split('@')[0]; + var releaseTrack = release.current.getReleaseTrack(); // Unless --release was passed (in which case we ought to already have // springboarded to that release), go get the latest release and switch to @@ -507,7 +507,7 @@ main.registerCommand({ // OK, let's figure out what release fits with our package constraints! var releaseVersionsToTry; if (release.forced) { - releaseVersionsToTry = [release.current.name.split('@')[1]]; + releaseVersionsToTry = [release.current.getReleaseVersion()]; } else { // XXX clean up all this splitty stuff var appReleaseInfo = catalog.getReleaseVersion( diff --git a/tools/fiber-helpers.js b/tools/fiber-helpers.js index 9cc396d547..9b94c4c3e8 100644 --- a/tools/fiber-helpers.js +++ b/tools/fiber-helpers.js @@ -76,3 +76,16 @@ exports.waitForOne = function (/* futures */) { return combinedFuture.wait(); }; + + +exports.noYieldsAllowed = function (f) { + var savedYield = Fiber.yield; + Fiber.yield = function () { + throw new Error("Can't call yield in a noYieldsAllowed block!"); + }; + try { + return f(); + } finally { + Fiber.yield = savedYield; + } +}; diff --git a/tools/files.js b/tools/files.js index b7cac8f490..3b712d551d 100644 --- a/tools/files.js +++ b/tools/files.js @@ -595,6 +595,14 @@ files.writeFileAtomically = function (filename, contents) { fs.renameSync(tmpFile, filename); }; +// Like fs.symlinkSync, but creates a temporay link and renames it over the +// file; this means it works even if the file already exists. +files.symlinkOverSync = function (linkText, file) { + var tmpSymlink = file + ".tmp" + utils.randomToken(); + fs.symlinkSync(linkText, tmpSymlink); + fs.renameSync(tmpSymlink, file); +}; + // Run a program synchronously and, assuming it returns success (0), // return whatever it wrote to stdout, as a string. Otherwise (if it // did not exit gracefully and return 0) return null. As node has diff --git a/tools/release.js b/tools/release.js index c85cc0f813..dcd36bd749 100644 --- a/tools/release.js +++ b/tools/release.js @@ -37,6 +37,20 @@ _.extend(Release.prototype, { return this.name === null; }, + getReleaseTrack: function () { + var self = this; + if (! self.isProperRelease()) + throw new Error("not a proper release?"); + return self.name.split('@')[0]; + }, + + getReleaseVersion: function () { + var self = this; + if (! self.isProperRelease()) + throw new Error("not a proper release?"); + return self.name.split('@')[1]; + }, + // Return the package name for the command-line tools that this release // uses. Valid only for proper releases. getToolsPackage: function () { @@ -167,7 +181,7 @@ release.latestDownloaded = function (track) { if (process.env.METEOR_TEST_LATEST_RELEASE) return process.env.METEOR_TEST_LATEST_RELEASE; - var defaultRelease = catalog.serverCatalog.getDefaultReleaseVersion(track); + var defaultRelease = catalog.serverCatalog.getDefaultRelease(track); if (!defaultRelease) { throw new Error("no latest release available?"); } diff --git a/tools/tropohouse.js b/tools/tropohouse.js index 24e5fe3fe8..ae8709a778 100644 --- a/tools/tropohouse.js +++ b/tools/tropohouse.js @@ -184,5 +184,17 @@ _.extend(exports.Tropohouse.prototype, { unipackage.saveToPath(packageDir); return true; + }, + + latestMeteorSymlink: function () { + var self = this; + var path = path.join(self.root, 'meteor'); + return fs.readlinkSync(path); + }, + + replaceLatestMeteorSymlink: function (linkText) { + var self = this; + var path = path.join(self.root, 'meteor'); + files.symlinkOverSync(linkText, path); } }); diff --git a/tools/unipackage.js b/tools/unipackage.js index ca4b49bcd5..aa16e962d9 100644 --- a/tools/unipackage.js +++ b/tools/unipackage.js @@ -336,7 +336,7 @@ _.extend(Unipackage.prototype, { // recover by returning by no builds return null; } - return _.where(self.builds, { arch: chosenArch })[0]; + return _.findWhere(self.builds, { arch: chosenArch }); }, // Load this package's plugins into memory, if they haven't already diff --git a/tools/updater.js b/tools/updater.js index f0a0dd6245..fd16d44e87 100644 --- a/tools/updater.js +++ b/tools/updater.js @@ -1,31 +1,15 @@ +var path = require('path'); var inFiber = require('./fiber-helpers.js').inFiber; var files = require('./files.js'); -var warehouse = require('./warehouse.js'); +var tropohouse = require('./tropohouse.js'); var httpHelpers = require('./http-helpers.js'); var config = require('./config.js'); var release = require('./release.js'); var runLog = require('./run-log.js'); - -/** - * Downloads the current manifest file and returns it. Throws - * files.OfflineError if we are offline, or throws some other - * exception if the server turned down our request. - */ -exports.getManifest = function () { - // Automated self-test support. You can set an environment variable - // to stub out the manifest fetch with a particular value, or to - // throw OfflineError. - if (process.env.METEOR_TEST_UPDATE_MANIFEST === "offline") - throw new files.OfflineError(new Error("scripted failure for tests")); - if (process.env.METEOR_TEST_UPDATE_MANIFEST) - return JSON.parse(process.env.METEOR_TEST_UPDATE_MANIFEST); - - return httpHelpers.getUrl({ - url: config.getUpdateManifestUrl(), - json: true, - useSessionHeader: true - }); -}; +var catalog = require('./catalog.js'); +var archinfo = require('./archinfo.js'); +var unipackage = require('./unipackage.js'); +var utils = require('./utils.js'); /** * Check to see if an update is available. If so, download and install @@ -42,69 +26,107 @@ exports.tryToDownloadUpdate = function (options) { if (checkInProgress) return; checkInProgress = true; - check(!!options.showBanner); + checkForUpdate(!!options.showBanner); checkInProgress = false; }; -var check = function (showBanner) { - var manifest = null; - try { - manifest = exports.getManifest(); - } catch (e) { - // Ignore error (eg, offline), but still do the "can we update this app - // with a locally available release" check. - } +var checkForUpdate = function (showBanner) { + // XXX we should ignore errors here, right? but still do the "can we update + // this app with a locally available release" check. + catalog.serverCatalog.refresh(true); - if (!files.usesWarehouse()) + if (!release.isProperRelease()) return; - // XXX in the future support release channels other than stable - var manifestLatestRelease = - manifest && manifest.releases && manifest.releases.stable && - manifest.releases.stable.version; - var localLatestRelease = warehouse.latestRelease(); - if (manifestLatestRelease && manifestLatestRelease !== localLatestRelease) { - // The manifest is telling us about a release that isn't our latest - // release! First, print a banner... but only if we've never printed a - // banner for this release before. (Or, well... only if this release isn't - // the last release which has had a banner printed.) - if (manifest.releases.stable.banner && - warehouse.lastPrintedBannerRelease() !== manifestLatestRelease) { - if (showBanner) { - runLog.log(""); - runLog.log(manifest.releases.stable.banner); - runLog.log(""); - } - warehouse.writeLastPrintedBannerRelease(manifestLatestRelease); - } else { - // Already printed this banner, or maybe there is no banner. - if (showBanner) { - runLog.log("=> Meteor " + manifestLatestRelease + - " is being downloaded in the background."); - } - } - warehouse.fetchLatestRelease(); - // We should now have fetched the latest release, which *probably* is - // manifestLatestRelease. As long as it's changed from the one it was - // before we tried to fetch it, print that out. - var newLatestRelease = warehouse.latestRelease(); - if (showBanner && newLatestRelease !== localLatestRelease) { - runLog.log( - "=> Meteor " + newLatestRelease + - " is available. Update this project with 'meteor update'."); - } + var currentReleaseTrack = release.current.getTrack(); + var latestRelease = catalog.serverCatalog.getDefaultRelease( + currentReleaseTrack); + // Maybe you're on some random track with nothing recommended. That's OK. + if (!latestRelease) return; + var latestReleaseToolParts = latestRelease.tool.split('@'); + var latestReleaseToolPackage = latestReleaseToolParts[0]; + var latestReleaseToolVersion = latestReleaseToolParts[1]; + var relativeToolPath = tropohouse.default.packagePath( + latestReleaseToolPackage, latestReleaseToolVersion, true); + + var localLatestReleaseLink = tropohouse.default.latestMeteorSymlink(); + if (utils.startsWith(localLatestReleaseLink, relativeToolPath + path.sep)) { + // The latest release from the catalog is not where the ~/.meteor0/meteor + // symlink points to. Let's make sure we have that release on disk, + // and then update the symlink. + // XXX download the packages too? + tropohouse.default.maybeDownloadPackageForArchitectures( + {packageName: latestReleaseToolPackage, + version: latestReleaseToolVersion}, + [archinfo.host()]); + + var toolUnipackage = new unipackage.Unipackage; + toolUnipackage.initFromPath( + latestReleaseToolPackage, + tropohouse.default.packagePath(latestReleaseToolPackage, + latestReleaseToolVersion)); + var toolRecord = _.findWhere(toolUnipackage.toolsOnDisk, + {arch: archinfo.host()}); + // XXX maybe we shouldn't throw from this background thing + if (!toolRecord) + throw Error("latest release has no tool?"); + + console.log("XXX updating tool symlink for", + latestRelease.track + "@" + latestRelease.version); + + tropohouse.default.replaceLatestMeteorSymlink( + path.join(relativeToolPath, toolRecord.path, 'meteor')); } - // We didn't do a global update (or we're not online), but do we need to - // update this app? Specifically: is our local latest release something - // other than this app's release, and the user didn't specify a specific - // release at the command line with --release? - if (showBanner && - localLatestRelease !== release.current.name && - ! release.forced) { - runLog.log( - "=> Meteor " + localLatestRelease + - " is available. Update this project with 'meteor update'."); - } + // XXX print banners + + // var manifestLatestRelease = + // manifest && manifest.releases && manifest.releases.stable && + // manifest.releases.stable.version; + // var localLatestRelease = warehouse.latestRelease(); + // if (manifestLatestRelease && manifestLatestRelease !== localLatestRelease) { + // // The manifest is telling us about a release that isn't our latest + // // release! First, print a banner... but only if we've never printed a + // // banner for this release before. (Or, well... only if this release isn't + // // the last release which has had a banner printed.) + // if (manifest.releases.stable.banner && + // warehouse.lastPrintedBannerRelease() !== manifestLatestRelease) { + // if (showBanner) { + // runLog.log(""); + // runLog.log(manifest.releases.stable.banner); + // runLog.log(""); + // } + // warehouse.writeLastPrintedBannerRelease(manifestLatestRelease); + // } else { + // // Already printed this banner, or maybe there is no banner. + // if (showBanner) { + // runLog.log("=> Meteor " + manifestLatestRelease + + // " is being downloaded in the background."); + // } + // } + // warehouse.fetchLatestRelease(); + // // We should now have fetched the latest release, which *probably* is + // // manifestLatestRelease. As long as it's changed from the one it was + // // before we tried to fetch it, print that out. + // var newLatestRelease = warehouse.latestRelease(); + // if (showBanner && newLatestRelease !== localLatestRelease) { + // runLog.log( + // "=> Meteor " + newLatestRelease + + // " is available. Update this project with 'meteor update'."); + // } + // return; + // } + + // // We didn't do a global update (or we're not online), but do we need to + // // update this app? Specifically: is our local latest release something + // // other than this app's release, and the user didn't specify a specific + // // release at the command line with --release? + // if (showBanner && + // localLatestRelease !== release.current.name && + // ! release.forced) { + // runLog.log( + // "=> Meteor " + localLatestRelease + + // " is available. Update this project with 'meteor update'."); + // } }; diff --git a/tools/utils.js b/tools/utils.js index 2e5c2f487d..48e8969942 100644 --- a/tools/utils.js +++ b/tools/utils.js @@ -256,3 +256,10 @@ exports.defaultOrderKeyForReleaseVersion = function (v) { return ret + '$'; }; + + +// XXX from Underscore.String (http://epeli.github.com/underscore.string/) +exports.startsWith = function(str, starts) { + return str.length >= starts.length && + str.substring(0, starts.length) === starts; +}; diff --git a/tools/warehouse.js b/tools/warehouse.js index 3217a54eed..577831ecf6 100644 --- a/tools/warehouse.js +++ b/tools/warehouse.js @@ -34,14 +34,6 @@ var fiberHelpers = require('./fiber-helpers.js'); var WAREHOUSE_URLBASE = 'https://warehouse.meteor.com'; -// Like fs.symlinkSync, but creates a temporay link and renames it over the -// file; this means it works even if the file already exists. -var symlinkOverSync = function (linkText, file) { - var tmpSymlink = file + ".tmp" + utils.randomToken(); - fs.symlinkSync(linkText, tmpSymlink); - fs.renameSync(tmpSymlink, file); -}; - var warehouse = exports; _.extend(warehouse, { // An exception meaning that you asked for a release that doesn't @@ -122,37 +114,6 @@ _.extend(warehouse, { } }, - // returns true if we updated the latest symlink - // XXX make errors prettier - fetchLatestRelease: function (options) { - options = options || {}; - var manifest = updater.getManifest(); - - // XXX in the future support release channels other than stable - var releaseName = manifest && manifest.releases && - manifest.releases.stable && manifest.releases.stable.version; - if (! releaseName) - throw new Error("no stable release found?"); - - var latestReleaseManifest = warehouse._populateWarehouseForRelease( - releaseName, !!options.showInstalling); - - // First, make sure the latest tools symlink reflects the latest installed - // release. - if (latestReleaseManifest.tools !== warehouse.latestTools()) { - symlinkOverSync(latestReleaseManifest.tools, - warehouse._latestToolsSymlinkPath()); - } - - var storedLatestRelease = warehouse.latestRelease(); - if (storedLatestRelease === releaseName) - return false; - - symlinkOverSync(releaseName + '.release.json', - warehouse._latestReleaseSymlinkPath()); - return true; - }, - packageExistsInWarehouse: function (name, version) { // A package exists if its directory exists. (We used to look for a // particular file name ("package.js") inside the directory, but since we From d176828d2aa79eafbcfeefe345ac5bfbba298e7c Mon Sep 17 00:00:00 2001 From: ekatek Date: Wed, 21 May 2014 12:38:17 -0700 Subject: [PATCH 6/7] minor bug cleanup to make tests pass --- tools/commands.js | 37 +++++++++++++++++++++++-------------- tools/compiler.js | 4 ++-- tools/project.js | 3 ++- tools/tests/add-package.js | 18 +++++++----------- 4 files changed, 34 insertions(+), 28 deletions(-) diff --git a/tools/commands.js b/tools/commands.js index 0ebd6243e5..8b81c2b9ea 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -708,7 +708,7 @@ main.registerCommand({ } // If the version was specified, check that the version exists. - if ( constraint.constraint !== "none") { + if ( constraint.constraint !== null) { var versionInfo = catalog.getVersion( constraint.package, constraint.constraint); @@ -814,11 +814,11 @@ main.registerCommand({ // If the previous versions file had this, then we are upgrading, if it did // not, then we must be adding this package anew. if (_.has(versions, packageName)) { - messageLog.push("upgraded " + packageName + " from version " + + messageLog.push(" upgraded " + packageName + " from version " + versions[packageName] + " to version " + newVersions[packageName]); } else { - messageLog.push("added " + packageName + + messageLog.push(" added " + packageName + " at version " + newVersions[packageName]); }; }); @@ -889,9 +889,14 @@ main.registerCommand({ // constraint solver, because our contract with the user says that we will // never downgrade a dependency. var versions = project.getIndirectDependencies(options.appDir); + // Combine into one object mapping package name to list of + // constraints, to pass in to the constraint solver. + var allPackages = project.combinedConstraints( + packages, + release.current.isProperRelease() ? release.current.getPackages() : {}); // Call the constraint solver. - var newVersions = catalog.resolveConstraints(packages, + var newVersions = catalog.resolveConstraints(allPackages, { previousSolution: versions }); if ( ! newVersions) { // This should never really happen. @@ -967,21 +972,25 @@ main.registerCommand({ // Generate a package loader for this project. This will also compute the // nessessary versions and write them to disk. project.generatePackageLoader(options.appDir); - var packages = project.getDirectDependencies(options.appDir); + var packages = project.getDirectDependencies(options.appDir).appDeps; + var versions = project.getIndirectDependencies(options.appDir); + var messages = buildmessage.capture(function () { - _.each(packages.appDeps, function (version, name) { + _.each(packages, function (version, name) { //XXX: Now that we don't store the version in the .meteor/packages file, //we should read the versions file for the version to use in this //description. - if (version) { - var versionInfo = catalog.getVersion(name, version); - if (!versionInfo) { - buildmessage.error("Cannot process package list. Unknown: " + name + + if (!version) { + version = versions[name]; + } + var versionInfo = catalog.getVersion(name, version); + if (!versionInfo) { + buildmessage.error("Cannot process package list. Unknown: " + name + " at version " + version + "\n"); - return; - } - items.push({ name: name, description: versionInfo.description }); - } + return; + } + items.push({ name: name, description: versionInfo.description }); + }); }); if (messages.hasMessages()) { diff --git a/tools/compiler.js b/tools/compiler.js index 56e54374ed..4a6246871e 100644 --- a/tools/compiler.js +++ b/tools/compiler.js @@ -162,7 +162,7 @@ var determineBuildTimeDependencies = function (packageSource) { }); - var versions = packageSource.dependencyVersions.dependencies; + var versions = packageSource.dependencyVersions.dependencies || {}; ret.packageDependencies = catalog.catalog.resolveConstraints(constraints, { previousSolution: versions }); @@ -191,7 +191,7 @@ var determineBuildTimeDependencies = function (packageSource) { constraints[parsedSpec.package] = parsedSpec.constraint || null; }); - var pluginVersion = pluginVersions[info.name]; + var pluginVersion = pluginVersions[info.name] || {}; ret.pluginDependencies[info.name] = catalog.catalog.resolveConstraints( constraints, { previousSolution: pluginVersion }); diff --git a/tools/project.js b/tools/project.js index 6d2dfd65e6..289de890e4 100644 --- a/tools/project.js +++ b/tools/project.js @@ -155,7 +155,8 @@ var rewriteDependencies = function (appDir, deps, versions) { // XXX: Do not remove comments from packages file. var lines = []; _.each(deps, function (versionConstraint, name) { - if (versionConstraint && versionConstraint[0] === "=") { /* exact version required */ + if (versionConstraint) { + console.log(versionConstraint); lines.push(name + "@" + versionConstraint + "\n"); } else { lines.push(name + "\n"); diff --git a/tools/tests/add-package.js b/tools/tests/add-package.js index 506d269082..9658272431 100644 --- a/tools/tests/add-package.js +++ b/tools/tests/add-package.js @@ -24,14 +24,11 @@ var copyFile = function(from, to, sand) { // packages: an array of packages in order. Packages can be of the form: // // standard-app-packages (ie: name), in which case this will match any -// version of that package as long as it is included. This is for packages -// external to the app, since we don't want this test to fail when we push a -// new version. +// version of that package as long as it is included. // // awesome-pack@1.0.0+local (ie: name@version) to match that name at that -// version explicitly. This is for packages that only exist for the purpose -// of this test (for example, packages local to this app), so we know exactly -// what version we expect. +// version explicitly. This is for packages that we included at a specific +// version. var checkPackages = function(sand, packages) { var lines = sand.read(".meteor/packages").split("\n"); var i = 0; @@ -170,16 +167,16 @@ selftest.define("add packages", function () { run = s.run("--once"); - run = s.run("add", "say-something", "--offline-catalog"); + run = s.run("add", "say-something@1.0.0", "--offline-catalog"); run.match("Successfully added"); checkPackages(s, - ["accounts-base", "say-something@1.0.0+local", "standard-app-packages"]); + ["accounts-base", "say-something@1.0.0", "standard-app-packages"]); run = s.run("add", "depends-on-plugin", "--offline-catalog"); run.match("Successfully added"); checkPackages(s, - ["accounts-base", "depends-on-plugin@1.0.0+local", - "say-something@1.0.0+local", "standard-app-packages"]); + ["accounts-base", "depends-on-plugin", + "say-something@1.0.0", "standard-app-packages"]); checkVersions(s, ["accounts-base", "depends-on-plugin", @@ -201,7 +198,6 @@ selftest.define("add packages", function () { checkVersions(s, ["accounts-base", "standard-app-packages"]); - run = s.run("list", "--using", "--offline-catalog"); run.match("accounts-base"); run.match("standard-app-packages"); From 71917200b792cd444cd7bf8cc75ca146f21e7bf7 Mon Sep 17 00:00:00 2001 From: Emily Stark Date: Wed, 28 May 2014 12:06:04 -0700 Subject: [PATCH 7/7] Go back to https for package server --- tools/config.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/config.js b/tools/config.js index cf3e0d9e5e..1aa02412bb 100644 --- a/tools/config.js +++ b/tools/config.js @@ -124,9 +124,7 @@ _.extend(exports, { return process.env.METEOR_PACKAGE_SERVER_URL; var host = config.getPackageServerDomain(); - console.log("XXX: currently using http, not https for package server."); - return "http://" + host; - // return addScheme(host); + return addScheme(host); }, getPackageServerDomain: function () {