X-Git-Url: https://git.tld-linux.org/?a=blobdiff_plain;f=client%2Fmake-request.sh;h=2c753c9b88de497539cb098bbad4a459cab60d38;hb=48833779774941e1ee019bf95395a8f67e414c52;hp=493432c438f611d059e50780634fae7cc3e49a8c;hpb=3d4e503a79ceec757a378a14892f59efcf482337;p=tld-builder.git diff --git a/client/make-request.sh b/client/make-request.sh index 493432c..2c753c9 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 +140,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 +151,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,36 +186,41 @@ 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 + local atag pkg spec rpmdir rpmdir=$(rpm -E %_topdir) - cd $rpmdir for pkg in "$@"; do + cd $rpmdir # strip branches pkg=${pkg%:*} # strip .spec extension pkg=${pkg%.spec} - # checkout only if missing - if [ ! -e $pkg/$pkg.spec ]; then - $rpmdir/builder -g $pkg -ns -r HEAD 1>&2 - fi - if [ ! -e $pkg/$pkg.spec ]; then - # just print it out, to fallback to base pkg name - echo "$pkg" + wget http://pkgrevs.tld-linux.org/list/$pkg -O /tmp/$pkg.tags 1>/dev/null 2>&1 + atag=$(head -n 1 /tmp/$pkg.tags) + rm -f /tmp/$pkg.tags + if [ "x$atag" = "x" ]; then + echo "$pkg.spec" else - autotag $pkg/$pkg.spec + echo "$pkg.spec:$atag" 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 +740,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 +771,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 +807,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 +833,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