The comments immediately after this new code claimed that the "changes
we made were persisted to disk", but they weren't. So, if you had some
sort of build error that occured after the initializeCatalog stage (say,
invalid JS in a non-package.js file), when the runner reset the context,
it would lose the changes to
projectContext.projectConstraintsFile (.meteor/packages), and you'd end
up with no packages in the test runner app.
mongo now transitively uses webapp (because ddp-server does) so we can't
really make an app with mongo and no webapp. This is a bit of a shame
and when we refactor the mongo package we should fix this... but until
then, let's just remove the no-longer-necessary main function and be OK
with this test running a pointless web server.
However, turns out the previous commit doesn't really work --- making
webapp a strong dependency of ddp-server means that as soon as we load
mongo we'll load webapp in the tool which is bad. So move the mongodb
Npm module out of mongo, since that's all we need in the tool.
This change allows the tool to *read* .meteor/versions whether it uses
"@" or " " as a package/version separator. It does not change how
.meteor/versions is written out.
Background:
The convention in the new Version Solver is that "foo@1.2.3" means a
constraint, which is satisfied by "foo 1.2.4" but not "foo 1.2.2", which
are specific versions of a package. This convention avoids the same
confusion of .meteor/packages being a list of constraints while
.meteor/versions is conceptually a list of (package,version) pairs, even
though both look like package@version.
We'd like to replace "@" by " " in .meteor/versions from now on.
Unfortunately, even if the new tool can read old .meteor/versions files,
the old tool wouldn't be able to read the new style. If in some release
of Meteor, we start writing .meteor/versions that use spaces, you won't
be able to switch between newer and older releases of Meteor without
getting a hard error about a malformed versions file in your app.
What we can do, at least, is start letting the tool read the better
format now, and maybe in the future we can switch.
This change also makes parsePackageAtVersion stand alone, instead of
being defined in terms of parsePackageConstraint, which is nice.
This reverts commit 415c179310.
This commit was wrong. Instead of removing the `if` block
we should always be running the contents. Thanks @glasser
for noticing.
The fix to #3999 didn't work on newer Linux systems whose pgrep contains
the backwards-incompatible change
f12277c74d
to not include arguments.
Since the inspiration to use pgrep instead of 'ps ax' was to work around
an OS X bug, just avoid pgrep on Linux in the first place.
Fixes#4115.
This test had been somewhat flaky. It seems to be less flaky now.
Changes include:
- Trying to not send the client->server logging RPC if the client is
about to reload due to autoupdate
- Making sure that the client doesn't send anything at all until a
little bit after starting, in order to make the ordering of messages
between tool-printed and server-printed messages more predictable
Also updated from standard-app-packages to meteor-tool.
`meteor run` doesn't always write changes to `.meteor/versions`: it only
does so if its release (or checkout-ness) matches `.meteor/release`. So
it preferred to just remember the value of `.meteor/versions` from
rebuild to rebuild rather than forgetting what it knew and re-reading
the possibly-not-updated file.
However, if some other process changes `.meteor/versions`, it would
ignore that change. With this fix, if `.meteor/versions` changes then
that is considered to be the previous versions list, not the last
version list from the same process. For example, this would commonly
happen due to using `meteor update` to update packages (without changing
the tool, which would cause the runner to stop).
Fixes#3582.
This restriction was originally in place because we did not know of a
use case for bare files on the server. The main use case for bare files
is putting pre-existing files in your app which expect top-level `var`s
to be "exported", which is common in browsers but not in Node.
However, there is a use case for this on the server: putting
pre-existing files that were originally written with clients in mind but
which function fine on the server into your server code. So we'll relax
the restriction.
Fixes#3681.
It was broken because fake-warehouse and test-package-server were
incompatible. In order to actually use the published packages, we had
to sync test-package-server into the local warehouse. But as soon as we
did that, the latest release became some other random release.
In any case, the semantics tested here have changed twice since 0.9.0!
In 0.9.0.1 we changed it from "ask for any RC means get any RC" to
"don't get any RCs that aren't explicitly anticipated". And in 1.1
we're changing it to "minimize unanticipated RCs".
Manually running through the equivalent of this test, most of it works
except for the last line; `meteor update` will not take you from one RC
to the next, due to minimizing unanticipated RCs. That's probably fine
though.
While we're at it, make it much more clear that warehouse and
test-package-server don't work together.
Adding the same file twice in the same package is now an
error. Previously, this could either lead to the file being included
multiple times (eg, JS), or to a build time crash (eg, client-side
assets).
Before:
While reading package from
`/private/tmp/meteor-duplicate-path-error/packages/dupe`:
/Users/glasser/.meteor/packages/meteor-tool/.1.0.45.1y6cwq8++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/package-api.js:22:5:
Invalid 'where' argument: '[object Object]'
at Array.forEach (native)
at Function._.each._.forEach
(/Users/glasser/.meteor/packages/meteor-tool/.1.0.45.1y6cwq8++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
at toArchArray
(/Users/glasser/.meteor/packages/meteor-tool/.1.0.45.1y6cwq8++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/package-api.js:22:5)
at PackageAPI._.extend.addFiles
(/Users/glasser/.meteor/packages/meteor-tool/.1.0.45.1y6cwq8++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/tools/package-api.js:287:12)
at package.js:2:7
After:
While reading package from
`/private/tmp/meteor-duplicate-path-error/packages/dupe`:
package.js:2:7: Invalid 'where' argument: '[object Object]'
The major problem here was that numeric useMyCaller never quite worked,
since useMyCaller was only used to calculate the file/line/etc for the
error, and not to convince formatMessages to not print the rest of the
stack.
The other issue is that `_.each` adds two levels of stack over just
using a `for` loop, whereas 8bcbd6534 only added 1 to the useMyCaller
argument.
Undocumented flag. This is one of those cases that is rare but may
come up, because `meteor list` runs the version solver (and writes
.meteor/versions). For example, it may come up if you run `meteor
list` with PACKAGE_DIRS and then without (or vice versa). You'll
get a message that says to pass --allow-incompatible-update, so we
must support it.
When you `meteor publish` a package (not from an app), a
ProjectContext is created that gets the Version Solver
"previousSolution" from the .versions file in the project directory.
From the point of view of the Version Solver, the package itself is
a root dependency, so if the version changes from last time, you
may be asked to pass --allow-incompatible-update! That isn't right.
However, the ProjectContext created by `meteor publish` doesn't know
it is created for a particular package. But it does have the package
marked as "explicitly added." So for now, the simplest thing to do
is to alter the input to the Version Solver based on the value of
explicitlyAddedLocalPackageDirs.
Oh, another wrinkle here is that we don't actually know the name of
the package we're publishing when we create the PackageContext, so it
can't be an option.
Example of a failing self-test that now passes:
'packages with organizations'
It's unfortunate that this change is in `compiler.compile`. It's
actually unfortunate that we only catch this during publish-for-arch.
But it seems too much to disallow all packages published with colons
even if they don't have binary dependencies since a lot of old
packages were created with our command-line tool that created
filenames with colons in them.