MCPcopy Create free account
hub / github.com/apache/mesos / tar

Function tar

src/common/command_utils.cpp:108–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106
107
108Future<Nothing> tar(
109 const Path& input,
110 const Path& output,
111 const Option<Path>& directory,
112 const Option<Compression>& compression)
113{
114 vector<string> argv = {
115 "tar",
116 "-c", // Create archive.
117 "-f", // Output file.
118 output
119 };
120
121 // Add additional flags.
122 if (directory.isSome()) {
123 argv.emplace_back("-C");
124 argv.emplace_back(directory.get());
125 }
126
127 if (compression.isSome()) {
128 switch (compression.get()) {
129 case Compression::GZIP:
130 argv.emplace_back("-z");
131 break;
132 case Compression::BZIP2:
133 argv.emplace_back("-j");
134 break;
135 case Compression::XZ:
136 argv.emplace_back("-J");
137 break;
138 default:
139 UNREACHABLE();
140 }
141 }
142
143 argv.emplace_back(input);
144
145 return launch("tar", argv)
146 .then([]() { return Nothing(); });
147}
148
149
150Future<Nothing> untar(

Callers 5

SetUpMethod · 0.50
createMethod · 0.50
prepareImageMethod · 0.50
prepareImageBundleMethod · 0.50

Calls 5

NothingClass · 0.85
launchFunction · 0.70
isSomeMethod · 0.45
getMethod · 0.45
thenMethod · 0.45

Tested by 5

SetUpMethod · 0.40
createMethod · 0.40
prepareImageMethod · 0.40
prepareImageBundleMethod · 0.40