hook scripts & repo scripts: provide and use --main-binary-filepath

This commit is contained in:
Robur 2024-01-09 15:05:09 +00:00
parent 1e522e2b39
commit c45488dd73
3 changed files with 17 additions and 2 deletions

View file

@ -493,6 +493,7 @@ let add_build
"--uuid=" ^ uuid ; "--platform=" ^ platform ; "--uuid=" ^ uuid ; "--platform=" ^ platform ;
"--cache-dir=" ^ Fpath.to_string cachedir ; "--cache-dir=" ^ Fpath.to_string cachedir ;
"--data-dir=" ^ Fpath.to_string datadir ; "--data-dir=" ^ Fpath.to_string datadir ;
"--main-binary-filepath=" ^ Fpath.to_string main_binary.filepath ;
fp_str Fpath.(datadir // artifact_path main_binary) ]) fp_str Fpath.(datadir // artifact_path main_binary) ])
in in
Log.debug (fun m -> m "executing hooks with %s" args); Log.debug (fun m -> m "executing hooks with %s" args);

View file

@ -32,6 +32,8 @@ Options:
Hex encoded SHA256 digest of the main binary. Hex encoded SHA256 digest of the main binary.
--job=STRING --job=STRING
Job name that was built. Job name that was built.
--main-binary-filepath=STRING
The file path of the main binary.
EOM EOM
exit 1 exit 1
} }
@ -39,6 +41,7 @@ EOM
BUILD_TIME= BUILD_TIME=
SHA= SHA=
JOB= JOB=
FILEPATH=
while [ $# -gt 1 ]; do while [ $# -gt 1 ]; do
OPT="$1" OPT="$1"
@ -53,6 +56,9 @@ while [ $# -gt 1 ]; do
--job=*) --job=*)
JOB="${OPT##*=}" JOB="${OPT##*=}"
;; ;;
--main-binary-filepath=*)
FILEPATH="${OPT##*=}"
;;
--*) --*)
warn "Ignoring unknown option: '${OPT}'" warn "Ignoring unknown option: '${OPT}'"
;; ;;
@ -67,13 +73,14 @@ done
[ -z "${BUILD_TIME}" ] && die "The --build-time option must be specified" [ -z "${BUILD_TIME}" ] && die "The --build-time option must be specified"
[ -z "${SHA}" ] && die "The --sha256 option must be specified" [ -z "${SHA}" ] && die "The --sha256 option must be specified"
[ -z "${JOB}" ] && die "The --job option must be specified" [ -z "${JOB}" ] && die "The --job option must be specified"
[ -z "${FILEPATH}" ] && die "The --main-binary-filepath option must be specified"
FILENAME="${1}" FILENAME="${1}"
: "${REPO:="/usr/local/www/pkg"}" : "${REPO:="/usr/local/www/pkg"}"
: "${REPO_KEY:="/usr/local/etc/builder-web/repo.key"}" : "${REPO_KEY:="/usr/local/etc/builder-web/repo.key"}"
if [ "$(basename "${FILENAME}" .pkg)" = "$(basename "${FILENAME}")" ]; then if [ "$(basename "${FILEPATH}" .pkg)" = "$(basename "${FILEPATH}")" ]; then
echo "Not a FreeBSD package" echo "Not a FreeBSD package"
exit 0 exit 0
fi fi

View file

@ -36,6 +36,8 @@ Options:
Job name that was built. Job name that was built.
--platform=STRING --platform=STRING
Platform name on which the build was performed. Platform name on which the build was performed.
--main-binary-filepath=STRING
The file path of the main binary.
EOM EOM
exit 1 exit 1
} }
@ -44,6 +46,7 @@ BUILD_TIME=
SHA= SHA=
JOB= JOB=
PLATFORM= PLATFORM=
FILEPATH=
while [ $# -gt 1 ]; do while [ $# -gt 1 ]; do
OPT="$1" OPT="$1"
@ -61,6 +64,9 @@ while [ $# -gt 1 ]; do
--platform=*) --platform=*)
PLATFORM="${OPT##*=}" PLATFORM="${OPT##*=}"
;; ;;
--main-binary-filepath=*)
FILEPATH="${OPT##*=}"
;;
--*) --*)
warn "Ignoring unknown option: '${OPT}'" warn "Ignoring unknown option: '${OPT}'"
;; ;;
@ -76,10 +82,11 @@ done
[ -z "${SHA}" ] && die "The --sha256 option must be specified" [ -z "${SHA}" ] && die "The --sha256 option must be specified"
[ -z "${JOB}" ] && die "The --job option must be specified" [ -z "${JOB}" ] && die "The --job option must be specified"
[ -z "${PLATFORM}" ] && die "The --platform option must be specified" [ -z "${PLATFORM}" ] && die "The --platform option must be specified"
[ -z "${FILEPATH}" ] && die "The --main-binary-filepath option must be specified"
FILENAME="${1}" FILENAME="${1}"
if [ $(basename "${FILENAME}" .deb) = $(basename "${FILENAME}") ]; then if [ $(basename "${FILEPATH}" .deb) = $(basename "${FILEPATH}") ]; then
echo "Not a Debian package" echo "Not a Debian package"
exit 0 exit 0
fi fi