|
25 | 25 | import tarfile |
26 | 26 | import tempfile |
27 | 27 |
|
| 28 | +from absl import flags |
28 | 29 | from rules_pkg import archive |
29 | | -from third_party.py import gflags |
30 | 30 |
|
31 | | -gflags.DEFINE_string('output', None, 'The output file, mandatory') |
32 | | -gflags.MarkFlagAsRequired('output') |
33 | 31 |
|
34 | | -gflags.DEFINE_multistring('file', [], 'A file to add to the layer') |
| 32 | +flags.DEFINE_string('output', None, 'The output file, mandatory') |
| 33 | +flags.mark_flag_as_required('output') |
35 | 34 |
|
36 | | -gflags.DEFINE_string('manifest', None, 'JSON manifest of contents to add to the layer') |
| 35 | +flags.DEFINE_multi_string('file', [], 'A file to add to the layer') |
37 | 36 |
|
38 | | -gflags.DEFINE_multistring('empty_file', [], 'An empty file to add to the layer') |
| 37 | +flags.DEFINE_string('manifest', None, 'JSON manifest of contents to add to the layer') |
39 | 38 |
|
40 | | -gflags.DEFINE_multistring('empty_dir', [], 'An empty dir to add to the layer') |
| 39 | +flags.DEFINE_multi_string('empty_file', [], 'An empty file to add to the layer') |
41 | 40 |
|
42 | | -gflags.DEFINE_string( |
| 41 | +flags.DEFINE_multi_string('empty_dir', [], 'An empty dir to add to the layer') |
| 42 | + |
| 43 | +flags.DEFINE_string( |
43 | 44 | 'mode', None, 'Force the mode on the added files (in octal).') |
44 | 45 |
|
45 | | -gflags.DEFINE_string( |
| 46 | +flags.DEFINE_string( |
46 | 47 | 'mtime', None, 'Set mtime on tar file entries. May be an integer or the' |
47 | 48 | ' value "portable", to get the value 2000-01-01, which is' |
48 | 49 | ' usable with non *nix OSes.') |
49 | 50 |
|
50 | | -gflags.DEFINE_bool( |
| 51 | +flags.DEFINE_bool( |
51 | 52 | 'enable_mtime_preservation', False, 'Preserve file mtimes from input tar file.') |
52 | 53 |
|
53 | | -gflags.DEFINE_multistring( |
| 54 | +flags.DEFINE_multi_string( |
54 | 55 | 'empty_root_dir', |
55 | 56 | [], |
56 | 57 | 'An empty root directory to add to the layer. This will create a directory that' |
57 | 58 | 'is a peer of "root_directory". "empty_dir" creates an empty directory inside of' |
58 | 59 | '"root_directory"') |
59 | 60 |
|
60 | | -gflags.DEFINE_multistring('tar', [], 'A tar file to add to the layer') |
| 61 | +flags.DEFINE_multi_string('tar', [], 'A tar file to add to the layer') |
61 | 62 |
|
62 | | -gflags.DEFINE_multistring('deb', [], 'A debian package to add to the layer') |
| 63 | +flags.DEFINE_multi_string('deb', [], 'A debian package to add to the layer') |
63 | 64 |
|
64 | | -gflags.DEFINE_multistring( |
| 65 | +flags.DEFINE_multi_string( |
65 | 66 | 'link', [], |
66 | 67 | 'Add a symlink a inside the layer ponting to b if a:b is specified') |
67 | | -gflags.RegisterValidator( |
| 68 | +flags.register_validator( |
68 | 69 | 'link', |
69 | 70 | lambda l: all(value.find(':') > 0 for value in l), |
70 | 71 | message='--link value should contains a : separator') |
71 | 72 |
|
72 | | -gflags.DEFINE_string( |
| 73 | +flags.DEFINE_string( |
73 | 74 | 'directory', None, 'Directory in which to store the file inside the layer') |
74 | 75 |
|
75 | | -gflags.DEFINE_string( |
| 76 | +flags.DEFINE_string( |
76 | 77 | 'compression', None, 'Compression (`gz` or `bz2`), default is none.') |
77 | 78 |
|
78 | | -gflags.DEFINE_multistring( |
| 79 | +flags.DEFINE_multi_string( |
79 | 80 | 'modes', None, |
80 | 81 | 'Specific mode to apply to specific file (from the file argument),' |
81 | 82 | ' e.g., path/to/file=0o455.') |
82 | 83 |
|
83 | | -gflags.DEFINE_multistring('owners', None, |
| 84 | +flags.DEFINE_multi_string('owners', None, |
84 | 85 | 'Specify the numeric owners of individual files, ' |
85 | 86 | 'e.g. path/to/file=0.0.') |
86 | 87 |
|
87 | | -gflags.DEFINE_string('owner', '0.0', |
| 88 | +flags.DEFINE_string('owner', '0.0', |
88 | 89 | 'Specify the numeric default owner of all files,' |
89 | 90 | ' e.g., 0.0') |
90 | 91 |
|
91 | | -gflags.DEFINE_string('owner_name', None, |
| 92 | +flags.DEFINE_string('owner_name', None, |
92 | 93 | 'Specify the owner name of all files, e.g. root.root.') |
93 | 94 |
|
94 | | -gflags.DEFINE_multistring('owner_names', None, |
| 95 | +flags.DEFINE_multi_string('owner_names', None, |
95 | 96 | 'Specify the owner names of individual files, e.g. ' |
96 | 97 | 'path/to/file=root.root.') |
97 | 98 |
|
98 | | -gflags.DEFINE_string( |
| 99 | +flags.DEFINE_string( |
99 | 100 | 'root_directory', './', 'Default root directory is named "."' |
100 | 101 | 'Windows docker images require this be named "Files" instead of "."') |
101 | 102 |
|
102 | | -gflags.DEFINE_string('xz_path', None, |
| 103 | +flags.DEFINE_string('xz_path', None, |
103 | 104 | 'Specify the path to xz as a fallback when the Python ' |
104 | 105 | 'lzma module is unavailable.') |
105 | 106 |
|
106 | | -FLAGS = gflags.FLAGS |
| 107 | +FLAGS = flags.FLAGS |
107 | 108 |
|
108 | 109 |
|
109 | 110 | class TarFile(object): |
|
0 commit comments