Initial commit
This commit is contained in:
commit
efdfdde6a2
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/out/nixos_release-*.*_*/
|
||||
/out/nixos_trunk-combined_*/
|
||||
/out/nixpkgs_nixpkgs-*.*-darwin_*/
|
||||
/out/nixpkgs_staging-next_*/
|
||||
/out/nixpkgs_trunk_*/
|
11
LICENSE
Normal file
11
LICENSE
Normal file
@ -0,0 +1,11 @@
|
||||
Copyright 2025 Peder Bergebakken Sundt <pbsds@hotmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
168
do.sh
Executable file
168
do.sh
Executable file
@ -0,0 +1,168 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
#set -x
|
||||
|
||||
# ===============
|
||||
# ===== lib =====
|
||||
# ===============
|
||||
|
||||
|
||||
trace() {
|
||||
echo >&2 "$@"
|
||||
}
|
||||
|
||||
die() {
|
||||
echo >&2 "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
traceval() {
|
||||
local _varname
|
||||
for _varname in "$@"; do
|
||||
if [[ -v "$_varname" ]]; then
|
||||
printf >&2 "%s = %q\n" "$_varname" "${!_varname}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
verbose() (
|
||||
set -x
|
||||
"$@"
|
||||
)
|
||||
|
||||
have() (
|
||||
for _cmd in "$@"; do
|
||||
unset "$_cmd"
|
||||
if ! command -v "$_cmd" >/dev/null \
|
||||
|| ! [[ "$(type -t "$_cmd")" = "file" ]]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
)
|
||||
|
||||
have_tty() {
|
||||
[[ -t 1 && -t 0 ]]
|
||||
}
|
||||
|
||||
require() {
|
||||
local missing=
|
||||
for cmd in "$@"; do
|
||||
if ! have "$cmd"; then
|
||||
trace "ERROR: '$cmd' not in PATH!"
|
||||
missing=1
|
||||
fi
|
||||
done
|
||||
[[ -z "$missing" ]] || exit 1
|
||||
}
|
||||
|
||||
export_default() {
|
||||
local varname="$1"
|
||||
local value="$2"
|
||||
if [[ ! -v "$varname" ]]; then
|
||||
export "${varname}"="$value"
|
||||
fi
|
||||
}
|
||||
|
||||
declare -a curlopts=()
|
||||
curl() (
|
||||
set +x
|
||||
{
|
||||
printf "%s" '+ curl "${curlopts[@]}"'
|
||||
printf " %q" "$@"
|
||||
printf "%s" "\n"
|
||||
} >&2
|
||||
command curl "${curlopts[@]}" "$@"
|
||||
)
|
||||
curl_htmlq() {
|
||||
local url="$1"; shift
|
||||
curl "${curlopts[@]}" "$url" | tr '\n' ' ' | tr -s ' ' | htmlq --base "$url" "$@"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# ===================
|
||||
# ===== setup =======
|
||||
# ===================
|
||||
|
||||
|
||||
require whoami basename tr head curl grep htmlq
|
||||
|
||||
# https://hydra.nixos.org/ annoucement:
|
||||
# > 2025-01-05 03:53:27 by Martin Weinelt
|
||||
# > Please set a proper User-Agent when scraping hydra.nixos.org, so we can reach out to you, when you are overloading the machine!
|
||||
user="$(whoami)"
|
||||
if [[ ! -v NO_GIT ]] && have git; then
|
||||
git_user="$(git config get user.name ||:)"
|
||||
git_email="$(git config get user.email ||:)"
|
||||
if [[ -n "$git_user" && -n "$git_email" ]]; then
|
||||
user="$git_user <$git_email>"
|
||||
fi
|
||||
unset git_user
|
||||
unset git_email
|
||||
fi
|
||||
if [[ ! -v NO_GH ]] && have gh jq && gh auth status >&/dev/null; then
|
||||
result="$(verbose gh api 'https://api.github.com/user' | jq '"\(.name) (@\(.login))"' -r ||:)"
|
||||
if [[ -n "$result" ]]; then
|
||||
user="$result"
|
||||
fi
|
||||
unset result
|
||||
fi
|
||||
if [[ -n "${CURL_USER:-}" ]]; then
|
||||
user="$CURL_USER"
|
||||
fi
|
||||
|
||||
user_agent="User-Agent: ${user} running https://git.pvv.ntnu.no/pederbs/nixpkgs-fetch-failing-build-logs"
|
||||
trace "HTTP User-Agent: '$user_agent'"
|
||||
curlopts+=( -H "$user_agent" )
|
||||
|
||||
jobsets=(
|
||||
"nixos:release-??.??/nixos_release-??.??"
|
||||
"nixos:trunk-combined/nixos_trunk-combined"
|
||||
"nixpkgs:nixpkgs-??.??-darwin/nixpkgs_nixpkgs-??.??-darwin"
|
||||
"nixpkgs:staging-next/nixpkgs_staging-next"
|
||||
"nixpkgs:trunk/nixpkgs_trunk"
|
||||
)
|
||||
jobset="${jobsets[1]}"
|
||||
|
||||
if have_tty && have gum; then
|
||||
export_default GUM_CHOOSE_HEIGHT 15
|
||||
jobset="$( gum choose --ordered --header "Which jobset?" --selected="$jobset" "${jobsets[@]}" )" || exit
|
||||
fi
|
||||
|
||||
# glob to regex
|
||||
#echo "$jobset"
|
||||
jobset="${jobset//'.'/'\.'}"
|
||||
jobset="${jobset//'*'/'.*'}"
|
||||
jobset="${jobset//'?'/'.'}"
|
||||
#echo "$jobset"
|
||||
|
||||
|
||||
# ==================
|
||||
# ===== main =======
|
||||
# ==================
|
||||
|
||||
|
||||
job_report_url="$(
|
||||
curl_htmlq https://malob.github.io/nix-review-tools-reports/ li a.post-link \
|
||||
| grep -E "/${jobset}.*\(succeeded\)" \
|
||||
| htmlq a -a href \
|
||||
| head -n1
|
||||
)"
|
||||
traceval job_report_url
|
||||
|
||||
out_dir="out/$(basename "$job_report_url" | rev | cut -d. -f2- | rev)"
|
||||
traceval out_dir
|
||||
mkdir -p "$out_dir"
|
||||
|
||||
curl_htmlq "$job_report_url" tr | grep -F '<td>Failed</td>' | htmlq tt a |
|
||||
grep -vF '>nixos.' | grep -E '(x86_64|aarch64)-linux' |
|
||||
#grep -v linuxPackages | grep -v linuxKernel |
|
||||
while read -r html; do
|
||||
href="$(htmlq <<<"$html" a -a href)"
|
||||
text="$(htmlq <<<"$html" a --text)"
|
||||
traceval href text
|
||||
|
||||
[[ -s "$out_dir/$text.log" ]] ||
|
||||
curl "${curlopts[@]}" --compressed -L "$href/nixlog/1/raw" > "$out_dir/$text.log"
|
||||
done
|
11
good-greps.sh
Normal file
11
good-greps.sh
Normal file
@ -0,0 +1,11 @@
|
||||
echo >&2 "don't run me plz, copy paste the lines as needed"
|
||||
exit 1
|
||||
|
||||
rg 'Unable to locate the following dependencies:'
|
||||
rg 'ModuleNotFoundError:'
|
||||
rg 'not satisfied by version'
|
||||
rg "^substituteStream\(\) .* ERROR: .* doesn't match anything in file "
|
||||
rg 'No such file or directory'
|
||||
|
||||
# if you have successfull logs as well:
|
||||
rg '^configure: WARNING:'
|
Loading…
x
Reference in New Issue
Block a user