Currently I have 2 versions of julia in my system, v0.5.2 and v0.7.0-DEV (master). To do so I cloned twice the repository to different folders and I build them to have both versions.
I think that it should be a way of downloading the repository only once and somehow do a git checkout master to some folder and git checkout v.0.5.2 into some other folder from which later I can build.
I don’t know whether this can be done. But note that it wouldn’t buy you much in terms of saving diskspace. The size of the cloned Julia repo is 0.2GB, but once you build it, it is 3GB. Much of this is due to external libraries, which often will be on different versions for different Julia versions. Thus sharing them between two Julia version will be difficult. But maybe someone has a trick?
Well, first you should check the link provided by @yuyichao.
I am just posting one solution to answer your question (on a *nix machine):
Clone the repository. git clone https://github.com/JuliaLang/Julia.git ~/julia-repo.
This command will clone the repository to the julia-repo folder in your user’s home folder.
After cd ~/julia-repo, checkout your favourite tag as a new branch. git checkout -b install-0.5 v0.5.2
This will create a new branch named install-0.5 from the tagged commit v0.5.2, which is the latest stable patch in v0.5 series.
Follow the steps on the Julia website to install the corresponding version.
Clean the workspace by issuing make cleanall or similar command. Once you are in ~/julia-repo folder, you can git clean -fdx to (force) clean all the untracked files and folders, i.e., the dependencies. For more info on what the -fdx switch means, please issue git help clean.
You can keep the branch, or simply remove it if you want: git branch -d install-0.5.
Some time after, when you would like to fetch the new updates from the repo, do the following:
cd ~/julia-repo
git checkout master
git fetch --all --prune
git merge --ff-only origin/master # if this results in a conflict, you are doing something wrong.
# if that is the case, issue first the below command prior to git merge
git reset --hard --
Follow steps 2-5 for other versions such as v0.6.0-rc3, master (for the latest (probably unstable) release), etc., as in
Sure, I did check the link of @yuyichao. It is very interesting. There are many things to learn each single day. I like both solutions, and now I’m implementing this ideas into a script.
I use make install, with a particular prefix (set in “Make.user”), each time I want to keep a certain version. This surely saves space compared to building in different clones (an installed julia takes up about 200MB). This seems simpler than using git worktree.
It it can be of any help, to automatically set the prefix, I have this in my “Make.user”:
ROOTPREFIX=<custom-location>/build/julia/
BRANCH=$(shell git rev-parse --abbrev-ref HEAD | sed s-/-_-)
COMMIT=$(shell git rev-parse HEAD | cut -c 1-8)
prefix = $(shell echo $(ROOTPREFIX)$(BRANCH)_$(COMMIT))
With git-worktree, do you have a way to avoid rebuilding the whole deps directory in a new working tree? I tried to symlink deps/srscache and deps/scratch (the two biggest subdirectories) from the main worktree, but this errors out.