Skip to content

Commit 512629a

Browse files
committed
tarball: allow choosing the compression formats to output
1 parent 88e76e1 commit 512629a

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ fn tarball(matches: &ArgMatches<'_>) -> Result<()> {
8888
"input" => input,
8989
"output" => output,
9090
"work-dir" => work_dir,
91+
"compression-formats" => compression_formats,
9192
});
9293

9394
tarballer.run().context("failed to generate tarballs")?;

src/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,9 @@ subcommands:
164164
long: work-dir
165165
takes_value: true
166166
value_name: DIR
167+
- compression-formats:
168+
help: Comma-separated list of compression formats to use
169+
long: compression-formats
170+
takes_value: true
171+
value_name: FORMAT
167172

test.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,42 @@ combine_compression_formats_error() {
13011301
}
13021302
runtest combine_compression_formats_error
13031303

1304+
tarball_compression_formats_one() {
1305+
try cp -r "${TEST_DIR}/image1" "${WORK_DIR}/image"
1306+
try sh "$S/make-tarballs.sh" \
1307+
--input="${WORK_DIR}/image" \
1308+
--work-dir="${WORK_DIR}" \
1309+
--output="${OUT_DIR}/rustc" \
1310+
--compression-formats="xz"
1311+
1312+
try test ! -e "${OUT_DIR}/rustc.tar.gz"
1313+
try test -e "${OUT_DIR}/rustc.tar.xz"
1314+
}
1315+
runtest tarball_compression_formats_one
1316+
1317+
tarball_compression_formats_multiple() {
1318+
try cp -r "${TEST_DIR}/image1" "${WORK_DIR}/image"
1319+
try sh "$S/make-tarballs.sh" \
1320+
--input="${WORK_DIR}/image" \
1321+
--work-dir="${WORK_DIR}" \
1322+
--output="${OUT_DIR}/rustc" \
1323+
--compression-formats="xz,gz"
1324+
1325+
try test -e "${OUT_DIR}/rustc.tar.gz"
1326+
try test -e "${OUT_DIR}/rustc.tar.xz"
1327+
}
1328+
runtest tarball_compression_formats_multiple
1329+
1330+
tarball_compression_formats_error() {
1331+
try cp -r "${TEST_DIR}/image1" "${WORK_DIR}/image"
1332+
expect_fail sh "$S/make-tarballs.sh" \
1333+
--input="${WORK_DIR}/image" \
1334+
--work-dir="${WORK_DIR}" \
1335+
--output="${OUT_DIR}/rustc" \
1336+
--compression-formats="xz,foobar"
1337+
}
1338+
runtest tarball_compression_formats_error
1339+
13041340
echo
13051341
echo "TOTAL SUCCESS!"
13061342
echo

0 commit comments

Comments
 (0)