A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bazel-contrib/rules_distroless/commit/7853bcd7eb6ce79fd0512eac3d721b7630fd2ba9 below:

make all gzip compression hermetic (#75) · bazel-contrib/rules_distroless@7853bcd · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+22

-9

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+22

-9

lines changed Original file line number Diff line number Diff line change

@@ -11,8 +11,10 @@ def _flatten_impl(ctx):

11 11

output = ctx.actions.declare_file(ctx.attr.name + ext)

12 12 13 13

args = ctx.actions.args()

14 +

args.add_all(tar_lib.DEFAULT_ARGS)

14 15

args.add("--create")

15 16

tar_lib.common.add_compression_args(ctx.attr.compress, args)

17 +

tar_lib.add_default_compression_args(ctx.attr.compress, args)

16 18

args.add("--file", output)

17 19

args.add_all(ctx.files.tars, format_each = "@%s")

18 20 Original file line number Diff line number Diff line change

@@ -53,7 +53,7 @@ def group(name, entries, time = "0.0", mode = "0644", **kwargs):

53 53

name = name,

54 54

srcs = [":%s_content" % name],

55 55

mtree = mtree.content(),

56 -

args = tar_lib.DEFAULT_ARGS,

56 +

args = tar_lib.DEFAULT_ARGS + tar_lib.DEFAULT_COMPRESSION_ARGS["gzip"],

57 57

compress = "gzip",

58 58

**common_kwargs

59 59

)

Original file line number Diff line number Diff line change

@@ -28,7 +28,7 @@ def home(name, dirs, **kwargs):

28 28

tar(

29 29

name = name,

30 30

mtree = mtree.content(),

31 -

args = tar_lib.DEFAULT_ARGS,

31 +

args = tar_lib.DEFAULT_ARGS + tar_lib.DEFAULT_COMPRESSION_ARGS["gzip"],

32 32

compress = "gzip",

33 33

**kwargs

34 34

)

Original file line number Diff line number Diff line change

@@ -10,8 +10,8 @@ shift 4

10 10

# TODO: there must be a better way to manipulate tars!

11 11

# "$bsdtar" -cf $out --posix --no-same-owner --options="" $@ "@$package_path"

12 12

# "$bsdtar" -cf to.mtree $@ --format=mtree --options '!gname,!uname,!sha1,!nlink' "@$package_path"

13 -

# "$bsdtar" --older "0" -Uf $out @to.mtree

13 +

# "$bsdtar" --older "0" -Uf $out @to.mtree

14 14 15 15

tmp=$(mktemp -d)

16 16

"$bsdtar" -xf "$package_path" $@ -C "$tmp"

17 -

"$bsdtar" -cf - $@ --format=mtree --options '!gname,!uname,!sha1,!nlink,!time' "@$package_path" | sed 's/$/ time=0.0/' | "$bsdtar" --gzip -cf "$out" -C "$tmp/" @-

17 +

"$bsdtar" -cf - $@ --format=mtree --options '!gname,!uname,!sha1,!nlink,!time' "@$package_path" | sed 's/$/ time=0.0/' | "$bsdtar" --gzip --options 'gzip:!timestamp' -cf "$out" -C "$tmp/" @-

Original file line number Diff line number Diff line change

@@ -54,7 +54,7 @@ def os_release(

54 54

name = name,

55 55

srcs = [":%s_content" % name],

56 56

mtree = mtree.content(),

57 -

args = tar_lib.DEFAULT_ARGS,

57 +

args = tar_lib.DEFAULT_ARGS + tar_lib.DEFAULT_COMPRESSION_ARGS["gzip"],

58 58

compress = "gzip",

59 59

**common_kwargs

60 60

)

Original file line number Diff line number Diff line change

@@ -63,7 +63,7 @@ def passwd(name, entries, mode = "0644", time = "0.0", **kwargs):

63 63

name = name,

64 64

srcs = [":%s_content" % name],

65 65

mtree = mtree.content(),

66 -

args = tar_lib.DEFAULT_ARGS,

66 +

args = tar_lib.DEFAULT_ARGS + tar_lib.DEFAULT_COMPRESSION_ARGS["gzip"],

67 67

compress = "gzip",

68 68

**common_kwargs

69 69

)

Original file line number Diff line number Diff line change

@@ -11,10 +11,15 @@ DEFAULT_ARGS = [

11 11

# TODO: distroless uses gnu archives

12 12

"--format",

13 13

"gnutar",

14 -

# Gzip timestamps are source of non-hermeticity. disable them

15 -

"--options=gzip:!timestamp",

16 14

]

17 15 16 +

DEFAULT_COMPRESSION_ARGS = {

17 +

"gzip": [

18 +

# Gzip timestamps are source of non-hermeticity. disable them

19 +

"--options=gzip:!timestamp",

20 +

],

21 +

}

22 + 18 23

def _mtree_line(dest, type, content = None, uid = DEFAULT_UID, gid = DEFAULT_GID, time = DEFAULT_TIME, mode = DEFAULT_MODE):

19 24

# mtree expects paths to start with ./ so normalize paths that starts with

20 25

# `/` or relative path (without / and ./)

@@ -56,7 +61,8 @@ def _build_tar(ctx, mtree, output, inputs = [], compression = "gzip", mnemonic =

56 61

args = ctx.actions.args()

57 62

args.add_all(DEFAULT_ARGS)

58 63

args.add("--create")

59 -

args.add(compression, format = "--%s")

64 +

tar.common.add_compression_args(compression, args)

65 +

_add_default_compression_args(compression, args)

60 66

args.add("--file", output)

61 67

args.add(mtree, format = "@%s")

62 68

@@ -100,9 +106,14 @@ def _create_mtree(ctx = None):

100 106

content = lambda: content.to_list() + ["#end"],

101 107

)

102 108 109 +

def _add_default_compression_args(compression, args):

110 +

args.add_all(DEFAULT_COMPRESSION_ARGS.get(compression, []))

111 + 103 112

tar_lib = struct(

104 113

TOOLCHAIN_TYPE = tar.toolchain_type,

105 114

DEFAULT_ARGS = DEFAULT_ARGS,

115 +

DEFAULT_COMPRESSION_ARGS = DEFAULT_COMPRESSION_ARGS,

116 +

add_default_compression_args = _add_default_compression_args,

106 117

create_mtree = _create_mtree,

107 118

common = tar.common,

108 119

)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4