Repository navigation
Commit 478f94f
Roll back a vendored PDM 0.x dependency declared with extras (#2060)
* Roll back a vendored PDM 0.x dependency declared with extras
`rollback` refused to undo socket-patch's own vendoring of a PyPI
package in a PDM 0.x project that declares it with extras
(`urllib3 = {version = "==1.26.18", extras = ["socks"]}`):
refusing to revert pkg:pypi/urllib3@1.26.18: for pdm.lock, the
ledger record for it would change entries other than urllib3's
own, which is not an edit socket-patch makes
PDM's lock_version 2 format keeps file hashes in `[metadata.files]`,
keyed `<name> <version>`, and a unit with extras has a key of its own,
`<name>[<extras>] <version>`. Vendoring rewrites both. The revert's
confinement check, new in 5.1.0 (#2052), read a key's package as its
first word, so `urllib3[socks]` counted as another package's entry
and the restore was refused. Nothing was written: the project stayed
vendored until its lock was restored from version control.
The check now drops the `[<extras>]` suffix before it compares names.
Another package's extras key is still refused.
Test: confinement_allows_a_pdm_revert_in_every_native_format runs the
PDM lock writer over every native lock fixture and holds the check to
accepting the revert. It fails on 0.12.3-extras without this change.
Found by depscan's PDM patch backtest on the 5.1.0 bump (PDM 0.12.3,
extras, vendored). The same cell passes with this build.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* Read the PDM files key beside the code that writes it
Review follow-up for the extras rollback fix.
The check's reading of a `[metadata.files]` key is now
`pdm_lock::files_key_package`, next to `legacy_files_key`, which builds
the key, with a test that every key the writer builds for the PDM 0.x
fixtures reads back as its unit's package. The two can no longer drift
apart unnoticed, which is how the 5.1.0 refusal shipped.
The `[<extras>]` suffix is dropped only for `files` / `hashes` keys.
A `sources` key is read as before, so `"six[socks]"` under
`[tool.uv.sources]` is not six's own entry.
Tests: revert_round_trip_restores_a_legacy_lock_with_extras vendors
and reverts urllib3 in the native PDM 0.12.3 extras lock through
wire_pdm and revert_pdm, the path that failed. Without the fix it
fails with the refusal users saw. The confinement sweep takes its
fixture list from pdm_lock's tests instead of a copy.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>1 parent 7208343 commit 478f94f
3 files changed
Lines changed: 164 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
117 | 127 | | |
118 | 128 | | |
119 | 129 | | |
| |||
497 | 507 | | |
498 | 508 | | |
499 | 509 | | |
500 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
501 | 524 | | |
502 | 525 | | |
503 | 526 | | |
| |||
508 | 531 | | |
509 | 532 | | |
510 | 533 | | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
| 534 | + | |
522 | 535 | | |
523 | 536 | | |
524 | 537 | | |
| |||
545 | 558 | | |
546 | 559 | | |
547 | 560 | | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
548 | 591 | | |
549 | 592 | | |
550 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1209 | 1209 | | |
1210 | 1210 | | |
1211 | 1211 | | |
1212 | | - | |
| 1212 | + | |
| 1213 | + | |
1213 | 1214 | | |
1214 | 1215 | | |
1215 | 1216 | | |
1216 | 1217 | | |
1217 | 1218 | | |
1218 | 1219 | | |
1219 | 1220 | | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
1225 | 1227 | | |
1226 | 1228 | | |
1227 | 1229 | | |
| |||
3676 | 3678 | | |
3677 | 3679 | | |
3678 | 3680 | | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
| 3686 | + | |
| 3687 | + | |
| 3688 | + | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
| 3699 | + | |
| 3700 | + | |
| 3701 | + | |
| 3702 | + | |
| 3703 | + | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
| 3710 | + | |
| 3711 | + | |
| 3712 | + | |
| 3713 | + | |
| 3714 | + | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
| 3721 | + | |
3679 | 3722 | | |
3680 | 3723 | | |
3681 | 3724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1328 | 1328 | | |
1329 | 1329 | | |
1330 | 1330 | | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
1331 | 1391 | | |
1332 | 1392 | | |
1333 | 1393 | | |
| |||
0 commit comments