Commit af7b1b5
committed
Install content-addressable gemspecs under specifications/<ruby_abi>/
A content-addressable gemspec in the flat specifications/ directory
poisons a shared GEM_HOME for older RubyGems: the stub line carries the
content address where the platform used to be, so an older StubLine
parses it as platform unknown and derives a gem_dir that does not exist.
gem list shows the gem while gem "name" raises MissingSpecError.
Older RubyGems globs specifications/*.gemspec non-recursively
(Gem::Util.glob_files_in_dir), so a subdirectory is invisible to it by
construction: nothing to parse, nothing to misinterpret.
specifications/default/ and plugins/<ruby_abi>/ are the existing
precedents.
The read side only adds the running Ruby's ABI subdirectory, so a CA
build for another ABI sharing the GEM_HOME is never an activation
candidate. This also fixes two CA builds of one name-version having
identical sort_obj values, where Dependency#to_spec could activate a
~> X.Y.0 build on a different Ruby with no warning.
Layout:
GEM_HOME/
specifications/
rake-13.3.1.gemspec # ordinary gems, unchanged
3.4/
nokogiri-1.19.4-86e5e59f.gemspec # CA gems, ABI-scoped
gems/
nokogiri-1.19.4-86e5e59f/ # payload location unchanged
Gem::SpecificationRecord is the single home for layout knowledge:
- dirs_from expands each path to the flat specifications directory
plus specifications/<Gem.ruby_abi> (read side, running Ruby)
- abi_scoped_spec_dir? classifies a directory as ABI-scoped only when
its basename is ABI-shaped AND its parent is named specifications,
so unrelated paths like /tmp/3.4 are never misclassified
- specification_dir_for maps a spec to its one directory (write side,
keyed by the spec's pinned ABI, mirroring plugin_stub_dir_for)
Installer#spec_file delegates to specification_dir_for; write_spec
creates the ABI directory lazily via ensure_writable_dir and clamps it
to --dir-mode only after the gemspec is written, matching the
gem_dir/build_info_dir two-step (and surviving read-only dir modes).
Specification#base_dir strips the extra path level for specs loaded
from an ABI-scoped directory (like default_gem?), and #spec_dir points
back at it, so uninstall and pristine work unchanged.
Installer#installed_specs and RequestSet#specs_in glob through
dirs_from so already-installed CA gems are recognized.
Out of scope, tracked as follow-ups: gem doctor, bundle clean,
gem contents --spec-dir, and migration of legacy flat CA gemspecs
written by earlier 4.1.0.dev builds.
Assisted-By: devx/8371356f-3924-46a0-be8e-70db09fa33521 parent 415026f commit af7b1b5
19 files changed
Lines changed: 451 additions & 32 deletions
File tree
- lib
- bundler
- rubygems
- commands
- resolver
- local:
- spec/install/gemfile
- test/rubygems
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
48 | 63 | | |
49 | 64 | | |
50 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
| 103 | + | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | | - | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
312 | 316 | | |
313 | 317 | | |
314 | 318 | | |
| |||
357 | 361 | | |
358 | 362 | | |
359 | 363 | | |
360 | | - | |
361 | | - | |
362 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
363 | 369 | | |
364 | 370 | | |
365 | 371 | | |
| |||
395 | 401 | | |
396 | 402 | | |
397 | 403 | | |
398 | | - | |
| 404 | + | |
399 | 405 | | |
400 | 406 | | |
401 | 407 | | |
| |||
419 | 425 | | |
420 | 426 | | |
421 | 427 | | |
422 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
423 | 446 | | |
424 | 447 | | |
425 | 448 | | |
| |||
973 | 996 | | |
974 | 997 | | |
975 | 998 | | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
976 | 1003 | | |
977 | 1004 | | |
978 | 1005 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
559 | | - | |
| 559 | + | |
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | | - | |
522 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
523 | 525 | | |
524 | 526 | | |
525 | 527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1263 | 1263 | | |
1264 | 1264 | | |
1265 | 1265 | | |
1266 | | - | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
1267 | 1271 | | |
1268 | 1272 | | |
1269 | 1273 | | |
| |||
2026 | 2030 | | |
2027 | 2031 | | |
2028 | 2032 | | |
2029 | | - | |
| 2033 | + | |
2030 | 2034 | | |
2031 | 2035 | | |
2032 | 2036 | | |
2033 | 2037 | | |
2034 | 2038 | | |
2035 | 2039 | | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
2036 | 2046 | | |
2037 | 2047 | | |
2038 | 2048 | | |
| |||
2330 | 2340 | | |
2331 | 2341 | | |
2332 | 2342 | | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
2333 | 2346 | | |
2334 | 2347 | | |
2335 | | - | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
2336 | 2353 | | |
2337 | 2354 | | |
2338 | 2355 | | |
| |||
0 commit comments