Skip to content

Commit fc1353b

Browse files
committed
cleanup migration + duplicate
1 parent 835d0eb commit fc1353b

316 files changed

Lines changed: 1387 additions & 1402 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/config/cpi/content.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"encoding/json"
66

77
"github.com/mandelsoft/goutils/errors"
8+
"github.com/mandelsoft/goutils/optionutils"
89
"github.com/mandelsoft/vfs/pkg/osfs"
910
"github.com/mandelsoft/vfs/pkg/vfs"
1011

11-
"ocm.software/ocm/api/utils"
1212
"ocm.software/ocm/api/utils/blobaccess/blobaccess"
1313
)
1414

@@ -76,5 +76,5 @@ func (k ContentSpec) Get() (interface{}, error) {
7676
fs = osfs.New()
7777
}
7878

79-
return utils.ReadFile(k.Path, fs)
79+
return optionutils.ReadFile(k.Path, fs)
8080
}

api/config/internal/configtypes.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import (
55
"strings"
66

77
"github.com/mandelsoft/goutils/errors"
8+
"github.com/mandelsoft/goutils/general"
9+
"github.com/mandelsoft/goutils/stringutils"
810
"github.com/modern-go/reflect2"
911

10-
"ocm.software/ocm/api/utils"
1112
"ocm.software/ocm/api/utils/runtime"
1213
)
1314

@@ -36,7 +37,7 @@ type configTypeScheme struct {
3637
}
3738

3839
func NewConfigTypeScheme(defaultDecoder ConfigDecoder, base ...ConfigTypeScheme) ConfigTypeScheme {
39-
scheme := runtime.MustNewDefaultTypeScheme[Config, ConfigType](&GenericConfig{}, true, defaultDecoder, utils.Optional(base...))
40+
scheme := runtime.MustNewDefaultTypeScheme[Config, ConfigType](&GenericConfig{}, true, defaultDecoder, general.Optional(base...))
4041
return &configTypeScheme{scheme}
4142
}
4243

@@ -54,7 +55,7 @@ type versionRegistry struct {
5455
}
5556

5657
func NewStrictConfigTypeScheme(base ...ConfigTypeScheme) runtime.VersionedTypeRegistry[Config, ConfigType] {
57-
scheme := runtime.MustNewDefaultTypeScheme[Config, ConfigType](nil, false, nil, utils.Optional(base...))
58+
scheme := runtime.MustNewDefaultTypeScheme[Config, ConfigType](nil, false, nil, general.Optional(base...))
5859
return &versionRegistry{scheme}
5960
}
6061

@@ -80,7 +81,7 @@ func (t *configTypeScheme) Usage() string {
8081
for strings.HasSuffix(u, "\n") {
8182
u = u[:len(u)-1]
8283
}
83-
s = fmt.Sprintf("%s\n- <code>%s</code>\n%s", s, ct.GetKind(), utils.IndentLines(u, " "))
84+
s = fmt.Sprintf("%s\n- <code>%s</code>\n%s", s, ct.GetKind(), stringutils.IndentLines(u, " "))
8485
}
8586
return s + "\n"
8687
}

api/config/internal/context.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import (
55
"reflect"
66

77
"github.com/mandelsoft/goutils/errors"
8+
"github.com/mandelsoft/goutils/general"
89

910
"ocm.software/ocm/api/datacontext"
10-
"ocm.software/ocm/api/utils"
11-
common "ocm.software/ocm/api/utils/misc"
11+
"ocm.software/ocm/api/utils/misc"
1212
"ocm.software/ocm/api/utils/runtime"
1313
)
1414

1515
// OCM_CONFIG_TYPE_SUFFIX is the standard suffix used for configuration
1616
// types provided by this library.
17-
const OCM_CONFIG_TYPE_SUFFIX = ".config" + common.OCM_TYPE_GROUP_SUFFIX
17+
const OCM_CONFIG_TYPE_SUFFIX = ".config" + misc.OCM_TYPE_GROUP_SUFFIX
1818

1919
type ConfigSelector interface {
2020
Select(Config) bool
@@ -157,7 +157,7 @@ type gcWrapper struct {
157157
}
158158

159159
func newView(c *_context, ref ...bool) Context {
160-
if utils.Optional(ref...) {
160+
if general.Optional(ref...) {
161161
return datacontext.FinalizedContext[gcWrapper](c)
162162
}
163163
return c

api/credentials/builtin/github/ghcr.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"ocm.software/ocm/api/credentials/cpi"
77
"ocm.software/ocm/api/tech/oci/identity"
8-
common "ocm.software/ocm/api/utils/misc"
8+
"ocm.software/ocm/api/utils/misc"
99
)
1010

1111
const HOST = "ghcr.io"
@@ -23,7 +23,7 @@ func init() {
2323
user = "any"
2424
}
2525
if src, err := cpi.DefaultContext.GetCredentialsForConsumer(id); err != nil || src == nil {
26-
creds := cpi.NewCredentials(common.Properties{cpi.ATTR_IDENTITY_TOKEN: t, cpi.ATTR_USERNAME: user})
26+
creds := cpi.NewCredentials(misc.Properties{cpi.ATTR_IDENTITY_TOKEN: t, cpi.ATTR_USERNAME: user})
2727
cpi.DefaultContext.SetCredentialsForConsumer(id, creds)
2828
}
2929
}

api/credentials/builtin/github/github.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"ocm.software/ocm/api/credentials/cpi"
77
"ocm.software/ocm/api/tech/github/identity"
8-
common "ocm.software/ocm/api/utils/misc"
8+
"ocm.software/ocm/api/utils/misc"
99
)
1010

1111
func init() {
@@ -15,7 +15,7 @@ func init() {
1515
id := identity.GetConsumerId(us)
1616

1717
if src, err := cpi.DefaultContext.GetCredentialsForConsumer(id); err != nil || src == nil {
18-
creds := cpi.NewCredentials(common.Properties{cpi.ATTR_TOKEN: t})
18+
creds := cpi.NewCredentials(misc.Properties{cpi.ATTR_TOKEN: t})
1919
cpi.DefaultContext.SetCredentialsForConsumer(id, creds)
2020
}
2121
}

api/credentials/config/config_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import (
1515
"ocm.software/ocm/api/credentials/extensions/repositories/aliases"
1616
"ocm.software/ocm/api/credentials/extensions/repositories/directcreds"
1717
"ocm.software/ocm/api/credentials/extensions/repositories/memory"
18-
common "ocm.software/ocm/api/utils/misc"
18+
"ocm.software/ocm/api/utils/misc"
1919
"ocm.software/ocm/api/utils/runtime"
2020
)
2121

2222
var DefaultContext = credentials.New()
2323

2424
var _ = Describe("generic credentials", func() {
25-
props := common.Properties{
25+
props := misc.Properties{
2626
"user": "USER",
2727
"password": "PASSWORD",
2828
}
@@ -154,7 +154,7 @@ var _ = Describe("generic credentials", func() {
154154
credentials.ID_TYPE: "mytype",
155155
"host": "localhost",
156156
}
157-
props := common.Properties{"token": "mytoken"}
157+
props := misc.Properties{"token": "mytoken"}
158158
creds := directcreds.NewCredentials(props)
159159
Expect(cfg.AddConsumer(consumer, creds)).To(Succeed())
160160

@@ -182,7 +182,7 @@ type: credentials.config.ocm.software
182182
})
183183

184184
It("applies a config for consumers", func() {
185-
props := common.Properties{"token": "mytoken"}
185+
props := misc.Properties{"token": "mytoken"}
186186
consumer := credentials.ConsumerIdentity{
187187
credentials.ID_TYPE: "mytype",
188188
"host": "localhost",

api/credentials/cpi/interface.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package cpi
55
import (
66
"ocm.software/ocm/api/credentials/internal"
77
"ocm.software/ocm/api/datacontext"
8-
common "ocm.software/ocm/api/utils/misc"
8+
"ocm.software/ocm/api/utils/misc"
99
)
1010

1111
const (
@@ -83,7 +83,7 @@ func RegisterStandardIdentity(typ string, matcher IdentityMatcher, desc string,
8383
internal.StandardIdentityMatchers.Register(typ, matcher, desc, attrs)
8484
}
8585

86-
func NewCredentials(props common.Properties) Credentials {
86+
func NewCredentials(props misc.Properties) Credentials {
8787
return internal.NewCredentials(props)
8888
}
8989

api/credentials/extensions/repositories/aliases/repo_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99

1010
"ocm.software/ocm/api/credentials"
1111
local "ocm.software/ocm/api/credentials/extensions/repositories/aliases"
12-
common "ocm.software/ocm/api/utils/misc"
12+
"ocm.software/ocm/api/utils/misc"
1313
)
1414

1515
var DefaultContext = credentials.New()
1616

1717
var _ = Describe("alias credentials", func() {
18-
props := common.Properties{
18+
props := misc.Properties{
1919
"user": "USER",
2020
"password": "PASSWORD",
2121
}

api/credentials/extensions/repositories/directcreds/credentials.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package directcreds
22

33
import (
44
"ocm.software/ocm/api/credentials/cpi"
5-
common "ocm.software/ocm/api/utils/misc"
5+
"ocm.software/ocm/api/utils/misc"
66
)
77

8-
func NewCredentials(props common.Properties) cpi.CredentialsSpec {
8+
func NewCredentials(props misc.Properties) cpi.CredentialsSpec {
99
return cpi.NewCredentialsSpec(Type, NewRepositorySpec(props))
1010
}

api/credentials/extensions/repositories/directcreds/repo_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99

1010
"ocm.software/ocm/api/credentials"
1111
"ocm.software/ocm/api/credentials/extensions/repositories/directcreds"
12-
common "ocm.software/ocm/api/utils/misc"
12+
"ocm.software/ocm/api/utils/misc"
1313
)
1414

1515
var DefaultContext = credentials.New()
1616

1717
var _ = Describe("direct credentials", func() {
18-
props := common.Properties{
18+
props := misc.Properties{
1919
"user": "USER",
2020
"password": "PASSWORD",
2121
}

0 commit comments

Comments
 (0)