[scripts] Backport scripts from z-run.

This commit is contained in:
Ciprian Dorin Craciun 2023-03-05 17:02:38 +02:00
parent 09c0edffcf
commit f2792a0ae9
14 changed files with 1178 additions and 706 deletions

View file

@ -1,33 +1,36 @@
#!/dev/null #!/dev/null
&&== env-fallback __BUILD_QUICK false ::// watch / ...
::// workspace / ...
::// execute / ...
::// clients / ...
::// examples / ...
::// benchmark / ...
::// go / ...
::// documentation / ...
::// tools / ...
::// tls / ...
::// * ::// *
&& _/go.z-run && _/environment.z-run
&& _/execute.z-run
&& _/clients.z-run
&& _/examples.z-run && _/workbench.z-run
&& _/benchmark.z-run
&& _/workspace.z-run
&& _/sources.z-run && _/sources.z-run
&& _/go.z-run
&& _/execute.z-run
&& _/examples.z-run
&& _/documentation.z-run && _/documentation.z-run
&& _/tools.z-run
&& _/tls.z-run
&& _/deploy.z-run && _/deploy.z-run
&& _/generate.z-run
&& _/clients.z-run
&& _/benchmark.z-run
&& _/tools.z-run
&& _/tls.z-run
&&?? _/.local.z-run &&?? _/.local.z-run

View file

@ -3,6 +3,11 @@
::// benchmark / ...
:: benchmark / server / http-fast / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server' http-fast "${@}" --processes 1 --threads 1 :: benchmark / server / http-fast / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server' http-fast "${@}" --processes 1 --threads 1
:: benchmark / server / http-fast / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server' http-fast "${@}" --processes 2 --threads 1 :: benchmark / server / http-fast / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server' http-fast "${@}" --processes 2 --threads 1
:: benchmark / server / http-fast / 1x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server' http-fast "${@}" --processes 1 --threads 2 :: benchmark / server / http-fast / 1x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server' http-fast "${@}" --processes 1 --threads 2
@ -172,7 +177,7 @@
--<< benchmark / server --<< benchmark / server
"${ZRUN[@]}" ':: go / build / server / release / quick' "${ZRUN[@]}" ':: go / build / kawipiko-server / release / native'
test "${#}" -ge 1 test "${#}" -ge 1
_mode="${1}" _mode="${1}"
shift -- 1 shift -- 1
@ -249,7 +254,7 @@
exec -- \ exec -- \
"${ZRUN[@]}" ':: benchmark / execute / server' \ "${ZRUN[@]}" ':: benchmark / execute / server' \
noenvironment \ noenvironment \
./.outputs/binaries/release/kawipiko-server \ ./.outputs/binaries/kawipiko-server--release--native \
--archive "${_archive}" \ --archive "${_archive}" \
"${_arguments[@]}" \ "${_arguments[@]}" \
"${@}" \ "${@}" \
@ -277,7 +282,7 @@
<< benchmark / server / profile / cpu / analyze << benchmark / server / profile / cpu / analyze
export -- PPROF_BINARY_PATH=./.outputs/binaries/release/kawipiko-server export -- PPROF_BINARY_PATH=./.outputs/binaries/kawipiko-server--release--native
exec -- go tool pprof \ exec -- go tool pprof \
"${@}" \ "${@}" \
-- ./.outputs/server-cpu.txt \ -- ./.outputs/server-cpu.txt \
@ -285,7 +290,7 @@
!! !!
<< benchmark / server / profile / cpu / analyze / web << benchmark / server / profile / cpu / analyze / web
export -- PPROF_BINARY_PATH=./.outputs/binaries/release/kawipiko-server export -- PPROF_BINARY_PATH=./.outputs/binaries/kawipiko-server--release--native
exec -- go tool pprof \ exec -- go tool pprof \
-http 127.108.221.132:8080 \ -http 127.108.221.132:8080 \
-no_browser \ -no_browser \
@ -303,7 +308,7 @@
<< benchmark / server / profile / mem / analyze << benchmark / server / profile / mem / analyze
export -- PPROF_BINARY_PATH=./.outputs/binaries/release/kawipiko-server export -- PPROF_BINARY_PATH=./.outputs/binaries/kawipiko-server--release--native
exec -- go tool pprof \ exec -- go tool pprof \
"${@}" \ "${@}" \
-- ./.outputs/server-mem.txt \ -- ./.outputs/server-mem.txt \
@ -311,7 +316,7 @@
!! !!
<< benchmark / server / profile / mem / analyze / web << benchmark / server / profile / mem / analyze / web
export -- PPROF_BINARY_PATH=./.outputs/binaries/release/kawipiko-server export -- PPROF_BINARY_PATH=./.outputs/binaries/kawipiko-server--release--native
exec -- go tool pprof \ exec -- go tool pprof \
-http 127.226.119.8:8080 \ -http 127.226.119.8:8080 \
-no_browser \ -no_browser \
@ -383,7 +388,7 @@
:: benchmark / dummy / fasthttp / 2x2 :: exec -- "${ZRUN[@]}" ':: benchmark / dummy / fasthttp' 2 2 "${@}" :: benchmark / dummy / fasthttp / 2x2 :: exec -- "${ZRUN[@]}" ':: benchmark / dummy / fasthttp' 2 2 "${@}"
--<< benchmark / dummy / fasthttp --<< benchmark / dummy / fasthttp
"${ZRUN[@]}" ':: go / build / server-dummy / release / quick' "${ZRUN[@]}" ':: go / build / kawipiko-server-dummy / release / native'
test "${#}" -ge 2 test "${#}" -ge 2
_count="${1}" _count="${1}"
_threads="${2}" _threads="${2}"
@ -392,7 +397,7 @@
"${ZRUN[@]}" ':: benchmark / execute / multiple' "${_count}" \ "${ZRUN[@]}" ':: benchmark / execute / multiple' "${_count}" \
"${ZRUN[@]}" ':: benchmark / execute / server' \ "${ZRUN[@]}" ':: benchmark / execute / server' \
noenvironment \ noenvironment \
./.outputs/binaries/release/kawipiko-server-dummy \ ./.outputs/binaries/kawipiko-server-dummy--release--native \
"127.9.185.194:8080" \ "127.9.185.194:8080" \
"${_threads}" \ "${_threads}" \
"${@}" \ "${@}" \

View file

@ -3,6 +3,11 @@
::// clients / ...
<< clients / nghttp / https << clients / nghttp / https
exec -- "${ZRUN[@]}" ':: clients / nghttp' https 127.9.185.194:8443 "${@}" exec -- "${ZRUN[@]}" ':: clients / nghttp' https 127.9.185.194:8443 "${@}"
!! !!

View file

@ -8,36 +8,65 @@
--:: deploy / rsync / * / linux / x86_64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' linux--x86_64 "${@}" --<<.. deploy / list / variant
--:: deploy / rsync / * / linux / x86_64 / seccomp :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' linux--x86_64--seccomp "${@}" linux--x86_64
--:: deploy / rsync / * / darwin / x86_64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' darwin--x86_64 "${@}" linux--x86_64--seccomp
--:: deploy / rsync / * / darwin / aarch64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' darwin--aarch64 "${@}" linux--aarch64
--:: deploy / rsync / * / freebsd / x86_64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' freebsd--x86_64 "${@}" linux--armv6
--:: deploy / rsync / * / openbsd / x86_64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' openbsd--x86_64 "${@}" darwin--x86_64
--:: deploy / rsync / * / android / aarch64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' android--aarch64 "${@}" darwin--aarch64
freebsd--x86_64
freebsd--aarch64
openbsd--x86_64
openbsd--aarch64
android--x86_64
android--aarch64
!!
--<<.. deploy / list / main
kawipiko-wrapper
kawipiko-archiver
kawipiko-server
kawipiko-server-dummy
!!
--<< deploy / rsync / * --<< deploy / rsync / *
test "${#}" -eq 3 ; _os="${1}" ; _main="${2}" ; _target="${3}" ; shift -- 3
"${ZRUN[@]}" ':: deploy / release' "${_os}" "${_main}" test "${#}" -eq 3 ; _main="${1}" ; _variant="${2}" ; _destination="${3}" ; shift -- 3
_source="./.outputs/binaries/publish/${_main}--${_os}"
printf -- '[ii] deploying `%s` for `%s` to `%s`...\n' "${_main}" "${_os}" "${_target}" >&2 "${ZRUN}" ':: deploy / release' "${_main}" "${_variant}"
exec -- rsync -i -t -p --chmod=0555 -- "${_source}" "${_target}"
_outputs="$( exec -- "${ZRUN}" ':: workbench / outputs' )"
test -d "${_outputs}"
_output="${_outputs}/binaries/${_main}--release--${_variant}"
test -f "${_output}"
printf -- '[ii] deploying `%s` for `%s` to `%s`...\n' "${_main}" "${_variant}" "${_destination}" >&2
exec -- rsync -i -t -p --chmod=0555 -- "${_output}" "${_destination}"
!! !!
<< deploy / publish / no-github << deploy / publish / no-github
export -- __DEPLOY_NOGITHUB=true export -- __DEPLOY_NOGITHUB=true
exec -- "${ZRUN[@]}" ':: deploy / publish' "${@}"
exec -- "${ZRUN}" ':: deploy / publish' "${@}"
!! !!
<< deploy / publish << deploy / publish
if test "${#}" -eq 0 ; then if test "${#}" -eq 0 ; then
_main_0=all _main_0=all
else else
@ -45,13 +74,44 @@
shift -- 1 shift -- 1
fi fi
if test "${#}" -ge 1 ; then
_variant_0="${1}"
shift -- 1
else
_variant_0=all
fi
test "${#}" -eq 0 test "${#}" -eq 0
test -d ./.publish/
_outputs="$( exec -- "${ZRUN}" ':: workbench / outputs' )"
test -d "${_outputs}"
_publish="$( exec -- "${ZRUN}" ':: workbench / publish' )"
test -d "${_publish}"
_embedded="${__EMBEDDED}"
test -d "${_embedded}"
_minisign='./documentation/releases/minisign'
test -d "${_minisign}"
if test ! -e "${_minisign}/signatures" ; then
mkdir -- "${_minisign}/signatures"
fi
_gpg='./documentation/releases/pgp'
test -d "${_gpg}"
if test ! -e "${_gpg}/signatures" ; then
mkdir -- "${_gpg}/signatures"
fi
_gpg_sign_key="$( exec -- cat -- "${_gpg}/keys/public.txt" )"
"${ZRUN[@]}" ':: documentation / all / render / forced' "${ZRUN}" ':: documentation / all / render / forced'
"${ZRUN[@]}" ':: sources / embedded / bundle' #! "${ZRUN}" ':: sources / generate / sbom'
"${ZRUN}" ':: sources / embedded / bundle'
export -- __SOURCES__PREPARED=true
if test "${__DEPLOY_NOGITHUB:-}" == true ; then if test "${__DEPLOY_NOGITHUB:-}" == true ; then
@ -61,7 +121,11 @@
fi fi
_build_version="$( exec -- cat -- ./sources/embedded/build/version.txt )" readarray -t -- _mains < <( exec -- "${ZRUN}" ':: deploy / list / main' )
readarray -t -- _variants < <( exec -- "${ZRUN}" ':: deploy / list / variant' )
_build_version="$( exec -- cat -- "${_embedded}/build/version.txt" )"
case "${_build_version}" in case "${_build_version}" in
( 0.0.0 | *.0 ) ( 0.0.0 | *.0 )
_build_release=false _build_release=false
@ -70,30 +134,50 @@
( * ) ( * )
_build_release=true _build_release=true
_build_suffix='' _build_suffix=''
_gpg_sign=true
_minisign_sign=true
;; ;;
esac esac
if test "${__DEPLOY_NOGPGSIGN:-}" == true ; then
_gpg_sign=false
else
_gpg_sign="${_gpg_sign:-false}"
fi
if test "${__DEPLOY_NOMINSIGN:-}" == true ; then
_minisign_sign=false
else
_minisign_sign="${_minisign_sign:-true}"
fi
if test "${_build_release}" == true ; then if test "${_build_release}" == true ; then
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do for _main in "${_mains[@]}" ; do
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then continue ; fi
continue for _variant in "${_variants[@]}" ; do
fi if test "${_variant_0}" != all -a "${_variant_0}" != "${_variant}" ; then continue ; fi
for _os in linux--x86_64 linux--x86_64--seccomp darwin--x86_64 darwin--aarch64 freebsd--x86_64 openbsd--x86_64 android--aarch64 ; do
case "${_main}::${_os}" in if test -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}" ; then
( kawipiko-server::linux--x86_64--seccomp ) ;; printf -- '[ee] release already exists for `%s` for `%s`!\n' "${_main}" "${_variant}" >&2
( *::linux--x86_64--seccomp ) continue ;;
esac
if test -e "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" ; then
printf -- '[ee] release already exists for `%s` for `%s`!\n' "${_main}" "${_os}" >&2
exit -- 1 exit -- 1
fi fi
done done
done done
fi fi
if test "${_github_publish}" == true ; then if test "${_github_publish}" == true ; then
if ! git diff --quiet -- "${_embedded}/build" ; then
printf -- '[--]\n' >&2
git add -p -- "${_embedded}/build"
git commit -m '[build] Snapshot build meta-data.' -- "${_embedded}/build"
printf -- '[--]\n' >&2
fi
if ! git diff --quiet ; then if ! git diff --quiet ; then
printf -- '[ee] dirty repository (before build); aborting!\n' >&2 printf -- '[ee] dirty repository (before build); aborting!\n' >&2
exit -- 1 exit -- 1
@ -105,9 +189,13 @@
fi fi
printf -- '[ii] releasing all for `%s`...\n' "${_build_version}${_build_suffix}" >&2 printf -- '[--]\n' >&2
printf -- '[ii] releasing `%s` for `%s` for `%s`...\n' "${_main_0}" "${_variant_0}" "${_build_version}${_build_suffix}" >&2
printf -- '[--]\n' >&2
"${ZRUN[@]}" ':: deploy / release' all "${_main_0}" "${ZRUN}" ':: deploy / release' "${_main_0}" "${_variant_0}"
printf -- '[--]\n' >&2
if test "${_github_publish}" == true ; then if test "${_github_publish}" == true ; then
@ -120,9 +208,190 @@
printf -- '[ee] dirty repository (after build); aborting!\n' >&2 printf -- '[ee] dirty repository (after build); aborting!\n' >&2
exit -- 1 exit -- 1
fi fi
fi
printf -- '[--]\n' >&2
printf -- '[ii] publishing `%s` for `%s` for `%s`...\n' "${_main_0}" "${_variant_0}" "${_build_version}${_build_suffix}" >&2
printf -- '[--]\n' >&2
for _main in "${_mains[@]}" ; do
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then continue ; fi
for _variant in "${_variants[@]}" ; do
if test "${_variant_0}" != all -a "${_variant_0}" != "${_variant}" ; then continue ; fi
printf -- '[ii] publishing `%s` for `%s` for `%s`...\n' "${_main}" "${_variant}" "${_build_version}${_build_suffix}" >&2
rsync -i -t -p --chmod=0555 -- \
"${_outputs}/binaries/${_main}--release--${_variant}" \
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}" \
#
if test "${_gpg_sign}" == true ; then
if test -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" ; then
if ! \
gpg --verify -- \
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" \
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}" \
< /dev/null > /dev/null 2> /dev/null \
; then
rm -- "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc"
fi
fi
if test ! -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" ; then
printf -- '[ii] signing `%s` for `%s` for `%s` (with GnuPG)...\n' "${_main}" "${_variant}" "${_build_version}${_build_suffix}" >&2
if test -e "${_gpg}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" ; then
rm -- "${_gpg}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc"
fi
if test ! -e "${_gpg}/signatures/v${_build_version}${_build_suffix}" ; then
mkdir -- "${_gpg}/signatures/v${_build_version}${_build_suffix}"
fi
for _retry in 1 2 3 4 ; do
if \
gpg --sign --detach-sign --armor \
--default-key "${_gpg_sign_key}" \
--output "${_gpg}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" \
-- "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}" \
< /dev/null > /dev/null 2> /dev/null \
; then break ; fi
done
cp -T -- \
"${_gpg}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" \
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" \
#
else
cp -T -- \
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" \
"${_gpg}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" \
#
fi
gpg --verify -- \
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" \
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}" \
< /dev/null > /dev/null 2> /dev/null \
#
else
if test -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" ; then
rm -- "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc"
fi
fi
if test "${_minisign_sign}" == true ; then
if test -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" ; then
if ! \
minisign -V \
-p "${_minisign}/keys/public.pub" \
-x "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" \
-m "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}" \
< /dev/null > /dev/null 2> /dev/null \
; then
rm -- "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig"
fi
fi
if test ! -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" ; then
printf -- '[ii] signing `%s` for `%s` for `%s` (with minisign)...\n' "${_main}" "${_variant}" "${_build_version}${_build_suffix}" >&2
if test -e "${_minisign}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" ; then
rm -- "${_minisign}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig"
fi
if test ! -e "${_minisign}/signatures/v${_build_version}${_build_suffix}" ; then
mkdir -- "${_minisign}/signatures/v${_build_version}${_build_suffix}"
fi
for _retry in 1 2 3 4 ; do
if \
minisign -S \
-t "${_main}--${_variant}--v${_build_version}${_build_suffix}" \
-s <( exec -- gpg --decrypt < "${_minisign}/keys/private.asc" 2> /dev/null ) \
-x "${_minisign}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" \
-m "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}" \
< /dev/null > /dev/null 2> /dev/null \
; then break ; fi
done
cp -T -- \
"${_minisign}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" \
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" \
#
else
cp -T -- \
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" \
"${_minisign}/signatures/v${_build_version}${_build_suffix}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" \
#
fi
minisign -V \
-p "${_minisign}/keys/public.pub" \
-x "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" \
-m "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}" \
< /dev/null > /dev/null 2> /dev/null \
#
else
if test -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" ; then
rm -- "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig"
fi
fi
if test "${_build_release}" == true ; then
ln -s -T -f -- "./${_main}--${_variant}--v${_build_version}${_build_suffix}" "${_publish}/${_variant}/${_main}${_build_suffix}"
if test -e "${_publish}/${_variant}/${_main}${_build_suffix}.asc" ; then
rm -- "${_publish}/${_variant}/${_main}${_build_suffix}.asc"
fi
if test -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" ; then
ln -s -T -f -- "./${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" "${_publish}/${_variant}/${_main}${_build_suffix}.asc"
fi
if test -e "${_publish}/${_variant}/${_main}${_build_suffix}.sig" ; then
rm -- "${_publish}/${_variant}/${_main}${_build_suffix}.sig"
fi
if test -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" ; then
ln -s -T -f -- "./${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" "${_publish}/${_variant}/${_main}${_build_suffix}.sig"
fi
fi
done
done
printf -- '[--]\n' >&2
if test "${_github_publish}" == true ; then
printf -- '[ii] tagging and pushing for `%s`...\n' "${_build_version}${_build_suffix}" >&2
printf -- '[--]\n' >&2 printf -- '[--]\n' >&2
printf -- '[ii] tagging and pushing for `%s` (on GitHub)...\n' "${_build_version}${_build_suffix}" >&2
if test -e "${_gpg}/signatures/v${_build_version}${_build_suffix}" ; then
git add --all -- "${_gpg}/signatures/v${_build_version}${_build_suffix}"
if ! git diff --cached --quiet -- "${_gpg}/signatures/v${_build_version}${_build_suffix}" ; then
printf -- '[--]\n' >&2
git commit -m '[release] Import release PGP signatures.' -- "${_gpg}/signatures/v${_build_version}${_build_suffix}"
printf -- '[--]\n' >&2
fi
fi
if test -e "${_minisign}/signatures/v${_build_version}${_build_suffix}" ; then
git add --all -- "${_minisign}/signatures/v${_build_version}${_build_suffix}"
if ! git diff --cached --quiet -- "${_minisign}/signatures/v${_build_version}${_build_suffix}" ; then
printf -- '[--]\n' >&2
git commit -m '[release] Import release `minisign` signatures.' -- "${_minisign}/signatures/v${_build_version}${_build_suffix}"
printf -- '[--]\n' >&2
fi
fi
if ! git diff --quiet ; then
printf -- '[ee] dirty repository (after build); aborting!\n' >&2
exit -- 1
fi
if ! git diff --cached --quiet ; then
printf -- '[ee] dirty repository (after build); aborting!\n' >&2
exit -- 1
fi
if test "${_build_release}" == true ; then if test "${_build_release}" == true ; then
git tag --sign -m "[release] Release \`v${_build_version}\`." -- "v${_build_version}" HEAD git tag --sign -m "[release] Release \`v${_build_version}\`." -- "v${_build_version}" HEAD
@ -130,99 +399,57 @@
git tag --sign -m "[preview] Preview \`v${_build_version}\`." --force -- preview HEAD git tag --sign -m "[preview] Preview \`v${_build_version}\`." --force -- preview HEAD
fi fi
"${ZRUN[@]}" ':: github / push' "${ZRUN}" ':: github / push'
printf -- '[--]\n' >&2 printf -- '[--]\n' >&2
fi fi
printf -- '[ii] publishing all for `%s`...\n' "${_build_version}${_build_suffix}" >&2
for _os in linux--x86_64 linux--x86_64--seccomp darwin--x86_64 darwin--aarch64 freebsd--x86_64 openbsd--x86_64 android--aarch64 ; do
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then
continue
fi
case "${_main}::${_os}" in
( kawipiko-server::linux--x86_64--seccomp ) ;;
( *::linux--x86_64--seccomp ) continue ;;
esac
printf -- '[ii] publishing `%s` for `%s` for `%s`...\n' "${_main}" "${_os}" "${_build_version}${_build_suffix}" >&2
printf -- '[--]\n' >&2
rsync -i -t -p --chmod=0555 -- \
"./.outputs/binaries/publish/${_main}--${_os}" \
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" \
#
if test -e "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" ; then
if ! gpg2 --verify -- \
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
< /dev/null > /dev/null 2> /dev/null \
; then
rm -- "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc"
fi
fi
if test ! -e "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" ; then
for _retry in 1 2 3 4 ; do
if gpg2 --sign --detach-sign --armor \
--default-key 58FC2194FCC2478399CB220C5A974037A6FD8839 \
--output "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
-- "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" \
; then break ; fi
done
fi
gpg2 --verify \
-- "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
#
if test "${_build_release}" == true ; then
ln -s -T -f -- "./${_main}--${_os}--v${_build_version}${_build_suffix}" "./.publish/${_os}/${_main}${_build_suffix}"
ln -s -T -f -- "./${_main}--${_os}--v${_build_version}${_build_suffix}.asc" "./.publish/${_os}/${_main}${_build_suffix}.asc"
fi
printf -- '[--]\n' >&2
done
done
if test "${_github_publish}" == true ; then if test "${_github_publish}" == true ; then
printf -- '[ii] publishing all for `%s` (on GitHub)...\n' "${_build_version}${_build_suffix}" >&2 printf -- '[--]\n' >&2
printf -- '[ii] publishing `%s` for `%s` for `%s` (on GitHub)...\n' "${_main_0}" "${_variant_0}" "${_build_version}${_build_suffix}" >&2
printf -- '[--]\n' >&2
for _os in linux--x86_64 linux--x86_64--seccomp darwin--x86_64 darwin--aarch64 freebsd--x86_64 openbsd--x86_64 android--aarch64 ; do _gh_release_files=()
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
for _main in "${_mains[@]}" ; do
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then continue ; fi
for _variant in "${_variants[@]}" ; do
if test "${_variant_0}" != all -a "${_variant_0}" != "${_variant}" ; then continue ; fi
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then printf -- '[ii] publishing `%s` for `%s` for `%s` (on GitHub)...\n' "${_main}" "${_variant}" "${_build_version}${_build_suffix}" >&2
continue
_gh_release_files+=(
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}"
)
if test -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc" ; then
_gh_release_files+=(
"${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.asc"
)
fi fi
case "${_main}::${_os}" in if test -e "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig" ; then
( kawipiko-server::linux--x86_64--seccomp ) ;; _gh_release_files+=(
( *::linux--x86_64--seccomp ) continue ;; "${_publish}/${_variant}/${_main}--${_variant}--v${_build_version}${_build_suffix}.sig"
esac )
printf -- '[ii] publishing `%s` for `%s` for `%s` (on GitHub)...\n' "${_main}" "${_os}" "${_build_version}${_build_suffix}" >&2
if test "${_build_release}" == true ; then
gh release upload --clobber -- "v${_build_version}" \
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" \
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
#
else
gh release upload --clobber -- preview \
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" \
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
#
fi fi
done done
done done
if test "${_build_release}" == true ; then
gh release upload --clobber -- "v${_build_version}" \
"${_gh_release_files[@]}" \
#
else
gh release upload --clobber -- preview \
"${_gh_release_files[@]}" \
#
fi
printf -- '[--]\n' >&2
fi fi
!! !!
@ -230,36 +457,71 @@
<< deploy / release << deploy / release
if test "${#}" -ge 1 ; then
_os_0="${1}"
shift -- 1
else
_os_0='all'
fi
if test "${#}" -ge 1 ; then if test "${#}" -ge 1 ; then
_main_0="${1}" _main_0="${1}"
shift -- 1 shift -- 1
else else
_main_0=all _main_0=all
fi fi
if test "${#}" -ge 1 ; then
_variant_0="${1}"
shift -- 1
else
_variant_0='all'
fi
test "${#}" -eq 0 test "${#}" -eq 0
if test "${__DEPLOY_NORELEASE:-}" == true ; then if test "${__DEPLOY_NORELEASE:-}" == true ; then
exit -- 0 exit -- 0
fi fi
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then if test -z "${__SOURCES__PREPARED:-}" ; then
continue "${ZRUN}" ':: sources / embedded / bundle'
fi export -- __SOURCES__PREPARED=true
for _os in linux--x86_64 linux--x86_64--seccomp darwin--x86_64 darwin--aarch64 freebsd--x86_64 openbsd--x86_64 android--aarch64 ; do fi
if test "${_os_0}" != all -a "${_os_0}" != "${_os}" ; then
continue readarray -t -- _mains < <( exec -- "${ZRUN}" ':: deploy / list / main' )
fi readarray -t -- _variants < <( exec -- "${ZRUN}" ':: deploy / list / variant' )
case "${_main}::${_os}" in
( kawipiko-server::linux--x86_64--seccomp ) ;; for _main in "${_mains[@]}" ; do
( *::linux--x86_64--seccomp ) continue ;; if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then continue ; fi
esac for _variant in "${_variants[@]}" ; do
"${ZRUN[@]}" ':: go / build / all / publish' "${_os}" "${_main#kawipiko-}" if test "${_variant_0}" != all -a "${_variant_0}" != "${_variant}" ; then continue ; fi
printf -- '[ii] releasing `%s` for `%s`...\n' "${_main}" "${_variant}" >&2
"${ZRUN}" ":: go / build / * / release / ${_variant%%--*} / ${_variant#*--}" "${_main}"
done done
done done
!! !!
<<== deploy / generate
test "${#}" -eq 0
readarray -t -- _mains < <( exec -- "${ZRUN}" ':: deploy / list / main' )
readarray -t -- _variants < <( exec -- "${ZRUN}" ':: deploy / list / variant' )
for _main in "${_mains[@]}" ; do
printf -- ':: deploy / publish / %s / all :: exec -- "${ZRUN}" ":: deploy / publish" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: deploy / publish / %s / all / no-github :: exec -- "${ZRUN}" ":: deploy / publish / no-github" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: deploy / release / %s / all :: exec -- "${ZRUN}" ":: deploy / release" %q %q "${@}"\n' "${_main}" all "${_main}"
for _variant in "${_variants[@]}" ; do
printf -- ':: deploy / rsync / %s / %s :: exec -- "${ZRUN}" ":: deploy / rsync / *" %q %q "${@}"\n' "${_main}" "${_variant}" "${_main}" "${_variant}"
printf -- ':: deploy / release / %s / %s :: exec -- "${ZRUN}" ":: deploy / release" %q %q "${@}"\n' "${_main}" "${_variant}" "${_main}" "${_variant}"
done
done
!!

View file

@ -3,6 +3,11 @@
::// documentation / ...
<< documentation / all / render << documentation / all / render
test "${#}" -eq 0 test "${#}" -eq 0
"${ZRUN[@]}" ':: documentation / manuals / render' "${ZRUN[@]}" ':: documentation / manuals / render'

12
scripts/environment.z-run Normal file
View file

@ -0,0 +1,12 @@
#!/dev/null
&&== env-path __SOURCES ./sources
&&== env-path __EMBEDDED ./sources/embedded
&&== env-path __OUTPUTS ./.outputs
&&== env-path __PUBLISH ./.publish

View file

@ -3,6 +3,11 @@
::// examples / ...
<< examples / curl / http << examples / curl / http
exec -- "${ZRUN[@]}" ':: clients / curl' http 127.153.215.30:8080 "${@}" --http1.1 exec -- "${ZRUN[@]}" ':: clients / curl' http 127.153.215.30:8080 "${@}" --http1.1
!! !!

View file

@ -3,72 +3,81 @@
::// execute / ...
++<< execute / server / debug ++<< execute / server / debug
"${ZRUN[@]}" ':: go / build / server / debug' "${ZRUN[@]}" ':: go / build / kawipiko-server / debug / native'
exec -- env -i -- ./.outputs/binaries/debug/kawipiko-server "${@}" exec -- env -i -- ./.outputs/binaries/kawipiko-server--debug--native "${@}"
!! !!
<< execute / server / release << execute / server / release
"${ZRUN[@]}" ':: go / build / server / release' "${ZRUN[@]}" ':: go / build / kawipiko-server / release / native'
exec -- env -i -- ./.outputs/binaries/release/kawipiko-server "${@}" exec -- env -i -- ./.outputs/binaries/kawipiko-server--release--native "${@}"
!! !!
<< execute / server / release / quick << execute / server / release / quick
"${ZRUN[@]}" ':: go / build / server / release / quick' export -- __BUILD_QUICK=true
exec -- env -i -- ./.outputs/binaries/release/kawipiko-server "${@}" "${ZRUN[@]}" ':: go / build / kawipiko-server / release / native'
exec -- env -i -- ./.outputs/binaries/kawipiko-server--release--native "${@}"
!! !!
++<< execute / archiver / debug ++<< execute / archiver / debug
"${ZRUN[@]}" ':: go / build / archiver / debug' "${ZRUN[@]}" ':: go / build / kawipiko-archiver / debug / native'
exec -- env -i -- ./.outputs/binaries/debug/kawipiko-archiver "${@}" exec -- env -i -- ./.outputs/binaries/kawipiko-archiver--debug--native "${@}"
!! !!
<< execute / archiver / release << execute / archiver / release
"${ZRUN[@]}" ':: go / build / archiver / release' "${ZRUN[@]}" ':: go / build / kawipiko-archiver / release / native'
exec -- env -i -- ./.outputs/binaries/release/kawipiko-archiver "${@}" exec -- env -i -- ./.outputs/binaries/kawipiko-archiver--release--native "${@}"
!! !!
<< execute / archiver / release / quick << execute / archiver / release / quick
"${ZRUN[@]}" ':: go / build / archiver / release / quick' export -- __BUILD_QUICK=true
exec -- env -i -- ./.outputs/binaries/release/kawipiko-archiver "${@}" "${ZRUN[@]}" ':: go / build / kawipiko-archiver / release / native'
exec -- env -i -- ./.outputs/binaries/kawipiko-archiver--release--native "${@}"
!! !!
<< execute / wrapper / debug << execute / wrapper / debug
"${ZRUN[@]}" ':: go / build / wrapper / debug' "${ZRUN[@]}" ':: go / build / kawipiko-wrapper / debug / native'
exec -- env -i -- ./.outputs/binaries/debug/kawipiko-wrapper "${@}" exec -- env -i -- ./.outputs/binaries/kawipiko-wrapper--debug--native "${@}"
!! !!
<< execute / wrapper / release << execute / wrapper / release
"${ZRUN[@]}" ':: go / build / wrapper / release' "${ZRUN[@]}" ':: go / build / kawipiko-wrapper / release / native'
exec -- env -i -- ./.outputs/binaries/release/kawipiko-wrapper "${@}" exec -- env -i -- ./.outputs/binaries/kawipiko-wrapper--release--native "${@}"
!! !!
<< execute / wrapper / release / quick << execute / wrapper / release / quick
"${ZRUN[@]}" ':: go / build / wrapper / release / quick' export -- __BUILD_QUICK=true
exec -- env -i -- ./.outputs/binaries/release/kawipiko-wrapper "${@}" "${ZRUN[@]}" ':: go / build / kawipiko-wrapper / release / native'
exec -- env -i -- ./.outputs/binaries/kawipiko-wrapper--release--native "${@}"
!! !!
<< execute / server-dummy / debug << execute / server-dummy / debug
"${ZRUN[@]}" ':: go / build / server-dummy / debug' "${ZRUN[@]}" ':: go / build / kawipiko-server-dummy / debug / native'
exec -- env -i -- ./.outputs/binaries/debug/kawipiko-server-dummy "${@}" exec -- env -i -- ./.outputs/binaries/kawipiko-server-dummy--debug--native "${@}"
!! !!
<< execute / server-dummy / release << execute / server-dummy / release
"${ZRUN[@]}" ':: go / build / server-dummy / release' "${ZRUN[@]}" ':: go / build / kawipiko-server-dummy / release / native'
exec -- env -i -- ./.outputs/binaries/release/kawipiko-server-dummy "${@}" exec -- env -i -- ./.outputs/binaries/kawipiko-server-dummy--release--native "${@}"
!! !!
<< execute / server-dummy / release / quick << execute / server-dummy / release / quick
"${ZRUN[@]}" ':: go / build / server-dummy / release / quick' export -- __BUILD_QUICK=true
exec -- env -i -- ./.outputs/binaries/release/kawipiko-server-dummy "${@}" "${ZRUN[@]}" ':: go / build / kawipiko-server-dummy / release / native'
exec -- env -i -- ./.outputs/binaries/kawipiko-server-dummy--release--native "${@}"
!! !!

58
scripts/generate.z-run Normal file
View file

@ -0,0 +1,58 @@
#!/dev/null
<<== _ / generate
test "${#}" -eq 0
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
printf -- ':: watch / run / %s :: exec -- "${ZRUN[@]}" ":: watch / run / exec / *" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: watch / go / build / %s / debug :: exec -- "${ZRUN[@]}" ":: watch / go / build / * / debug" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: watch / go / execute / %s / debug :: exec -- "${ZRUN[@]}" ":: watch / go / execute / * / debug" %q "${@}"\n' "${_main}" "${_main}"
printf -- '++:: run / %s :: exec -- "${ZRUN[@]}" ":: run / exec / *" %q "${@}"\n' "${_main}" "${_main}"
printf -- '++:: go / execute / %s / debug :: exec -- "${ZRUN[@]}" ":: go / execute / * / debug" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: go / execute / %s / release :: exec -- "${ZRUN[@]}" ":: go / execute / * / release" %q "${@}"\n' "${_main}" "${_main}"
printf -- '++:: go / build / %s / debug :: exec -- "${ZRUN[@]}" ":: go / build / * / debug" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: go / build / %s / release :: exec -- "${ZRUN[@]}" ":: go / build / * / release" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: go / build / %s / debug / all :: exec -- "${ZRUN[@]}" ":: go / build / * / debug / all" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: go / build / %s / release / all :: exec -- "${ZRUN[@]}" ":: go / build / * / release / all" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: go / build / %s / debug / native :: exec -- "${ZRUN[@]}" ":: go / build / * / debug / native" %q "${@}"\n' "${_main}" "${_main}"
printf -- ':: go / build / %s / release / native :: exec -- "${ZRUN[@]}" ":: go / build / * / release / native" %q "${@}"\n' "${_main}" "${_main}"
for _os in linux darwin freebsd openbsd android ; do
printf -- ':: go / build / %s / debug / %s / x86_64 :: exec -- "${ZRUN[@]}" ":: go / build / * / debug / %q / x86_64" %q "${@}"\n' "${_main}" "${_os}" "${_os}" "${_main}"
printf -- ':: go / build / %s / release / %s / x86_64 :: exec -- "${ZRUN[@]}" ":: go / build / * / release / %q / x86_64" %q "${@}"\n' "${_main}" "${_os}" "${_os}" "${_main}"
done
for _os in linux darwin freebsd openbsd android ; do
printf -- ':: go / build / %s / debug / %s / aarch64 :: exec -- "${ZRUN[@]}" ":: go / build / * / debug / %q / aarch64" %q "${@}"\n' "${_main}" "${_os}" "${_os}" "${_main}"
printf -- ':: go / build / %s / release / %s / aarch64 :: exec -- "${ZRUN[@]}" ":: go / build / * / release / %q / aarch64" %q "${@}"\n' "${_main}" "${_os}" "${_os}" "${_main}"
done
for _os in linux ; do
printf -- ':: go / build / %s / debug / %s / armv6 :: exec -- "${ZRUN[@]}" ":: go / build / * / debug / %q / armv6" %q "${@}"\n' "${_main}" "${_os}" "${_os}" "${_main}"
printf -- ':: go / build / %s / release / %s / armv6 :: exec -- "${ZRUN[@]}" ":: go / build / * / release / %q / armv6" %q "${@}"\n' "${_main}" "${_os}" "${_os}" "${_main}"
done
done
!!

View file

@ -3,92 +3,97 @@
++<< go / build / all / debug ::// go / ...
printf -- '[ii] building archiver...\n' >&2
"${ZRUN[@]}" ':: go / build / archiver / debug' "${@}"
printf -- '[ii] building server...\n' >&2
"${ZRUN[@]}" ':: go / build / server / debug' "${@}"
printf -- '[ii] building server-dummy...\n' >&2
"${ZRUN[@]}" ':: go / build / server-dummy / debug' "${@}"
printf -- '[ii] building wrapper...\n' >&2
"${ZRUN[@]}" ':: go / build / wrapper / debug' "${@}"
!!
++<< go / build / all / release
printf -- '[ii] building archiver...\n' >&2
"${ZRUN[@]}" ':: go / build / archiver / release' "${@}"
printf -- '[ii] building server...\n' >&2
"${ZRUN[@]}" ':: go / build / server / release' "${@}"
printf -- '[ii] building server-dummy...\n' >&2
"${ZRUN[@]}" ':: go / build / server-dummy / release' "${@}"
printf -- '[ii] building wrapper...\n' >&2
"${ZRUN[@]}" ':: go / build / wrapper / release' "${@}"
!!
++<< go / build / all / release / quick
export -- __BUILD_QUICK=true
exec -- "${ZRUN[@]}" ':: go / build / all / release'
!!
++<< go / build / all / publish / quick
export -- __BUILD_QUICK=true
exec -- "${ZRUN[@]}" ':: go / build / all / publish'
!!
<< go / build / server / debug --:: watch / go / build / * / debug :: exec -- "${ZRUN[@]}" ':: sources / watch' ':: go / build / * / debug' "${@}"
test "${#}" -eq 0 --:: watch / go / execute / * / debug :: exec -- "${ZRUN[@]}" ':: sources / watch' ':: go / execute / * / debug' "${@}"
"${ZRUN[@]}" ':: sources / embedded / prepare'
_outputs="$( exec -- readlink -e -- ./.outputs )"
if test -e "${_outputs}/binaries/debug/kawipiko-server" ; then
rm -- "${_outputs}/binaries/debug/kawipiko-server"
fi --<< go / execute / * / debug
exec -- \
nodaemon \ test "${#}" -ge 1
nice -n 19 \ _main="${1}"
"${ZRUN[@]}" ':: go / tool' \ shift -- 1
build \
-o "${_outputs}/binaries/debug/kawipiko-server" \ export -- __BUILD_SUFFIX=native
-- ./cmd/server.go \
"${ZRUN[@]}" ':: go / build / * / debug' "${_main}"
export -n -- \
ZRUN_LIBRARY_SOURCE= \
ZRUN_LIBRARY_URL= \
ZRUN_LIBRARY_IDENTIFIER= \
ZRUN_LIBRARY_FINGERPRINT= \
ZRUN_EXECUTABLE= \
ZRUN_WORKSPACE= \
ZRUN_WORKSPACE_IDENTIFIER= \
ZRUN_CACHE= \
# #
exec -- "./.outputs/binaries/${_main}--debug--native" "${@}"
!! !!
<< go / build / server / release / quick --<< go / execute / * / release
export -- __BUILD_QUICK=true
exec -- "${ZRUN[@]}" ':: go / build / server / release' "${@}" test "${#}" -ge 1
_main="${1}"
shift -- 1
export -- __BUILD_SUFFIX=native
"${ZRUN[@]}" ':: go / build / * / release' "${_main}"
export -n -- \
ZRUN_LIBRARY_SOURCE= \
ZRUN_LIBRARY_URL= \
ZRUN_LIBRARY_IDENTIFIER= \
ZRUN_LIBRARY_FINGERPRINT= \
ZRUN_EXECUTABLE= \
ZRUN_WORKSPACE= \
ZRUN_WORKSPACE_IDENTIFIER= \
ZRUN_CACHE= \
#
exec -- "./.outputs/binaries/${_main}--release--native" "${@}"
!! !!
<< go / build / server / release
--<< go / build / * / debug
test "${#}" -ge 1
_main="${1}"
shift -- 1
test "${#}" -eq 0 test "${#}" -eq 0
"${ZRUN[@]}" ':: sources / embedded / bundle'
_outputs="$( exec -- readlink -e -- ./.outputs )" "${ZRUN[@]}" ':: sources / embedded / prepare'
if test -e "${_outputs}/binaries/release/kawipiko-server" ; then
rm -- "${_outputs}/binaries/release/kawipiko-server" _binaries="$( exec -- readlink -e -- ./.outputs/binaries )"
fi
_build_target=development
_build_git_hash="$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
_tags=( _tags=(
netgo netgo
) )
_flags=( _flags=()
#? -buildmode exe _gcflags=(
-N
-l
) )
_gcflags=() _ldflags=(
_ldflags=() -X "github.com/volution/kawipiko/embedded.BUILD_TARGET=${_build_target}"
if test "${__BUILD_QUICK:-false}" != true ; then -X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=${_build_git_hash}"
_flags+=( -trimpath -a )
_gcflags+=( 'all=-l=4' )
_ldflags+=( 'all=-s' )
fi
_ldflags+=(
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release"
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
) )
_seccomp="${__BUILD_SECCOMP:-false}" _seccomp="${__BUILD_SECCOMP:-false}"
if test "${_seccomp}" == true ; then if test "${_seccomp}" == true ; then
_tags+=( _tags+=(
@ -99,56 +104,45 @@
-extldflags -static -extldflags -static
) )
fi fi
_flags+=(
-tags "$( printf -- '%s,' "${_tags[@]}" )" _tags="$( printf -- '%s,' "${_tags[@]}" )"
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )" _gcflags="$( printf -- '%s ' "${_gcflags[@]}" )"
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )" _ldflags="$( printf -- '%s ' "${_ldflags[@]}" )"
)
_suffix="${__BUILD_SUFFIX:-native}"
exec -- \ exec -- \
nodaemon \
nice -n 19 -- \ nice -n 19 -- \
"${ZRUN[@]}" ':: go / tool' \ "${ZRUN[@]}" ':: go / tool' \
build \ build \
-o "${_binaries}/${_main}--debug--${_suffix}" \
-tags "${_tags}" \
-gcflags "${_gcflags}" \
-ldflags "${_ldflags}" \
"${_flags[@]}" \ "${_flags[@]}" \
-o "${_outputs}/binaries/release/kawipiko-server" \ -- \
-- ./cmd/server.go \ "./cmd/${_main#kawipiko-}.go" \
# #
!! !!
<< go / build / archiver / debug --<< go / build / * / release
test "${#}" -eq 0
"${ZRUN[@]}" ':: sources / embedded / prepare' test "${#}" -ge 1
_outputs="$( exec -- readlink -e -- ./.outputs )" _main="${1}"
if test -e "${_outputs}/binaries/debug/kawipiko-archiver" ; then shift -- 1
rm -- ${_outputs}/binaries/debug/kawipiko-archiver
fi
exec -- \
nodaemon \
nice -n 19 -- \
"${ZRUN[@]}" ':: go / tool' \
build \
-o "${_outputs}/binaries/debug/kawipiko-archiver" \
-- ./cmd/archiver.go \
#
!!
<< go / build / archiver / release / quick
export -- __BUILD_QUICK=true
exec -- "${ZRUN[@]}" ':: go / build / archiver / release' "${@}"
!!
<< go / build / archiver / release
test "${#}" -eq 0 test "${#}" -eq 0
"${ZRUN[@]}" ':: sources / embedded / bundle' "${ZRUN[@]}" ':: sources / embedded / bundle'
_outputs="$( exec -- readlink -e -- ./.outputs )"
if test -e "${_outputs}/binaries/release/kawipiko-archiver" ; then _binaries="$( exec -- readlink -e -- ./.outputs/binaries )"
rm -- "${_outputs}/binaries/release/kawipiko-archiver"
fi _build_target=release
_build_git_hash="$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
_tags=( _tags=(
netgo netgo
) )
@ -157,318 +151,340 @@
) )
_gcflags=() _gcflags=()
_ldflags=() _ldflags=()
if test "${__BUILD_QUICK:-false}" != true ; then if test "${__BUILD_QUICK:-false}" != true ; then
_flags+=( -trimpath -a ) _flags+=( -a )
_gcflags+=( 'all=-l=4' ) _gcflags+=( 'all=-l=4' )
_ldflags+=( 'all=-s' ) _ldflags+=( 'all=-s' )
fi fi
_ldflags+=( _ldflags+=(
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release" -X "github.com/volution/kawipiko/embedded.BUILD_TARGET=${_build_target}"
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )" -X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=${_build_git_hash}"
) )
_flags+=(
-tags "$( printf -- '%s,' "${_tags[@]}" )" _seccomp="${__BUILD_SECCOMP:-false}"
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )" if test "${_seccomp}" == true ; then
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )" _tags+=(
) seccomp
exec -- \ )
nodaemon \ _ldflags+=(
nice -n 19 -- \ -linkmode external
-extldflags -static
)
fi
_tags="$( printf -- '%s,' "${_tags[@]}" )"
_gcflags="$( printf -- '%s ' "${_gcflags[@]}" )"
_ldflags="$( printf -- '%s ' "${_ldflags[@]}" )"
_suffix="${__BUILD_SUFFIX:-native}"
if test -f "${_binaries}/${_main}--release--${_suffix}" ; then
mv -T -- "${_binaries}/${_main}--release--${_suffix}" "${_binaries}/${_main}--release--${_suffix}.old"
fi
nice -n 19 -- \
"${ZRUN[@]}" ':: go / tool' \ "${ZRUN[@]}" ':: go / tool' \
build \ build \
-o "${_binaries}/${_main}--release--${_suffix}.new" \
-tags "${_tags}" \
-gcflags "${_gcflags}" \
-ldflags "${_ldflags}" \
"${_flags[@]}" \ "${_flags[@]}" \
-o "${_outputs}/binaries/release/kawipiko-archiver" \ -trimpath \
-- ./cmd/archiver.go \ -- \
"./cmd/${_main#kawipiko-}.go" \
# #
!!
if test ! -e "${_binaries}/${_main}--release--${_suffix}.old" ; then
mv -T -- "${_binaries}/${_main}--release--${_suffix}.new" "${_binaries}/${_main}--release--${_suffix}"
elif ! cmp -s -- "${_binaries}/${_main}--release--${_suffix}.new" "${_binaries}/${_main}--release--${_suffix}.old" ; then
mv -T -- "${_binaries}/${_main}--release--${_suffix}.new" "${_binaries}/${_main}--release--${_suffix}"
<< go / build / wrapper / debug rm -- "${_binaries}/${_main}--release--${_suffix}.old"
test "${#}" -eq 0
"${ZRUN[@]}" ':: sources / embedded / prepare'
_outputs="$( exec -- readlink -e -- ./.outputs )"
if test -e "${_outputs}/binaries/debug/kawipiko-wrapper" ; then
rm -- "${_outputs}/binaries/debug/kawipiko-wrapper"
fi
exec -- \
nodaemon \
nice -n 19 \
"${ZRUN[@]}" ':: go / tool' \
build \
-o "${_outputs}/binaries/debug/kawipiko-wrapper" \
-- ./cmd/wrapper.go \
#
!!
<< go / build / wrapper / release / quick
export -- __BUILD_QUICK=true
exec -- "${ZRUN[@]}" ':: go / build / wrapper / release' "${@}"
!!
<< go / build / wrapper / release
test "${#}" -eq 0
"${ZRUN[@]}" ':: sources / embedded / bundle'
_outputs="$( exec -- readlink -e -- ./.outputs )"
if test -e "${_outputs}/binaries/release/kawipiko-wrapper" ; then
rm -- "${_outputs}/binaries/release/kawipiko-wrapper"
fi
_tags=(
netgo
)
_flags=(
#? -buildmode exe
)
_gcflags=()
_ldflags=()
if test "${__BUILD_QUICK:-false}" != true ; then
_flags+=( -trimpath -a )
_gcflags+=( 'all=-l=4' )
_ldflags+=( 'all=-s' )
fi
_ldflags+=(
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release"
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
)
_flags+=(
-tags "$( printf -- '%s,' "${_tags[@]}" )"
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )"
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )"
)
exec -- \
nodaemon \
nice -n 19 -- \
"${ZRUN[@]}" ':: go / tool' \
build \
"${_flags[@]}" \
-o "${_outputs}/binaries/release/kawipiko-wrapper" \
-- ./cmd/wrapper.go \
#
!!
<< go / build / server-dummy / debug
test "${#}" -eq 0
"${ZRUN[@]}" ':: sources / embedded / prepare'
_outputs="$( exec -- readlink -e -- ./.outputs )"
if test -e "${_outputs}/binaries/debug/kawipiko-server-dummy" ; then
rm -- "${_outputs}/binaries/debug/kawipiko-server-dummy"
fi
exec -- \
nodaemon \
nice -n 19 \
"${ZRUN[@]}" ':: go / tool' \
build \
-o "${_outputs}/binaries/debug/kawipiko-server-dummy" \
-- ./cmd/server-dummy.go \
#
!!
<< go / build / server-dummy / release / quick
export -- __BUILD_QUICK=true
exec -- "${ZRUN[@]}" ':: go / build / server-dummy / release' "${@}"
!!
<< go / build / server-dummy / release
test "${#}" -eq 0
"${ZRUN[@]}" ':: sources / embedded / bundle'
_outputs="$( exec -- readlink -e -- ./.outputs )"
if test -e "${_outputs}/binaries/release/kawipiko-server-dummy" ; then
rm -- "${_outputs}/binaries/release/kawipiko-server-dummy"
fi
_tags=(
netgo
)
_flags=(
#? -buildmode exe
)
_gcflags=()
_ldflags=()
if test "${__BUILD_QUICK:-false}" != true ; then
_flags+=( -trimpath -a )
_gcflags+=( 'all=-l=4' )
_ldflags+=( 'all=-s' )
fi
_ldflags+=(
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release"
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
)
_flags+=(
-tags "$( printf -- '%s,' "${_tags[@]}" )"
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )"
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )"
)
exec -- \
nodaemon \
nice -n 19 -- \
"${ZRUN[@]}" ':: go / tool' \
build \
"${_flags[@]}" \
-o "${_outputs}/binaries/release/kawipiko-server-dummy" \
-- ./cmd/server-dummy.go \
#
!!
++<< go / build / all / publish
if test "${#}" -ge 1 ; then
_platform_0="${1}"
shift -- 1
else else
_platform_0='all' mv -T -- "${_binaries}/${_main}--release--${_suffix}.old" "${_binaries}/${_main}--release--${_suffix}"
rm -- "${_binaries}/${_main}--release--${_suffix}.new"
fi fi
if test "${#}" -ge 1 ; then !!
_component_0="${1}"
shift -- 1
else
_component_0=all
fi ++<< go / build / all / debug
test "${#}" -eq 0 for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
"${ZRUN[@]}" ':: sources / embedded / bundle' printf -- '[ii] building `%s`...\n' "${_main}" >&2
_outputs="$( exec -- readlink -e -- ./.outputs )" "${ZRUN[@]}" ':: go / build / * / debug / all' "${_main}" "${@}"
for _platform in linux--x86_64 linux--x86_64--seccomp darwin--x86_64 darwin--aarch64 openbsd--x86_64 freebsd--x86_64 android--aarch64 ; do
if test "${_platform_0}" != all -a "${_platform_0}" != "${_platform}" ; then
continue
fi
for _component in archiver server server-dummy wrapper ; do
if test "${_component_0}" != all -a "${_component_0}" != "${_component}" ; then
continue
fi
case "${_component}::${_platform}" in
( server::linux--x86_64--seccomp ) ;;
( *::linux--x86_64--seccomp ) continue ;;
esac
if test -e "${_outputs}/binaries/publish/kawipiko-${_component}--${_platform}" ; then
rm -f -- "${_outputs}/binaries/publish/kawipiko-${_component}--${_platform}"
fi
done
done
for _platform in linux--x86_64 linux--x86_64--seccomp darwin--x86_64 darwin--aarch64 openbsd--x86_64 freebsd--x86_64 android--aarch64 ; do
if test "${_platform_0}" != all -a "${_platform_0}" != "${_platform}" ; then
continue
fi
for _component in archiver server server-dummy wrapper ; do
if test "${_component_0}" != all -a "${_component_0}" != "${_component}" ; then
continue
fi
case "${_component}::${_platform}" in
( server::linux--x86_64--seccomp ) ;;
( *::linux--x86_64--seccomp ) continue ;;
esac
test ! -e "${_outputs}/binaries/publish/kawipiko-${_component}--${_platform}"
printf -- '[ii] building `%s` for `%s`...\n' "${_component}" "${_platform}" >&2
case "${_platform}" in
( linux--x86_64 | linux--x86_64--seccomp )
export -- GOOS=linux
export -- GOARCH=amd64
;;
( darwin--x86_64 )
export -- GOOS=darwin
export -- GOARCH=amd64
;;
( darwin--aarch64 )
export -- GOOS=darwin
export -- GOARCH=arm64
;;
( freebsd--x86_64 )
export -- GOOS=freebsd
export -- GOARCH=amd64
;;
( openbsd--x86_64 )
export -- GOOS=openbsd
export -- GOARCH=amd64
;;
( android--aarch64 )
export -- GOOS=android
export -- GOARCH=arm64
;;
( * )
exit -- 1
;;
esac
if test "${_platform}" == linux--x86_64--seccomp ; then
_seccomp=true
else
_seccomp=false
fi
_tags=(
netgo
)
_flags=(
#? -buildmode exe
)
_gcflags=()
_ldflags=()
if test "${__BUILD_QUICK:-false}" != true ; then
_flags+=( -trimpath -a )
_gcflags+=( 'all=-l=4' )
_ldflags+=( 'all=-s' )
fi
_ldflags+=(
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release"
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
)
if test "${_seccomp}" == true ; then
_tags+=(
seccomp
)
_ldflags+=(
-linkmode external
-extldflags -static
)
fi
_flags+=(
-tags "$( printf -- '%s,' "${_tags[@]}" )"
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )"
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )"
)
nodaemon \
nice -n 19 -- \
"${ZRUN[@]}" ':: go / tool' \
build \
"${_flags[@]}" \
-o "${_outputs}/binaries/publish/kawipiko-${_component}--${_platform}" \
-- "./cmd/${_component}.go" \
#
strip \
--strip-all \
-- \
"${_outputs}/binaries/publish/kawipiko-${_component}--${_platform}" \
#
done
done done
!! !!
--<< go / build / * / debug / all
printf -- '[ii] building for `%s`...\n' 'native' >&2
"${ZRUN[@]}" ':: go / build / * / debug / native' "${@}"
printf -- '[ii] building for `%s`...\n' 'linux / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / linux / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'linux / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / linux / aarch64' "${@}"
printf -- '[ii] building for `%s`...\n' 'linux / armv6' >&2
"${ZRUN[@]}" ':: go / build / * / debug / linux / armv6' "${@}"
printf -- '[ii] building for `%s`...\n' 'linux / x86_64--seccomp' >&2
"${ZRUN[@]}" ':: go / build / * / debug / linux / x86_64--seccomp' "${@}"
printf -- '[ii] building for `%s`...\n' 'darwin / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / darwin / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'darwin / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / darwin / aarch64' "${@}"
printf -- '[ii] building for `%s`...\n' 'freebsd / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / freebsd / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'freebsd / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / freebsd / aarch64' "${@}"
printf -- '[ii] building for `%s`...\n' 'openbsd / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / openbsd / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'openbsd / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / openbsd / aarch64' "${@}"
printf -- '[ii] building for `%s`...\n' 'android / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / android / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'android / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / debug / android / aarch64' "${@}"
!!
--<< go / build / * / debug / native
export -- __BUILD_SUFFIX=native
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / linux / x86_64--seccomp
export -- GOOS=linux
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=linux--x86_64--seccomp
export -- __BUILD_SECCOMP=true
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
<< go / build / server / analyze --<< go / build / * / debug / linux / x86_64
test "${#}" -eq 0 export -- GOOS=linux
_outputs="$( exec -- readlink -e -- ./.outputs )" export -- GOARCH=amd64
exec -- "${ZRUN[@]}" ':: go / tool' \ export -- __BUILD_SUFFIX=linux--x86_64
build \ exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
-a \ !!
-gcflags '-m' \
-o "${_outputs}/binaries/analyze/kawipiko-server" \ --<< go / build / * / debug / linux / aarch64
-- ./cmd/server/server.go \ export -- GOOS=linux
# export -- GOARCH=arm64
export -- __BUILD_SUFFIX=linux--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / linux / armv6
export -- GOOS=linux
export -- GOARCH=arm
export -- GOARM=6
export -- __BUILD_SUFFIX=linux--armv6
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / darwin / x86_64
export -- GOOS=darwin
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=darwin--x86_64
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / darwin / aarch64
export -- GOOS=darwin
export -- GOARCH=arm64
export -- __BUILD_SUFFIX=darwin--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / freebsd / x86_64
export -- GOOS=freebsd
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=freebsd--x86_64
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / freebsd / aarch64
export -- GOOS=freebsd
export -- GOARCH=arm64
export -- __BUILD_SUFFIX=freebsd--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / openbsd / x86_64
export -- GOOS=openbsd
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=openbsd--x86_64
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / openbsd / aarch64
export -- GOOS=openbsd
export -- GOARCH=arm64
export -- __BUILD_SUFFIX=openbsd--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / android / x86_64
export -- GOOS=android
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=android--x86_64
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!!
--<< go / build / * / debug / android / aarch64
export -- GOOS=android
export -- GOARCH=arm64
export -- __BUILD_SUFFIX=android--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
!! !!
<< go / build / server / analyze / escapes
"${ZRUN[@]}" ':: go / build / server / analyze' "${@}" \
2>&1 \ ++<< go / build / all / release / quick
| grep -F -e ' escapes ' \ export -- __BUILD_QUICK=true
| LC_ALL=C sort -n -k 2,2 -t ':' exec -- "${ZRUN[@]}" ':: go / build / all / release' "${@}"
!!
++<< go / build / all / release
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
printf -- '[ii] building `%s`...\n' "${_main}" >&2
"${ZRUN[@]}" ':: go / build / * / release / all' "${_main}" "${@}"
done
!!
--<< go / build / * / release / all
printf -- '[ii] building for `%s`...\n' 'native' >&2
"${ZRUN[@]}" ':: go / build / * / release / native' "${@}"
printf -- '[ii] building for `%s`...\n' 'linux / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / release / linux / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'linux / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / release / linux / aarch64' "${@}"
printf -- '[ii] building for `%s`...\n' 'linux / armv6' >&2
"${ZRUN[@]}" ':: go / build / * / release / linux / armv6' "${@}"
printf -- '[ii] building for `%s`...\n' 'linux / x86_64--seccomp' >&2
"${ZRUN[@]}" ':: go / build / * / release / linux / x86_64--seccomp' "${@}"
printf -- '[ii] building for `%s`...\n' 'darwin / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / release / darwin / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'darwin / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / release / darwin / aarch64' "${@}"
printf -- '[ii] building for `%s`...\n' 'freebsd / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / release / freebsd / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'freebsd / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / release / freebsd / aarch64' "${@}"
printf -- '[ii] building for `%s`...\n' 'openbsd / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / release / openbsd / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'openbsd / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / release / openbsd / aarch64' "${@}"
printf -- '[ii] building for `%s`...\n' 'android / x86_64' >&2
"${ZRUN[@]}" ':: go / build / * / release / android / x86_64' "${@}"
printf -- '[ii] building for `%s`...\n' 'android / aarch64' >&2
"${ZRUN[@]}" ':: go / build / * / release / android / aarch64' "${@}"
!!
--<< go / build / * / release / native
export -- __BUILD_SUFFIX=native
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / linux / x86_64--seccomp
export -- GOOS=linux
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=linux--x86_64--seccomp
export -- __BUILD_SECCOMP=true
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / linux / x86_64
export -- GOOS=linux
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=linux--x86_64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / linux / aarch64
export -- GOOS=linux
export -- GOARCH=arm64
export -- __BUILD_SUFFIX=linux--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / linux / armv6
export -- GOOS=linux
export -- GOARCH=arm
export -- GOARM=6
export -- __BUILD_SUFFIX=linux--armv6
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / darwin / x86_64
export -- GOOS=darwin
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=darwin--x86_64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / darwin / aarch64
export -- GOOS=darwin
export -- GOARCH=arm64
export -- __BUILD_SUFFIX=darwin--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / freebsd / x86_64
export -- GOOS=freebsd
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=freebsd--x86_64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / freebsd / aarch64
export -- GOOS=freebsd
export -- GOARCH=arm64
export -- __BUILD_SUFFIX=freebsd--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / openbsd / x86_64
export -- GOOS=openbsd
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=openbsd--x86_64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / openbsd / aarch64
export -- GOOS=openbsd
export -- GOARCH=arm64
export -- __BUILD_SUFFIX=openbsd--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / android / x86_64
export -- GOOS=android
export -- GOARCH=amd64
export -- __BUILD_SUFFIX=android--x86_64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!!
--<< go / build / * / release / android / aarch64
export -- GOOS=android
export -- GOARCH=arm64
export -- __BUILD_SUFFIX=android--aarch64
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
!! !!
@ -492,6 +508,7 @@
get \ get \
-v \ -v \
-d \ -d \
-u \
-- \ -- \
all \ all \
# #
@ -606,6 +623,50 @@
<< go / dependencies / vendor
test "${#}" -eq 0
if test -e ./vendors ; then
rm -- ./sources/vendor
mv -T -- ./vendors ./sources/vendor
fi
"${ZRUN[@]}" ':: go / tool' \
mod vendor \
#
mv -T -- ./sources/vendor ./vendors
ln -s -T -- ../vendors ./sources/vendor
!!
<< go / dependencies / vendor / cleanup
test "${#}" -eq 0
find ./vendor/ \
-xdev \
-not -type d \
-not -path './sources/vendor/modules.txt' \
-not -name 'go.mod' \
-not -name 'go.sum' \
-not -name '*.go' \
-not -name '*.c' \
-not -name '*.h' \
-not -name '*.s' \
-delete \
#
find ./vendor/ \
-xdev \
-type d \
-empty \
-delete \
#
!!
<< go / tool << go / tool
test "${#}" -ge 1 test "${#}" -ge 1
@ -617,6 +678,7 @@
ZRUN_LIBRARY_FINGERPRINT= \ ZRUN_LIBRARY_FINGERPRINT= \
ZRUN_EXECUTABLE= \ ZRUN_EXECUTABLE= \
ZRUN_WORKSPACE= \ ZRUN_WORKSPACE= \
ZRUN_WORKSPACE_IDENTIFIER= \
ZRUN_CACHE= \ ZRUN_CACHE= \
# #
@ -639,3 +701,28 @@
exec -- "${_go}" "${@}" exec -- "${_go}" "${@}"
!! !!
<< go / build / kawipiko-server / analyze
test "${#}" -eq 0
_outputs="$( exec -- readlink -e -- ./.outputs )"
exec -- "${ZRUN[@]}" ':: go / tool' \
build \
-o "${_outputs}/binaries/kawipiko-server--analyze" \
-gcflags '-m' \
-a \
-- \
./cmd/server/server.go \
#
!!
<< go / build / kawipiko-server / analyze / escapes
"${ZRUN[@]}" ':: go / build / kawipiko-server / analyze' "${@}" \
2>&1 \
| grep -F -e ' escapes ' \
| LC_ALL=C sort -n -k 2,2 -t ':'
!!

View file

@ -3,6 +3,11 @@
::// tls / ...
<< tls / generate / all << tls / generate / all
test "${#}" -eq 0 test "${#}" -eq 0

View file

@ -3,6 +3,11 @@
::// tools / ...
<< tools / wrk << tools / wrk
test -f ./.bin/wrk test -f ./.bin/wrk
test -x ./.bin/wrk test -x ./.bin/wrk

140
scripts/workbench.z-run Normal file
View file

@ -0,0 +1,140 @@
#!/dev/null
::// workbench / ...
<< workbench / initialize
test "${#}" -eq 0
"${ZRUN[@]}" ':: workbench / initialize / go'
!!
<< workbench / initialize / go
test "${#}" -eq 0
_outputs="$( exec -- "${ZRUN[@]}" ':: workbench / outputs' )"
test -d "${_outputs}"
_sources="${__SOURCES}"
test -d "${_sources}"
GOPATH="${_outputs}/go"
GOBIN="${_outputs}/go/bin"
GOTMPDIR="${_outputs}/go/tmp"
GOCACHE="${_outputs}/go/cache"
_gosrc="${_outputs}/go/src"
_gopkg="${_outputs}/go/pkg"
_binaries="${_outputs}/binaries"
_markers="${_outputs}/markers"
for _folder in "${GOPATH}" "${GOBIN}" "${GOTMPDIR}" "${GOTMPDIR}" "${GOCACHE}" "${_gosrc}" "${_gopkg}" "${_binaries}" "${_markers}" ; do
if test ! -e "${_folder}" ; then
mkdir -- "${_folder}"
fi
done
!!
--<< workbench / scratch
test "${#}" -eq 0
if test -e ./.scratch ; then
_scratch="$( exec -- readlink -e -- ./.scratch )"
elif test -h ./.scratch ; then
_scratch="$( exec -- readlink -f -- ./.scratch )"
mkdir -- "${_scratch}"
elif test -e "${HOME}/go/.scratch" ; then
_scratch="$( exec -- readlink -e -- "${HOME}/go/.scratch" )"
else
_scratch="${TMPDIR:-/tmp}/go--scratch--${UID}"
fi
_scratch="$( exec -- readlink -e -- "${_scratch}" )"
printf -- '%s\n' "${_scratch}"
!!
--<< workbench / outputs
test "${#}" -eq 0
_outputs="${__OUTPUTS}"
if test ! -e "${_outputs}" -o -h "${_outputs}" ; then
_scratch="$( exec -- "${ZRUN}" ':: workbench / scratch' )"
_outputs_store="${_scratch}/${UNAME_NODE}--${UNAME_FINGERPRINT}--${ZRUN_WORKSPACE_IDENTIFIER}"
if test ! -d "${_outputs_store}" ; then
mkdir -- "${_outputs_store}"
fi
_outputs_store="$( exec -- readlink -e -- "${_outputs_store}" )"
ln -s -f -T -- "${_outputs_store}" "${_outputs}"
fi
test -d "${_outputs}"
printf -- '%s\n' "${_outputs}"
!!
--<< workbench / publish
_publish="${__PUBLISH}"
test -d "${_publish}"
printf -- '%s\n' "${_publish}"
!!
<< workbench / initialize / python
test "${#}" -eq 0
_outputs="$( exec -- "${ZRUN[@]}" ':: workbench / outputs' )"
if test -d "${_outputs}/python" ; then
exit -- 0
fi
mkdir -- "${_outputs}/python"
virtualenv \
--python python3 \
--clear \
--symlinks \
--no-setuptools \
--no-wheel \
--no-download \
-- \
"${_outputs}/python" \
#
"${_outputs}/python/bin/pip" install --upgrade --compile -- pip
"${_outputs}/python/bin/pip" install --upgrade --compile -- wheel
"${_outputs}/python/bin/pip" install --upgrade --compile -- setuptools
"${_outputs}/python/bin/pip" install --compile -- docutils
"${_outputs}/python/bin/pip" install --compile -- restview
!!

View file

@ -1,129 +0,0 @@
#!/dev/null
<< workspace / initialize
test "${#}" -eq 0
"${ZRUN[@]}" ':: workspace / initialize / outputs'
"${ZRUN[@]}" ':: workspace / initialize / go'
!!
<< workspace / initialize / outputs
test "${#}" -eq 0
if test ! -d ./.outputs ; then
if test -h ./.outputs ; then
_outputs_store="$( exec -- readlink -f -- ./.outputs )"
else
_outputs_store="${TMPDIR:-/tmp}/workspace--${UID}--${RANDOM}-${RANDOM}-${RANDOM}-${RANDOM}"
fi
mkdir -- "${_outputs_store}"
if test ! -e ./.outputs ; then
_outputs_store="$( exec -- readlink -e -- "${_outputs_store}" )"
ln -s -f -T -- "${_outputs_store}" ./.outputs
fi
fi
_outputs="$( exec -- readlink -e -- ./.outputs )"
_folders=(
binaries
binaries/debug
binaries/release
binaries/publish
binaries/analyze
examples
markers
)
for _folder in "${_folders[@]}" ; do
if test ! -e "${_outputs}/${_folder}" ; then
mkdir -- "${_outputs}/${_folder}"
fi
done
!!
<< workspace / initialize / go / clean
test "${#}" -eq 0
_outputs="$( exec -- readlink -e -- ./.outputs )"
if test -d "${_outputs}/go" ; then
chmod -R +w -- "${_outputs}/go"
fi
rm -R -- "${_outputs}/go"
exec -- "${ZRUN[@]}" ':: workspace / initialize / go'
!!
<< workspace / initialize / go
test "${#}" -eq 0
_outputs="$( exec -- readlink -e -- ./.outputs )"
_sources="$( exec -- readlink -e -- ./sources )"
GOPATH="${_outputs}/go"
GOBIN="${_outputs}/go/bin"
GOTMPDIR="${_outputs}/go/tmp"
GOCACHE="${_outputs}/go/cache"
_gosrc="${_outputs}/go/src"
_gopkg="${_outputs}/go/pkg"
_folders=(
"${GOPATH}"
"${GOBIN}"
"${GOTMPDIR}"
"${GOCACHE}"
"${_gosrc}"
"${_gopkg}"
)
for _folder in "${_folders[@]}" ; do
if test ! -e "${_folder}" ; then
mkdir -- "${_folder}"
fi
done
!!
<< workspace / initialize / python
test "${#}" -eq 0
if test -d ./.outputs/python ; then
exit -- 0
fi
test -d ./.outputs
mkdir -- ./.outputs/python
virtualenv-3.8 \
--python python3.8 \
--clear \
--symlinks \
--no-setuptools \
--no-wheel \
--no-download \
-- \
./.outputs/python \
#
./.outputs/python/bin/pip install --upgrade --compile -- pip
./.outputs/python/bin/pip install --upgrade --compile -- wheel
./.outputs/python/bin/pip install --upgrade --compile -- setuptools
./.outputs/python/bin/pip install --compile -- docutils
./.outputs/python/bin/pip install --compile -- restview
!!