diff --git a/pkg/client/client.go b/pkg/client/client.go index ae055149..c744ed76 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -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 @@ -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 } diff --git a/pkg/client/test_data/test_add_diff_version/with_sum_check/kcl.mod.lock.bak b/pkg/client/test_data/test_add_diff_version/with_sum_check/kcl.mod.lock.bak index 7eaf9cba..c1bebf8c 100644 --- a/pkg/client/test_data/test_add_diff_version/with_sum_check/kcl.mod.lock.bak +++ b/pkg/client/test_data/test_add_diff_version/with_sum_check/kcl.mod.lock.bak @@ -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" diff --git a/pkg/client/test_data/test_add_diff_version/with_sum_check/kcl.mod.lock.expect b/pkg/client/test_data/test_add_diff_version/with_sum_check/kcl.mod.lock.expect index 7eaf9cba..c1bebf8c 100644 --- a/pkg/client/test_data/test_add_diff_version/with_sum_check/kcl.mod.lock.expect +++ b/pkg/client/test_data/test_add_diff_version/with_sum_check/kcl.mod.lock.expect @@ -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" diff --git a/pkg/client/test_data/test_update/test_update_kcl_mod/expected b/pkg/client/test_data/test_update/test_update_kcl_mod/expected index 7eaf9cba..c1bebf8c 100644 --- a/pkg/client/test_data/test_update/test_update_kcl_mod/expected +++ b/pkg/client/test_data/test_update/test_update_kcl_mod/expected @@ -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" diff --git a/pkg/client/test_data/test_update/test_update_kcl_mod_lock/kcl.mod.lock b/pkg/client/test_data/test_update/test_update_kcl_mod_lock/kcl.mod.lock index 7eaf9cba..c1bebf8c 100644 --- a/pkg/client/test_data/test_update/test_update_kcl_mod_lock/kcl.mod.lock +++ b/pkg/client/test_data/test_update/test_update_kcl_mod_lock/kcl.mod.lock @@ -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"