mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
changes
This commit is contained in:
@@ -3,6 +3,7 @@ var path = require('path');
|
||||
var semver = require('semver');
|
||||
var _ = require('underscore');
|
||||
var packageClient = require('./package-client.js');
|
||||
var watch = require('./watch.js');
|
||||
var archinfo = require('./archinfo.js');
|
||||
var unipackage = require('./unipackage.js');
|
||||
var compiler = require('./compiler.js');
|
||||
@@ -325,7 +326,7 @@ _.extend(LocalCatalog.prototype, {
|
||||
}
|
||||
|
||||
self.refreshing = true;
|
||||
console.log("refreshing the local catalog");
|
||||
// console.log("refreshing the local catalog");
|
||||
try {
|
||||
self.reset();
|
||||
self._recomputeEffectiveLocalPackages();
|
||||
@@ -342,7 +343,7 @@ _.extend(LocalCatalog.prototype, {
|
||||
// and self.localPackages.
|
||||
_recomputeEffectiveLocalPackages: function () {
|
||||
var self = this;
|
||||
console.log("refrehsing for " + self.localPackageDirs);
|
||||
// console.log("refrehsing for " + self.localPackageDirs);
|
||||
|
||||
self.effectiveLocalPackages = _.clone(self.localPackages);
|
||||
|
||||
@@ -646,7 +647,7 @@ _.extend(LocalCatalog.prototype, {
|
||||
return count;
|
||||
},
|
||||
|
||||
// Register local package directories with a watchSet. We want to know if a
|
||||
// Register local package directories with a watchSet. We want to know if a
|
||||
// package is created or deleted, which includes both its top-level source
|
||||
// directory and its main package metadata file.
|
||||
//
|
||||
|
||||
@@ -30,9 +30,6 @@ var sqlite3 = require('../dev_bundle/bin/node_modules/sqlite3');
|
||||
var RemoteCatalog = function (options) {
|
||||
var self = this;
|
||||
|
||||
// We inherit from the BaseCatalog class.
|
||||
//BaseCatalog.call(self);
|
||||
|
||||
// Set this to true if we are not going to connect to the remote package
|
||||
// server, and will only use the cached data.json file for our package
|
||||
// information. This means that the catalog might be out of date on the latest
|
||||
@@ -162,16 +159,21 @@ _.extend(RemoteCatalog.prototype, {
|
||||
return result;
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
initialize: function (options) {
|
||||
//PASCAL deal with offline mode?
|
||||
var self = this;
|
||||
|
||||
// We should to figure out if we are intending to connect to the package server.
|
||||
self.offline = options.offline ? options.offline : false;
|
||||
|
||||
var dbFile = self.options.packageStorage || config.getPackageStorage();
|
||||
db = new sqlite3.Database(dbFile);
|
||||
if ( !fs.existsSync(path.dirname(dbFile)) ) {
|
||||
fs.mkdirSync(path.dirname(dbFile));
|
||||
}
|
||||
|
||||
var future = new Future;
|
||||
db.serialize(function() {
|
||||
db.run("BEGIN TRANSACTION");
|
||||
db.run("CREATE TABLE IF NOT EXISTS versions (name STRING, version STRING, id String, content STRING)");
|
||||
db.run("CREATE INDEX IF NOT EXISTS versionsNamesIdx ON versions(name)");
|
||||
|
||||
@@ -182,23 +184,41 @@ _.extend(RemoteCatalog.prototype, {
|
||||
db.run("CREATE TABLE IF NOT EXISTS releaseVersions (track STRING, version STRING, id STRING, content STRING)");
|
||||
db.run("CREATE TABLE IF NOT EXISTS packages (name STRING, id STRING, content STRING)");
|
||||
db.run("CREATE TABLE IF NOT EXISTS syncToken (id STRING, content STRING)");
|
||||
db.run("END TRANSACTION", function(err, row) {
|
||||
if (err)
|
||||
console.log("TRANSACTION PB 1 " + err);
|
||||
//PASCAL check errors
|
||||
future.return();
|
||||
});
|
||||
});
|
||||
future.wait();
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
var self = this;
|
||||
|
||||
var future = new Future;
|
||||
db.serialize(function() {
|
||||
db.run("BEGIN TRANSACTION");
|
||||
db.run("DELETE FROM versions");
|
||||
db.run("DELETE FROM builds");
|
||||
db.run("DELETE FROM releaseTracks");
|
||||
db.run("DELETE FROM releaseVersions");
|
||||
db.run("DELETE FROM packages");
|
||||
db.run("DELETE FROM syncToken");
|
||||
db.run("END TRANSACTION", function(err, row) {
|
||||
if (err)
|
||||
console.log("TRANSACTION PB 2 " + err);
|
||||
//PASCAL check errors
|
||||
future.return();
|
||||
});
|
||||
});
|
||||
future.wait();
|
||||
},
|
||||
|
||||
refresh: function () {
|
||||
refresh: function (overrides) {
|
||||
var self = this;
|
||||
if (self.offline)
|
||||
return;
|
||||
packageClient.updateServerPackageData(this);
|
||||
},
|
||||
|
||||
@@ -337,6 +357,8 @@ _.extend(RemoteCatalog.prototype, {
|
||||
self._insertReleaseVersions(serverData.collections.releaseVersions, db);
|
||||
self._insertTimestamps(serverData.syncToken, db);
|
||||
db.run("END TRANSACTION", function(err, row) {
|
||||
if (err)
|
||||
console.log("TRANSACTION PB 3 " + err);
|
||||
//PASCAL check errors
|
||||
future.return();
|
||||
});
|
||||
|
||||
136
tools/catalog.js
136
tools/catalog.js
@@ -13,6 +13,7 @@ var checkoutBootstrap = require('./catalog-bootstrap-checkout.js');
|
||||
var project = require('./project.js');
|
||||
var utils = require('./utils.js');
|
||||
var config = require('./config.js');
|
||||
var packageClient = require('./package-client.js');
|
||||
|
||||
var LayeredCatalog = function() {
|
||||
var self = this;
|
||||
@@ -136,19 +137,19 @@ _.extend(LayeredCatalog.prototype, {
|
||||
|
||||
refresh: function () {
|
||||
var self = this;
|
||||
console.log("refreshing the LayeredCatalog");
|
||||
// console.log("refreshing the LayeredCatalog");
|
||||
//PASCAL Deal with refresh properly
|
||||
},
|
||||
|
||||
refreshInProgress: function () {
|
||||
var self = this;
|
||||
console.log("refresh in progress the LayeredCatalog");
|
||||
// console.log("refresh in progress the LayeredCatalog");
|
||||
//PASCAL Deal with refresh properly
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
this.localCatalog.reset();
|
||||
console.log("resetting the LayeredCatalog");
|
||||
// console.log("resetting the LayeredCatalog");
|
||||
//PASCAL
|
||||
},
|
||||
|
||||
@@ -304,78 +305,78 @@ _.extend(LayeredCatalog.prototype, {
|
||||
// to this set.
|
||||
refresh: function (options) {
|
||||
var self = this;
|
||||
options = options || {};
|
||||
buildmessage.assertInCapture();
|
||||
// options = options || {};
|
||||
// buildmessage.assertInCapture();
|
||||
|
||||
// We need to limit the rate of refresh, or, at least, prevent any sort of
|
||||
// loops. ForceRefresh will override either one.
|
||||
if (!options.forceRefresh && !options.initializing &&
|
||||
(catalog.official._refreshFutures || self.refreshing)) {
|
||||
// // We need to limit the rate of refresh, or, at least, prevent any sort of
|
||||
// // loops. ForceRefresh will override either one.
|
||||
// if (!options.forceRefresh && !options.initializing &&
|
||||
// (catalog.official._refreshFutures || self.refreshing)) {
|
||||
|
||||
return;
|
||||
}
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (options.initializing && !self.forUniload) {
|
||||
// If we are doing the top level initialization in main.js, everything
|
||||
// sure had better be in a relaxed state, since we're about to hackily
|
||||
// steal some data from catalog.official.
|
||||
if (self.refreshing)
|
||||
throw Error("initializing catalog.complete re-entrantly?");
|
||||
if (catalog.official._refreshFutures)
|
||||
throw Error("initializing catalog.complete during official refresh?");
|
||||
}
|
||||
// if (options.initializing && !self.forUniload) {
|
||||
// // If we are doing the top level initialization in main.js, everything
|
||||
// // sure had better be in a relaxed state, since we're about to hackily
|
||||
// // steal some data from catalog.official.
|
||||
// if (self.refreshing)
|
||||
// throw Error("initializing catalog.complete re-entrantly?");
|
||||
// if (catalog.official._refreshFutures)
|
||||
// throw Error("initializing catalog.complete during official refresh?");
|
||||
// }
|
||||
|
||||
if (self.refreshing) {
|
||||
// We're being asked to refresh re-entrantly, maybe because we just
|
||||
// updated the official catalog. Let's not do this now, but make the
|
||||
// outer call do it instead.
|
||||
// XXX refactoring the catalogs so that the two catalogs share their
|
||||
// data and this one is just an overlay would reduce this wackiness
|
||||
self.needRefresh = true;
|
||||
return;
|
||||
}
|
||||
// if (self.refreshing) {
|
||||
// // We're being asked to refresh re-entrantly, maybe because we just
|
||||
// // updated the official catalog. Let's not do this now, but make the
|
||||
// // outer call do it instead.
|
||||
// // XXX refactoring the catalogs so that the two catalogs share their
|
||||
// // data and this one is just an overlay would reduce this wackiness
|
||||
// self.needRefresh = true;
|
||||
// return;
|
||||
// }
|
||||
|
||||
self.refreshing = true;
|
||||
// self.refreshing = true;
|
||||
|
||||
try {
|
||||
self.reset();
|
||||
// try {
|
||||
// self.reset();
|
||||
|
||||
if (!self.forUniload) {
|
||||
if (options.initializing) {
|
||||
// It's our first time! Everything ought to be at rest. Let's just
|
||||
// steal data (without even a deep clone!) from catalog.official.
|
||||
// XXX this is horrible. restructure to have a reference to
|
||||
// catalog.official instead.
|
||||
self.packages = _.clone(catalog.official.packages);
|
||||
self.builds = _.clone(catalog.official.builds);
|
||||
_.each(catalog.official.versions, function (versions, name) {
|
||||
self.versions[name] = _.clone(versions);
|
||||
});
|
||||
} else {
|
||||
// Not the first time. Slowly load data from disk.
|
||||
// XXX restructure this class to just have a reference to
|
||||
// catalog.official instead of a copy of its data.
|
||||
var localData = packageClient.loadCachedServerData();
|
||||
self._insertServerPackages(localData);
|
||||
}
|
||||
}
|
||||
// if (!self.forUniload) {
|
||||
// if (options.initializing) {
|
||||
// // It's our first time! Everything ought to be at rest. Let's just
|
||||
// // steal data (without even a deep clone!) from catalog.official.
|
||||
// // XXX this is horrible. restructure to have a reference to
|
||||
// // catalog.official instead.
|
||||
// self.packages = _.clone(catalog.official.packages);
|
||||
// self.builds = _.clone(catalog.official.builds);
|
||||
// _.each(catalog.official.versions, function (versions, name) {
|
||||
// self.versions[name] = _.clone(versions);
|
||||
// });
|
||||
// } else {
|
||||
// // Not the first time. Slowly load data from disk.
|
||||
// // XXX restructure this class to just have a reference to
|
||||
// // catalog.official instead of a copy of its data.
|
||||
// var localData = packageClient.loadCachedServerData();
|
||||
// self._insertServerPackages(localData);
|
||||
// }
|
||||
// }
|
||||
|
||||
self._recomputeEffectiveLocalPackages();
|
||||
var allOK = self._addLocalPackageOverrides(
|
||||
{ watchSet: options.watchSet });
|
||||
self.initialized = true;
|
||||
// Rebuild the resolver, since packages may have changed.
|
||||
self.resolver = null;
|
||||
} finally {
|
||||
self.refreshing = false;
|
||||
}
|
||||
// self._recomputeEffectiveLocalPackages();
|
||||
// var allOK = self._addLocalPackageOverrides(
|
||||
// { watchSet: options.watchSet });
|
||||
// self.initialized = true;
|
||||
// // Rebuild the resolver, since packages may have changed.
|
||||
// self.resolver = null;
|
||||
// } finally {
|
||||
// self.refreshing = false;
|
||||
// }f
|
||||
|
||||
// If we got a re-entrant refresh request, do it now. (But not if we
|
||||
// encountered build errors building the packages, since in that case
|
||||
// we'd probably just get the same build errors again.)
|
||||
if (self.needRefresh && allOK) {
|
||||
self.refresh(options);
|
||||
}
|
||||
// // If we got a re-entrant refresh request, do it now. (But not if we
|
||||
// // encountered build errors building the packages, since in that case
|
||||
// // we'd probably just get the same build errors again.)
|
||||
// if (self.needRefresh && allOK) {
|
||||
// self.refresh(options);
|
||||
// }
|
||||
},
|
||||
|
||||
_initializeResolver: function () {
|
||||
@@ -396,8 +397,7 @@ _.extend(LayeredCatalog.prototype, {
|
||||
|
||||
watchLocalPackageDirs: function (watchSet) {
|
||||
var self = this;
|
||||
console.log("watchllocalpackageDirs the LayeredCatalog");
|
||||
//PASCAL
|
||||
self.localCatalog.watchLocalPackageDirs(watchSet);
|
||||
},
|
||||
|
||||
_refreshingIsProductive: function() {
|
||||
|
||||
Reference in New Issue
Block a user