X-Git-Url: https://git.tld-linux.org/?p=tld-builder.git;a=blobdiff_plain;f=client%2Fmake-request.sh;h=a14bd7c5ffadd4308f3f7a125f7f5e4f3d094988;hp=d73c08ab19df1ae1b7db69cd5fa97d0554141745;hb=b999f53d4bf5d44586ecf028876e8bc20b5fd2ce;hpb=37463eaa22f48f5fecbb90e69ef67a69e0bf9788 diff --git a/client/make-request.sh b/client/make-request.sh index d73c08a..a14bd7c 100755 --- a/client/make-request.sh +++ b/client/make-request.sh @@ -1,4 +1,6 @@ #!/bin/sh +# vim:noet:ts=4:sw=4 +VERSION=1.89 # prevent "*" from being expanded in builders var set -f @@ -16,6 +18,8 @@ url= no_depend=no verbose=no autotag=no +requester_override= +relup=no if [ -x /usr/bin/python ]; then send_mode="python" @@ -34,14 +38,14 @@ if [ ! -f "$USER_CFG" ]; then echo "Creating config file $USER_CFG. You *must* edit it." cat > $USER_CFG <> sys.stdout, "Request queued via HTTP." esac } +# htmlspecialchars: escape <, > and & +hsc() { + local input=$1 + echo -E "$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 @@ -115,7 +133,7 @@ df_fetch() { local specs="$@" # Sending by - local MAILER='/usr/sbin/sendmail' + local MAILER='/usr/lib/sendmail' # MAILER='/usr/bin/msmtp' # Sending via local VIA="SENDMAIL" @@ -126,23 +144,24 @@ df_fetch() { # VIA_ARGS='-a gmail' # # DISTFILES EMAIL - local DMAIL="distfiles@pld-linux.org" + local DMAIL="df@tld-linux.org" local HOST=$(hostname -f) local LOGIN=${requester%@*} + local SPEC BRANCH for spec in $specs; do - local SPEC=$(echo "$spec" | sed -e 's|:.*||') - local BRANCH=$(echo "$spec" | sed -e 's|.*:||') + 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-CVS-Module: SPECS X-distfiles-request: yes X-Login: $LOGIN - X-Spec: $SPEC + X-Package: $SPEC X-Branch: $BRANCH X-Flags: force-reply @@ -160,19 +179,21 @@ autotag() { s=${s%:*} # ensure package ends with .spec s=${s%.spec}.spec - out=$(cvs status -v $s | awk "!/Sticky/&&/auto-$dist-/{if (!a++) print \$1}") + git fetch --tags + out=$(git for-each-ref --count=1 --sort=-authordate refs/tags/auto/$dist \ + --format='%(refname:short)') echo "$s:$out" done } # get autotag for specs -# WARNING: This may checkout some files from CVS +# WARNING: This may checkout some files from VCS get_autotag() { local pkg spec rpmdir rpmdir=$(rpm -E %_topdir) - cd $rpmdir for pkg in "$@"; do + cd $rpmdir # strip branches pkg=${pkg%:*} # strip .spec extension @@ -185,11 +206,17 @@ get_autotag() { # just print it out, to fallback to base pkg name echo "$pkg" else - autotag $pkg/$pkg.spec + cd $pkg + autotag $pkg.spec fi done } +relup() { + local script=$(dirname $(rpm -E %_topdir))/rpm-build-tools/relup.sh + $script -u -i "$@" +} + usage() { cat <$requester_override" + fi + msg "Queue-ID: $id" echo # job to depend on local depend= - local b i=1 + local b i=1 val local name branch builders_xml for b in $builders; do @@ -694,7 +736,7 @@ gen_req() { echo -E >&2 "* Command: $command" echo " " echo " " - echo -E "$command" | sed -e 's,&,\&,g;s,<,\<,g;s,>,\>,g' + hsc "$command" echo "" echo " " echo "$builders_xml" @@ -725,6 +767,17 @@ gen_req() { echo " $branch" echo " ${kernel:+$kernel}" echo " ${target:+$target}" + + oIFS=$IFS; IFS=$cr + for b in $define; do + [ -z "$b" ] && continue + value=${b#*=} + b=${b%%=*} + echo " $(hsc "$value")" + msg "- define $b=$value" + done + IFS=$oIFS + echo " " echo for b in $with; do @@ -750,7 +803,7 @@ gen_req() { echo -E >&2 "* Post-Command: $post_command" echo " " echo " " - echo -E "$post_command" | sed -e 's,&,\&,g;s,<,\<,g;s,>,\>,g' + hsc "$post_command" echo "" echo " " echo "$builders_xml" @@ -776,8 +829,8 @@ gen_email () { To: $builder_email Subject: build request Message-Id: <$id@$(hostname)> - X-New-PLD-Builder: request - X-Requester-Version: \$Id$ + X-New-TLD-Builder: request + X-Requester-Version: $VERSION EOF