Skip to content

Commit

Permalink
Merge pull request #332 from zong-zhe/rm-fetch-sum
Browse files Browse the repository at this point in the history
fix: rm fetch metadata during loading kcl.mod
  • Loading branch information
Peefy committed May 24, 2024
2 parents ec21ccf + bfd8fe3 commit d20b1ac
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 26 deletions.
23 changes: 1 addition & 22 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func (c *KpmClient) resolvePkgDeps(kclPkg *pkg.KclPkg, lockDeps *pkg.Dependencie
}

// Generate file kcl.mod.lock.
if !kclPkg.NoSumCheck {
if !kclPkg.NoSumCheck || !update {
err := kclPkg.LockDepsVersion()
if err != nil {
return err
Expand Down Expand Up @@ -899,27 +899,6 @@ func (c *KpmClient) FillDepInfo(dep *pkg.Dependency, homepath string) error {
urlpath := utils.JoinPath(c.GetSettings().DefaultOciRepo(), dep.Name)
dep.Source.Oci.Repo = urlpath
}
manifest := ocispec.Manifest{}
jsonDesc, err := c.FetchOciManifestIntoJsonStr(opt.OciFetchOptions{
FetchBytesOptions: oras.DefaultFetchBytesOptions,
OciOptions: opt.OciOptions{
Reg: dep.Source.Oci.Reg,
Repo: dep.Source.Oci.Repo,
Tag: dep.Version,
},
})

if err == nil {
err = json.Unmarshal([]byte(jsonDesc), &manifest)
if err != nil {
return err
}

if value, ok := manifest.Annotations[constants.DEFAULT_KCL_OCI_MANIFEST_SUM]; ok {
dep.Sum = value
}
}
return nil
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
name = "helloworld"
full_name = "helloworld_0.1.2"
version = "0.1.2"
sum = "PN0OMEV9M8VGFn1CtA/T3bcgZmMJmOo+RkBrLKIWYeQ="
reg = "ghcr.io"
repo = "kcl-lang/helloworld"
oci_tag = "0.1.2"
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
name = "helloworld"
full_name = "helloworld_0.1.2"
version = "0.1.2"
sum = "PN0OMEV9M8VGFn1CtA/T3bcgZmMJmOo+RkBrLKIWYeQ="
reg = "ghcr.io"
repo = "kcl-lang/helloworld"
oci_tag = "0.1.2"
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
name = "helloworld"
full_name = "helloworld_0.1.2"
version = "0.1.2"
sum = "PN0OMEV9M8VGFn1CtA/T3bcgZmMJmOo+RkBrLKIWYeQ="
reg = "ghcr.io"
repo = "kcl-lang/helloworld"
oci_tag = "0.1.2"
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
name = "helloworld"
full_name = "helloworld_0.1.2"
version = "0.1.2"
sum = "PN0OMEV9M8VGFn1CtA/T3bcgZmMJmOo+RkBrLKIWYeQ="
reg = "ghcr.io"
repo = "kcl-lang/helloworld"
oci_tag = "0.1.2"

0 comments on commit d20b1ac

Please sign in to comment.