Skip to content

Commit 3b27d43

Browse files
committed
DevPkg -> Package
1 parent 06107c2 commit 3b27d43

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

internal/impl/packages.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func (d *Devbox) removePackagesFromProfile(ctx context.Context, pkgs []string) e
356356
index, err := nixprofile.ProfileListIndex(&nixprofile.ProfileListIndexArgs{
357357
Lockfile: d.lockfile,
358358
Writer: d.writer,
359-
DevPkg: pkg,
359+
Package: pkg,
360360
ProfileDir: profileDir,
361361
})
362362
if err != nil {
@@ -431,7 +431,7 @@ func (d *Devbox) pendingPackagesForInstallation(ctx context.Context) ([]*devpkg.
431431
Items: items,
432432
Lockfile: d.lockfile,
433433
Writer: d.writer,
434-
DevPkg: pkg,
434+
Package: pkg,
435435
ProfileDir: profileDir,
436436
})
437437
if err != nil {

internal/nix/nixprofile/profile.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ type ProfileListIndexArgs struct {
105105
Items []*NixProfileListItem
106106
Lockfile *lock.File
107107
Writer io.Writer
108-
DevPkg *devpkg.Package
108+
Package *devpkg.Package
109109
ProfileDir string
110110
}
111111

112-
// ProfileListIndex returns the index of args.DevPkg in the nix profile specified by args.ProfileDir,
112+
// ProfileListIndex returns the index of args.Package in the nix profile specified by args.ProfileDir,
113113
// or -1 if it's not found. Callers can pass in args.Items to avoid having to call `nix-profile list` again.
114114
func ProfileListIndex(args *ProfileListIndexArgs) (int, error) {
115115
var err error
@@ -121,30 +121,30 @@ func ProfileListIndex(args *ProfileListIndexArgs) (int, error) {
121121
}
122122
}
123123

124-
inCache, err := args.DevPkg.IsInBinaryCache()
124+
inCache, err := args.Package.IsInBinaryCache()
125125
if err != nil {
126126
return -1, err
127127
}
128128
if inCache {
129129
// Packages in cache are added by store path, which means we only need to check
130130
// for store path equality to find it.
131-
pathInStore, err := args.DevPkg.Installable()
131+
pathInStore, err := args.Package.Installable()
132132
if err != nil {
133-
return -1, errors.Wrapf(err, "failed to get installable for %s", args.DevPkg.String())
133+
return -1, errors.Wrapf(err, "failed to get installable for %s", args.Package.String())
134134
}
135135
for _, item := range items {
136136
if pathInStore == item.nixStorePath {
137137
return item.index, nil
138138
}
139139
}
140-
return -1, errors.Wrap(nix.ErrPackageNotFound, args.DevPkg.String())
140+
return -1, errors.Wrap(nix.ErrPackageNotFound, args.Package.String())
141141
}
142142

143-
// else: check if the DevPkg matches an item's unlockedReference.
143+
// else: check if the Package matches an item's unlockedReference.
144144
// This is an optimization for happy path. A resolved devbox package *which was added by
145145
// flake reference* (not by store path) should match the unlockedReference of an existing
146146
// profile item.
147-
ref, err := args.DevPkg.NormalizedDevboxPackageReference()
147+
ref, err := args.Package.NormalizedDevboxPackageReference()
148148
if err != nil {
149149
return -1, err
150150
}
@@ -158,11 +158,11 @@ func ProfileListIndex(args *ProfileListIndexArgs) (int, error) {
158158
for _, item := range items {
159159
existing := item.ToPackage(args.Lockfile)
160160

161-
if args.DevPkg.Equals(existing) {
161+
if args.Package.Equals(existing) {
162162
return item.index, nil
163163
}
164164
}
165-
return -1, errors.Wrap(nix.ErrPackageNotFound, args.DevPkg.String())
165+
return -1, errors.Wrap(nix.ErrPackageNotFound, args.Package.String())
166166
}
167167

168168
// parseNixProfileListItem reads each line of output (from `nix profile list`) and converts

internal/nix/nixprofile/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func ProfileUpgrade(ProfileDir string, pkg *devpkg.Package, lock *lock.File) err
1616
&ProfileListIndexArgs{
1717
Lockfile: lock,
1818
Writer: os.Stderr,
19-
DevPkg: pkg,
19+
Package: pkg,
2020
ProfileDir: ProfileDir,
2121
},
2222
)

0 commit comments

Comments
 (0)