PreviewSubmit: always allow tgz format

Currently the setting archive.download is used in two different cases:
* It is used to specify formats for downloading a patch set archive
* It is used to specify the formats in preview_submit

However these two use cases serve different purposes:
The format for downloading a patch set archive can be used to
adapt to the resource environment:
* When bandwidth is cheap, tar is a good choice.
* When CPU is available, tbz2 and txz are good candidates.
* tgz does an ok job w.r.t. any resource.
* the admin may deem downloading patches as an archive is
  not a good idea and disable it completely by allowing no formats.

The format for preview_submit is different, though, because it is
used as a wrapper around already compressed files (git bundles),
so it makes no sense to spent a lot of CPU to compress it further.
Also at least one format needs to be allowed, otherwise this call
cannot be used. Always allow tgz as that format is a good trade off
for all resources.

Change-Id: I7177a6135d507f481bb3fa52c46883951030af11
Signed-off-by: Stefan Beller <sbeller@google.com>
This commit is contained in:
Stefan Beller
2016-10-05 15:23:22 -07:00
parent d4cd492d0f
commit 3e58674648
3 changed files with 11 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ then
fi
curl --digest -u $gerrituser -w '%{http_code}' -o preview \
$server/a/changes/$changeId/revisions/current/preview_submit?format=zip >http_code
$server/a/changes/$changeId/revisions/current/preview_submit?format=tgz >http_code
if ! grep 200 http_code >/dev/null
then
# error out:
@@ -45,9 +45,9 @@ then
cat preview
echo
else
# valid zip file, extract and obtain a bundle for each project
# valid tgz file, extract and obtain a bundle for each project
mkdir tmp-bundles
unzip preview -d tmp-bundles
(cd tmp-bundles && tar -zxf ../preview)
for project in $(cd tmp-bundles && find -type f)
do
# Projects may contain slashes, so create the required