Commit Graph

24 Commits

Author SHA1 Message Date
Kazuyoshi Kato
1d6d5b4102
Merge pull request #7344 from thaJeztah/archive_cleanup
archive: replace tarName() with filepath.ToSlash()
2022-08-30 09:18:18 -07:00
Sebastiaan van Stijn
19db697a5a
archive: replace tarName() with filepath.ToSlash()
This code was copied from github.com/moby/moby/pkg/archive;
28842d3f09,
which got later simplified in
a5aed699cf

This patch aligns the containerd implementation with those changes, and uses
filepath.ToSlash() unconditionally on all platforms, as it's a no-op on platforms
that use a forward-slash; https://github.com/golang/go/blob/go1.19/src/path/filepath/path.go#L175-L183

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-30 15:19:58 +02:00
Sebastiaan van Stijn
93342d637c
replace sys Sequential funcs with moby/sys/sequential
These functions were originally copied from the docker / moby repository in
4a7a8efc2d. Migrating these functions to use the
github.com/moby/sys/sequential module allows them being shared between moby,
docker/cli, and containerd, and to allow using them without importing all of sys
which also depends on hcsshim and more.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-29 18:36:34 +02:00
haoyun
bbe46b8c43 feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
2022-01-07 10:27:03 +08:00
Derek McGowan
6f027e38a8
Remove redundant build tags
Remove build tags which are already implied by the name of the file.
Ensures build tags are used consistently

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-08-05 22:27:46 -07:00
Derek McGowan
53835221f6
Cleanup lchmod logic in archive
Move to single lchmod interface mirroring other implementations.
Separate logic for freebsd which supports symlink no follow flag.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-07-08 13:44:28 -07:00
Paul "TBBle" Hampson
a64a76846c Replace inline applyWindowsLayer using hcsshim
Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2021-04-10 02:02:33 +10:00
Paul "TBBle" Hampson
78f31afb45 Reorder to separate generic from windows-specific code
Specifically, all the functions above applyWindowsLayer are actually
used by the (generic) applyNaive code, while the functions below this
point are specific to applyWindowsLayer.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-12-03 02:43:37 +11:00
Paul "TBBle" Hampson
3e47cdf70f Use go-winio tar-application code instead of our own
applyFunc now takes an io.Reader instead of a tar.Reader because I'm
trying to mirror the API of the not-yet-exposed implementation of this
same behaviour in github.com/Microsoft/hcsshim/internal/ociwclayer,
with an eye to later moving to that implementation it is ever exposed.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-12-03 02:42:54 +11:00
Derek McGowan
bcc4a146e4
Support applying with parent directories
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-08-16 15:49:47 -07:00
Wei Fu
132ee9b826 fix: linter issue
megacheck, gosimple and unused has been deprecated and subsumed by
staticcheck. And staticcheck also has been upgraded. we need to update
code for the linter issue.

close: #2945

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-01-23 22:54:51 +08:00
John Howard
2c4b7f6bd1 Fixup archive/tar_windows.go type
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-08-20 12:02:04 -07:00
Darren Stahl
84f6fce240 Make hcsshim layerwriter close a fatal error
Signed-off-by: Darren Stahl <darst@microsoft.com>
2018-03-28 18:02:45 -07:00
Stephen J Day
9cdd036393
build: bump to Go 1.10
Bumps the build to use Go 1.10, which allows us to drop the forked tar
package.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-02-26 16:47:24 -08:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Stephen J Day
cd72819b53
archive, cio, cmd, linux: use buffer pools
To avoid buffer bloat in long running processes, we try to use buffer
pools where possible. This is meant to address shim memory usage issues,
but may not be the root cause.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-01-22 13:52:06 -08:00
Darren Stahl
c195ebb3e2 Implement archive.Apply on Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
2017-12-15 11:33:03 -08:00
Derek McGowan
e20b371807
Remove umask, replace with explicit chmod after create
Call chmod on all open files and created directories to
ensure permission is set as expected without changing umask.

Fixes #1608

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-10-11 15:13:18 -07:00
Derek McGowan
23aa4910c0
Use forked archive/tar package
Use fork of archive/tar to carry changes to tar for
all go versions.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-18 18:32:44 -07:00
Michael Crosby
4f2b443a27 Rewrite imports for new github org
This rewrites the Go imports after switching to the new github org.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-03 14:05:44 -07:00
Akihiro Suda
6089c1525b new package: compression (ported from docker/pkg/archive)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-03-16 05:29:27 +00:00
kevinetc123
fa584958fc using github.com/pkg/errors & correct some typo mistakes
Signed-off-by: kevinetc123 <kaiwentan@harmonycloud.cn>
2017-02-24 10:59:11 +08:00
Derek McGowan
6443891a7d Update log lines to use containerd log package
Removed unused requires root test function and updated
tar requires function to use lookup method.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-17 11:50:49 -08:00
Derek McGowan
0deba01621 Add archive package
Archive package handles generating and applying diff tar streams
based on the OCI diff tar specification.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-17 11:49:58 -08:00