diff --git a/cmds/ocm/commands/ocmcmds/common/options/rscbyvalueoption/option.go b/cmds/ocm/commands/ocmcmds/common/options/rscbyvalueoption/option.go
index b2598c73bd..4e31bd103f 100644
--- a/cmds/ocm/commands/ocmcmds/common/options/rscbyvalueoption/option.go
+++ b/cmds/ocm/commands/ocmcmds/common/options/rscbyvalueoption/option.go
@@ -24,25 +24,32 @@ func New() *Option {
type Option struct {
ResourcesByValue bool
+ LocalByValue bool
}
var _ transferhandler.TransferOption = (*Option)(nil)
func (o *Option) AddFlags(fs *pflag.FlagSet) {
fs.BoolVarP(&o.ResourcesByValue, "copy-resources", "V", false, "transfer referenced resources by-value")
+ fs.BoolVarP(&o.LocalByValue, "copy-local-resources", "L", false, "transfer referenced local resources by-value")
}
func (o *Option) Usage() string {
s := `
It the option --copy-resources is given, all referential
resources will potentially be localized, mapped to component version local
-resources in the target repository.
-This behaviour can be further influenced by specifying a transfer script
-with the script option family.
+resources in the target repository. It the option --copy-local-resources
+is given, instead, only resources with the relation local will be
+transferred. This behaviour can be further influenced by specifying a transfer
+script with the script option family.
`
return s
}
func (o *Option) ApplyTransferOption(opts transferhandler.TransferOptions) error {
- return standard.ResourcesByValue(o.ResourcesByValue).ApplyTransferOption(opts)
+ err := standard.ResourcesByValue(o.ResourcesByValue).ApplyTransferOption(opts)
+ if err == nil {
+ err = standard.LocalResourcesByValue(o.LocalByValue).ApplyTransferOption(opts)
+ }
+ return err
}
diff --git a/cmds/ocm/commands/ocmcmds/componentarchive/transfer/cmd.go b/cmds/ocm/commands/ocmcmds/componentarchive/transfer/cmd.go
index 3bff6e69d8..8d3eb60f68 100644
--- a/cmds/ocm/commands/ocmcmds/componentarchive/transfer/cmd.go
+++ b/cmds/ocm/commands/ocmcmds/componentarchive/transfer/cmd.go
@@ -8,6 +8,11 @@ import (
"github.com/spf13/cobra"
"github.com/open-component-model/ocm/cmds/ocm/commands/common/options/formatoption"
+ ocmcommon "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common"
+ "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/lookupoption"
+ "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/overwriteoption"
+ "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/rscbyvalueoption"
+ "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/srcbyvalueoption"
"github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/names"
"github.com/open-component-model/ocm/cmds/ocm/commands/verbs"
"github.com/open-component-model/ocm/cmds/ocm/pkg/utils"
@@ -17,6 +22,7 @@ import (
"github.com/open-component-model/ocm/pkg/contexts/ocm"
"github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/comparch"
"github.com/open-component-model/ocm/pkg/contexts/ocm/transfer"
+ "github.com/open-component-model/ocm/pkg/contexts/ocm/transfer/transferhandler/standard"
)
var (
@@ -32,7 +38,7 @@ type Command struct {
// NewCommand creates a new transfer command.
func NewCommand(ctx clictx.Context, names ...string) *cobra.Command {
- return utils.SetupCommand(&Command{BaseCommand: utils.NewBaseCommand(ctx, formatoption.New())}, utils.Names(Names, names...)...)
+ return utils.SetupCommand(&Command{BaseCommand: utils.NewBaseCommand(ctx, formatoption.New(), lookupoption.New(), overwriteoption.New(), rscbyvalueoption.New(), srcbyvalueoption.New())}, utils.Names(Names, names...)...)
}
func (o *Command) ForName(name string) *cobra.Command {
@@ -62,6 +68,13 @@ func (o *Command) Complete(args []string) error {
func (o *Command) Run() error {
session := ocm.NewSession(nil)
defer session.Close()
+ session.Finalize(o.OCMContext())
+
+ err := o.ProcessOnOptions(ocmcommon.CompleteOptionsWithSession(o, session))
+ if err != nil {
+ return err
+ }
+
source, err := comparch.Open(o.Context.OCMContext(), accessobj.ACC_READONLY, o.Path, 0, o.Context)
if err != nil {
return err
@@ -74,5 +87,14 @@ func (o *Command) Run() error {
return err
}
- return transfer.TransferVersion(common.NewPrinter(o.Context.StdOut()), nil, source, target, nil)
+ thdlr, err := standard.New(
+ lookupoption.From(o),
+ overwriteoption.From(o),
+ rscbyvalueoption.From(o),
+ srcbyvalueoption.From(o),
+ )
+ if err != nil {
+ return err
+ }
+ return transfer.TransferVersion(common.NewPrinter(o.Context.StdOut()), nil, source, target, thdlr)
}
diff --git a/docs/reference/ocm_add_componentversions.md b/docs/reference/ocm_add_componentversions.md
index a8ca5130a7..d82a34b56b 100644
--- a/docs/reference/ocm_add_componentversions.md
+++ b/docs/reference/ocm_add_componentversions.md
@@ -11,6 +11,7 @@ ocm add componentversions [] [--version ] [] {--copy-resources is given, all referential
resources will potentially be localized, mapped to component version local
-resources in the target repository.
-This behaviour can be further influenced by specifying a transfer script
-with the script option family.
+resources in the target repository. It the option --copy-local-resources
+is given, instead, only resources with the relation local will be
+transferred. This behaviour can be further influenced by specifying a transfer
+script with the script option family.
### Examples
diff --git a/docs/reference/ocm_logging.md b/docs/reference/ocm_logging.md
index 6c0ce36885..f5035d3de4 100644
--- a/docs/reference/ocm_logging.md
+++ b/docs/reference/ocm_logging.md
@@ -22,6 +22,7 @@ The following *realms* are used by the command line tool:
- ocm/accessmethod/ociartifact: access method ociArtifact
- ocm/credentials/dockerconfig: docker config handling as credential repository
- ocm/oci.ocireg: OCI repository handling
+ - ocm/ocimapping: OCM to OCI Registry Mapping
- ocm/plugins: OCM plugin handling
- ocm/processing: output processing chains
- ocm/toi: TOI logging
diff --git a/docs/reference/ocm_transfer_commontransportarchive.md b/docs/reference/ocm_transfer_commontransportarchive.md
index 9d3e840cbe..9499d830e4 100644
--- a/docs/reference/ocm_transfer_commontransportarchive.md
+++ b/docs/reference/ocm_transfer_commontransportarchive.md
@@ -9,6 +9,7 @@ ocm transfer commontransportarchive []
### Options
```
+ -L, --copy-local-resources transfer referenced local resources by-value
-V, --copy-resources transfer referenced resources by-value
-h, --help help for commontransportarchive
--lookup stringArray repository name or spec for closure lookup fallback
@@ -51,9 +52,10 @@ target repository will be overwritten, if they already exist.
It the option --copy-resources is given, all referential
resources will potentially be localized, mapped to component version local
-resources in the target repository.
-This behaviour can be further influenced by specifying a transfer script
-with the script option family.
+resources in the target repository. It the option --copy-local-resources
+is given, instead, only resources with the relation local will be
+transferred. This behaviour can be further influenced by specifying a transfer
+script with the script option family.
It the option --stop-on-existing is given together with the --recursive
option, the recursion is stopped for component versions already existing in the
diff --git a/docs/reference/ocm_transfer_componentarchive.md b/docs/reference/ocm_transfer_componentarchive.md
index 55a3c8d5bd..eb2b19a437 100644
--- a/docs/reference/ocm_transfer_componentarchive.md
+++ b/docs/reference/ocm_transfer_componentarchive.md
@@ -9,8 +9,13 @@ ocm transfer componentarchive []