|
| 1 | + |
| 2 | +using Pkg, Dates |
| 3 | + |
| 4 | +# -------- sources -------- |
| 5 | +lcm_url = "https://github.com/Electa-Git/LineCableModels.jl" |
| 6 | +lcm_rev = "dev/thermal" |
| 7 | +getdp_url = "https://github.com/Electa-Git/GetDP.jl" |
| 8 | +getdp_rev = "473dece8e9bdb614990f611cac346d10984cfd25" |
| 9 | +# ------------------------- |
| 10 | + |
| 11 | +Pkg.activate() |
| 12 | + |
| 13 | +# 1) Remove from manifest (works even when not in Project.toml) |
| 14 | +for name in ("GetDP", "LineCableModels") |
| 15 | + try |
| 16 | + Pkg.rm(name; mode = Pkg.PKGMODE_MANIFEST) |
| 17 | + catch err |
| 18 | + @warn "Pkg.rm failed (ok if not present)" name err |
| 19 | + end |
| 20 | +end |
| 21 | + |
| 22 | +# 2) GC immediately |
| 23 | +try |
| 24 | + Pkg.gc(; collect_delay = Day(0)) |
| 25 | +catch err |
| 26 | + @warn "Pkg.gc failed (non-fatal)" err |
| 27 | +end |
| 28 | + |
| 29 | +# 3) Delete depot caches (sources + compiled) for these two packages |
| 30 | +jver = "v$(VERSION.major).$(VERSION.minor)" |
| 31 | + |
| 32 | +for depot in DEPOT_PATH |
| 33 | + # Sources / dev checkouts |
| 34 | + for p in ( |
| 35 | + joinpath(depot, "packages", "GetDP"), |
| 36 | + joinpath(depot, "packages", "LineCableModels"), |
| 37 | + joinpath(depot, "dev", "GetDP"), |
| 38 | + joinpath(depot, "dev", "LineCableModels"), |
| 39 | + ) |
| 40 | + if ispath(p) |
| 41 | + rm(p; force = true, recursive = true) |
| 42 | + println("rm -rf ", p) |
| 43 | + end |
| 44 | + end |
| 45 | + |
| 46 | + # Compiled caches |
| 47 | + compdir = joinpath(depot, "compiled", jver) |
| 48 | + if isdir(compdir) |
| 49 | + for (root, _, files) in walkdir(compdir) |
| 50 | + for f in files |
| 51 | + if startswith(f, "GetDP") || startswith(f, "LineCableModels") |
| 52 | + fp = joinpath(root, f) |
| 53 | + rm(fp; force = true) |
| 54 | + println("rm ", fp) |
| 55 | + end |
| 56 | + end |
| 57 | + end |
| 58 | + end |
| 59 | +end |
| 60 | + |
| 61 | +# 4) Re-add: pinned GetDP + LineCableModels, then rebuild |
| 62 | +Pkg.add(PackageSpec(url = getdp_url, rev = getdp_rev)) |
| 63 | +Pkg.add(PackageSpec(url = lcm_url, rev = lcm_rev)) |
| 64 | + |
| 65 | + |
| 66 | +Pkg.resolve() |
| 67 | +Pkg.instantiate() |
| 68 | +Pkg.precompile() |
| 69 | + |
| 70 | +# 5) Verify the resolved GetDP source (truth) |
| 71 | +Pkg.status("GetDP") |
| 72 | +println(only([i for (u, i) in Pkg.dependencies() if i.name == "GetDP"]).source) |
0 commit comments