mirror of
https://github.com/moby/moby.git
synced 2026-07-22 07:21:16 +00:00
- pkg/archive: deprecate, and add aliases
Keeping the tests in this commit; also moves various utilities
into a _test.go file, as they were now only used in tests.
- pkg/chrootarchive: deprecate and add aliase
deprecate pkg/archive and add aliases
keeping the tests in this commit
- Add temporary exceptions for deprecation linting errors, because
this commit is to verify everything works with the aliases.
- remove tests that depend on un-exported types
=== RUN TestDisablePigz
--- FAIL: TestDisablePigz (0.00s)
panic: interface conversion: io.Reader is *archive.readCloserWrapper, not *archive.readCloserWrapper (types from different packages) [recovered]
- pkg/archive, pkg/chrootarchive: remove test files
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Derek McGowan <derek@mcg.dev>
43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
package archive
|
|
|
|
import (
|
|
"github.com/docker/docker/pkg/idtools"
|
|
"github.com/moby/go-archive"
|
|
)
|
|
|
|
// ToArchiveOpt converts an [TarOptions] to a [archive.TarOptions].
|
|
//
|
|
// Deprecated: use [archive.TarOptions] instead, this utility is for internal use to transition to the [github.com/moby/go-archive] module.
|
|
func ToArchiveOpt(options *TarOptions) *archive.TarOptions {
|
|
return toArchiveOpt(options)
|
|
}
|
|
|
|
func toArchiveOpt(options *TarOptions) *archive.TarOptions {
|
|
if options == nil {
|
|
return nil
|
|
}
|
|
|
|
var chownOpts *archive.ChownOpts
|
|
if options.ChownOpts != nil {
|
|
chownOpts = &archive.ChownOpts{
|
|
UID: options.ChownOpts.UID,
|
|
GID: options.ChownOpts.GID,
|
|
}
|
|
}
|
|
|
|
return &archive.TarOptions{
|
|
IncludeFiles: options.IncludeFiles,
|
|
ExcludePatterns: options.ExcludePatterns,
|
|
Compression: options.Compression,
|
|
NoLchown: options.NoLchown,
|
|
IDMap: idtools.ToUserIdentityMapping(options.IDMap),
|
|
ChownOpts: chownOpts,
|
|
IncludeSourceDir: options.IncludeSourceDir,
|
|
WhiteoutFormat: options.WhiteoutFormat,
|
|
NoOverwriteDirNonDir: options.NoOverwriteDirNonDir,
|
|
RebaseNames: options.RebaseNames,
|
|
InUserNS: options.InUserNS,
|
|
BestEffortXattrs: options.BestEffortXattrs,
|
|
}
|
|
}
|