Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove keep AcquireDepSum() only in the downloading from OCI #330

Merged
merged 1 commit into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 7 additions & 22 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,6 @@ func (c *KpmClient) LoadLockDeps(pkgPath string) (*pkg.Dependencies, error) {
return nil, err
}

for name, dep := range deps.Deps {
sum, err := c.AcquireDepSum(dep)
if err != nil {
return nil, err
}
dep.Sum = sum
deps.Deps[name] = dep
}

return deps, nil
}

Expand Down Expand Up @@ -362,6 +353,7 @@ func (c *KpmClient) resolvePkgDeps(kclPkg *pkg.KclPkg, lockDeps *pkg.Dependencie
if err != nil {
return err
}

depPath = c.getDepStorePath(kclPkg.HomePath, &d, kclPkg.IsVendorMode())
}
} else {
Expand All @@ -380,10 +372,6 @@ func (c *KpmClient) resolvePkgDeps(kclPkg *pkg.KclPkg, lockDeps *pkg.Dependencie
)
}
d.FromKclPkg(depPkg)
d.Sum, err = c.AcquireDepSum(d)
if err != nil {
return err
}
err = c.resolvePkgDeps(depPkg, lockDeps, update)
if err != nil {
return err
Expand Down Expand Up @@ -1008,10 +996,6 @@ func (c *KpmClient) Download(dep *pkg.Dependency, homePath, localPath string) (*
}
} else {
dep.FromKclPkg(dpkg)
dep.Sum, err = c.AcquireDepSum(*dep)
if err != nil {
return nil, err
}
return dep, nil
}
}
Expand All @@ -1031,11 +1015,16 @@ func (c *KpmClient) Download(dep *pkg.Dependency, homePath, localPath string) (*
return nil, err
}
dep.FromKclPkg(dpkg)
// The downloaded checksum is requested, not calculated
dep.Sum, err = c.AcquireDepSum(*dep)
if err != nil {
return nil, err
}
if dep.Sum == "" {
dep.Sum, err = utils.HashDir(localPath)
if err != nil {
return nil, err
}
}

if dep.LocalFullPath == "" {
dep.LocalFullPath = localPath
Expand Down Expand Up @@ -1470,10 +1459,6 @@ func (c *KpmClient) dependencyExistsLocal(searchPath string, dep *pkg.Dependency
return nil, err
}
dep.FromKclPkg(depPkg)
dep.Sum, err = c.AcquireDepSum(*dep)
if err != nil {
return nil, err
}
return dep, nil
}
return nil, nil
Expand Down
Loading