X-Git-Url: https://git.tld-linux.org/?p=TLD.git;a=blobdiff_plain;f=pld-builder.new%2Fclient%2Fmake-request.sh;fp=pld-builder.new%2Fclient%2Fmake-request.sh;h=0000000000000000000000000000000000000000;hp=493432c438f611d059e50780634fae7cc3e49a8c;hb=3dc53b6865f716904ad4d02e934e04b3d4855c32;hpb=b235722fd546915a60800f2660d76f684d6f1445 diff --git a/pld-builder.new/client/make-request.sh b/pld-builder.new/client/make-request.sh deleted file mode 100755 index 493432c..0000000 --- a/pld-builder.new/client/make-request.sh +++ /dev/null @@ -1,788 +0,0 @@ -#!/bin/sh - -# prevent "*" from being expanded in builders var -set -f - -builders= -with= -without= -flags= -command= -command_flags= -gpg_opts= -default_branch='HEAD' -dist= -url= -no_depend=no -verbose=no -autotag=no - -if [ -x /usr/bin/python ]; then - send_mode="python" -else - echo "No python present, using mail mode" - send_mode="mail" -fi - -if [ -n "$HOME_ETC" ]; then - USER_CFG=$HOME_ETC/.requestrc -else - USER_CFG=$HOME/.requestrc -fi - -if [ ! -f "$USER_CFG" ]; then - echo "Creating config file $USER_CFG. You *must* edit it." - cat > $USER_CFG <&2 "${c_star}*${c_norm} $*" -} -red() { - echo "${c_red}$*${c_norm}" -} - -die() { - echo >&2 "$0: $*" - exit 1 -} - -send_request() { - # switch to mail mode, if no url set - [ -z "$url" ] && send_mode="mail" - - case "$send_mode" in - "mail") - msg "Sending using mail mode" - cat - | $mailer - ;; - *) - msg "Sending using http mode to $url" - cat - | python -c ' -import sys, socket, urllib2 - -try: - data = sys.stdin.read() - url = sys.argv[1] - socket.setdefaulttimeout(10) - req = urllib2.Request(url, data) - f = urllib2.urlopen(req) - f.close() -except Exception, e: - print >> sys.stderr, "Problem while sending request via HTTP: %s: %s" % (url, e) - sys.exit(1) -print >> sys.stdout, "Request queued via HTTP." -' "$url" - ;; - esac -} - -# 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/sbin/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="distfiles@pld-linux.org" - - local HOST=$(hostname -f) - local LOGIN=${requester%@*} - - for spec in $specs; do - local SPEC=$(echo "$spec" | sed -e 's|:.*||') - local 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-Branch: $BRANCH - X-Flags: force-reply - - . - EOF - done -} - -# autotag from rpm-build-macros -# displays latest used tag for a specfile -autotag() { - local out s - for s in "$@"; do - # strip branches - s=${s%:*} - # ensure package ends with .spec - s=${s%.spec}.spec - out=$(cvs status -v $s | awk "!/Sticky/&&/auto-$dist-/{if (!a++) print \$1}") - echo "$s:$out" - done -} - -# get autotag for specs -# WARNING: This may checkout some files from CVS -get_autotag() { - local pkg spec rpmdir - - rpmdir=$(rpm -E %_topdir) - cd $rpmdir - for pkg in "$@"; do - # 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" - else - autotag $pkg/$pkg.spec - fi - done -} - -usage() { - cat <