From 6ab2f2f958d2350d09654f8d06dfee915432b337 Mon Sep 17 00:00:00 2001 From: DCCooper <1866858@gmail.com> Date: Wed, 10 Feb 2021 10:59:29 +0800 Subject: [PATCH] enhancement:remove empty lines when showing image list Signed-off-by: DCCooper <1866858@gmail.com> --- VERSION-openeuler | 2 +- git-commit | 2 +- isula-build.spec | 8 +- patch/0038-vendor-update-images-display.patch | 75 ----------- ...bulate-vendor-to-support-eliminate-s.patch | 121 ++++++++++++++++++ ...ve-empty-lines-when-showing-image-li.patch | 24 ++++ series.conf | 3 +- 7 files changed, 156 insertions(+), 79 deletions(-) delete mode 100644 patch/0038-vendor-update-images-display.patch create mode 100644 patch/0040-vendor-update-tabulate-vendor-to-support-eliminate-s.patch create mode 100644 patch/0041-enhancement-remove-empty-lines-when-showing-image-li.patch diff --git a/VERSION-openeuler b/VERSION-openeuler index 96af73f..bd14de0 100644 --- a/VERSION-openeuler +++ b/VERSION-openeuler @@ -1 +1 @@ -0.9.5-4 +0.9.5-5 diff --git a/git-commit b/git-commit index cb21818..316482f 100644 --- a/git-commit +++ b/git-commit @@ -1 +1 @@ -384a5e76fd695ddef1237488f634c29337c0440c +4678e505019fae52f1801e172fd19c84ddfc0a70 diff --git a/isula-build.spec b/isula-build.spec index f47d3fa..9e2c697 100644 --- a/isula-build.spec +++ b/isula-build.spec @@ -2,7 +2,7 @@ Name: isula-build Version: 0.9.5 -Release: 4 +Release: 5 Summary: A tool to build container images License: Mulan PSL V2 URL: https://gitee.com/openeuler/isula-build @@ -85,6 +85,12 @@ fi /usr/share/bash-completion/completions/isula-build %changelog +* Wed Feb 10 2021 lixiang - 0.9.5-5 +- Type:enhancement +- CVE:NA +- SUG:restart +- DESC:remove empty lines when showing image list + * Tue Feb 09 2021 DCCooper <1866858@gmail.com> - 0.9.5-4 - Type:bugfix - CVE:NA diff --git a/patch/0038-vendor-update-images-display.patch b/patch/0038-vendor-update-images-display.patch deleted file mode 100644 index dc73a5a..0000000 --- a/patch/0038-vendor-update-images-display.patch +++ /dev/null @@ -1,75 +0,0 @@ -From f97d236951af0ed82854e25319ff35542c04a010 Mon Sep 17 00:00:00 2001 -From: Lu Jingxiao -Date: Thu, 4 Feb 2021 20:04:01 +0800 -Subject: [PATCH] update images display - ---- - cmd/cli/images.go | 1 + - vendor/github.com/bndr/gotabulate/tabulate.go | 20 +++++++++++++------ - 2 files changed, 15 insertions(+), 6 deletions(-) - -diff --git a/cmd/cli/images.go b/cmd/cli/images.go -index bded3617..0405a34b 100644 ---- a/cmd/cli/images.go -+++ b/cmd/cli/images.go -@@ -100,5 +100,6 @@ func formatAndPrint(images []*pb.ListResponse_ImageInfo) { - tabulate := gotabulate.Create(lines) - tabulate.SetHeaders(title) - tabulate.SetAlign("left") -+ tabulate.SetDenseMode(true) - fmt.Print(tabulate.Render("simple")) - } -diff --git a/vendor/github.com/bndr/gotabulate/tabulate.go b/vendor/github.com/bndr/gotabulate/tabulate.go -index a2e43265..095c11d8 100644 ---- a/vendor/github.com/bndr/gotabulate/tabulate.go -+++ b/vendor/github.com/bndr/gotabulate/tabulate.go -@@ -1,10 +1,13 @@ - package gotabulate - --import "fmt" --import "bytes" --import "github.com/mattn/go-runewidth" --import "unicode/utf8" --import "math" -+import ( -+ "bytes" -+ "fmt" -+ "math" -+ "unicode/utf8" -+ -+ "github.com/mattn/go-runewidth" -+) - - // Basic Structure of TableFormat - type TableFormat struct { -@@ -84,6 +87,7 @@ type Tabulate struct { - WrapStrings bool - WrapDelimiter rune - SplitConcat string -+ DenseMode bool - } - - // Represents normalized tabulate Row -@@ -208,6 +212,10 @@ func (t *Tabulate) SetWrapDelimiter(r rune) { - t.WrapDelimiter = r - } - -+func (t *Tabulate) SetDenseMode(m bool) { -+ t.DenseMode = m -+} -+ - //SetSplitConcat assigns the character that will be used when a WrapDelimiter is - //set but the renderer cannot abide by the desired split. This may happen when - //the WrapDelimiter is a space ' ' but a single word is longer than the width of a cell -@@ -292,7 +300,7 @@ func (t *Tabulate) Render(format ...interface{}) string { - // Add Data Rows - for index, element := range t.Data { - lines = append(lines, t.buildRow(t.padRow(element.Elements, t.TableFormat.Padding), padded_widths, cols, t.TableFormat.DataRow)) -- if index < len(t.Data)-1 { -+ if !t.DenseMode && index < len(t.Data)-1 { - if element.Continuos != true && !inSlice("betweenLine", t.HideLines) { - lines = append(lines, t.buildLine(padded_widths, cols, t.TableFormat.LineBetweenRows)) - } --- -2.23.0 - diff --git a/patch/0040-vendor-update-tabulate-vendor-to-support-eliminate-s.patch b/patch/0040-vendor-update-tabulate-vendor-to-support-eliminate-s.patch new file mode 100644 index 0000000..a842e05 --- /dev/null +++ b/patch/0040-vendor-update-tabulate-vendor-to-support-eliminate-s.patch @@ -0,0 +1,121 @@ +From e38c2ef1e4dc0f7579027deb7c36cba2516e8161 Mon Sep 17 00:00:00 2001 +From: DCCooper <1866858@gmail.com> +Date: Wed, 10 Feb 2021 10:09:31 +0800 +Subject: [PATCH 1/2] vendor:update tabulate vendor to support eliminate space + line + +Signed-off-by: DCCooper <1866858@gmail.com> +--- + go.mod | 2 +- + go.sum | 4 +-- + vendor/github.com/bndr/gotabulate/tabulate.go | 25 +++++++++++++------ + vendor/modules.txt | 2 +- + 4 files changed, 22 insertions(+), 11 deletions(-) + +diff --git a/go.mod b/go.mod +index 336dd2cc..b02071c9 100644 +--- a/go.mod ++++ b/go.mod +@@ -5,7 +5,7 @@ go 1.13 + require ( + github.com/BurntSushi/toml v0.3.1 + github.com/blang/semver v4.0.0+incompatible // indirect +- github.com/bndr/gotabulate v1.1.3-0.20170315142410-bc555436bfd5 ++ github.com/bndr/gotabulate v1.1.3-0.20210209140214-21a495b00e22 + github.com/containerd/cgroups v0.0.0-20200710171044-318312a37340 // indirect + github.com/containerd/containerd v1.4.0-rc.0 + github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe // indirect +diff --git a/go.sum b/go.sum +index 1ecfa084..3a52a22f 100644 +--- a/go.sum ++++ b/go.sum +@@ -43,8 +43,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r + github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= + github.com/blang/semver v4.0.0+incompatible h1:hnDL+Ci6ZJmEDIbUvCUt3Gh3QsnkdiIj88cWsqe4C4I= + github.com/blang/semver v4.0.0+incompatible/go.mod h1:u4Z/LRonWXLVIJgtpeY3+xwWiIhiJ9ilXrKVGnfHe/c= +-github.com/bndr/gotabulate v1.1.3-0.20170315142410-bc555436bfd5 h1:D48YSLPNJ8WpdwDqYF8bMMKUB2bgdWEiFx1MGwPIdbs= +-github.com/bndr/gotabulate v1.1.3-0.20170315142410-bc555436bfd5/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U= ++github.com/bndr/gotabulate v1.1.3-0.20210209140214-21a495b00e22 h1:IsKzSX8XqgT8xSo4nxtTOH7014e1L+vPB1wh3IqkWr0= ++github.com/bndr/gotabulate v1.1.3-0.20210209140214-21a495b00e22/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U= + github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= + github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= + github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +diff --git a/vendor/github.com/bndr/gotabulate/tabulate.go b/vendor/github.com/bndr/gotabulate/tabulate.go +index a2e43265..e6684d22 100644 +--- a/vendor/github.com/bndr/gotabulate/tabulate.go ++++ b/vendor/github.com/bndr/gotabulate/tabulate.go +@@ -1,10 +1,13 @@ + package gotabulate + +-import "fmt" +-import "bytes" +-import "github.com/mattn/go-runewidth" +-import "unicode/utf8" +-import "math" ++import ( ++ "bytes" ++ "fmt" ++ "math" ++ "unicode/utf8" ++ ++ "github.com/mattn/go-runewidth" ++) + + // Basic Structure of TableFormat + type TableFormat struct { +@@ -84,6 +87,7 @@ type Tabulate struct { + WrapStrings bool + WrapDelimiter rune + SplitConcat string ++ DenseMode bool + } + + // Represents normalized tabulate Row +@@ -292,7 +296,7 @@ func (t *Tabulate) Render(format ...interface{}) string { + // Add Data Rows + for index, element := range t.Data { + lines = append(lines, t.buildRow(t.padRow(element.Elements, t.TableFormat.Padding), padded_widths, cols, t.TableFormat.DataRow)) +- if index < len(t.Data)-1 { ++ if !t.DenseMode && index < len(t.Data)-1 { + if element.Continuos != true && !inSlice("betweenLine", t.HideLines) { + lines = append(lines, t.buildLine(padded_widths, cols, t.TableFormat.LineBetweenRows)) + } +@@ -385,7 +389,8 @@ func (t *Tabulate) SetEmptyString(empty string) { + // Can be: + // top - Top line of the table, + // belowheader - Line below the header, +-// bottom - Bottom line of the table ++// bottomLine - Bottom line of the table ++// betweenLine - Between line of the table + func (t *Tabulate) SetHideLines(hide []string) { + t.HideLines = hide + } +@@ -401,6 +406,12 @@ func (t *Tabulate) SetMaxCellSize(max int) { + t.MaxSize = max + } + ++// Sets dense mode ++// Under dense mode, no space line between rows ++func (t *Tabulate) SetDenseMode() { ++ t.DenseMode = true ++} ++ + func (t *Tabulate) splitElement(e string) (bool, string) { + //check if we are not attempting to smartly wrap + if t.WrapDelimiter == 0 { +diff --git a/vendor/modules.txt b/vendor/modules.txt +index bb224e3e..0017d4a3 100644 +--- a/vendor/modules.txt ++++ b/vendor/modules.txt +@@ -33,7 +33,7 @@ github.com/acarl005/stripansi + github.com/beorn7/perks/quantile + # github.com/blang/semver v4.0.0+incompatible + github.com/blang/semver +-# github.com/bndr/gotabulate v1.1.3-0.20170315142410-bc555436bfd5 ++# github.com/bndr/gotabulate v1.1.3-0.20210209140214-21a495b00e22 + github.com/bndr/gotabulate + # github.com/cespare/xxhash/v2 v2.1.1 + github.com/cespare/xxhash/v2 +-- +2.27.0 + diff --git a/patch/0041-enhancement-remove-empty-lines-when-showing-image-li.patch b/patch/0041-enhancement-remove-empty-lines-when-showing-image-li.patch new file mode 100644 index 0000000..2a97023 --- /dev/null +++ b/patch/0041-enhancement-remove-empty-lines-when-showing-image-li.patch @@ -0,0 +1,24 @@ +From 647011394abab7da261e827a3148c0c89467a6f8 Mon Sep 17 00:00:00 2001 +From: DCCooper <1866858@gmail.com> +Date: Wed, 10 Feb 2021 10:16:17 +0800 +Subject: [PATCH 2/2] enhancement: remove empty lines when showing image list + +Signed-off-by: DCCooper <1866858@gmail.com> +--- + cmd/cli/images.go | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/cmd/cli/images.go b/cmd/cli/images.go +index bded3617..19777ce8 100644 +--- a/cmd/cli/images.go ++++ b/cmd/cli/images.go +@@ -100,5 +100,6 @@ func formatAndPrint(images []*pb.ListResponse_ImageInfo) { + tabulate := gotabulate.Create(lines) + tabulate.SetHeaders(title) + tabulate.SetAlign("left") ++ tabulate.SetDenseMode() + fmt.Print(tabulate.Render("simple")) + } +-- +2.27.0 + diff --git a/series.conf b/series.conf index 2581ec5..f70cb7d 100644 --- a/series.conf +++ b/series.conf @@ -2,5 +2,6 @@ patch/0013-vendor-change-auth.json-file-mode-from-0700-to-0600.patch patch/0030-xattr-support-ima-and-evm.patch patch/0033-isula-build-remove-docker-releated-path-for-authenti.patch patch/0037-isula-build-fix-goroutine-leak-problem.patch -patch/0038-vendor-update-images-display.patch patch/0039-bugfix-remove-Healthcheck-field-when-build-from-scra.patch +patch/0040-vendor-update-tabulate-vendor-to-support-eliminate-s.patch +patch/0041-enhancement-remove-empty-lines-when-showing-image-li.patch