MCPcopy Index your code
hub / github.com/jetify-com/devbox / Resolve

Method Resolve

internal/lock/lockfile.go:76–106  ·  view source on GitHub ↗

Resolve updates the in memory copy for performance but does not write to disk This avoids writing values that may need to be removed in case of error.

(pkg string)

Source from the content-addressed store, hash-verified

74// Resolve updates the in memory copy for performance but does not write to disk
75// This avoids writing values that may need to be removed in case of error.
76func (f *File) Resolve(pkg string) (*Package, error) {
77 entry, hasEntry := f.Packages[pkg]
78 if hasEntry && entry.Resolved != "" {
79 return f.Packages[pkg], nil
80 }
81
82 locked := &Package{}
83 _, _, versioned := searcher.ParseVersionedPackage(pkg)
84 if pkgtype.IsRunX(pkg) || versioned || pkgtype.IsFlake(pkg) {
85 resolved, err := f.FetchResolvedPackage(pkg, false)
86 if err != nil {
87 return nil, err
88 }
89 if resolved != nil {
90 locked = resolved
91 }
92 } else if IsLegacyPackage(pkg) {
93 // These are legacy packages without a version. Resolve to nixpkgs with
94 // whatever hash is in the devbox.json
95 locked = &Package{
96 Resolved: flake.Installable{
97 Ref: f.Stdenv(),
98 AttrPath: pkg,
99 }.String(),
100 Source: nixpkgSource,
101 }
102 }
103 f.Packages[pkg] = locked
104
105 return f.Packages[pkg], nil
106}
107
108// TODO:
109// Consider a design change to have the File struct match disk to make this system

Callers 3

AddMethod · 0.95
StdenvMethod · 0.95
SetOutputsForPackageMethod · 0.95

Calls 7

FetchResolvedPackageMethod · 0.95
StdenvMethod · 0.95
ParseVersionedPackageFunction · 0.92
IsRunXFunction · 0.92
IsFlakeFunction · 0.92
IsLegacyPackageFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected