aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-03-23 23:32:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-03-23 23:32:57 +0300
commitb76f47b910bd924f1384dad71043d39f5dfe1f18 (patch)
tree1dad628e1e63121d592b3c2b0ccb6b8cdd9563f6
parent0a66376a54b3ef4b1c754e65cc2f7d0e8b2987e8 (diff)
Cleanup some files replacing tabs with spaces
-rw-r--r--INSTALL8
-rw-r--r--INSTALL-DEV4
-rw-r--r--brep/handler/ci/ci-load.in10
-rw-r--r--brep/handler/handler.bash.in4
-rw-r--r--brep/handler/submit/submit-git.bash.in2
-rw-r--r--brep/handler/submit/submit-git.in6
-rwxr-xr-xdoc/cli.sh4
-rw-r--r--libbrep/package-extra.sql20
-rw-r--r--mod/external-handler.cxx322
-rw-r--r--tests/ci/ci-dir.testscript2
-rw-r--r--tests/ci/ci-load.testscript6
-rw-r--r--tests/submit/submit-git.testscript6
-rw-r--r--www/submit.xhtml10
13 files changed, 202 insertions, 202 deletions
diff --git a/INSTALL b/INSTALL
index 8110cb4..59ec07e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -284,10 +284,10 @@ can also find this fragment in install/share/brep/etc/brep-apache2.conf):
# Repository root. This is the part of the URL between the host name
# and the start of the repository. For example, root value /pkg means
- # the repository URL is http://example.org/pkg/. Specify / to use the
+ # the repository URL is http://example.org/pkg/. Specify / to use the
# web server root (e.g., http://example.org/). If using a different
# repository root, don't forget to also change Location and Alias
- # directives below.
+ # directives below.
#
brep-root /pkg
@@ -337,10 +337,10 @@ compressed (along with linked CSS), also add the following lines:
# Compress brep output (xhtml+xml) and CSS.
#
- AddOutputFilterByType DEFLATE application/xhtml+xml
+ AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/manifest
AddOutputFilterByType DEFLATE text/plain
- AddOutputFilterByType DEFLATE text/css
+ AddOutputFilterByType DEFLATE text/css
Restart Apache2:
diff --git a/INSTALL-DEV b/INSTALL-DEV
index da27c8f..101d9d7 100644
--- a/INSTALL-DEV
+++ b/INSTALL-DEV
@@ -176,8 +176,8 @@ replacing <user> with your login.
# Brep module configuration.
#
brep-conf <BREP-SRC-ROOT>/etc/brep-module.conf
- brep-package-db-role <user>
- brep-build-db-role <user>
+ brep-package-db-role <user>
+ brep-build-db-role <user>
# Static brep content (CSS files).
#
diff --git a/brep/handler/ci/ci-load.in b/brep/handler/ci/ci-load.in
index f471a84..0a16e8c 100644
--- a/brep/handler/ci/ci-load.in
+++ b/brep/handler/ci/ci-load.in
@@ -202,10 +202,10 @@ while [ "$more" ]; do
while IFS=: read -ru "$manifest_parser_ofd" -d '' n v; do
case "$n" in
"") # Start of (next) manifest.
- more=true
- manifest_version="$v"
- break
- ;;
+ more=true
+ manifest_version="$v"
+ break
+ ;;
name) name="$v" ;;
version) version="$v" ;;
@@ -278,7 +278,7 @@ manifest_serializer_start "$cache_dir/packages.manifest"
for ((i=0; i <= ${#packages_manifest_names[@]}; ++i)); do
manifest_serialize "${packages_manifest_names[$i]}" \
- "${packages_manifest_values[$i]}"
+ "${packages_manifest_values[$i]}"
done
manifest_serializer_finish
diff --git a/brep/handler/handler.bash.in b/brep/handler/handler.bash.in
index 81ab08f..2e66afc 100644
--- a/brep/handler/handler.bash.in
+++ b/brep/handler/handler.bash.in
@@ -68,9 +68,9 @@ function trace_cmd () # <cmd> <arg>...
local s="+"
while [ $# -gt 0 ]; do
if [ -z "$1" -o -z "${1##* *}" ]; then
- s="$s '$1'"
+ s="$s '$1'"
else
- s="$s $1"
+ s="$s $1"
fi
shift
diff --git a/brep/handler/submit/submit-git.bash.in b/brep/handler/submit/submit-git.bash.in
index ec4d944..a36164c 100644
--- a/brep/handler/submit/submit-git.bash.in
+++ b/brep/handler/submit/submit-git.bash.in
@@ -85,7 +85,7 @@ function check_package_duplicate () # <name> <version> <repo-dir>
f="$(run find "$d" -name "$nam-$ver.*")"
if [ -n "$f" ]; then
- trace "found: $f"
+ trace "found: $f"
exit_with_manifest 422 "duplicate submission"
fi
fi
diff --git a/brep/handler/submit/submit-git.in b/brep/handler/submit/submit-git.in
index e70d100..5f95b7f 100644
--- a/brep/handler/submit/submit-git.in
+++ b/brep/handler/submit/submit-git.in
@@ -294,7 +294,7 @@ fi
# connectivity with the remote repository.
#
git_http_timeout=("-c" "http.lowSpeedLimit=1" \
- "-c" "http.lowSpeedTime=$git_timeout")
+ "-c" "http.lowSpeedTime=$git_timeout")
# Parse the submission request manifest and obtain the required values.
#
@@ -466,7 +466,7 @@ for i in {1..11}; do
# 'project' auth state.
#
if [ "$a" != "unknown" ]; then
- auth="$a"
+ auth="$a"
fi
fi
@@ -562,7 +562,7 @@ for i in {1..11}; do
ctl="$(repository_base "$control")"
create_owner_manifest \
- "$project" "$author_name" "$author_email" "$ctl" "$prj_man"
+ "$project" "$author_name" "$author_email" "$ctl" "$prj_man"
# Add the project owners manifest file to git repository using the path
# relative to the repository directory.
diff --git a/doc/cli.sh b/doc/cli.sh
index 0a84909..4f0547f 100755
--- a/doc/cli.sh
+++ b/doc/cli.sh
@@ -14,8 +14,8 @@ while [ $# -gt 0 ]; do
--clean)
rm -f brep*.xhtml brep*.1
rm -f build2-repository-interface-manual*.ps \
- build2-repository-interface-manual*.pdf \
- build2-repository-interface-manual.xhtml
+ build2-repository-interface-manual*.pdf \
+ build2-repository-interface-manual.xhtml
exit 0
;;
*)
diff --git a/libbrep/package-extra.sql b/libbrep/package-extra.sql
index 86f055b..fe936ff 100644
--- a/libbrep/package-extra.sql
+++ b/libbrep/package-extra.sql
@@ -26,7 +26,7 @@
--
DROP FUNCTION IF EXISTS search_packages(IN query tsquery,
IN tenant TEXT,
- IN name CITEXT);
+ IN name CITEXT);
DROP FUNCTION IF EXISTS search_latest_packages(IN query tsquery,
IN tenant TEXT);
@@ -98,10 +98,10 @@ RETURNS SETOF record AS $$
SELECT tenant, name, version_epoch, version_canonical_upstream,
version_canonical_release, version_revision,
CASE
- WHEN query IS NULL THEN 0
+ WHEN query IS NULL THEN 0
-- Weight mapping: D C B A
- ELSE ts_rank_cd('{0.05, 0.2, 0.9, 1.0}', search_index, query)
- END AS rank
+ ELSE ts_rank_cd('{0.05, 0.2, 0.9, 1.0}', search_index, query)
+ END AS rank
FROM latest_packages(search_latest_packages.tenant)
WHERE query IS NULL OR search_index @@ query;
$$ LANGUAGE SQL STABLE;
@@ -124,10 +124,10 @@ RETURNS SETOF record AS $$
SELECT tenant, name, version_epoch, version_canonical_upstream,
version_canonical_release, version_revision,
CASE
- WHEN query IS NULL THEN 0
+ WHEN query IS NULL THEN 0
-- Weight mapping: D C B A
- ELSE ts_rank_cd('{0.05, 0.2, 0.9, 1.0}', search_index, query)
- END AS rank
+ ELSE ts_rank_cd('{0.05, 0.2, 0.9, 1.0}', search_index, query)
+ END AS rank
FROM package
WHERE
(search_packages.tenant IS NULL OR tenant = search_packages.tenant) AND
@@ -146,8 +146,8 @@ RETURNS tsvector AS $$
WHEN document IS NULL THEN NULL
ELSE
setweight(to_tsvector(document.a), 'A') ||
- setweight(to_tsvector(document.b), 'B') ||
- setweight(to_tsvector(document.c), 'C') ||
- setweight(to_tsvector(document.d), 'D')
+ setweight(to_tsvector(document.b), 'B') ||
+ setweight(to_tsvector(document.c), 'C') ||
+ setweight(to_tsvector(document.d), 'D')
END
$$ LANGUAGE SQL IMMUTABLE;
diff --git a/mod/external-handler.cxx b/mod/external-handler.cxx
index d05e5bf..e88e4b4 100644
--- a/mod/external-handler.cxx
+++ b/mod/external-handler.cxx
@@ -76,209 +76,209 @@ namespace brep
string ref (data_dir.leaf ().string ());
for (;;) // Breakout loop.
+ try
+ {
+ fdpipe pipe (fdopen_pipe ()); // Can throw io_error.
+
+ // Redirect the diagnostics to the web server error log.
+ //
+ process pr (
+ process_start_callback ([&trace] (const char* args[], size_t n)
+ {
+ if (trace != nullptr)
+ *trace << process_args {args, n};
+ },
+ 0 /* stdin */,
+ pipe /* stdout */,
+ 2 /* stderr */,
+ handler,
+ args,
+ data_dir));
+ pipe.out.close ();
+
+ auto kill = [&pr, &warn, &handler, &ref] ()
+ {
+ // We may still end up well (see below), thus this is a warning.
+ //
+ warn << "ref " << ref << ": process " << handler
+ << " execution timeout expired";
+
+ pr.kill ();
+ };
+
try
{
- fdpipe pipe (fdopen_pipe ()); // Can throw io_error.
+ ifdstream is (move (pipe.in), fdstream_mode::non_blocking);
- // Redirect the diagnostics to the web server error log.
- //
- process pr (
- process_start_callback ([&trace] (const char* args[], size_t n)
- {
- if (trace != nullptr)
- *trace << process_args {args, n};
- },
- 0 /* stdin */,
- pipe /* stdout */,
- 2 /* stderr */,
- handler,
- args,
- data_dir));
- pipe.out.close ();
-
- auto kill = [&pr, &warn, &handler, &ref] ()
- {
- // We may still end up well (see below), thus this is a warning.
- //
- warn << "ref " << ref << ": process " << handler
- << " execution timeout expired";
-
- pr.kill ();
- };
+ const size_t nbuf (8192);
+ char buf[nbuf];
- try
+ while (is.is_open ())
{
- ifdstream is (move (pipe.in), fdstream_mode::non_blocking);
+ time_point start;
+ milliseconds wd (10); // Max time to wait for the data portion.
- const size_t nbuf (8192);
- char buf[nbuf];
-
- while (is.is_open ())
+ if (timeout)
{
- time_point start;
- milliseconds wd (10); // Max time to wait for the data portion.
+ start = system_clock::now ();
- if (timeout)
- {
- start = system_clock::now ();
+ if (*timeout < wd)
+ wd = *timeout;
+ }
- if (*timeout < wd)
- wd = *timeout;
- }
+ timeval tm {wd.count () / 1000 /* seconds */,
+ wd.count () % 1000 * 1000 /* microseconds */};
+
+ fd_set rd;
+ FD_ZERO (&rd);
+ FD_SET (is.fd (), &rd);
- timeval tm {wd.count () / 1000 /* seconds */,
- wd.count () % 1000 * 1000 /* microseconds */};
+ int r (select (is.fd () + 1, &rd, nullptr, nullptr, &tm));
- fd_set rd;
- FD_ZERO (&rd);
- FD_SET (is.fd (), &rd);
+ if (r == -1)
+ {
+ // Don't fail if the select() call was interrupted by the
+ // signal.
+ //
+ if (errno != EINTR)
+ throw_system_ios_failure (errno, "select failed");
+ }
+ else if (r != 0) // Is data available?
+ {
+ assert (FD_ISSET (is.fd (), &rd));
- int r (select (is.fd () + 1, &rd, nullptr, nullptr, &tm));
+ // The only leagal way to read from non-blocking ifdstream.
+ //
+ streamsize n (is.readsome (buf, nbuf));
- if (r == -1)
+ // Close the stream (and bail out) if the end of the data is
+ // reached. Otherwise cache the read data.
+ //
+ if (is.eof ())
+ is.close ();
+ else
{
- // Don't fail if the select() call was interrupted by the
- // signal.
+ // The data must be available.
//
- if (errno != EINTR)
- throw_system_ios_failure (errno, "select failed");
- }
- else if (r != 0) // Is data available?
- {
- assert (FD_ISSET (is.fd (), &rd));
-
- // The only leagal way to read from non-blocking ifdstream.
+ // Note that we could keep reading until the readsome() call
+ // returns 0. However, this way we could potentially exceed
+ // the timeout significantly for some broken handler that
+ // floods us with data. So instead, we will be checking the
+ // process execution time after every data chunk read.
//
- streamsize n (is.readsome (buf, nbuf));
+ assert (n != 0);
- // Close the stream (and bail out) if the end of the data is
- // reached. Otherwise cache the read data.
- //
- if (is.eof ())
- is.close ();
- else
- {
- // The data must be available.
- //
- // Note that we could keep reading until the readsome() call
- // returns 0. However, this way we could potentially exceed
- // the timeout significantly for some broken handler that
- // floods us with data. So instead, we will be checking the
- // process execution time after every data chunk read.
- //
- assert (n != 0);
-
- ss.write (buf, n);
- }
+ ss.write (buf, n);
}
- else // Timeout occured.
+ }
+ else // Timeout occured.
+ {
+ // Normally, we don't expect timeout to occur on the pipe read
+ // operation if the process has terminated successfully, as
+ // all its output must already be buffered (including eof).
+ // However, there can be some still running handler's child
+ // that has inherited the parent's stdout. In this case we
+ // assume that we have read all the handler's output, close
+ // the stream, log the warning and bail out.
+ //
+ if (pr.exit)
{
- // Normally, we don't expect timeout to occur on the pipe read
- // operation if the process has terminated successfully, as
- // all its output must already be buffered (including eof).
- // However, there can be some still running handler's child
- // that has inherited the parent's stdout. In this case we
- // assume that we have read all the handler's output, close
- // the stream, log the warning and bail out.
+ // We keep reading only upon successful handler termination.
//
- if (pr.exit)
- {
- // We keep reading only upon successful handler termination.
- //
- assert (*pr.exit);
+ assert (*pr.exit);
- is.close ();
+ is.close ();
- warn << "ref " << ref << ": process " << handler
- << " stdout is not closed after termination (possibly "
- << "handler's child still running)";
- }
+ warn << "ref " << ref << ": process " << handler
+ << " stdout is not closed after termination (possibly "
+ << "handler's child still running)";
}
+ }
+
+ if (timeout)
+ {
+ time_point now (system_clock::now ());
+
+ // Assume we have waited the full amount if the time
+ // adjustment is detected.
+ //
+ duration d (now > start ? now - start : wd);
- if (timeout)
+ // If the timeout is not fully exhausted, then decrement it and
+ // try to read some more data from the handler' stdout.
+ // Otherwise, kill the process, if not done yet.
+ //
+ // Note that it may happen that we are killing an already
+ // terminated process, in which case kill() just sets the
+ // process exit information. On the other hand it's guaranteed
+ // that the process is terminated after the kill() call, and
+ // so the pipe is presumably closed on the write end (see
+ // above for details). Thus, if the process terminated
+ // successfully, we will continue reading until eof is
+ // reached or read timeout occurred. Yes, it may happen that
+ // we will succeed even with the kill.
+ //
+ if (*timeout > d)
+ *timeout -= duration_cast<milliseconds> (d);
+ else if (!pr.exit)
{
- time_point now (system_clock::now ());
+ kill ();
- // Assume we have waited the full amount if the time
- // adjustment is detected.
- //
- duration d (now > start ? now - start : wd);
+ assert (pr.exit);
- // If the timeout is not fully exhausted, then decrement it and
- // try to read some more data from the handler' stdout.
- // Otherwise, kill the process, if not done yet.
+ // Close the stream (and bail out) if the process hasn't
+ // terminate successfully.
//
- // Note that it may happen that we are killing an already
- // terminated process, in which case kill() just sets the
- // process exit information. On the other hand it's guaranteed
- // that the process is terminated after the kill() call, and
- // so the pipe is presumably closed on the write end (see
- // above for details). Thus, if the process terminated
- // successfully, we will continue reading until eof is
- // reached or read timeout occurred. Yes, it may happen that
- // we will succeed even with the kill.
- //
- if (*timeout > d)
- *timeout -= duration_cast<milliseconds> (d);
- else if (!pr.exit)
- {
- kill ();
-
- assert (pr.exit);
-
- // Close the stream (and bail out) if the process hasn't
- // terminate successfully.
- //
- if (!*pr.exit)
- is.close ();
-
- *timeout = milliseconds::zero ();
- }
+ if (!*pr.exit)
+ is.close ();
+
+ *timeout = milliseconds::zero ();
}
}
+ }
- assert (!is.is_open ());
-
- if (!timeout)
- pr.wait ();
+ assert (!is.is_open ());
- // If the process is not terminated yet, then wait for its
- // termination for the remaining time. Kill it if the timeout has
- // been exceeded and the process still hasn't terminate.
- //
- else if (!pr.exit && !pr.timed_wait (*timeout))
- kill ();
+ if (!timeout)
+ pr.wait ();
- assert (pr.exit); // The process must finally be terminated.
+ // If the process is not terminated yet, then wait for its
+ // termination for the remaining time. Kill it if the timeout has
+ // been exceeded and the process still hasn't terminate.
+ //
+ else if (!pr.exit && !pr.timed_wait (*timeout))
+ kill ();
- if (*pr.exit)
- break; // Get out of the breakout loop.
+ assert (pr.exit); // The process must finally be terminated.
- error << "ref " << ref << ": process " << handler << " "
- << *pr.exit;
+ if (*pr.exit)
+ break; // Get out of the breakout loop.
- // Fall through.
- }
- catch (const io_error& e)
- {
- if (pr.wait ())
- error << "ref " << ref << ": unable to read handler's output: "
- << e;
+ error << "ref " << ref << ": process " << handler << " "
+ << *pr.exit;
- // Fall through.
- }
+ // Fall through.
+ }
+ catch (const io_error& e)
+ {
+ if (pr.wait ())
+ error << "ref " << ref << ": unable to read handler's output: "
+ << e;
- return nullopt;
+ // Fall through.
}
+
+ return nullopt;
+ }
// Handle process_error and io_error (both derive from system_error).
//
- catch (const system_error& e)
- {
- error << "ref " << ref << ": unable to execute '" << handler
- << "': " << e;
+ catch (const system_error& e)
+ {
+ error << "ref " << ref << ": unable to execute '" << handler
+ << "': " << e;
- return nullopt;
- }
+ return nullopt;
+ }
result_manifest r;
diff --git a/tests/ci/ci-dir.testscript b/tests/ci/ci-dir.testscript
index 66a1042..c850df0 100644
--- a/tests/ci/ci-dir.testscript
+++ b/tests/ci/ci-dir.testscript
@@ -89,7 +89,7 @@
$clone_root_data_clean;
sed -i -e "s%^\(repository:\) .+\$%\\1 http://example.com/repo.git%" \
- $data_dir/request.manifest;
+ $data_dir/request.manifest;
$* >>~"%EOO%"
: 1
diff --git a/tests/ci/ci-load.testscript b/tests/ci/ci-load.testscript
index 9de6b75..bc0d521 100644
--- a/tests/ci/ci-load.testscript
+++ b/tests/ci/ci-load.testscript
@@ -201,8 +201,8 @@
%.
reference: $request_id
EOO
- %.*:.*%+
- EOE
+ %.*:.*%+
+ EOE
}
}
}
@@ -233,7 +233,7 @@
$clone_root_data_clean;
sed -i -e "s%^\(repository:\) .+\$%\\1 http://example.com/repo.git%" \
- $data_dir/request.manifest;
+ $data_dir/request.manifest;
$* >>~"%EOO%"
: 1
diff --git a/tests/submit/submit-git.testscript b/tests/submit/submit-git.testscript
index 83e39a7..122c9ae 100644
--- a/tests/submit/submit-git.testscript
+++ b/tests/submit/submit-git.testscript
@@ -893,7 +893,7 @@ pkg_ctl="$prj_ctl/hello.git"
$clone_root_data_clean;
sed -i -e 's%^(sha256sum:) .+$%\1 59941e842667%' \
- $data_dir/request.manifest;
+ $data_dir/request.manifest;
$clone_root_tgt;
$g clone tgt.git &tgt/***;
@@ -927,7 +927,7 @@ pkg_ctl="$prj_ctl/hello.git"
{
$clone_root_data_clean;
sed -i -e 's%^(control:) .+$%\1 http://non-existent-host/path/rep.git%' \
- $data_dir/request.manifest;
+ $data_dir/request.manifest;
$clone_root_tgt;
@@ -944,7 +944,7 @@ pkg_ctl="$prj_ctl/hello.git"
{
$clone_root_data_clean;
sed -i -e 's%^(control:) .+$%\1 http://example.com/path/rep.git%' \
- $data_dir/request.manifest;
+ $data_dir/request.manifest;
$clone_root_tgt;
diff --git a/www/submit.xhtml b/www/submit.xhtml
index 4a7ed50..bb950d9 100644
--- a/www/submit.xhtml
+++ b/www/submit.xhtml
@@ -8,11 +8,11 @@
<tr>
<th>archive</th>
<td>
- <input type="file"
- name="archive"
- accept=".tar.gz"
- required=""/>
- </td>
+ <input type="file"
+ name="archive"
+ accept=".tar.gz"
+ required=""/>
+ </td>
</tr>
<tr>
<th>sha256sum</th>