if [ -x /usr/bin/python3 ]; then
send_mode="python"
else
- echo "No python present, using mail mode"
- send_mode="mail"
+ echo "No python3 present, aborting"
+ exit 1
fi
if [ -n "$HOME_ETC" ]; then
default_key=deviloper@tld-linux.org
send_mode="$send_mode"
url="$url"
-mailer="/usr/lib/sendmail -t"
gpg_opts=""
dist=ti
-url="https://src.tld-linux.org:1241/"
+url="https://giant.tld-linux.org:1241/"
# defaults:
f_upgrade=yes
# internal options, not to be overriden
specs=
-df_fetch=no
upgrade_macros=no
upgrade_scripts=no
cr=$(printf "\r")
}
send_request() {
- # switch to mail mode, if no url set
- [ -z "$url" ] && send_mode="mail"
-
if [ -n "$wait" ]; then
msg "Waiting $wait seconds before sending request"
sleep $wait
msg "Wait has ended, proceeding!"
fi
- case "$send_mode" in
- "mail")
- msg "Sending using mail mode"
- cat - | $mailer
- ;;
- *)
- msg "Sending using HTTP mode to $url"
- cat - | python3 -c '
+ msg "Sending using HTTP mode to $url"
+ cat - | python3 -c '
import sys, socket, ssl
from urllib import request
sys.exit(1)
print("Request queued via HTTP.", file=sys.stdout)
' "$url"
- ;;
- esac
}
# htmlspecialchars: escape <, > and &
printf "%s\n" "$input" | sed -e 's,&,\&,g;s,<,\<,g;s,>,\>,g'
}
-# simple df_fetcher, based on packages/fetchsrc_request
-# TODO: tcp (smtp) mode
-# TODO: adjust for ~/.requestrc config
-df_fetch() {
- local specs="$@"
-
- # Sending by
- local MAILER='/usr/lib/sendmail'
- # MAILER='/usr/bin/msmtp'
- # Sending via
- local VIA="SENDMAIL"
- #VIA="localhost"
- local VIA_ARGS=""
- #VIA_ARGS="some additional flags"
- # e.g. for msmtp:
- # VIA_ARGS='-a gmail'
- #
- # DISTFILES EMAIL
- local DMAIL="df@tld-linux.org"
-
- local HOST=$(hostname -f)
- local LOGIN=${requester%@*}
-
- local SPEC BRANCH
- for spec in $specs; do
- SPEC=$(echo "$spec" | sed -e 's|:.*||')
- SPEC=${SPEC%.spec}
- BRANCH=$(echo "$spec" | sed -e 's|.*:||')
- echo >&2 "Distfiles Request: $SPEC:$BRANCH via $MAILER ${VIA_ARGS:+ ($VIA_ARGS)}"
- cat <<-EOF | "$MAILER" -t -i $VIA_ARGS
- To: $DMAIL
- From: $LOGIN <$LOGIN@$HOST>
- Subject: fetchsrc_request notify
- X-distfiles-request: yes
- X-Login: $LOGIN
- X-Package: $SPEC
- X-Branch: $BRANCH
- X-Flags: force-reply
-
- .
- EOF
- done
-}
-
# get package revision for specs
get_pkgrevision() {
local pkgrev pkg spec rpmdir
upgrade_scripts='yes'
;;
- -df | --distfiles-fetch | --distfiles-fetch-request)
- df_fetch=yes
- ;;
-
--gpg-opts | -g)
gpg_opts="$2"
shift
case "$dist" in
ti)
- builder_email="builderti@src.tld-linux.org"
default_builders="ti-*"
- url="https://src.tld-linux.org:1241/"
+ url="https://giant.tld-linux.org:1241/"
control_url="http://src.tld-linux.org/~builderti"
;;
ti-dev)
- builder_email="buildertidev@src.tld-linux.org"
default_builders="ti-dev-*"
- url="https://src.tld-linux.org:1242/"
+ url="https://giant.tld-linux.org:1242/"
control_url="http://src.tld-linux.org/~buildertidev"
;;
*)
specs=$(get_pkgrevision $specs)
fi
-if [ "$df_fetch" = "yes" ]; then
- df_fetch $specs
- exit 0
-fi
-
if [ "$upgrade_macros" = "yes" ]; then
command="poldek --up; poldek -uv rpm-build-macros"
builders="$dist-src"
msg "Using jobs $jobs"
echo " <maxjobs>$jobs</maxjobs>"
fi
- if [ -z "$url" ]; then
- msg "Using email $builder_email"
- else
- msg "Using URL $url"
- fi
+ msg "Using URL $url"
if [ "$build_mode" = "ready" ]; then
msg "Build mode: $(tput setaf 2)$build_mode$c_norm"