m icon indicating copy to clipboard operation
m copied to clipboard

Add link command to create versioned binaries

Open dgomezferro opened this issue 3 years ago • 2 comments

This is useful for multiversion tests, but feel free to suggest alternative ways of doing it (for instance during installation)

$ ls ~/.local/bin -l
total 28
[...]
lrwxrwxrwx 1 ubuntu ubuntu   56 Dec 22 15:04 install_compass -> /home/ubuntu/.local/m/versions/5.0.3/bin/install_compass
lrwxrwxrwx 1 ubuntu ubuntu   46 Dec 22 15:04 mongo -> /home/ubuntu/.local/m/versions/5.0.3/bin/mongo
lrwxrwxrwx 1 ubuntu ubuntu   46 Dec 22 15:15 mongo-5.0 -> /home/ubuntu/.local/m/versions/5.0.5/bin/mongo
lrwxrwxrwx 1 ubuntu ubuntu   46 Dec 22 15:15 mongo-5.1 -> /home/ubuntu/.local/m/versions/5.1.1/bin/mongo
lrwxrwxrwx 1 ubuntu ubuntu   50 Dec 22 15:15 mongo-5.2 -> /home/ubuntu/.local/m/versions/5.2.0-rc2/bin/mongo
lrwxrwxrwx 1 ubuntu ubuntu   47 Dec 22 15:04 mongod -> /home/ubuntu/.local/m/versions/5.0.3/bin/mongod
lrwxrwxrwx 1 ubuntu ubuntu   47 Dec 22 15:15 mongod-5.0 -> /home/ubuntu/.local/m/versions/5.0.5/bin/mongod
[...]

dgomezferro avatar Dec 22 '21 15:12 dgomezferro

@dgomezferro FYI you can select an installed mongod/mongos/mongo version with m <binary> <version>:

m mongod 5.0  --version
db version v5.0.5

Would that work for your testing use case or would you prefer symlinks so you can test if a file exists?

You may also find the JSON output of installed versions and paths helpful for test integration: m lls --json.

Cheers, Stennie

stennie avatar Jan 13 '22 21:01 stennie

@stennie I used this for multiversion tests, they expect multiple versions of the mongod binaries available in the PATH with format mongod-X.Y.

If the feature doesn't belong in m that's fine by me though. I've just learned about db-contrib-tool that should take care of setting up the environment for tests, haven't tried it yet though.

dgomezferro avatar Jan 14 '22 10:01 dgomezferro