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

Method FixMissingStorePaths

internal/devbox/packages.go:726–770  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

724}
725
726func (d *Devbox) FixMissingStorePaths(ctx context.Context) error {
727 packages := d.InstallablePackages()
728 for _, pkg := range packages {
729 if !pkg.IsDevboxPackage || pkg.IsRunX() {
730 continue
731 }
732 existingStorePaths, err := pkg.GetResolvedStorePaths()
733 if err != nil {
734 return err
735 }
736
737 if len(existingStorePaths) > 0 {
738 continue
739 }
740
741 installables, err := pkg.Installables()
742 if err != nil {
743 return err
744 }
745
746 outputs := []lock.Output{}
747 for _, installable := range installables {
748 storePaths, err := nix.StorePathsFromInstallable(ctx, installable, pkg.HasAllowInsecure())
749 if err != nil {
750 return err
751 }
752 if len(storePaths) == 0 {
753 return fmt.Errorf("no store paths found for package %s", pkg.Raw)
754 }
755 for _, storePath := range storePaths {
756 parts := nix.NewStorePathParts(storePath)
757 outputs = append(outputs, lock.Output{
758 Path: storePath,
759 Name: parts.Output,
760 // Ugh, not sure this is true, but it's more true than not.
761 Default: true,
762 })
763 }
764 }
765 if err = d.lockfile.SetOutputsForPackage(pkg.Raw, outputs); err != nil {
766 return err
767 }
768 }
769 return d.lockfile.Save()
770}

Callers 2

UpdateMethod · 0.95
installCmdFuncFunction · 0.80

Calls 9

InstallablePackagesMethod · 0.95
NewStorePathPartsFunction · 0.92
IsRunXMethod · 0.80
GetResolvedStorePathsMethod · 0.80
InstallablesMethod · 0.80
HasAllowInsecureMethod · 0.80
SetOutputsForPackageMethod · 0.80
SaveMethod · 0.45

Tested by

no test coverage detected