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

Cryptography module, integrity checking commands and small fixes #108

Merged
merged 17 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion cmd/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var (
ErrPackNotPurgeable = errors.New("pack not purgeable")
ErrPdscEntryExists = errors.New("pdsc already in index")
ErrPdscEntryNotFound = errors.New("pdsc not found in index")
ErrEula = errors.New("user does not agree with the pack's license")
ErrExtractEula = errors.New("user wants to extract embedded license only")
ErrLicenseNotFound = errors.New("embedded license not found")
ErrPackRootNotFound = errors.New("no CMSIS Pack Root directory specified. Either the environment CMSIS_PACK_ROOT needs to be set or the path specified using the command line option -R/--pack-root string")
Expand Down
3 changes: 2 additions & 1 deletion cmd/installer/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ func (p *PackType) install(installation *PacksInstallationType, checkEula bool)
}

if !ok {
return errs.ErrEula
log.Info("User does not agree with the pack's license")
return nil
}
} else {
// Explicitly inform the user that license has been agreed
Expand Down
24 changes: 0 additions & 24 deletions cmd/installer/root_pack_add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,30 +390,6 @@ func TestAddPack(t *testing.T) {
})
})

t.Run("test installing pack with license disagreed", func(t *testing.T) {
chaws marked this conversation as resolved.
Show resolved Hide resolved
localTestingDir := "test-add-pack-with-license-disagreed"
assert.Nil(installer.SetPackRoot(localTestingDir, CreatePackRoot))
defer os.RemoveAll(localTestingDir)

packPath := packWithLicense

info, err := utils.ExtractPackInfo(packPath)
assert.Nil(err)

// Should NOT be installed if license is not agreed
ui.LicenseAgreed = &ui.Disagreed
err = installer.AddPack(packPath, CheckEula, !ExtractEula, !ForceReinstall)

// Sanity check
assert.NotNil(err)
assert.Equal(errs.ErrEula, err)
assert.False(utils.FileExists(installer.Installation.PackIdx))

// Check in installer internals
pack := packInfoToType(info)
assert.False(installer.Installation.PackIsInstalled(pack))
})

t.Run("test installing pack with license agreed", func(t *testing.T) {
localTestingDir := "test-add-pack-with-license-agreed"
assert.Nil(installer.SetPackRoot(localTestingDir, CreatePackRoot))
Expand Down