Skip to content

Commit 0d30114

Browse files
committed
fix(compat.glfw): the source tree is named by upstream's tag, not by this package's version
`install()` fell back to `"glfw-" .. pkginfo.version()`. That was the same string for as long as the package had one version; the day it took an ecosystem segment -- 3.4.0.1, for a pin that moved while upstream did not release -- the expression asked for `glfw-3.4.0.1/`, which no tarball contains. install() then moved nothing, and the failure appeared two layers away as `GLFW/glfw3.h: file not found` in a consumer's test. A path derived from a version breaks the first time the version means something the upstream tag does not. The fallback now names the tag, and a source tree that is missing under both spellings is an error rather than an install that "succeeds" and leaves a directory with no headers in it. Found by CI, not locally: `mcpp build` does not compile a member's tests, so the local check was weaker than the one that caught it.
1 parent 0d35495 commit 0d30114

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

pkgs/c/compat.glfw.lua

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,35 @@ package = {
168168

169169
import("xim.libxpkg.pkginfo")
170170

171+
-- THE SOURCE TREE IS NAMED BY UPSTREAM'S TAG, NOT BY THIS PACKAGE'S VERSION.
172+
--
173+
-- They were the same string for as long as this package had one version, and
174+
-- the fallback below spelled the directory as `"glfw-" .. pkginfo.version()`.
175+
-- The day the package took an ecosystem segment -- 3.4.0.1, for a pin that
176+
-- moved while upstream did not release -- that expression asked for
177+
-- `glfw-3.4.0.1/`, which no tarball contains. install() then moved nothing and
178+
-- the failure appeared two layers away, as `GLFW/glfw3.h: file not found` in a
179+
-- consumer's test.
180+
--
181+
-- A path derived from a version is a path that breaks the first time the
182+
-- version means something the upstream tag does not.
183+
local UPSTREAM_TAG = "3.4"
184+
185+
import("xim.libxpkg.log")
186+
171187
function install()
172188
local srcdir = pkginfo.install_file():replace(".tar.gz", "")
173189
if not os.isdir(srcdir) then
174-
srcdir = "glfw-" .. pkginfo.version()
190+
srcdir = "glfw-" .. UPSTREAM_TAG
191+
end
192+
if not os.isdir(srcdir) then
193+
-- Loud, because the alternative is an install that "succeeds" and
194+
-- leaves an install_dir with no headers in it.
195+
log.error("compat.glfw: no source tree at %s; the tarball's top-level "
196+
.. "directory is named by upstream's tag (%s), and neither "
197+
.. "that nor the downloaded name matched",
198+
srcdir, UPSTREAM_TAG)
199+
return false
175200
end
176201

177202
os.tryrm(pkginfo.install_dir())

0 commit comments

Comments
 (0)