Hello,
I am working on configuring stow to manage multiple versions of packages (emacs master build vs emacs 25.1 release, etc), and also my dot files.
I am using stow built from its master branch as of today.
I plan to install all software packages in ~/stow/pkgs/PKG_NAME/VERSION
So I would then have
~/stow/pkgs/PKG1/V1/bin
~/stow/pkgs/PKG1/V1/share
~/stow/pkgs/PKG1/V1 /lib
~/stow/pkgs/PKG1/V2/bin
~/stow/pkgs/PKG1/V2/share
~/stow/pkgs/PKG1/V2 /lib
...
That means that for package PKG1, ~/stow/pkgs/PKG1 needs to become the "stow dir", and then V1, V2, .. will become the "stow packages" for PKG1.
In ~/stow/.stowrc, I have just this one line
--target=/home/kmodi/stowed
I plan to create the links in ~/stowed.
My idea is to have
~/stowed/bin/PKG1_binary_file
~/stowed/bin/PKG2_binary_file
....
=====
You probably understood by now where I am going with this and what issue I am able to mention.
So if I do the below
cd ~/stow
stow --dir=pkgs/PKG1 V1
.. things start out good. I get links created in ~/stowed/
But then when I do
stow --dir=pkgs/PKG2 V1
I get
WARNING! stowing master would cause conflicts:
* existing target is not owned by stow: bin
All operations aborted.
I tried using --defer=bin --defer=lib .. but that did not help.
What is the best way to make this setup work for installing multiple versions of multiple packages?
Below finally worked, but I would like to know if that's the canonical way to go about it.
I basically create a dummy package called gen_dir_struct that just dictates what directories I need to create in the target dir, and only that package I stow using the --no-folding option.
Here is the stow wrapper script I use:
=====
#!/usr/bin/env bash
# Time-stamp: <2017-01-27 11:46:03 kmodi>
if [[ -z ${STOW_PKGS_ROOT+x} ]]
then
export STOW_PKGS_ROOT="/home/$USER/stow/pkgs"
fi
# The stow binary is installed in ${STOW_PKGS_ROOT}/stow/master/bin
PATH=${STOW_PKGS_ROOT}/stow/master/bin:$PATH
stow_ver="master"
ripgrep_ver="master"
here=$(pwd)
# Generate a directory structure in ${STOW_TARGET}
cd ${STOW_PKGS_ROOT}/..
stow --no-folding gen_dir_struct
# Without the above, you will get this error after running the first stow command
# below.
# WARNING! stowing master would cause conflicts:
# * existing target is not owned by stow: bin
# All operations aborted.
stow --dir=${STOW_PKGS_ROOT}/stow ${stow_ver}
stow --dir=${STOW_PKGS_ROOT}/ripgrep ${ripgrep_ver}
cd ${here}
=====
Here is my ~/stow structure:
=====
km²~/stow/:> tree -L 4 -a
.
├── gen_dir_struct
│ ├── bin
│ │ └── file
│ ├── lib
│ │ └── file
│ ├── lib64
│ │ └── file
│ ├── man
│ │ └── man1
│ │ └── file
│ └── share
│ └── file
├── pkgs
│ ├── ripgrep
│ │ └── master
│ │ ├── bin
│ │ └── man
│ └── stow
│ └── master
│ ├── bin
│ ├── lib
│ └── share
├── stow_it.sh
└── .stowrc
=====
I am looking forward to feedback if it's a good idea to do the above before I start migrating my dozens of package installations to the above structure.
Thank you.