Trying to use stow for managing multiple versions of packages

Kaushal Modi <[email protected]> Fri, 27 Jan 2017 17:23:59 +0000
Newsgroups gmane.comp.gnu.stow.general
Message-ID <CAFyQvY2kZjt0_0L03d=7+fHg1Pc5UOAWmgFA37JGmb40MfYn2g@mail.gmail.com>
--f403045dd560edbce7054716bb8f
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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=3D/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
....

=3D=3D=3D=3D=3D

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=3Dpkgs/PKG1 V1

.. things start out good. I get links created in ~/stowed/

But then when I do

stow --dir=3Dpkgs/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=3Dbin --defer=3Dlib .. 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:
=3D=3D=3D=3D=3D
#!/usr/bin/env bash
# Time-stamp: <2017-01-27 11:46:03 kmodi>

if [[ -z ${STOW_PKGS_ROOT+x} ]]
then
    export STOW_PKGS_ROOT=3D"/home/$USER/stow/pkgs"
fi

# The stow binary is installed in ${STOW_PKGS_ROOT}/stow/master/bin
PATH=3D${STOW_PKGS_ROOT}/stow/master/bin:$PATH

stow_ver=3D"master"
ripgrep_ver=3D"master"

here=3D$(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=3D${STOW_PKGS_ROOT}/stow    ${stow_ver}
stow --dir=3D${STOW_PKGS_ROOT}/ripgrep ${ripgrep_ver}

cd ${here}
=3D=3D=3D=3D=3D

Here is my ~/stow structure:

=3D=3D=3D=3D=3D
km=C2=B2~/stow/:> tree -L 4 -a
.
=E2=94=9C=E2=94=80=E2=94=80 gen_dir_struct
=E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 bin
=E2=94=82   =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 file
=E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 lib
=E2=94=82   =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 file
=E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 lib64
=E2=94=82   =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 file
=E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 man
=E2=94=82   =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 man1
=E2=94=82   =E2=94=82       =E2=94=94=E2=94=80=E2=94=80 file
=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 share
=E2=94=82       =E2=94=94=E2=94=80=E2=94=80 file
=E2=94=9C=E2=94=80=E2=94=80 pkgs
=E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 ripgrep
=E2=94=82   =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 master
=E2=94=82   =E2=94=82       =E2=94=9C=E2=94=80=E2=94=80 bin
=E2=94=82   =E2=94=82       =E2=94=94=E2=94=80=E2=94=80 man
=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 stow
=E2=94=82       =E2=94=94=E2=94=80=E2=94=80 master
=E2=94=82           =E2=94=9C=E2=94=80=E2=94=80 bin
=E2=94=82           =E2=94=9C=E2=94=80=E2=94=80 lib
=E2=94=82           =E2=94=94=E2=94=80=E2=94=80 share
=E2=94=9C=E2=94=80=E2=94=80 stow_it.sh
=E2=94=94=E2=94=80=E2=94=80 .stowrc
=3D=3D=3D=3D=3D

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.
--=20

Kaushal Modi

--f403045dd560edbce7054716bb8f
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div><br></div><div>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.</div><div><br></div><div>I am using s=
tow built from its master branch as of today.</div><div><br></div><div>I pl=
an to install all software packages in ~/stow/pkgs/PKG_NAME/VERSION</div><d=
iv><br></div><div>So I would then have</div><div>~/stow/pkgs/PKG1/V1/bin=C2=
=A0</div><div>~/stow/pkgs/PKG1/V1/share</div><div>~/stow/pkgs/PKG1/V1 /lib<=
br></div><div>~/stow/pkgs/PKG1/V2/bin=C2=A0</div><div>~/stow/pkgs/PKG1/V2/s=
hare</div><div>~/stow/pkgs/PKG1/V2 /lib<br></div><br class=3D"inbox-inbox-A=
pple-interchange-newline"><div>...</div><div><br></div><div>That means that=
 for package PKG1, ~/stow/pkgs/PKG1 needs to become the &quot;stow dir&quot=
;, and then V1, V2, .. will become the &quot;stow packages&quot; for PKG1.<=
/div><div><br></div><div>In ~/stow/.stowrc, I have just this one line</div>=
<div><br></div><div>--target=3D/home/kmodi/stowed<br></div><div><br></div><=
div>I plan to create the links in ~/stowed.</div><div><br></div><div>My ide=
a is to have</div><div><br></div><div>~/stowed/bin/PKG1_binary_file</div><d=
iv>~/stowed/bin/PKG2_binary_file=C2=A0=C2=A0<br></div><div>....</div><div><=
br></div><div>=3D=3D=3D=3D=3D</div><div><br></div><div>You probably underst=
ood by now where I am going with this and what issue I am able to mention.<=
/div><div><br></div><div>So if I do the below</div><div><br></div><div>cd ~=
/stow</div><div>stow --dir=3Dpkgs/PKG1 V1</div><div><br></div><div>.. thing=
s start out good. I get links created in ~/stowed/</div><div><br></div><div=
>But then when I do</div><div><br></div><div>stow --dir=3Dpkgs/PKG2 V1<br><=
/div><div><br></div><div>I get</div><div><br></div><div><div>WARNING! stowi=
ng master would cause conflicts:</div><div>=C2=A0 * existing target is not =
owned by stow: bin</div><div>=C2=A0 All operations aborted.</div></div><div=
><br></div><div>I tried using --defer=3Dbin --defer=3Dlib .. but that did n=
ot help.</div><div><br></div><div>What is the best way to make this setup w=
ork for installing multiple versions of multiple packages?</div><div><br></=
div><div>Below finally worked, but I would like to know if that&#39;s the c=
anonical way to go about it.</div><div><br></div><div>I basically create a =
dummy package called gen_dir_struct that just dictates what directories I n=
eed to create in the target dir, and only that package I stow using the --n=
o-folding option.</div><div><br></div><div>Here is the stow wrapper script =
I use:</div><div>=3D=3D=3D=3D=3D</div><div><div>#!/usr/bin/env bash</div><d=
iv># Time-stamp: &lt;2017-01-27 11:46:03 kmodi&gt;</div><div><br></div><div=
>if [[ -z ${STOW_PKGS_ROOT+x} ]]</div><div>then</div><div>=C2=A0 =C2=A0 exp=
ort STOW_PKGS_ROOT=3D&quot;/home/$USER/stow/pkgs&quot;</div><div>fi</div><d=
iv><br></div><div># The stow binary is installed in ${STOW_PKGS_ROOT}/stow/=
master/bin</div><div>PATH=3D${STOW_PKGS_ROOT}/stow/master/bin:$PATH</div><d=
iv><br></div><div>stow_ver=3D&quot;master&quot;</div><div>ripgrep_ver=3D&qu=
ot;master&quot;</div><div><br></div><div>here=3D$(pwd)</div><div><br></div>=
<div># Generate a directory structure in ${STOW_TARGET}</div><div>cd ${STOW=
_PKGS_ROOT}/..</div><div>stow --no-folding gen_dir_struct</div><div># Witho=
ut the above, you will get this error after running the first stow command<=
/div><div># below.</div><div># WARNING! stowing master would cause conflict=
s:</div><div># =C2=A0 * existing target is not owned by stow: bin</div><div=
># =C2=A0 All operations aborted.</div><div><br></div><div>stow --dir=3D${S=
TOW_PKGS_ROOT}/stow =C2=A0 =C2=A0${stow_ver}</div><div>stow --dir=3D${STOW_=
PKGS_ROOT}/ripgrep ${ripgrep_ver}</div><div><br></div><div>cd ${here}</div>=
</div><div>=3D=3D=3D=3D=3D</div><div><br></div><div>Here is my ~/stow struc=
ture:</div><div><br></div><div>=3D=3D=3D=3D=3D</div><div><div>km=C2=B2~/sto=
w/:&gt; tree -L 4 -a</div><div>.</div><div>=E2=94=9C=E2=94=80=E2=94=80 gen_=
dir_struct</div><div>=E2=94=82 =C2=A0 =E2=94=9C=E2=94=80=E2=94=80 bin</div>=
<div>=E2=94=82 =C2=A0 =E2=94=82 =C2=A0 =E2=94=94=E2=94=80=E2=94=80 file</di=
v><div>=E2=94=82 =C2=A0 =E2=94=9C=E2=94=80=E2=94=80 lib</div><div>=E2=94=82=
 =C2=A0 =E2=94=82 =C2=A0 =E2=94=94=E2=94=80=E2=94=80 file</div><div>=E2=94=
=82 =C2=A0 =E2=94=9C=E2=94=80=E2=94=80 lib64</div><div>=E2=94=82 =C2=A0 =E2=
=94=82 =C2=A0 =E2=94=94=E2=94=80=E2=94=80 file</div><div>=E2=94=82 =C2=A0 =
=E2=94=9C=E2=94=80=E2=94=80 man</div><div>=E2=94=82 =C2=A0 =E2=94=82 =C2=A0=
 =E2=94=94=E2=94=80=E2=94=80 man1</div><div>=E2=94=82 =C2=A0 =E2=94=82 =C2=
=A0 =C2=A0 =C2=A0 =E2=94=94=E2=94=80=E2=94=80 file</div><div>=E2=94=82 =C2=
=A0 =E2=94=94=E2=94=80=E2=94=80 share</div><div>=E2=94=82 =C2=A0 =C2=A0 =C2=
=A0 =E2=94=94=E2=94=80=E2=94=80 file</div><div>=E2=94=9C=E2=94=80=E2=94=80 =
pkgs</div><div>=E2=94=82 =C2=A0 =E2=94=9C=E2=94=80=E2=94=80 ripgrep</div><d=
iv>=E2=94=82 =C2=A0 =E2=94=82 =C2=A0 =E2=94=94=E2=94=80=E2=94=80 master</di=
v><div>=E2=94=82 =C2=A0 =E2=94=82 =C2=A0 =C2=A0 =C2=A0 =E2=94=9C=E2=94=80=
=E2=94=80 bin</div><div>=E2=94=82 =C2=A0 =E2=94=82 =C2=A0 =C2=A0 =C2=A0 =E2=
=94=94=E2=94=80=E2=94=80 man</div><div>=E2=94=82 =C2=A0 =E2=94=94=E2=94=80=
=E2=94=80 stow</div><div>=E2=94=82 =C2=A0 =C2=A0 =C2=A0 =E2=94=94=E2=94=80=
=E2=94=80 master</div><div>=E2=94=82 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =E2=
=94=9C=E2=94=80=E2=94=80 bin</div><div>=E2=94=82 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =E2=94=9C=E2=94=80=E2=94=80 lib</div><div>=E2=94=82 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =E2=94=94=E2=94=80=E2=94=80 share</div><div>=E2=94=
=9C=E2=94=80=E2=94=80 stow_it.sh</div><div>=E2=94=94=E2=94=80=E2=94=80 .sto=
wrc</div></div><div>=3D=3D=3D=3D=3D</div><div><br></div><div>I am looking f=
orward to feedback if it&#39;s a good idea to do the above before I start m=
igrating my dozens of package installations to the above structure.</div><d=
iv><br></div><div>Thank you.</div></div><div dir=3D"ltr">-- <br></div><div =
data-smartmail=3D"gmail_signature"><p dir=3D"ltr">Kaushal Modi</p>
</div>

--f403045dd560edbce7054716bb8f--