* [gentoo-commits] proj/qa-scripts:master commit in: cgi-bin/
@ 2015-09-06 13:24 Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2015-09-06 13:24 UTC (permalink / raw
To: gentoo-commits
commit: 49748d5bfee72b7e80a93a11250a1ba78eadfcab
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 6 13:24:28 2015 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Sep 6 13:24:28 2015 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=49748d5b
cgi: Add script to output files from git repo
cgi-bin/get-git-file.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/cgi-bin/get-git-file.sh b/cgi-bin/get-git-file.sh
new file mode 100755
index 0000000..8b48b08
--- /dev/null
+++ b/cgi-bin/get-git-file.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+if [[ ! ${QUERY_STRING} ]]; then
+ echo "Script must be run through CGI" >&2
+ exit 1
+fi
+
+main() {
+ local qs=${QUERY_STRING}
+ local repo=${qs%%;*}
+ qs=${qs#*;}
+ local commit=${qs%%;*}
+ qs=${qs#*;}
+ local file=${qs%%;*}
+
+ if [[ ${repo} == */* ]]; then
+ echo "DANGER! SOMEONE TRIES TO ABUSE ME!" >&2
+ exit 1
+ fi
+
+ if ! cd "$(dirname "${0}")/../htdocs/output/${repo}" 2>/dev/null; then
+ echo "Status: 404 Not Found"
+ echo
+ echo "404 Not Found"
+ exit 0
+ fi
+
+ local tree=( $(git ls-tree "${commit}" "${file}" 2>/dev/null) )
+ if [[ ! ${tree[*]} ]]; then
+ echo "Status: 404 Not Found"
+ echo
+ echo "404 Not Found"
+ exit 0
+ fi
+
+ local ct
+ case "${file}" in
+ *.css) ct=text/css;;
+ *.html) ct=text/html;;
+ *) ct=text/plain;;
+ esac
+
+ echo "Content-Type: ${ct}"
+ echo
+ git cat-file -p "${tree[2]}"
+}
+
+main
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/qa-scripts:master commit in: cgi-bin/
@ 2016-12-05 9:03 Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2016-12-05 9:03 UTC (permalink / raw
To: gentoo-commits
commit: f87c07fff29036a13bbae97f8b08943dac292ae2
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 5 09:02:40 2016 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 5 09:02:40 2016 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=f87c07ff
get-git-file: Generate gentoo-ci (+PR) HTML locally
cgi-bin/get-git-file.sh | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/cgi-bin/get-git-file.sh b/cgi-bin/get-git-file.sh
index 8b48b08..56eecaa 100755
--- a/cgi-bin/get-git-file.sh
+++ b/cgi-bin/get-git-file.sh
@@ -18,31 +18,50 @@ main() {
exit 1
fi
- if ! cd "$(dirname "${0}")/../htdocs/output/${repo}" 2>/dev/null; then
+ local topdir=$(dirname "${0}")/..
+
+ if ! cd "${topdir}/htdocs/output/${repo}" 2>/dev/null; then
echo "Status: 404 Not Found"
echo
echo "404 Not Found"
exit 0
fi
- local tree=( $(git ls-tree "${commit}" "${file}" 2>/dev/null) )
+ # generate HTML from XML
+ local lfile=${file}
+ [[ ${file} == *.html ]] && lfile=${file%.html}.xml
+
+ local tree=( $(git ls-tree "${commit}" "${lfile}" 2>/dev/null) )
if [[ ! ${tree[*]} ]]; then
- echo "Status: 404 Not Found"
- echo
- echo "404 Not Found"
- exit 0
+ # fallback for stuff without .xml
+ lfile=${file}
+ tree=( $(git ls-tree "${commit}" "${lfile}" 2>/dev/null) )
+ if [[ ! ${tree[*]} ]]; then
+ echo "Status: 404 Not Found"
+ echo
+ echo "404 Not Found"
+ exit 0
+ fi
fi
local ct
case "${file}" in
*.css) ct=text/css;;
*.html) ct=text/html;;
+ *.xml) ct=application/xml;;
*) ct=text/plain;;
esac
echo "Content-Type: ${ct}"
echo
- git cat-file -p "${tree[2]}"
+ if [[ ${file} == *.html && ${lfile} == *.xml ]]; then
+ local ts=$(TZ=UTC git log --format='%cd' --date=iso-local -1 | cut -d' ' -f1-2)
+
+ git cat-file -p "${tree[2]}" \
+ | PYTHONIOENCODING=utf8 python "${topdir}"/pkgcheck2html/pkgcheck2html.py -t "${ts}" -
+ else
+ git cat-file -p "${tree[2]}"
+ fi
}
main
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/qa-scripts:master commit in: cgi-bin/
@ 2017-05-13 10:53 Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2017-05-13 10:53 UTC (permalink / raw
To: gentoo-commits
commit: 17c948206120bb935d953aea6c2e0e99e116e693
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat May 13 10:53:15 2017 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat May 13 10:53:15 2017 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=17c94820
get-git-file: warn about sync delay on 404
cgi-bin/get-git-file.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cgi-bin/get-git-file.sh b/cgi-bin/get-git-file.sh
index 56eecaa..5e9fd0d 100755
--- a/cgi-bin/get-git-file.sh
+++ b/cgi-bin/get-git-file.sh
@@ -39,7 +39,7 @@ main() {
if [[ ! ${tree[*]} ]]; then
echo "Status: 404 Not Found"
echo
- echo "404 Not Found"
+ echo "404 Not Found (if the report was just published, you may need to wait a minute or two for sync)"
exit 0
fi
fi
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/qa-scripts:master commit in: cgi-bin/
@ 2020-06-02 16:19 Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2020-06-02 16:19 UTC (permalink / raw
To: gentoo-commits
commit: 303638ac23747f92a44b0e7eaa6821ebcb147aee
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 2 16:19:03 2020 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jun 2 16:19:03 2020 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=303638ac
Fix silly thinko
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
cgi-bin/get-git-file.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cgi-bin/get-git-file.sh b/cgi-bin/get-git-file.sh
index ef57a72..09e0122 100755
--- a/cgi-bin/get-git-file.sh
+++ b/cgi-bin/get-git-file.sh
@@ -25,7 +25,7 @@ main() {
projects=--projects
;;
pkg=*)
- filter_pkg="--pkg ${pkg}"
+ filter_pkg="--pkg ${q#pkg=}"
;;
esac
[[ ${qs} == *\;* ]] && qs=${qs#*;} || qs=
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/qa-scripts:master commit in: cgi-bin/
@ 2020-06-02 16:28 Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2020-06-02 16:28 UTC (permalink / raw
To: gentoo-commits
commit: bfa8601882f94b74f08971bc5ae0b7751f8ac3d5
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 2 16:28:17 2020 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jun 2 16:28:17 2020 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=bfa86018
get-git-file: Replace / with : for apache's sake
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
cgi-bin/get-git-file.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cgi-bin/get-git-file.sh b/cgi-bin/get-git-file.sh
index 09e0122..9451d1e 100755
--- a/cgi-bin/get-git-file.sh
+++ b/cgi-bin/get-git-file.sh
@@ -25,7 +25,8 @@ main() {
projects=--projects
;;
pkg=*)
- filter_pkg="--pkg ${q#pkg=}"
+ pkgs=${q#pkg=}
+ filter_pkg="--pkg ${pkgs//://}"
;;
esac
[[ ${qs} == *\;* ]] && qs=${qs#*;} || qs=
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/qa-scripts:master commit in: cgi-bin/
@ 2021-09-02 5:39 Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2021-09-02 5:39 UTC (permalink / raw
To: gentoo-commits
commit: a361f8f2a37c32b5472422245a57581cd5788934
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 2 05:38:41 2021 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Sep 2 05:38:41 2021 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=a361f8f2
get-git-file: Issue 503 when commit is not found
Issue 503 to suggest retrying more aggressively when the requested
commit is not found. It usually means that the CI reports haven't been
fetched yet.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
cgi-bin/get-git-file.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cgi-bin/get-git-file.sh b/cgi-bin/get-git-file.sh
index 9451d1e..9721f71 100755
--- a/cgi-bin/get-git-file.sh
+++ b/cgi-bin/get-git-file.sh
@@ -61,7 +61,8 @@ main() {
lfile=${file}
tree=( $(git ls-tree "${commit}" "${lfile}" 2>/dev/null) )
if [[ ! ${tree[*]} ]]; then
- echo "Status: 404 Not Found"
+ echo "Status: 503 Service Unavailable"
+ echo "Retry-After: 30"
echo
echo "404 Not Found (if the report was just published, you may need to wait a minute or two for sync)"
exit 0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/qa-scripts:master commit in: cgi-bin/
@ 2021-11-09 18:20 Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2021-11-09 18:20 UTC (permalink / raw
To: gentoo-commits
commit: 76ef821a35c6ac43665c4909b298a67cc9237bb1
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 9 18:20:27 2021 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Nov 9 18:20:27 2021 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=76ef821a
Add a cgi script to trigger git pulls remotely
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
cgi-bin/trigger-pull.sh | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/cgi-bin/trigger-pull.sh b/cgi-bin/trigger-pull.sh
new file mode 100755
index 0000000..89aff7a
--- /dev/null
+++ b/cgi-bin/trigger-pull.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+if [[ ! ${QUERY_STRING} ]]; then
+ echo "Script must be run through CGI" >&2
+ exit 1
+fi
+
+main() {
+ local repo=${QUERY_STRING}
+ if [[ ${repo} == */* ]]; then
+ echo "DANGER! DANGER! DON'T TALK TO STRANGERS!" >&2
+ exit 1
+ fi
+
+ local topdir=$(dirname "${0}")/..
+
+ if ! cd "${topdir}/htdocs/output/${repo}" 2>/dev/null; then
+ echo "Status: 404 Not Found"
+ echo
+ echo "404 Not Found"
+ exit 0
+ fi
+
+ local output=$(git pull -q 2>&1)
+ if [ $? -eq 0 ]; then
+ echo "Status: 200 OK"
+ echo
+ echo "Done."
+ else
+ echo "Status: 500 Failed"
+ echo
+ echo "${output}"
+ fi
+}
+
+main
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-11-09 18:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-02 5:39 [gentoo-commits] proj/qa-scripts:master commit in: cgi-bin/ Michał Górny
-- strict thread matches above, loose matches on Subject: below --
2021-11-09 18:20 Michał Górny
2020-06-02 16:28 Michał Górny
2020-06-02 16:19 Michał Górny
2017-05-13 10:53 Michał Górny
2016-12-05 9:03 Michał Górny
2015-09-06 13:24 Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox