Commit Graph

256 Commits

Author SHA1 Message Date
David Glasser
f61ada859d Refresh catalog if release's tool has no build
This fixes a corner case where if you synced the catalog between the
creation of a release and the creation of its tool's build for your
platform, running `meteor --release R` would fail.

Fixes #3317.
2015-01-08 12:28:25 -08:00
Sashko Stubailo
e7167e5257 Factor out almost all fs. and path. calls in the tool
This will be useful when we want to be smart with windows file paths later
Also, all of the file calls are asynchronous with fibers now, which comes with
many benefits.

This is a combination of 23 commits. Original messages:
Wrap a large number of fs calls inside files.*

Convert a few more fs calls to files.*

More moving fs.* to files

Implement read/write streams and open/read/close

Get rid of fs from auth.js

Remove fs and unused imports from catalog-local and catalog-remote

Remove unused imports from catalog.js

Replace a whole lot of fs calls

Fix error

Migrate a lot more fs. calls to files.

Add a temporary symlink method

Convert old test to files.*

Use files.pathX instead of path.x everywhere

Replace path.x to files.pathX in tests

Small fixes to files.js and one rename

Make cleanup run in a fiber

Make wrapping functions take function name in case we need it

Add some timeouts and stuff to HCP tests

wrapFsFunc also makes a sync version of the function

Sometimes you just don't want to yield!

Make sure JsImage readFromDisk doesn't yield

Remove unused imports from npm test

Change order of test now that some things don't yield

Fix missing files import, and add a debug error printout
2014-12-15 15:32:06 -08:00
David Glasser
1e5b7437a5 Refresh catalog only on relevant errors
Fixes #2846.  Fixes #2847. Fixes #2979.

Errors in the build process that could be fixed by refreshing the
catalog now cause the catalog to refresh, assuming we have not already
refreshed it recently and that we are not offline.

These commands now don't need to refresh at startup: remove, run, debug,
create, build, bundle, deploy, test-packages, rebuild, and self-test

It should be OK for create to throw SpringboardToLatestRelease even
without refreshing, since release.latestKnown is still something we know
about.
2014-12-10 19:03:05 -08:00
David Glasser
d3ff3954bf PackageMap only has a local (not layered) catalog
No need to introduce the LayeredCatalog anywhere it's not needed.

Simplify some more things about LayeredCatalog:

- remove unused containingCatalog link from localCatalog to
  layeredCatalog

- because of that, simplify LayeredCatalog initialization to occur after
  localCatalog (no more circular references required)

- drop some other dead LayeredCatalog methods
2014-12-09 18:43:25 -08:00
David Glasser
31a43fc019 prune dead code 2014-12-09 18:30:22 -08:00
David Glasser
2f90467da0 Optimize constraint solver's catalog interface
We shouldn't ask sqlite for a list of rows and then go back and ask for
each row one by one!

Addresses #3043.
2014-12-01 19:20:28 -08:00
David Glasser
45cc54fb63 comment and require cleanup 2014-11-25 09:06:20 -08:00
David Glasser
1a9536baa2 Fix test-packages
See #3012, though.
2014-11-25 09:06:20 -08:00
David Glasser
83421c288a Remove isLocalPackage 2014-11-25 09:06:19 -08:00
David Glasser
f0ff76a24b watch local package search dirs 2014-11-25 09:06:18 -08:00
David Glasser
438ddad7bc Remove catalog.complete from core code
It's still in unmigrated commands.

Remove tropohouse's catalog.  It was there to stop you from downloading
local packages but downloadPackagesMissingFromMap does that based on the
PackageMap now.
2014-11-25 09:06:16 -08:00
David Glasser
490511a498 Move catalog refresh off of catalog.complete 2014-11-25 09:06:15 -08:00
David Glasser
c862b30e1e Remove resolver from catalog 2014-11-25 09:06:15 -08:00
David Glasser
e921b20caa Remove catalog.resolveConstraints
Also remove the subclass of LocalCatalog used for the isopacket building
catalog... it can just use LocalCatalog and set a flag (which is only
checked in one place).
2014-11-25 09:06:15 -08:00
David Glasser
ed4325aca5 Delete getLoadPathForPackage and _build 2014-11-25 09:06:14 -08:00
David Glasser
0738e2ddb4 Delete all references to PackageCache 2014-11-25 09:06:14 -08:00
David Glasser
7b529ba9c9 Add a note to get rid of catalog.complete 2014-11-25 09:06:13 -08:00
David Glasser
8aefc5b46f Use IsopackCache to build isopackets 2014-11-25 09:06:11 -08:00
David Glasser
8d7139e624 Start on a new lightweight ProjectContext
This one won't be a singleton.  Eventually project.js will be moved into
here.

Add a 'meteor prep' command which exercises new codepaths. It will be
deleted eventually.

So far, it converts .meteor/packages directly into the format that the
constraint solver wants.  (Unlike the existing code which has several
intermediate formats.)
2014-11-25 09:06:09 -08:00
David Glasser
261a93b3dd Remove 'meteor rebuild' and rebuildLocalPackages
This is the first step in removing all references to
PACKAGESOURCE/.build.packagename caches. We will then implement a new
package cache from the ground up.
2014-11-25 09:06:08 -08:00
David Glasser
96bae0e077 Use correct error-printing Console function
Changes

  { [Error: Network error: wss://packages.meteor.com/websocket: Hostname/IP doesn't match certificate's altnames] stack: [Getter] }

into

  Network error: wss://packages.meteor.com/websocket: Hostname/IP doesn't match certificate's altnames
2014-11-10 16:25:14 -08:00
David Glasser
3444b9a6d3 Remove support for earliestCompatibleVersion
This was an undocumented and entirely unused feature (only two dummy
packages on the package server have this set to a non-default value).

No attempt is being made to remove the field from existing isopacks or
catalog entries. To continue to support existing clients, the package
server has been modified to ignore any provided
earliestCompatibleVersion and instead always write the default ECV to
the catalog.
2014-11-10 13:33:41 -08:00
David Glasser
d6b3da53ab getForgottenECVs only returns forgotten ECVs 2014-11-07 19:10:11 -08:00
David Glasser
170c0acad7 Rename unibuild everywhere to isopackets 2014-11-07 16:45:58 -08:00
David Glasser
97f6a0236e get rid of catalog.uniload
There is no longer a uniload catalog when running from a release, since
the release contains whole isopackets (programs) not
isopacks (packages).

We only need a uniload-specific catalog when we're actually rebuilding
isopackets (not in order to load them), so we now have it as a local
variable in the two places that build isopackets.

The deleted code in package-loader.js was specific to the prebuilt
uniload package which no longer exists.
2014-11-07 16:45:58 -08:00
David Glasser
9cab094f18 uniload now works via named "isopackets"
You can only request a named set of packages, not a random assortment.

In future commits, we will pre-build these packages into JsImages and
load them from that. Building packages for uniload will eventually not
involve the .build.foo directories at all.  (All saved packages will be
built in app context, eventually.)
2014-11-07 16:45:57 -08:00
David Glasser
831ca7d20c cleanup test-packages
- Errors in merging the cordova branch against 273b70bea4 left
  in an unnecessary getLocalPackages function

- LocalCatalog.getLocalPackageNames is unnecessary (it's the same as
  getAllPackageNames!)  CompleteCatalog.getLocalPackageNames is OK I
  guess.

- getPackagesForTest returned some extra data that was only used to call
  the nonexistent catalog.removeLocalPackage method.  Meh, we don't
  clean up the catalog when the command ends now (which doesn't happens
  unless you're using --once anyway). We'll probably fix this by making
  catalog.complete less global soon anyway (ie, it should be build-specific).

- Fix a duplicate test runner app cp_r
2014-11-04 10:47:34 -08:00
David Glasser
b5d2cce308 Refactor LocalCatalog
- Simplify internal data structure to just have one map of name ->
  various data instead of a whole bunch of different unsynchronized data
  structures (most of which were used with frequent O(n) operations).

- Move the getLoadPathForPackage logic which combines local and remote
  packages into LayeredCatalog from LocalCatalog, and delete the
  unnecessary copy in BootstrapCatalogCheckout.

- Rename a bunch of fields to make it explicit which ones contain
  package objects, which ones contain package directories, and which
  ones contain package *search* directories

- Replace random version IDs and a long comment about why random is safe
  with sequential. (I don't think these version IDs are ever used
  anyway.)

- Drop unused "initializing" option to refresh

- Drop redundant call to _recomputeEffectiveLocalPackages in
  addLocalPackage (it is called immediately below by refresh).
2014-10-30 22:43:13 -07:00
David Glasser
ca33c4111a Two other build calls are only on catalog.official
getAllBuilds and getBuildWithPreciseBuildArchitectures
2014-10-30 21:38:58 -07:00
David Glasser
371a21d5bc getBuildsForArches is only on catalog.official 2014-10-30 21:34:54 -07:00
David Glasser
7ac4a838e3 Remove some catalog buildmessage.asserts 2014-10-29 19:25:13 -07:00
David Glasser
1ed619378f Fix resolveConstraints indentation 2014-10-29 18:52:07 -07:00
David Glasser
f97e374ac7 Remove release methods from catalog.complete
They are unused (and were accidentally introduced in 0.9.4 with the
sqlite branch).  The only thing you're allowed to query for releases is
the official catalog, since the complete catalog doesn't actually
augment releases with anything.

(If we later implement some sort of "local release", we should probably
also introduce a new release-specific interface that can be backed
either by sqlite or by sqlite-plus-local, analogous to catalog.  There's
no real reason that it should be the same interface as catalog.)
2014-10-29 18:10:49 -07:00
ekatek
e2086d4dba replace 'figuring out the best package versions to use' with 'selecting package versions' 2014-10-22 22:18:49 -07:00
Emily Stark
784e8fa29b Tweak wording of offline package sync message 2014-10-20 17:31:21 -07:00
David Glasser
e22702be45 Make more DDP errors specific
These errors should look like connection errors, not clean closes:

- Heartbeat timeout (DDP-level or SockJS-level)
- Connection timeout (SockJS implementation)

The "disconnected with no error while waiting for something we asked
for" error in ServiceConnection is now a DDP.ConnectionError so that it
prints better.

If a command refuses to run due to a catalog sync error, it should print
the error. (Commands that merely warn that they could not sync don't
print that error, unless METEOR_LOG=debug.)
2014-10-20 15:04:12 -07:00
Nick Martin
a75b0c9591 Fix error handling for offline support.
(untested. glasser told me what to type.)
2014-10-17 19:18:23 -07:00
David Glasser
468aeb25bf avoid circular dependency 2014-10-17 13:47:23 -07:00
David Glasser
82bdaf86b9 no catalog.complete for non-refresh commands 2014-10-17 13:47:23 -07:00
Justin SB
d5657218d0 Add ignoreErrors to Refresh.OnceAtStart strategy 2014-10-17 13:47:22 -07:00
Justin SB
4fcdd04d85 Make refreshFailed a global, not a strategy field
This way it works no matter where we call catalog.refreshOrWarn
2014-10-17 13:47:22 -07:00
David Glasser
a7c369284f refresh-related cleanup 2014-10-17 13:47:21 -07:00
Justin SB
d1c896724c We do need to cache the resolver after all; invalidate it correctly 2014-10-17 13:47:21 -07:00
Justin SB
da41eccf58 Do cache the resolver after all; resolveConstraints is called a large number of times 2014-10-17 13:47:21 -07:00
David Glasser
a19141ac2f update initial springboarding for refreshpolicy
Since release.load no longer refreshes, we now need to manually
refresh. This is actually a great thing! It lets us look at modern
releases before legacy releases, which is the proper order anyway!
2014-10-17 13:47:20 -07:00
Justin SB
4ec3cb2a55 Rename LayeredCatalog refresh -> refreshLocalPackages, drop cached resolver 2014-10-17 13:47:20 -07:00
Justin SB
2e01bde51f Record in strategy if package refresh failed; explain if so 2014-10-17 13:47:19 -07:00
Justin SB
2324f6f6ef Tolerate catalog refresh throwing 2014-10-17 13:47:19 -07:00
David Glasser
41db23e6e5 Drop refresh logic around constraint solver 2014-10-17 13:47:18 -07:00
Justin SB
618783b546 Remove SpecialEvents strategy & Events; we're going to modify updater.js 2014-10-17 13:47:17 -07:00