Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad-img
提交
8767d1a1
I
iSulad-img
项目概览
openeuler
/
iSulad-img
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad-img
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8767d1a1
编写于
6月 19, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
6月 19, 2020
浏览文件
操作
浏览文件
下载
差异文件
!49 support more compressed type when import tarball
Merge pull request !49 from wangfengtu/more_type
上级
b2154cf4
feb32b08
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
78 addition
and
1 deletion
+78
-1
iSulad-img.spec
iSulad-img.spec
+1
-1
patch/0057-support-more-compressed-type-when-import-tarball.patch
...57-support-more-compressed-type-when-import-tarball.patch
+76
-0
patch/series-patch.conf
patch/series-patch.conf
+1
-0
未找到文件。
iSulad-img.spec
浏览文件 @
8767d1a1
%global _version 2.0.0
%global _release 202006
08.153239.gitf3fd7793
%global _release 202006
19.162225.gitb2154cf4
Name: iSulad-img
Version: %{_version}
Release: %{_release}
...
...
patch/0057-support-more-compressed-type-when-import-tarball.patch
0 → 100644
浏览文件 @
8767d1a1
From 835df1e959632ee3a21fd532ab7468611ac1f798 Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Fri, 19 Jun 2020 16:12:50 +0800
Subject: [PATCH] support more compressed type when import tarball
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
.../containers/image/tarball/tarball_src.go | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/vendor/github.com/containers/image/tarball/tarball_src.go b/vendor/github.com/containers/image/tarball/tarball_src.go
index 76e3e75..a3c5453 100644
--- a/vendor/github.com/containers/image/tarball/tarball_src.go
+++ b/vendor/github.com/containers/image/tarball/tarball_src.go
@@ -12,8 +12,8 @@
import (
"strings"
"time"
+ "github.com/containers/image/pkg/compression"
"github.com/containers/image/types"
- "github.com/klauspost/pgzip"
digest "github.com/opencontainers/go-digest"
imgspecs "github.com/opencontainers/image-spec/specs-go"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
@@ -67,23 +67,23 @@
func (r *tarballReference) NewImageSource(ctx context.Context, sys *types.System
blobTime = fileinfo.ModTime()
}
- // Default to assuming the layer is compressed.
- layerType := imgspecv1.MediaTypeImageLayerGzip
-
// Set up to digest the file as it is.
blobIDdigester := digest.Canonical.Digester()
reader = io.TeeReader(reader, blobIDdigester.Hash())
// Set up to digest the file after we maybe decompress it.
diffIDdigester := digest.Canonical.Digester()
- uncompressed, err := pgzip.NewReader(reader)
- if err == nil {
+ uncompressed, iscompressed, err := compression.AutoDecompress(reader)
+ if err != nil {
+ return nil, fmt.Errorf("error decompress %q: %v", filename, err)
+ }
+ defer uncompressed.Close()
+ if iscompressed {
// It is compressed, so the diffID is the digest of the uncompressed version
reader = io.TeeReader(uncompressed, diffIDdigester.Hash())
} else {
// It is not compressed, so the diffID and the blobID are going to be the same
diffIDdigester = blobIDdigester
- layerType = imgspecv1.MediaTypeImageLayer
uncompressed = nil
}
// TODO: This can take quite some time, and should ideally be cancellable using ctx.Done().
@@ -91,9 +91,6 @@
func (r *tarballReference) NewImageSource(ctx context.Context, sys *types.System
if err != nil {
return nil, fmt.Errorf("error reading %q: %v", filename, err)
}
- if uncompressed != nil {
- uncompressed.Close()
- }
// Grab our uncompressed and possibly-compressed digests and sizes.
filenames = append(filenames, filename)
@@ -102,7 +99,7 @@
func (r *tarballReference) NewImageSource(ctx context.Context, sys *types.System
blobIDs = append(blobIDs, blobIDdigester.Digest())
blobSizes = append(blobSizes, blobSize)
blobTimes = append(blobTimes, blobTime)
- blobTypes = append(blobTypes, layerType)
+ blobTypes = append(blobTypes, imgspecv1.MediaTypeImageLayer)
}
// Build the rootfs and history for the configuration blob.
--
2.20.1
patch/series-patch.conf
浏览文件 @
8767d1a1
...
...
@@ -54,3 +54,4 @@
0054
-
Change
-
copyright
-
from
-
Mulan
-
PSL
-
v1
-
to
-
Mulan
-
PSL
-
v2
.
patch
0055
-
Change
-
copyright
-
from
-
MulanPSL
-
to
-
MulanPSL2
.
patch
0056
-
make
-
sure
-
created
-
time
-
is
-
larger
-
or
-
equal
-
than
-
1970
.
patch
0057
-
support
-
more
-
compressed
-
type
-
when
-
import
-
tarball
.
patch
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录