WEBVTT

00:00:00.520 --> 00:00:05.240
An upgrade can quietly take away
the one version something on your machine

00:00:05.400 --> 00:00:06.233
still needed.

00:00:06.880 --> 00:00:10.200
This is the OCX Podcast for engineers

00:00:10.260 --> 00:00:13.560
who install tools on laptops
and in pipelines.

00:00:14.200 --> 00:00:15.033
I'm Vera.

00:00:15.140 --> 00:00:15.973
And I'm Max.

00:00:16.500 --> 00:00:21.300
This episode assumes you've tried OCX,
a package manager that installs your tools

00:00:21.320 --> 00:00:23.860
from a registry and picks
each machine's build.

00:00:24.540 --> 00:00:25.380
In episode two,

00:00:25.840 --> 00:00:30.580
we used it to put two versions of one tool
side by side and to switch between them.

00:00:31.120 --> 00:00:35.580
This time, it's a laptop with two
projects that need different versions

00:00:35.620 --> 00:00:39.160
of the same tool and room
for just one of them.

00:00:39.500 --> 00:00:44.160
The package manager on this laptop
holds one CMake, three point thirty-one,

00:00:44.660 --> 00:00:46.500
and both of its projects lean on it.

00:00:47.120 --> 00:00:49.040
A routine upgrade moves it to four.

00:00:49.720 --> 00:00:54.160
Now the newer project,
which needs four, finally configures.

00:00:54.900 --> 00:00:58.500
The older project stops
on the first line of its build file,

00:00:58.960 --> 00:01:00.711
the line that asks for its minimum.

00:01:01.500 --> 00:01:04.220
Version four won't take
a minimum that old.

00:01:04.660 --> 00:01:08.600
Put three point thirty-one back, and
the newer project is the one that fails.

00:01:09.220 --> 00:01:14.120
Whichever CMake the laptop keeps, one of
its projects stops at the configure step.

00:01:14.640 --> 00:01:16.880
Four arriving wasn't the whole of it.

00:01:17.460 --> 00:01:22.540
The upgrade also made four
the only CMake anyone on this laptop gets,

00:01:23.060 --> 00:01:24.880
and nobody asked for that part.

00:01:25.180 --> 00:01:27.060
The upgrade itself was reasonable.

00:01:27.600 --> 00:01:30.840
The newer project needed four,
and four is what it got.

00:01:31.300 --> 00:01:34.920
It also got the spot three point
thirty-one had been sitting in,

00:01:35.320 --> 00:01:36.380
under the same name.

00:01:37.080 --> 00:01:40.100
An upgrade only breaks what it overwrites.

00:01:40.520 --> 00:01:43.820
Upgrading less often wouldn't
have saved the older project.

00:01:44.200 --> 00:01:47.260
Giving every version
a place of its own would.

00:01:47.900 --> 00:01:48.733
With that,

00:01:49.020 --> 00:01:53.240
four arrives beside three point
thirty-one, not on top of it.

00:01:53.560 --> 00:01:56.360
Old minimums are where CMake
four drew its line.

00:01:56.900 --> 00:02:00.051
It dropped support for build files
that ask for a minimum older

00:02:00.100 --> 00:02:01.201
than three point five.

00:02:01.840 --> 00:02:04.700
On four, those don't configure
without a workaround.

00:02:05.120 --> 00:02:09.940
And keeping anything below four around
isn't what the laptop's package manager

00:02:10.000 --> 00:02:10.833
is for.

00:02:11.120 --> 00:02:13.540
It carries one version of each name.

00:02:14.200 --> 00:02:16.660
That's a design choice, not a defect.

00:02:17.200 --> 00:02:20.380
And for managing an operating
system, it's the right one.

00:02:20.800 --> 00:02:24.380
Homebrew, apt, and DNF
all treat CMake that way.

00:02:24.980 --> 00:02:27.020
Each stock package is a single version,

00:02:27.380 --> 00:02:30.931
and Homebrew doesn't even have
an older CMake formula to put beside it.

00:02:31.220 --> 00:02:33.860
Neither project is wrong
about what it needs.

00:02:34.340 --> 00:02:38.960
The laptop just has room for one CMake,
and they need different ones.

00:02:39.360 --> 00:02:41.420
We rebuilt that situation on Linux,

00:02:41.740 --> 00:02:46.780
the same pair of projects with both
CMakes installed side by side in OCX.

00:02:47.500 --> 00:02:50.120
The older project's configure
step runs through it,

00:02:50.560 --> 00:02:53.420
names three point thirty-one,
and writes its build files.

00:02:53.880 --> 00:02:57.840
The newer project names four
instead and goes through as well.

00:02:58.500 --> 00:03:03.600
Same machine, same install, and each
command says which version it wants.

00:03:04.100 --> 00:03:07.040
That's the part the laptop's
package manager couldn't do.

00:03:07.720 --> 00:03:10.620
There, the machine picks
the CMake a project gets.

00:03:11.020 --> 00:03:12.680
Here, the command picks.

00:03:13.220 --> 00:03:14.580
We cross them over as well.

00:03:15.240 --> 00:03:19.340
The newer project on three point
thirty-one stops at its version check.

00:03:19.860 --> 00:03:23.740
The older one on four stops right
where it did on the laptop.

00:03:24.120 --> 00:03:28.100
Each project needs its own CMake,
and here both get theirs.

00:03:28.440 --> 00:03:33.500
On disk, the packages you install
with OCX all sit in one place,

00:03:34.000 --> 00:03:35.740
each in a directory of its own.

00:03:36.420 --> 00:03:38.140
That place is the store.

00:03:38.880 --> 00:03:41.980
Each directory is named
by the package's digest,

00:03:42.380 --> 00:03:45.580
a checksum that identifies
one exact build.

00:03:45.980 --> 00:03:49.400
Which is how both CMakes share
one install without colliding.

00:03:50.020 --> 00:03:52.271
Neither directory
is named after its version.

00:03:52.620 --> 00:03:54.780
It isn't named after a tag either.

00:03:55.360 --> 00:03:56.800
The digest is the name,

00:03:57.240 --> 00:04:01.040
and a tag is a label that points
at one of those directories.

00:04:01.480 --> 00:04:05.420
We tested that with the tags both
CMakes carry: a short version,

00:04:05.760 --> 00:04:09.300
a full version, and a dated
build tag, or latest.

00:04:09.960 --> 00:04:11.211
We installed six of them.

00:04:11.640 --> 00:04:15.040
The extra ones all pointed
at builds already in the store,

00:04:15.520 --> 00:04:17.700
so installing them fetched nothing.

00:04:18.200 --> 00:04:22.340
Six tags, two directories,
and the disk usage doesn't move.

00:04:22.640 --> 00:04:26.960
The store keeps a build once,
even with several tags pointing at it.

00:04:27.380 --> 00:04:31.000
Which would mean both CMakes share
whatever files they have in common,

00:04:31.500 --> 00:04:34.240
so keeping the second one
around costs very little.

00:04:34.740 --> 00:04:37.360
That's one step further
than the store goes.

00:04:37.920 --> 00:04:40.220
Identical builds are stored once.

00:04:40.840 --> 00:04:44.500
These are different builds,
so they share no files at all,

00:04:45.020 --> 00:04:48.180
and each one costs its full size on disk.

00:04:48.680 --> 00:04:49.513
Fair enough.

00:04:50.100 --> 00:04:54.740
Keeping the second one around means paying
for every byte of it, and by itself,

00:04:55.040 --> 00:04:57.620
CMake four comes
to about two hundred megabytes.

00:04:58.000 --> 00:05:03.060
Every tool gets one fixed place on disk,
holding whichever version you chose.

00:05:03.800 --> 00:05:07.200
Select is the step that changes
which version that is.

00:05:07.660 --> 00:05:12.600
We'd chosen three point thirty-one for
CMake, and installing four didn't move it.

00:05:12.940 --> 00:05:14.240
Only a select would.

00:05:14.860 --> 00:05:17.720
Arriving and switching
are separate steps here,

00:05:18.100 --> 00:05:20.700
where the laptop's
upgrade did both at once.

00:05:21.100 --> 00:05:23.120
Tags can move too from the other end.

00:05:23.760 --> 00:05:26.880
A publisher can push a different
build under the same tag,

00:05:27.360 --> 00:05:29.661
so we did that with a test
package of our own.

00:05:29.960 --> 00:05:32.920
Until our machine refreshed
what that tag pointed at,

00:05:33.260 --> 00:05:35.340
it kept running the build we'd installed.

00:05:35.800 --> 00:05:38.300
After the refresh,
running that tag fetched

00:05:38.320 --> 00:05:42.760
the build pushed later, while our install
still pointed at the one it started with.

00:05:43.080 --> 00:05:45.900
Some packages need another package to run.

00:05:46.620 --> 00:05:48.960
One public example is pipx,

00:05:49.300 --> 00:05:51.860
which pins the Python it needs by digest.

00:05:52.300 --> 00:05:56.820
We built one for this episode to show
how that works. It needs CMake four

00:05:57.000 --> 00:05:58.600
and asks for it by its tag.

00:05:59.000 --> 00:06:02.900
When our package is built,
the tag is turned into a digest.

00:06:03.432 --> 00:06:07.152
The digest goes into the description
that travels with the package

00:06:07.532 --> 00:06:11.292
Try to push it with only the tag
written down and the push is refused.

00:06:11.712 --> 00:06:12.852
It wants a digest.

00:06:13.212 --> 00:06:15.112
The digest is the name here too.

00:06:15.632 --> 00:06:20.252
Installing fetches CMake by that digest
and never looks the tag up.

00:06:20.932 --> 00:06:22.492
Tag 4 can keep moving,

00:06:22.712 --> 00:06:26.532
and this package still asks
for the exact build it was made with.

00:06:26.812 --> 00:06:30.032
Anyone who's used Nix is hearing
something familiar by now.

00:06:30.612 --> 00:06:35.252
Builds named by digest, versions
side by side, dependencies pinned.

00:06:35.932 --> 00:06:37.183
Isn't that the Nix store?

00:06:37.372 --> 00:06:40.232
It's close, and none of it is new.

00:06:40.992 --> 00:06:44.772
Even the OCX docs compare
its store to the Nix store.

00:06:45.492 --> 00:06:50.632
The differences are in where that store
lives and who needs root to create it.

00:06:50.992 --> 00:06:55.132
Nix's cache is keyed to its store
directory. Pick a different directory

00:06:55.412 --> 00:06:56.513
and you're rebuilding.

00:06:56.712 --> 00:07:00.252
With OCX, you pick
its folder before you install.

00:07:00.812 --> 00:07:05.252
Any path, any length,
and the pre-built binaries still work.

00:07:05.672 --> 00:07:09.212
Nix also needs root to create
its store directory in the first place,

00:07:09.552 --> 00:07:14.492
where OCX installs as you,
no sudo and no root-owned prefix.

00:07:14.792 --> 00:07:18.812
The older project's build file
still asks for its old minimum.

00:07:19.392 --> 00:07:21.512
Its configure step goes through anyway

00:07:21.812 --> 00:07:25.572
because it now names 3.31 through OCX.

00:07:26.012 --> 00:07:30.052
Meanwhile, the laptop's package
manager still holds one CMake.

00:07:30.672 --> 00:07:32.692
It's 4, just as the upgrade left it,

00:07:33.072 --> 00:07:36.032
and both projects now name
their own version instead.

00:07:36.572 --> 00:07:40.432
Nothing about that package manager
changed, and nothing had to.

00:07:41.072 --> 00:07:45.732
The versions the projects ask for sit
outside it in a folder of their own.

00:07:46.152 --> 00:07:49.192
What sits in CMake's fixed
place is a choice now,

00:07:49.612 --> 00:07:51.463
not something an upgrade does to you.

00:07:52.052 --> 00:07:54.072
Moving it to 4 takes one select.

00:07:54.652 --> 00:07:57.652
For a tool installed this way,
going back takes another.

00:07:58.072 --> 00:08:01.852
With both CMakes installed,
type the tool's name on its own.

00:08:02.512 --> 00:08:04.132
Which one actually runs?

00:08:04.692 --> 00:08:06.712
Neither of the two that OCX holds.

00:08:07.312 --> 00:08:11.631
The shell finds the laptop's own CMake,
the one its package manager put there.

00:08:12.092 --> 00:08:13.672
Episode 4 picks that up.

00:08:14.452 --> 00:08:16.912
Nothing on the path you did not ask for.

00:08:17.512 --> 00:08:19.772
Everything's at ocx.sh.

00:08:20.672 --> 00:08:23.052
Same toolchain on every laptop.

00:08:23.492 --> 00:08:24.672
And in CI.

00:08:25.312 --> 00:08:26.412
See you next episode.

